feat: add cast bar to pet frame

Show an orange cast bar in the pet frame when the pet is casting a
spell, matching the party frame cast bar pattern. Displays spell name
and time remaining; falls back to 'Casting...' when spell name is
unavailable from Spell.dbc.
This commit is contained in:
Kelsi 2026-03-12 04:59:24 -07:00
parent b682e8c686
commit 0a03bf9028

View file

@ -2448,6 +2448,22 @@ void GameScreen::renderPetFrame(game::GameHandler& gameHandler) {
ImGui::PopStyleColor();
}
// Pet cast bar
if (auto* pcs = gameHandler.getUnitCastState(petGuid)) {
float castPct = (pcs->timeTotal > 0.0f)
? (pcs->timeTotal - pcs->timeRemaining) / pcs->timeTotal : 0.0f;
// Orange color to distinguish from health/power bars
ImGui::PushStyleColor(ImGuiCol_PlotHistogram, ImVec4(0.85f, 0.55f, 0.1f, 1.0f));
char petCastLabel[48];
const std::string& spellNm = gameHandler.getSpellName(pcs->spellId);
if (!spellNm.empty())
snprintf(petCastLabel, sizeof(petCastLabel), "%s (%.1fs)", spellNm.c_str(), pcs->timeRemaining);
else
snprintf(petCastLabel, sizeof(petCastLabel), "Casting... (%.1fs)", pcs->timeRemaining);
ImGui::ProgressBar(castPct, ImVec2(-1, 10), petCastLabel);
ImGui::PopStyleColor();
}
// Dismiss button (compact, right-aligned)
ImGui::SameLine(ImGui::GetContentRegionAvail().x - 60.0f);
if (ImGui::SmallButton("Dismiss")) {