From 764f2b8edc9fa6b07194aaa1f18f8501de41fce8 Mon Sep 17 00:00:00 2001 From: Kelsi Date: Thu, 19 Feb 2026 16:52:04 -0800 Subject: [PATCH] Fix missing armor in WotLK item tooltips and character stats MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit SMSG_ITEM_QUERY_SINGLE_RESPONSE in WotLK 3.3.5a sends BuyCount as a separate field before BuyPrice. The parser was skipping only one of the two fields, shifting every subsequent read by 4 bytes. This caused statsCount to be read from ContainerSlots (always 0 for non-bags) so no stat pairs were parsed, and the armor field was read from the wrong offset in the damage block — leaving all stat bonuses and armor at 0. Also moved armor above stat bonuses in the item tooltip to match WoW's canonical tooltip layout (armor, then green stat lines). --- src/game/world_packets.cpp | 1 + src/ui/inventory_screen.cpp | 10 ++++++---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/game/world_packets.cpp b/src/game/world_packets.cpp index 63c72300..1fa34986 100644 --- a/src/game/world_packets.cpp +++ b/src/game/world_packets.cpp @@ -2086,6 +2086,7 @@ bool ItemQueryResponseParser::parse(network::Packet& packet, ItemQueryResponseDa packet.readUInt32(); // Flags packet.readUInt32(); // Flags2 + packet.readUInt32(); // BuyCount (WotLK: separate from BuyPrice) packet.readUInt32(); // BuyPrice data.sellPrice = packet.readUInt32(); // SellPrice diff --git a/src/ui/inventory_screen.cpp b/src/ui/inventory_screen.cpp index 02d98d15..45536ca1 100644 --- a/src/ui/inventory_screen.cpp +++ b/src/ui/inventory_screen.cpp @@ -1620,6 +1620,12 @@ void InventoryScreen::renderItemTooltip(const game::ItemDef& item, const game::I float dps = ((item.damageMin + item.damageMax) * 0.5f) / speed; ImGui::Text("%.1f DPS", dps); } + + // Armor appears before stat bonuses — matches WoW tooltip order + if (item.armor > 0) { + ImGui::Text("%d Armor", item.armor); + } + auto appendBonus = [](std::string& out, int32_t val, const char* shortName) { if (val <= 0) return; if (!out.empty()) out += " "; @@ -1635,10 +1641,6 @@ void InventoryScreen::renderItemTooltip(const game::ItemDef& item, const game::I if (!bonusLine.empty()) { ImGui::TextColored(green, "%s", bonusLine.c_str()); } - - if (item.armor > 0) { - ImGui::Text("%d Armor", item.armor); - } if (item.sellPrice > 0) { uint32_t g = item.sellPrice / 10000; uint32_t s = (item.sellPrice / 100) % 100;