From a56b50df2bba068e47cc7bf775557d0c46d6e15c Mon Sep 17 00:00:00 2001 From: Kelsi Date: Thu, 12 Mar 2026 12:41:05 -0700 Subject: [PATCH] feat: show average item level in character stats panel --- src/ui/inventory_screen.cpp | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/ui/inventory_screen.cpp b/src/ui/inventory_screen.cpp index fbe5fbfc..7c705d9d 100644 --- a/src/ui/inventory_screen.cpp +++ b/src/ui/inventory_screen.cpp @@ -1599,6 +1599,28 @@ void InventoryScreen::renderStatsPanel(game::Inventory& inventory, uint32_t play } int32_t totalArmor = (serverArmor > 0) ? serverArmor : itemQueryArmor; + // Average item level (exclude shirt/tabard as WoW convention) + { + uint32_t iLvlSum = 0; + int iLvlCount = 0; + for (int s = 0; s < game::Inventory::NUM_EQUIP_SLOTS; s++) { + auto eslot = static_cast(s); + if (eslot == game::EquipSlot::SHIRT || eslot == game::EquipSlot::TABARD) continue; + const auto& slot = inventory.getEquipSlot(eslot); + if (!slot.empty() && slot.item.itemLevel > 0) { + iLvlSum += slot.item.itemLevel; + ++iLvlCount; + } + } + if (iLvlCount > 0) { + float avg = static_cast(iLvlSum) / static_cast(iLvlCount); + ImGui::TextColored(ImVec4(0.7f, 0.9f, 1.0f, 1.0f), + "Average Item Level: %.1f (%d/%d slots)", avg, iLvlCount, + game::Inventory::NUM_EQUIP_SLOTS - 2); // -2 for shirt/tabard + } + ImGui::Separator(); + } + ImVec4 green(0.0f, 1.0f, 0.0f, 1.0f); ImVec4 white(1.0f, 1.0f, 1.0f, 1.0f); ImVec4 gold(1.0f, 0.84f, 0.0f, 1.0f);