mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-03-22 23:30:14 +00:00
Fix vanilla spell casting and bag contents
Vanilla CMSG_CAST_SPELL target mask is uint16 (not uint32 like WotLK), the extra 2 bytes were corrupting packets. Also implement full bag content tracking: extract container slot GUIDs from CONTAINER update objects, set proper bag sizes, and populate bag items in inventory rebuild.
This commit is contained in:
parent
811a2a97a8
commit
89ccb0720a
12 changed files with 191 additions and 9 deletions
|
|
@ -859,6 +859,7 @@ private:
|
|||
void emitAllOtherPlayerEquipment();
|
||||
void detectInventorySlotBases(const std::map<uint16_t, uint32_t>& fields);
|
||||
bool applyInventoryFields(const std::map<uint16_t, uint32_t>& fields);
|
||||
void extractContainerFields(uint64_t containerGuid, const std::map<uint16_t, uint32_t>& fields);
|
||||
uint64_t resolveOnlineItemGuid(uint32_t itemId) const;
|
||||
|
||||
// ---- Phase 2 handlers ----
|
||||
|
|
@ -1094,6 +1095,12 @@ private:
|
|||
std::unordered_set<uint32_t> pendingItemQueries_;
|
||||
std::array<uint64_t, 23> equipSlotGuids_{};
|
||||
std::array<uint64_t, 16> backpackSlotGuids_{};
|
||||
// Container (bag) contents: containerGuid -> array of item GUIDs per slot
|
||||
struct ContainerInfo {
|
||||
uint32_t numSlots = 0;
|
||||
std::array<uint64_t, 36> slotGuids{}; // max 36 slots
|
||||
};
|
||||
std::unordered_map<uint64_t, ContainerInfo> containerContents_;
|
||||
int invSlotBase_ = -1;
|
||||
int packSlotBase_ = -1;
|
||||
std::map<uint16_t, uint32_t> lastPlayerFields_;
|
||||
|
|
|
|||
|
|
@ -72,6 +72,7 @@ public:
|
|||
|
||||
// Extra bags
|
||||
int getBagSize(int bagIndex) const;
|
||||
void setBagSize(int bagIndex, int size);
|
||||
const ItemSlot& getBagSlot(int bagIndex, int slotIndex) const;
|
||||
bool setBagSlot(int bagIndex, int slotIndex, const ItemDef& item);
|
||||
|
||||
|
|
|
|||
|
|
@ -45,6 +45,11 @@ public:
|
|||
return MovementPacket::build(opcode, info, playerGuid);
|
||||
}
|
||||
|
||||
/** Build CMSG_CAST_SPELL (WotLK default: castCount + spellId + castFlags + targets) */
|
||||
virtual network::Packet buildCastSpell(uint32_t spellId, uint64_t targetGuid, uint8_t castCount) {
|
||||
return CastSpellPacket::build(spellId, targetGuid, castCount);
|
||||
}
|
||||
|
||||
// --- Character Enumeration ---
|
||||
|
||||
/** Parse SMSG_CHAR_ENUM */
|
||||
|
|
@ -201,6 +206,7 @@ public:
|
|||
network::Packet buildMovementPacket(LogicalOpcode opcode,
|
||||
const MovementInfo& info,
|
||||
uint64_t playerGuid = 0) override;
|
||||
network::Packet buildCastSpell(uint32_t spellId, uint64_t targetGuid, uint8_t castCount) override;
|
||||
bool parseMessageChat(network::Packet& packet, MessageChatData& data) override;
|
||||
bool parseGuildRoster(network::Packet& packet, GuildRosterData& data) override;
|
||||
bool parseGuildQueryResponse(network::Packet& packet, GuildQueryResponseData& data) override;
|
||||
|
|
|
|||
|
|
@ -52,6 +52,10 @@ enum class UF : uint16_t {
|
|||
// Item fields
|
||||
ITEM_FIELD_STACK_COUNT,
|
||||
|
||||
// Container fields
|
||||
CONTAINER_FIELD_NUM_SLOTS,
|
||||
CONTAINER_FIELD_SLOT_1,
|
||||
|
||||
COUNT
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue