mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-03-25 00:20:16 +00:00
feat: show pet happiness bar in pet frame for hunter pets
This commit is contained in:
parent
84b31d3bbd
commit
88c3cfe7ab
2 changed files with 20 additions and 0 deletions
|
|
@ -2844,6 +2844,23 @@ void GameScreen::renderPetFrame(game::GameHandler& gameHandler) {
|
|||
ImGui::PopStyleColor();
|
||||
}
|
||||
|
||||
// Happiness bar — hunter pets store happiness as power type 4
|
||||
{
|
||||
uint32_t happiness = petUnit->getPowerByType(4);
|
||||
uint32_t maxHappiness = petUnit->getMaxPowerByType(4);
|
||||
if (maxHappiness > 0 && happiness > 0) {
|
||||
float hapPct = static_cast<float>(happiness) / static_cast<float>(maxHappiness);
|
||||
// Tier: < 33% = Unhappy (red), < 67% = Content (yellow), >= 67% = Happy (green)
|
||||
ImVec4 hapColor = hapPct >= 0.667f ? ImVec4(0.2f, 0.85f, 0.2f, 1.0f)
|
||||
: hapPct >= 0.333f ? ImVec4(0.9f, 0.75f, 0.1f, 1.0f)
|
||||
: ImVec4(0.85f, 0.2f, 0.2f, 1.0f);
|
||||
const char* hapLabel = hapPct >= 0.667f ? "Happy" : hapPct >= 0.333f ? "Content" : "Unhappy";
|
||||
ImGui::PushStyleColor(ImGuiCol_PlotHistogram, hapColor);
|
||||
ImGui::ProgressBar(hapPct, ImVec2(-1, 8), hapLabel);
|
||||
ImGui::PopStyleColor();
|
||||
}
|
||||
}
|
||||
|
||||
// Pet cast bar
|
||||
if (auto* pcs = gameHandler.getUnitCastState(petGuid)) {
|
||||
float castPct = (pcs->timeTotal > 0.0f)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue