Fix item use (CMSG_USE_ITEM), mount tab, and inventory right-click

- Fix SMSG_ITEM_QUERY_SINGLE_RESPONSE parsing: read statsCount stat
  pairs instead of always 10, use 2 damage entries (MAX_ITEM_PROTO_DAMAGES),
  and parse item spell data (spellId + spellTrigger per slot)
- Pass item spell ID in CMSG_USE_ITEM packet so server processes item
  use requests (spellId=0 caused silent server rejection)
- Add spellId parameter to buildUseItem interface across all expansions
- Fix spellbook mount tab to use SkillLine 777 (Mounts) instead of 762
  (Riding), so known mount summon spells appear correctly
- Fix inventory right-click: use IsItemHovered+IsMouseClicked instead
  of IsItemClicked for InvisibleButton (which only tracks left-clicks)
- Fix SlotKind enum declaration order in inventory_screen.hpp
This commit is contained in:
Kelsi 2026-02-26 00:59:07 -08:00
parent 7982815a67
commit c919477e74
9 changed files with 233 additions and 152 deletions

View file

@ -125,6 +125,19 @@ private:
int heldBagSlotIndex = -1;
game::EquipSlot heldEquipSlot = game::EquipSlot::NUM_SLOTS;
// Slot rendering with interaction support
enum class SlotKind { BACKPACK, EQUIPMENT };
// Click-and-hold pickup tracking
bool pickupPending_ = false;
float pickupPressTime_ = 0.0f;
SlotKind pickupSlotKind_ = SlotKind::BACKPACK;
int pickupBackpackIndex_ = -1;
int pickupBagIndex_ = -1;
int pickupBagSlotIndex_ = -1;
game::EquipSlot pickupEquipSlot_ = game::EquipSlot::NUM_SLOTS;
static constexpr float kPickupHoldThreshold = 0.12f; // seconds
void renderSeparateBags(game::Inventory& inventory, uint64_t moneyCopper);
void renderAggregateBags(game::Inventory& inventory, uint64_t moneyCopper);
void renderBagWindow(const char* title, bool& isOpen, game::Inventory& inventory,
@ -133,8 +146,6 @@ private:
void renderBackpackPanel(game::Inventory& inventory, bool collapseEmptySections = false);
void renderStatsPanel(game::Inventory& inventory, uint32_t playerLevel, int32_t serverArmor = 0);
// Slot rendering with interaction support
enum class SlotKind { BACKPACK, EQUIPMENT };
void renderItemSlot(game::Inventory& inventory, const game::ItemSlot& slot,
float size, const char* label,
SlotKind kind, int backpackIndex,

View file

@ -66,7 +66,7 @@ private:
bool skillLineDbLoaded = false;
std::unordered_map<uint32_t, std::string> skillLineNames;
std::unordered_map<uint32_t, uint32_t> skillLineCategories;
std::unordered_map<uint32_t, uint32_t> spellToSkillLine;
std::unordered_multimap<uint32_t, uint32_t> spellToSkillLine;
// Categorized spell tabs
std::vector<SpellTabInfo> spellTabs;