mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-03-22 23:30:14 +00:00
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.
This commit is contained in:
parent
72993121ab
commit
533831e18d
1 changed files with 12 additions and 0 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue