game/ui: add channeled spell cast tracking and party cast bars

- Handle MSG_CHANNEL_START: populate unitCastStates_ for both the local
  player and any non-player caster (boss/mob channeled spells); use
  full uint64 GUIDs for TBC/Classic, packed GUIDs for WotLK
- Handle MSG_CHANNEL_UPDATE: sync remaining channel time; clear cast
  state on channel completion (remainingMs == 0)
- Fix SMSG_RESUME_CAST_BAR: also resumes non-player units' cast bars
  (previously only resumed the player's own bar after zone transitions)
- Add party member cast bars in renderPartyFrames: golden progress bar
  appears beneath the power bar when a party member is casting,
  leveraging the existing unitCastStates_ per-GUID map
This commit is contained in:
Kelsi 2026-03-09 23:36:14 -07:00
parent d72912714b
commit f31fa29616
2 changed files with 84 additions and 7 deletions

View file

@ -4937,6 +4937,21 @@ void GameScreen::renderPartyFrames(game::GameHandler& gameHandler) {
ImGui::PopStyleColor();
}
// Party member cast bar — shows when the party member is casting
if (auto* cs = gameHandler.getUnitCastState(member.guid)) {
float castPct = (cs->timeTotal > 0.0f)
? (cs->timeTotal - cs->timeRemaining) / cs->timeTotal : 0.0f;
ImGui::PushStyleColor(ImGuiCol_PlotHistogram, ImVec4(0.8f, 0.8f, 0.2f, 1.0f));
char pcastLabel[48];
const std::string& spellNm = gameHandler.getSpellName(cs->spellId);
if (!spellNm.empty())
snprintf(pcastLabel, sizeof(pcastLabel), "%s (%.1fs)", spellNm.c_str(), cs->timeRemaining);
else
snprintf(pcastLabel, sizeof(pcastLabel), "Casting... (%.1fs)", cs->timeRemaining);
ImGui::ProgressBar(castPct, ImVec2(-1, 10), pcastLabel);
ImGui::PopStyleColor();
}
ImGui::Separator();
ImGui::PopID();
}