Fix missing armor in WotLK item tooltips and character stats

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).
This commit is contained in:
Kelsi 2026-02-19 16:52:04 -08:00
parent d7692ab88e
commit 764f2b8edc
2 changed files with 7 additions and 4 deletions

View file

@ -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;