From 8819f30a12e12075f3008aefe2ae61c5d99b49eb Mon Sep 17 00:00:00 2001 From: Shauren Date: Mon, 13 Aug 2012 14:56:56 +0200 Subject: Core/Auras: Simplified SPELL_AURA_OVERRIDE_ACTIONBAR_SPELLS handling --- src/server/game/Handlers/SpellHandler.cpp | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) (limited to 'src/server/game/Handlers/SpellHandler.cpp') diff --git a/src/server/game/Handlers/SpellHandler.cpp b/src/server/game/Handlers/SpellHandler.cpp index 8369fcde064..079a4e2422d 100755 --- a/src/server/game/Handlers/SpellHandler.cpp +++ b/src/server/game/Handlers/SpellHandler.cpp @@ -350,8 +350,6 @@ void WorldSession::HandleCastSpellOpcode(WorldPacket& recvPacket) return; } - if (Player* plrMover = mover->ToPlayer()) - spellId = plrMover->GetSpellForCast(spellId); SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId); if (!spellInfo) @@ -382,6 +380,27 @@ void WorldSession::HandleCastSpellOpcode(WorldPacket& recvPacket) } } + Unit::AuraEffectList swaps = mover->GetAuraEffectsByType(SPELL_AURA_OVERRIDE_ACTIONBAR_SPELLS); + Unit::AuraEffectList const& swaps2 = mover->GetAuraEffectsByType(SPELL_AURA_OVERRIDE_ACTIONBAR_SPELLS_2); + if (!swaps2.empty()) + swaps.insert(swaps.end(), swaps2.begin(), swaps2.end()); + + if (!swaps.empty()) + { + for (Unit::AuraEffectList::const_iterator itr = swaps.begin(); itr != swaps.end(); ++itr) + { + if ((*itr)->IsAffectingSpell(spellInfo)) + { + if (SpellInfo const* newInfo = sSpellMgr->GetSpellInfo((*itr)->GetAmount())) + { + spellInfo = newInfo; + spellId = newInfo->Id; + } + break; + } + } + } + // Client is resending autoshot cast opcode when other spell is casted during shoot rotation // Skip it to prevent "interrupt" message if (spellInfo->IsAutoRepeatRangedSpell() && _player->GetCurrentSpell(CURRENT_AUTOREPEAT_SPELL) -- cgit v1.2.3