From a6c4f6d2e9bf671c763405be9821aaa6fce12a0f Mon Sep 17 00:00:00 2001 From: Kelsi Date: Fri, 13 Mar 2026 10:58:05 -0700 Subject: [PATCH] feat: show effective skill value with bonus indicator in skills panel Read the third update field (bonusTemp/bonusPerm) for each skill slot so the skills tab displays the actual buffed value rather than just the base value. Skills buffed by food/potions/items now show "value / max (+N)" with a cyan name, and maxed-out skills show a gold bar and name for quick identification. --- include/game/game_handler.hpp | 5 ++++- src/game/game_handler.cpp | 10 ++++++++++ src/ui/inventory_screen.cpp | 25 +++++++++++++++++++++---- 3 files changed, 35 insertions(+), 5 deletions(-) diff --git a/include/game/game_handler.hpp b/include/game/game_handler.hpp index 325e3bb1..224a6ae6 100644 --- a/include/game/game_handler.hpp +++ b/include/game/game_handler.hpp @@ -38,8 +38,11 @@ namespace game { struct PlayerSkill { uint32_t skillId = 0; - uint16_t value = 0; + uint16_t value = 0; // base + permanent item bonuses uint16_t maxValue = 0; + uint16_t bonusTemp = 0; // temporary buff bonus (food, potions, etc.) + uint16_t bonusPerm = 0; // permanent spec/misc bonus (rarely non-zero) + uint16_t effectiveValue() const { return value + bonusTemp + bonusPerm; } }; /** diff --git a/src/game/game_handler.cpp b/src/game/game_handler.cpp index a161e396..27afba4a 100644 --- a/src/game/game_handler.cpp +++ b/src/game/game_handler.cpp @@ -21382,10 +21382,20 @@ void GameHandler::extractSkillFields(const std::map& fields) uint16_t value = raw1 & 0xFFFF; uint16_t maxValue = (raw1 >> 16) & 0xFFFF; + uint16_t bonusTemp = 0; + uint16_t bonusPerm = 0; + auto bonusIt = fields.find(static_cast(baseField + 2)); + if (bonusIt != fields.end()) { + bonusTemp = bonusIt->second & 0xFFFF; + bonusPerm = (bonusIt->second >> 16) & 0xFFFF; + } + PlayerSkill skill; skill.skillId = skillId; skill.value = value; skill.maxValue = maxValue; + skill.bonusTemp = bonusTemp; + skill.bonusPerm = bonusPerm; newSkills[skillId] = skill; } diff --git a/src/ui/inventory_screen.cpp b/src/ui/inventory_screen.cpp index d63cdb9e..42090f2a 100644 --- a/src/ui/inventory_screen.cpp +++ b/src/ui/inventory_screen.cpp @@ -1245,18 +1245,35 @@ void InventoryScreen::renderCharacterScreen(game::GameHandler& gameHandler) { snprintf(label, sizeof(label), "%s", name.c_str()); } - // Show progress bar with value/max overlay + // Effective value includes temporary and permanent bonuses + uint16_t effective = skill->effectiveValue(); + uint16_t bonus = skill->bonusTemp + skill->bonusPerm; + + // Progress bar reflects effective / max; cap visual fill at 1.0 float ratio = (skill->maxValue > 0) - ? static_cast(skill->value) / static_cast(skill->maxValue) + ? std::min(1.0f, static_cast(effective) / static_cast(skill->maxValue)) : 0.0f; char overlay[64]; - snprintf(overlay, sizeof(overlay), "%u / %u", skill->value, skill->maxValue); + if (bonus > 0) + snprintf(overlay, sizeof(overlay), "%u / %u (+%u)", effective, skill->maxValue, bonus); + else + snprintf(overlay, sizeof(overlay), "%u / %u", effective, skill->maxValue); - ImGui::Text("%s", label); + // Gold name when maxed out, cyan when buffed above base, default otherwise + bool isMaxed = (effective >= skill->maxValue && skill->maxValue > 0); + bool isBuffed = (bonus > 0); + ImVec4 nameColor = isMaxed ? ImVec4(1.0f, 0.82f, 0.0f, 1.0f) + : isBuffed ? ImVec4(0.4f, 0.9f, 1.0f, 1.0f) + : ImVec4(0.85f, 0.85f, 0.85f, 1.0f); + ImGui::TextColored(nameColor, "%s", label); ImGui::SameLine(180.0f); ImGui::SetNextItemWidth(-1.0f); + // Bar color: gold when maxed, green otherwise + ImVec4 barColor = isMaxed ? ImVec4(1.0f, 0.82f, 0.0f, 1.0f) : ImVec4(0.2f, 0.7f, 0.2f, 1.0f); + ImGui::PushStyleColor(ImGuiCol_PlotHistogram, barColor); ImGui::ProgressBar(ratio, ImVec2(0, 14.0f), overlay); + ImGui::PopStyleColor(); } } }