Fix NPC textures, bag item interactions, and Classic item query parsing

Rebuild creature display lookups after expansion-specific DBC layout loads
(was using WotLK defaults before turtle layout was available). Add full
drag-and-drop support for bag items with server-side CMSG_SWAP_ITEM packets.
Add Classic-specific SMSG_ITEM_QUERY_SINGLE_RESPONSE parser for Vanilla
format differences (fewer damage types, no scaling stats, no Flags2).
This commit is contained in:
Kelsi 2026-02-17 01:00:04 -08:00
parent 97ea390969
commit 5ea41df8b5
10 changed files with 384 additions and 62 deletions

View file

@ -762,8 +762,12 @@ public:
void buyItem(uint64_t vendorGuid, uint32_t itemId, uint32_t slot, uint32_t count);
void sellItem(uint64_t vendorGuid, uint64_t itemGuid, uint32_t count);
void sellItemBySlot(int backpackIndex);
void sellItemInBag(int bagIndex, int slotIndex);
void autoEquipItemBySlot(int backpackIndex);
void autoEquipItemInBag(int bagIndex, int slotIndex);
void useItemBySlot(int backpackIndex);
void useItemInBag(int bagIndex, int slotIndex);
void swapContainerItems(uint8_t srcBag, uint8_t srcSlot, uint8_t dstBag, uint8_t dstSlot);
void useItemById(uint32_t itemId);
bool isVendorWindowOpen() const { return vendorWindowOpen; }
const ListInventoryData& getVendorItems() const { return currentVendorItems; }

View file

@ -77,6 +77,7 @@ public:
void setBagSize(int bagIndex, int size);
const ItemSlot& getBagSlot(int bagIndex, int slotIndex) const;
bool setBagSlot(int bagIndex, int slotIndex, const ItemDef& item);
bool clearBagSlot(int bagIndex, int slotIndex);
// Bank slots (28 main + 7 bank bags)
const ItemSlot& getBankSlot(int index) const;

View file

@ -122,6 +122,13 @@ public:
return NameQueryResponseParser::parse(packet, data);
}
// --- Item Query ---
/** Parse SMSG_ITEM_QUERY_SINGLE_RESPONSE */
virtual bool parseItemQueryResponse(network::Packet& packet, ItemQueryResponseData& data) {
return ItemQueryResponseParser::parse(packet, data);
}
// --- GameObject Query ---
/** Parse SMSG_GAMEOBJECT_QUERY_RESPONSE */
@ -280,6 +287,7 @@ public:
bool parseMailList(network::Packet& packet, std::vector<MailMessage>& inbox) override;
network::Packet buildMailTakeItem(uint64_t mailboxGuid, uint32_t mailId, uint32_t itemSlot) override;
network::Packet buildMailDelete(uint64_t mailboxGuid, uint32_t mailId, uint32_t mailTemplateId) override;
bool parseItemQueryResponse(network::Packet& packet, ItemQueryResponseData& data) override;
};
/**

View file

@ -113,9 +113,11 @@ private:
// Drag-and-drop held item state
bool holdingItem = false;
game::ItemDef heldItem;
enum class HeldSource { NONE, BACKPACK, EQUIPMENT };
enum class HeldSource { NONE, BACKPACK, BAG, EQUIPMENT };
HeldSource heldSource = HeldSource::NONE;
int heldBackpackIndex = -1;
int heldBagIndex = -1;
int heldBagSlotIndex = -1;
game::EquipSlot heldEquipSlot = game::EquipSlot::NUM_SLOTS;
void renderSeparateBags(game::Inventory& inventory, uint64_t moneyCopper);
@ -131,13 +133,16 @@ private:
void renderItemSlot(game::Inventory& inventory, const game::ItemSlot& slot,
float size, const char* label,
SlotKind kind, int backpackIndex,
game::EquipSlot equipSlot);
game::EquipSlot equipSlot,
int bagIndex = -1, int bagSlotIndex = -1);
void renderItemTooltip(const game::ItemDef& item);
// Held item helpers
void pickupFromBackpack(game::Inventory& inv, int index);
void pickupFromBag(game::Inventory& inv, int bagIndex, int slotIndex);
void pickupFromEquipment(game::Inventory& inv, game::EquipSlot slot);
void placeInBackpack(game::Inventory& inv, int index);
void placeInBag(game::Inventory& inv, int bagIndex, int slotIndex);
void placeInEquipment(game::Inventory& inv, game::EquipSlot slot);
void cancelPickup(game::Inventory& inv);
game::EquipSlot getEquipSlotForType(uint8_t inventoryType, game::Inventory& inv);