From 67db7383ad4169622636cece25d73e3be1ddd503 Mon Sep 17 00:00:00 2001 From: Kelsi Date: Tue, 10 Mar 2026 16:23:12 -0700 Subject: [PATCH] feat: add durability bar overlay on equipment slots in character panel Draw a 3px color-coded strip at the bottom of each equipment slot icon (green >50%, yellow >25%, red <=25%) so broken or near-broken gear is immediately visible at a glance without opening the tooltip. --- src/ui/inventory_screen.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/ui/inventory_screen.cpp b/src/ui/inventory_screen.cpp index edf18525..49ff82ba 100644 --- a/src/ui/inventory_screen.cpp +++ b/src/ui/inventory_screen.cpp @@ -1594,6 +1594,20 @@ void InventoryScreen::renderItemSlot(game::Inventory& inventory, const game::Ite IM_COL32(255, 255, 255, 220), countStr); } + // Durability bar on equipment slots (3px strip at bottom of slot icon) + if (kind == SlotKind::EQUIPMENT && item.maxDurability > 0) { + float durPct = static_cast(item.curDurability) / + static_cast(item.maxDurability); + ImU32 durCol; + if (durPct > 0.5f) durCol = IM_COL32(0, 200, 0, 220); + else if (durPct > 0.25f) durCol = IM_COL32(220, 220, 0, 220); + else durCol = IM_COL32(220, 40, 40, 220); + float barW = size * durPct; + drawList->AddRectFilled(ImVec2(pos.x, pos.y + size - 3.0f), + ImVec2(pos.x + barW, pos.y + size), + durCol); + } + ImGui::InvisibleButton("slot", ImVec2(size, size)); // Left mouse: hold to pick up, release to drop/swap