mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2025-08-13 01:57:18 -07:00
Fix OnItemReceive hook for items in the extendedVanillaGetItem table (#3063)
This commit is contained in:
parent
19cede44c3
commit
1fea642f33
3 changed files with 63 additions and 16 deletions
|
@ -1804,12 +1804,22 @@ u8 Return_Item(u8 itemID, ModIndex modId, ItemID returnItem) {
|
|||
GetItemEntry gie = { ITEM_SOLD_OUT, 0, 0, 0, 0, 0, 0, 0, false, ITEM_FROM_NPC, ITEM_CATEGORY_LESSER, NULL };
|
||||
return Return_Item_Entry(gie, returnItem);
|
||||
}
|
||||
int32_t get = GetGIID(itemID);
|
||||
if (get == -1) {
|
||||
modId = MOD_RANDOMIZER;
|
||||
get = itemID;
|
||||
|
||||
GetItemID getItemID = RetrieveGetItemIDFromItemID(itemID);
|
||||
if (getItemID != GI_MAX) {
|
||||
// Vanilla ItemID with an associated GetItemID
|
||||
return Return_Item_Entry(ItemTable_RetrieveEntry(modId, getItemID), returnItem);
|
||||
}
|
||||
return Return_Item_Entry(ItemTable_RetrieveEntry(modId, get), returnItem);
|
||||
|
||||
RandomizerGet randomizerGet = RetrieveRandomizerGetFromItemID(itemID);
|
||||
if (randomizerGet != RG_MAX) {
|
||||
// Vanilla ItemID with an associated RandomizerGet (These are items in extendedVanillaGetItemTable)
|
||||
return Return_Item_Entry(ItemTable_RetrieveEntry(MOD_RANDOMIZER, randomizerGet), returnItem);
|
||||
}
|
||||
|
||||
// All randomizer items should go through Randomizer_Item_Give, so this should never be reached
|
||||
// but leaving this here just in case, as it was in the original behavior
|
||||
return Return_Item_Entry(ItemTable_RetrieveEntry(MOD_RANDOMIZER, itemID), returnItem);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -6556,11 +6566,15 @@ void Interface_Update(PlayState* play) {
|
|||
gSaveContext.pendingSale = ITEM_NONE;
|
||||
gSaveContext.pendingSaleMod = MOD_NONE;
|
||||
if (tempSaleMod == MOD_NONE) {
|
||||
s16 giid = GetGIID(tempSaleItem);
|
||||
if (giid == -1) {
|
||||
tempSaleMod = MOD_RANDOMIZER;
|
||||
GetItemID getItemID = RetrieveGetItemIDFromItemID(tempSaleItem);
|
||||
RandomizerGet randomizerGet = RetrieveRandomizerGetFromItemID(tempSaleItem);
|
||||
if (getItemID != GI_MAX) {
|
||||
tempSaleItem = getItemID;
|
||||
} else {
|
||||
tempSaleItem = giid;
|
||||
if (randomizerGet != RG_MAX) {
|
||||
tempSaleItem = randomizerGet;
|
||||
}
|
||||
tempSaleMod = MOD_RANDOMIZER;
|
||||
}
|
||||
}
|
||||
GameInteractor_ExecuteOnSaleEndHooks(ItemTable_RetrieveEntry(tempSaleMod, tempSaleItem));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue