fix: use expansion-aware item size in LootResponseParser for Classic/TBC

The previous per-iteration heuristic (remaining >= 22 → 22 bytes, >= 14 → 14 bytes)
incorrectly parsed Classic/TBC multi-item loots: 2+ items × 14 bytes would
trigger the 22-byte WotLK path for the first item, corrupting subsequent items.

Classic 1.12 and TBC 2.4.3 use 14 bytes/item (slot+itemId+count+displayInfo+slotType).
WotLK 3.3.5a uses 22 bytes/item (adds randomSuffix+randomPropertyId).

Add isWotlkFormat bool parameter to LootResponseParser::parse and pass
isActiveExpansion('wotlk') from handleLootResponse.
This commit is contained in:
Kelsi 2026-03-11 04:01:07 -07:00
parent dd7d74cb93
commit 750b270502
3 changed files with 22 additions and 28 deletions

View file

@ -16164,7 +16164,10 @@ void GameHandler::unstuckHearth() {
}
void GameHandler::handleLootResponse(network::Packet& packet) {
if (!LootResponseParser::parse(packet, currentLoot)) return;
// Classic 1.12 and TBC 2.4.3 use 14 bytes/item (no randomSuffix/randomProp fields);
// WotLK 3.3.5a uses 22 bytes/item.
const bool wotlkLoot = isActiveExpansion("wotlk");
if (!LootResponseParser::parse(packet, currentLoot, wotlkLoot)) return;
lootWindowOpen = true;
localLootState_[currentLoot.lootGuid] = LocalLootState{currentLoot, false};