mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-03-23 15:50:20 +00:00
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.
This commit is contained in:
parent
c48065473f
commit
a6c4f6d2e9
3 changed files with 35 additions and 5 deletions
|
|
@ -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<float>(skill->value) / static_cast<float>(skill->maxValue)
|
||||
? std::min(1.0f, static_cast<float>(effective) / static_cast<float>(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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue