fix: show action bar cooldown timers for spells on cooldown at login

SMSG_INITIAL_SPELLS delivers active cooldowns which were stored in
spellCooldowns but never propagated to the action bar slot
cooldownRemaining/cooldownTotal fields. This meant that spells with
remaining cooldowns at login time showed no countdown overlay on the
action bar. Sync the action bar slots from spellCooldowns after
loadCharacterConfig() to restore the correct timers.
This commit is contained in:
Kelsi 2026-03-13 05:58:57 -07:00
parent 2b131548aa
commit dfe091473c

View file

@ -16174,6 +16174,19 @@ void GameHandler::handleInitialSpells(network::Packet& packet) {
actionBar[11].id = 8690; // Hearthstone
loadCharacterConfig();
// Sync login-time cooldowns into action bar slot overlays. Without this, spells
// that are still on cooldown when the player logs in show no cooldown timer on the
// action bar even though spellCooldowns has the right remaining time.
for (auto& slot : actionBar) {
if (slot.type == ActionBarSlot::SPELL && slot.id != 0) {
auto it = spellCooldowns.find(slot.id);
if (it != spellCooldowns.end() && it->second > 0.0f) {
slot.cooldownTotal = it->second;
slot.cooldownRemaining = it->second;
}
}
}
LOG_INFO("Learned ", knownSpells.size(), " spells");
}