Browse Source

Merge 24e53bc883 into 5a08031caf

pull/7662/merge
Eric Robinson 4 days ago committed by GitHub
parent
commit
aa768458ab
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 18
      Source/inv.h
  2. 7
      Source/items.cpp
  3. 1
      Source/towners.cpp

18
Source/inv.h

@ -384,6 +384,24 @@ inline bool RemoveInventoryOrBeltItemById(Player &player, _item_indexes id)
return RemoveInventoryItemById(player, id) || RemoveBeltItemById(player, id);
}
/**
* @brief Marks all Spectral Elixir items in the player's inventory as permanently usable
* by setting the CF_USEFUL flag in the item's creation info.
*
* This ensures that Spectral Elixirs remain usable across game sessions, regardless of
* quest status, while maintaining reverse compatibility with the original game.
*
* @param player The player whose inventory is being updated.
*/
inline void SetSpectralUsable(Player &player)
{
for (Item &item : player.InvList) {
if (item.IDidx == IDI_SPECELIX) {
item._iCreateInfo |= CF_ONLYGOOD; // Set the unused flag to mark as permanently usable
}
}
}
/**
* @brief Removes the first inventory or belt scroll with the player's current spell.
*/

7
Source/items.cpp

@ -4785,8 +4785,13 @@ void PutItemRecord(uint32_t nSeed, uint16_t wCI, int nIndex)
bool Item::isUsable() const
{
if (IDidx == IDI_SPECELIX && Quests[Q_MUSHROOM]._qactive != QUEST_DONE)
// If the item is a Spectral Elixir
if (IDidx == IDI_SPECELIX) {
if ((_iCreateInfo & CF_ONLYGOOD) != 0 || Quests[Q_MUSHROOM]._qactive == QUEST_DONE)
return true;
return false;
}
return AllItemsList[IDidx].iUsable;
}

1
Source/towners.cpp

@ -374,6 +374,7 @@ void TalkToWitch(Player &player, Towner & /*witch*/)
return;
}
if (HasInventoryOrBeltItemWithId(player, IDI_SPECELIX)) {
SetSpectralUsable(player);
Quests[Q_MUSHROOM]._qactive = QUEST_DONE;
NetSendCmdQuest(true, Quests[Q_MUSHROOM]);
InitQTextMsg(TEXT_MUSH12);

Loading…
Cancel
Save