From 533831e18dbe3a9639faf849e161eecae5d291ff Mon Sep 17 00:00:00 2001 From: Kelsi Date: Fri, 20 Mar 2026 06:59:23 -0700 Subject: [PATCH] fix: sync pending spell cooldowns to action bar after login SMSG_SPELL_COOLDOWN arrives before SMSG_ACTION_BUTTONS during login, so cooldown times were stored in spellCooldowns but never applied to the newly populated action bar slots. Players would see all abilities as ready immediately after login even if spells were on cooldown. Now applies pending cooldowns from the spellCooldowns map to each matching slot when the action bar is first populated. --- src/game/game_handler.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/game/game_handler.cpp b/src/game/game_handler.cpp index 62b91b4e..ac58e946 100644 --- a/src/game/game_handler.cpp +++ b/src/game/game_handler.cpp @@ -4492,6 +4492,18 @@ void GameHandler::handlePacket(network::Packet& packet) { } actionBar[i] = slot; } + // Apply any pending cooldowns from spellCooldowns to newly populated slots. + // SMSG_SPELL_COOLDOWN often arrives before SMSG_ACTION_BUTTONS during login, + // so the per-slot cooldownRemaining would be 0 without this sync. + for (auto& slot : actionBar) { + if (slot.type == ActionBarSlot::SPELL && slot.id != 0) { + auto cdIt = spellCooldowns.find(slot.id); + if (cdIt != spellCooldowns.end() && cdIt->second > 0.0f) { + slot.cooldownRemaining = cdIt->second; + slot.cooldownTotal = cdIt->second; + } + } + } LOG_INFO("SMSG_ACTION_BUTTONS: populated action bar from server"); packet.setReadPos(packet.getSize()); break;