Skip to content

Commit

Permalink
start
Browse files Browse the repository at this point in the history
  • Loading branch information
ghoulslash committed Apr 2, 2021
1 parent a0b3d4d commit cfac676
Showing 1 changed file with 191 additions and 0 deletions.
191 changes: 191 additions & 0 deletions src/shop.c
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,180 @@ static void Task_HandleShopMenuBuy(u8 taskId);
static void Task_HandleShopMenuSell(u8 taskId);
static void BuyMenuPrintItemDescriptionAndShowItemIcon(s32 item, bool8 onInit, struct ListMenu *list);
static void BuyMenuPrintPriceInList(u8 windowId, s32 item, u8 y);
//mart badges
static u8 GetNumberOfBadges(void);

// pokemart items by badge
static const u16 sShopInventory_ZeroBadges[] = {
ITEM_POKE_BALL,
ITEM_POTION,
ITEM_ANTIDOTE,
ITEM_PARALYZE_HEAL,
ITEM_NONE
};

static const u16 sShopInventory_OneBadge[] = {
ITEM_POKE_BALL,
ITEM_POTION,
ITEM_SUPER_POTION,
ITEM_ANTIDOTE,
ITEM_PARALYZE_HEAL,
ITEM_AWAKENING,
ITEM_BURNHEAL,
ITEM_ICEHEAL,
ITEM_ESCAPEROPE,
ITEM_REPEL,
ITEM_NONE
};

// two is same as one badge
static const u16 sShopInventory_TwoBadges[] = {
ITEM_POKE_BALL,
ITEM_POTION,
ITEM_SUPER_POTION,
ITEM_ANTIDOTE,
ITEM_PARALYZE_HEAL,
ITEM_AWAKENING,
ITEM_BURNHEAL,
ITEM_ICEHEAL,
ITEM_ESCAPEROPE,
ITEM_REPEL,
ITEM_NONE
};

static const u16 sShopInventory_ThreeBadges[] = {
ITEM_POKE_BALL,
ITEM_GREATBALL,
ITEM_POTION,
ITEM_SUPER_POTION,
ITEM_REVIVE,
ITEM_ANTIDOTE,
ITEM_PARALYZE_HEAL,
ITEM_AWAKENING,
ITEM_BURNHEAL,
ITEM_ICEHEAL,
ITEM_ESCAPEROPE,
ITEM_REPEL,
ITEM_SUPERREPEL,
ITEM_NONE
};

// four is same as three
static const u16 sShopInventory_FourBadges[] = {
ITEM_POKE_BALL,
ITEM_GREATBALL,
ITEM_POTION,
ITEM_SUPER_POTION,
ITEM_REVIVE,
ITEM_ANTIDOTE,
ITEM_PARALYZE_HEAL,
ITEM_AWAKENING,
ITEM_BURNHEAL,
ITEM_ICEHEAL,
ITEM_ESCAPEROPE,
ITEM_REPEL,
ITEM_SUPERREPEL,
ITEM_NONE
};

static const u16 sShopInventory_FiveBadges[] = {
ITEM_POKE_BALL,
ITEM_GREATBALL,
ITEM_ULTRABALL,
ITEM_POTION,
ITEM_SUPER_POTION,
ITEM_HYPERPOTION,
ITEM_REVIVE,
ITEM_ANTIDOTE,
ITEM_PARALYZE_HEAL,
ITEM_AWAKENING,
ITEM_BURNHEAL,
ITEM_ICEHEAL,
ITEM_FULLHEAL,
ITEM_ESCAPEROPE,
ITEM_REPEL,
ITEM_SUPERREPEL,
ITEM_NONE
};

// six is same as five
static const u16 sShopInventory_SixBadges[] = {
ITEM_POKE_BALL,
ITEM_GREATBALL,
ITEM_ULTRABALL,
ITEM_POTION,
ITEM_SUPER_POTION,
ITEM_HYPERPOTION,
ITEM_REVIVE,
ITEM_ANTIDOTE,
ITEM_PARALYZE_HEAL,
ITEM_AWAKENING,
ITEM_BURNHEAL,
ITEM_ICEHEAL,
ITEM_FULLHEAL,
ITEM_ESCAPEROPE,
ITEM_REPEL,
ITEM_SUPERREPEL,
ITEM_NONE
};

static const u16 sShopInventory_SevenBadges[] = {
ITEM_POKE_BALL,
ITEM_GREATBALL,
ITEM_ULTRABALL,
ITEM_POTION,
ITEM_SUPER_POTION,
ITEM_HYPERPOTION,
ITEM_MAXPOTION,
ITEM_REVIVE,
ITEM_ANTIDOTE,
ITEM_PARALYZE_HEAL,
ITEM_AWAKENING,
ITEM_BURNHEAL,
ITEM_ICEHEAL,
ITEM_FULLHEAL,
ITEM_ESCAPEROPE,
ITEM_REPEL,
ITEM_SUPERREPEL,
ITEM_MAXREPEL,
ITEM_NONE
};

static const u16 sShopInventory_EightBadges[] = {
ITEM_POKE_BALL,
ITEM_GREATBALL,
ITEM_ULTRABALL,
ITEM_POTION,
ITEM_SUPER_POTION,
ITEM_HYPERPOTION,
ITEM_MAXPOTION,
ITEM_FULLRESTORE,
ITEM_REVIVE,
ITEM_ANTIDOTE,
ITEM_PARALYZE_HEAL,
ITEM_AWAKENING,
ITEM_BURNHEAL,
ITEM_ICEHEAL,
ITEM_FULLHEAL,
ITEM_ESCAPEROPE,
ITEM_REPEL,
ITEM_SUPERREPEL,
ITEM_MAXREPEL,
ITEM_NONE
};

static const u16 *sShopInventories[] =
{
sShopInventory_ZeroBadges,
sShopInventory_OneBadge,
sShopInventory_TwoBadges,
sShopInventory_ThreeBadges,
sShopInventory_FourBadges,
sShopInventory_FiveBadges,
sShopInventory_SixBadges,
sShopInventory_SevenBadges,
sShopInventory_EightBadges
};

static const struct YesNoFuncTable sShopPurchaseYesNoFuncs =
{
Expand Down Expand Up @@ -317,6 +491,7 @@ static void SetShopMenuCallback(void (* callback)(void))
static void SetShopItemsForSale(const u16 *items)
{
u16 i = 0;
u8 badgeCount = GetNumberOfBadges();

sMartInfo.itemList = items;
sMartInfo.itemCount = 0;
Expand Down Expand Up @@ -1227,3 +1402,19 @@ void CreateDecorationShop2Menu(const u16 *itemsForSale)
SetShopItemsForSale(itemsForSale);
SetShopMenuCallback(EnableBothScriptContexts);
}



static u8 GetNumberOfBadges(void)
{
u16 badgeFlag;
u8 count = 0;

for (badgeFlag = FLAG_BADGE01_GET; badgeFlag < FLAG_BADGE01_GET + NUM_BADGES; badgeFlag++)
{
if (FlagGet(badgeFlag))
count++;
}

return count;
}

0 comments on commit cfac676

Please sign in to comment.