From 08bdd9eb36d44f75f23aa564bc984f3de813ba54 Mon Sep 17 00:00:00 2001 From: Kelsi Date: Wed, 11 Mar 2026 23:35:51 -0700 Subject: [PATCH] Add low durability warning indicator below minimap Shows 'Low durability' in orange when any equipped item falls below 20% durability, and a pulsing red 'Item breaking!' warning below 5%. Uses the same stacked indicator slot system as the latency and mail notices. --- src/ui/game_screen.cpp | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/src/ui/game_screen.cpp b/src/ui/game_screen.cpp index 2052d3fd..18e6d1ce 100644 --- a/src/ui/game_screen.cpp +++ b/src/ui/game_screen.cpp @@ -11071,6 +11071,39 @@ void GameScreen::renderMinimapMarkers(game::GameHandler& gameHandler) { nextIndicatorY += kIndicatorH; } + // Low durability warning — shown when any equipped item has < 20% durability + if (gameHandler.getState() == game::WorldState::IN_WORLD) { + const auto& inv = gameHandler.getInventory(); + float lowestDurPct = 1.0f; + for (int i = 0; i < game::Inventory::NUM_EQUIP_SLOTS; ++i) { + const auto& slot = inv.getEquipSlot(static_cast(i)); + if (slot.empty()) continue; + const auto& it = slot.item; + if (it.maxDurability > 0) { + float pct = static_cast(it.curDurability) / static_cast(it.maxDurability); + if (pct < lowestDurPct) lowestDurPct = pct; + } + } + if (lowestDurPct < 0.20f) { + bool critical = (lowestDurPct < 0.05f); + float pulse = critical + ? (0.7f + 0.3f * std::sin(static_cast(ImGui::GetTime()) * 4.0f)) + : 1.0f; + ImVec4 durWarnColor = critical + ? ImVec4(1.0f, 0.2f, 0.2f, pulse) + : ImVec4(1.0f, 0.65f, 0.1f, 0.9f); + const char* durWarnText = critical ? "Item breaking!" : "Low durability"; + + ImGui::SetNextWindowPos(ImVec2(indicatorX, nextIndicatorY), ImGuiCond_Always); + ImGui::SetNextWindowSize(ImVec2(indicatorW, kIndicatorH), ImGuiCond_Always); + if (ImGui::Begin("##DurabilityIndicator", nullptr, indicatorFlags)) { + ImGui::TextColored(durWarnColor, "%s", durWarnText); + } + ImGui::End(); + nextIndicatorY += kIndicatorH; + } + } + // Local time clock — always visible below minimap indicators { auto now = std::chrono::system_clock::now();