Add new sell value of 1/4 of an item's price, with config (#3315)
Co-authored-by: Eduardo Quezada D'Ottone <eduardo602002@gmail.com>
This commit is contained in:
parent
7ebaddc290
commit
ab8bc6e493
4 changed files with 17 additions and 10 deletions
|
@ -13,6 +13,7 @@
|
|||
#define I_GEM_BOOST_POWER GEN_LATEST // In Gen5+, the Gem boost power was reduced from 50% to 30%.
|
||||
#define I_USE_EVO_HELD_ITEMS_FROM_BAG FALSE // If TRUE, items such as Razor Claw or Electirizer will be usable from the bag to evolve a Pokémon just like in LA.
|
||||
#define I_TYPE_BOOST_POWER GEN_LATEST // In Gen4+, all regular type boosting held items had their power increased from 10% to 20%. eg. Charcoal
|
||||
#define I_SELL_VALUE_FRACTION GEN_LATEST // In Gen9+, items sell for 1/4 of their value instead of 1/2.
|
||||
|
||||
// TM config
|
||||
#define I_REUSABLE_TMS FALSE // In Gen5-8, TMs are reusable. Setting this to TRUE will make all vanilla TMs reusable, though they can also be cherry-picked by setting their importance to 1.
|
||||
|
|
|
@ -9,17 +9,17 @@ typedef void (*ItemUseFunc)(u8);
|
|||
|
||||
struct Item
|
||||
{
|
||||
u32 price;
|
||||
u16 secondaryId;
|
||||
ItemUseFunc fieldUseFunc;
|
||||
const u8 *description;
|
||||
u8 name[ITEM_NAME_LENGTH];
|
||||
u16 price;
|
||||
u8 holdEffect;
|
||||
u8 holdEffectParam;
|
||||
const u8 *description;
|
||||
u8 importance;
|
||||
u8 pocket;
|
||||
u8 type;
|
||||
ItemUseFunc fieldUseFunc;
|
||||
u8 battleUsage;
|
||||
u16 secondaryId;
|
||||
u8 flingPower;
|
||||
};
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
#endif
|
||||
|
||||
#if I_TYPE_BOOST_POWER >= GEN_4 // For non Pokémon-specific type-boosting held items.
|
||||
#define TYPE_BOOST_PARAM 20
|
||||
#define TYPE_BOOST_PARAM 20
|
||||
#else
|
||||
#define TYPE_BOOST_PARAM 10
|
||||
#endif
|
||||
|
|
|
@ -2098,11 +2098,17 @@ static void Task_ItemContext_Sell(u8 taskId)
|
|||
}
|
||||
}
|
||||
|
||||
#if I_SELL_VALUE_FRACTION >= GEN_9
|
||||
#define ITEM_SELL_FACTOR 4
|
||||
#else
|
||||
#define ITEM_SELL_FACTOR 2
|
||||
#endif
|
||||
|
||||
static void DisplaySellItemPriceAndConfirm(u8 taskId)
|
||||
{
|
||||
s16 *data = gTasks[taskId].data;
|
||||
|
||||
ConvertIntToDecimalStringN(gStringVar1, (ItemId_GetPrice(gSpecialVar_ItemId) / 2) * tItemCount, STR_CONV_MODE_LEFT_ALIGN, 6);
|
||||
ConvertIntToDecimalStringN(gStringVar1, (ItemId_GetPrice(gSpecialVar_ItemId) / ITEM_SELL_FACTOR) * tItemCount, STR_CONV_MODE_LEFT_ALIGN, 6);
|
||||
StringExpandPlaceholders(gStringVar4, gText_ICanPayVar1);
|
||||
DisplayItemMessage(taskId, FONT_NORMAL, gStringVar4, AskSellItems);
|
||||
}
|
||||
|
@ -2127,7 +2133,7 @@ static void InitSellHowManyInput(u8 taskId)
|
|||
s16 *data = gTasks[taskId].data;
|
||||
u8 windowId = BagMenu_AddWindow(ITEMWIN_QUANTITY_WIDE);
|
||||
|
||||
PrintItemSoldAmount(windowId, 1, (ItemId_GetPrice(gSpecialVar_ItemId) / 2) * tItemCount);
|
||||
PrintItemSoldAmount(windowId, 1, (ItemId_GetPrice(gSpecialVar_ItemId) / ITEM_SELL_FACTOR) * tItemCount);
|
||||
DisplayCurrentMoneyWindow();
|
||||
gTasks[taskId].func = Task_ChooseHowManyToSell;
|
||||
}
|
||||
|
@ -2138,7 +2144,7 @@ static void Task_ChooseHowManyToSell(u8 taskId)
|
|||
|
||||
if (AdjustQuantityAccordingToDPadInput(&tItemCount, tQuantity) == TRUE)
|
||||
{
|
||||
PrintItemSoldAmount(gBagMenu->windowIds[ITEMWIN_QUANTITY_WIDE], tItemCount, (ItemId_GetPrice(gSpecialVar_ItemId) / 2) * tItemCount);
|
||||
PrintItemSoldAmount(gBagMenu->windowIds[ITEMWIN_QUANTITY_WIDE], tItemCount, (ItemId_GetPrice(gSpecialVar_ItemId) / ITEM_SELL_FACTOR) * tItemCount);
|
||||
}
|
||||
else if (JOY_NEW(A_BUTTON))
|
||||
{
|
||||
|
@ -2162,7 +2168,7 @@ static void ConfirmSell(u8 taskId)
|
|||
s16 *data = gTasks[taskId].data;
|
||||
|
||||
CopyItemName(gSpecialVar_ItemId, gStringVar2);
|
||||
ConvertIntToDecimalStringN(gStringVar1, (ItemId_GetPrice(gSpecialVar_ItemId) / 2) * tItemCount, STR_CONV_MODE_LEFT_ALIGN, 6);
|
||||
ConvertIntToDecimalStringN(gStringVar1, (ItemId_GetPrice(gSpecialVar_ItemId) / ITEM_SELL_FACTOR) * tItemCount, STR_CONV_MODE_LEFT_ALIGN, 6);
|
||||
StringExpandPlaceholders(gStringVar4, gText_TurnedOverVar1ForVar2);
|
||||
DisplayItemMessage(taskId, FONT_NORMAL, gStringVar4, SellItem);
|
||||
}
|
||||
|
@ -2175,7 +2181,7 @@ static void SellItem(u8 taskId)
|
|||
|
||||
PlaySE(SE_SHOP);
|
||||
RemoveBagItem(gSpecialVar_ItemId, tItemCount);
|
||||
AddMoney(&gSaveBlock1Ptr->money, (ItemId_GetPrice(gSpecialVar_ItemId) / 2) * tItemCount);
|
||||
AddMoney(&gSaveBlock1Ptr->money, (ItemId_GetPrice(gSpecialVar_ItemId) / ITEM_SELL_FACTOR) * tItemCount);
|
||||
DestroyListMenuTask(tListTaskId, scrollPos, cursorPos);
|
||||
UpdatePocketItemList(gBagPosition.pocket);
|
||||
UpdatePocketListPosition(gBagPosition.pocket);
|
||||
|
|
Loading…
Reference in a new issue