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.
This commit is contained in:
Kelsi 2026-03-13 05:37:15 -07:00
parent 3c704088af
commit 2d587d0d4b

View file

@ -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);