From 2d587d0d4b014f75e705e0774544a224c5bcc987 Mon Sep 17 00:00:00 2001 From: Kelsi Date: Fri, 13 Mar 2026 05:37:15 -0700 Subject: [PATCH] feat: upgrade action bar slots to new spell rank on supercede When a spell is superceded (e.g. Fireball Rank 1 -> Rank 2 after training), update any action bar slots referencing the old spell ID to point to the new rank. This matches WoW client behaviour where training a new rank automatically upgrades your action bars so you don't have to manually re-place the spell. --- 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 f81405ca..61189a95 100644 --- a/src/game/game_handler.cpp +++ b/src/game/game_handler.cpp @@ -16559,6 +16559,18 @@ void GameHandler::handleSupercededSpell(network::Packet& packet) { LOG_INFO("Spell superceded: ", oldSpellId, " -> ", newSpellId); + // Update all action bar slots that reference the old spell rank to the new rank. + // This matches the WoW client behaviour: the action bar automatically upgrades + // to the new rank when you train it. + for (auto& slot : actionBar) { + if (slot.type == ActionBarSlot::SPELL && slot.id == oldSpellId) { + slot.id = newSpellId; + slot.cooldownRemaining = 0.0f; + slot.cooldownTotal = 0.0f; + LOG_DEBUG("Action bar slot upgraded: spell ", oldSpellId, " -> ", newSpellId); + } + } + const std::string& newName = getSpellName(newSpellId); if (!newName.empty()) { addSystemChatMessage("Upgraded to " + newName);