aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShauren <shauren.trinity@gmail.com>2012-08-13 14:56:56 +0200
committerShauren <shauren.trinity@gmail.com>2012-08-13 14:56:56 +0200
commit8819f30a12e12075f3008aefe2ae61c5d99b49eb (patch)
tree34b9db713cc17150379da1ae1d51b80d05d883cf
parent3ad20d6bbdbefa29bca81b3399cb63d0968599cd (diff)
Core/Auras: Simplified SPELL_AURA_OVERRIDE_ACTIONBAR_SPELLS handling
-rwxr-xr-xsrc/server/game/Entities/Player/Player.h15
-rwxr-xr-xsrc/server/game/Handlers/SpellHandler.cpp23
-rw-r--r--src/server/game/Spells/Auras/SpellAuraEffects.cpp47
-rw-r--r--src/server/game/Spells/Auras/SpellAuraEffects.h1
4 files changed, 23 insertions, 63 deletions
diff --git a/src/server/game/Entities/Player/Player.h b/src/server/game/Entities/Player/Player.h
index ab4c738f119..c8c132b56f3 100755
--- a/src/server/game/Entities/Player/Player.h
+++ b/src/server/game/Entities/Player/Player.h
@@ -2606,19 +2606,6 @@ class Player : public Unit, public GridObject<Player>
VoidStorageItem* GetVoidStorageItem(uint8 slot) const;
VoidStorageItem* GetVoidStorageItem(uint64 id, uint8& slot) const;
- // SPELL_AURA_OVERRIDE_ACTIONBAR_SPELLS handling
- void AddSpellSwap(uint32 oldSpell, uint32 newSpell) { _spellSwaps[oldSpell] = newSpell; }
- void RemoveSpellSwap(uint32 originalSpell) { _spellSwaps.erase(originalSpell); }
-
- uint32 GetSpellForCast(uint32 spellId) const
- {
- std::map<uint32, uint32>::const_iterator itr = _spellSwaps.find(spellId);
- if (itr != _spellSwaps.end())
- return itr->second;
-
- return spellId;
- }
-
protected:
// Gamemaster whisper whitelist
WhisperListContainer WhisperList;
@@ -2947,8 +2934,6 @@ class Player : public Unit, public GridObject<Player>
InstanceTimeMap _instanceResetTimes;
uint32 _pendingBindId;
uint32 _pendingBindTimer;
-
- std::map<uint32, uint32> _spellSwaps;
};
void AddItemsSetItem(Player*player, Item* item);
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)
diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp
index 097ec0b2e8e..e81d465b664 100644
--- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp
+++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp
@@ -385,8 +385,8 @@ pAuraEffectHandler AuraEffectHandler[TOTAL_AURAS]=
&AuraEffect::HandleNULL, //329 SPELL_AURA_MOD_RUNE_REGEN_SPEED
&AuraEffect::HandleNULL, //330 SPELL_AURA_CAST_WHILE_WALKING
&AuraEffect::HandleNULL, //331 SPELL_AURA_331
- &AuraEffect::HandleOverrideActionbar, //332 SPELL_AURA_OVERRIDE_ACTIONBAR_SPELLS
- &AuraEffect::HandleOverrideActionbar, //333 SPELL_AURA_OVERRIDE_ACTIONBAR_SPELLS_2
+ &AuraEffect::HandleNoImmediateEffect, //332 SPELL_AURA_OVERRIDE_ACTIONBAR_SPELLS implemented in WorldSession::HandleCastSpellOpcode
+ &AuraEffect::HandleNoImmediateEffect, //333 SPELL_AURA_OVERRIDE_ACTIONBAR_SPELLS_2 implemented in WorldSession::HandleCastSpellOpcode
&AuraEffect::HandleNULL, //334 SPELL_AURA_334
&AuraEffect::HandleNULL, //335 SPELL_AURA_335
&AuraEffect::HandleNULL, //336 SPELL_AURA_MOD_FLYING_RESTRICTIONS
@@ -5679,49 +5679,6 @@ void AuraEffect::HandlePreventResurrection(AuraApplication const* aurApp, uint8
aurApp->GetTarget()->SetByteFlag(PLAYER_FIELD_BYTES, 0, PLAYER_FIELD_BYTE_RELEASE_TIMER);
}
-void AuraEffect::HandleOverrideActionbar(AuraApplication const* aurApp, uint8 mode, bool apply) const
-{
- if (!(mode & AURA_EFFECT_HANDLE_REAL))
- return;
-
- Player* target = aurApp->GetTarget()->ToPlayer();
- if (!target)
- return;
-
- uint32 newSpellId = uint32(GetAmount());
- if (!sSpellMgr->GetSpellInfo(newSpellId))
- return;
-
- bool foundAny = false;
- PlayerSpellMap const& spells = target->GetSpellMap();
- for (PlayerSpellMap::const_iterator itr = spells.begin(); itr != spells.end(); ++itr)
- {
- if (itr->second->state == PLAYERSPELL_REMOVED)
- continue;
-
- if (!itr->second->active || itr->second->disabled)
- continue;
-
- SpellInfo const* info = sSpellMgr->GetSpellInfo(itr->first);
- if (!IsAffectingSpell(info))
- continue;
-
- foundAny = true;
- if (apply)
- target->AddSpellSwap(itr->first, newSpellId);
- else
- target->RemoveSpellSwap(itr->first);
- }
-
- if (foundAny)
- {
- if (apply)
- target->AddTemporarySpell(newSpellId);
- else
- target->RemoveTemporarySpell(newSpellId);
- }
-}
-
void AuraEffect::HandlePeriodicDummyAuraTick(Unit* target, Unit* caster) const
{
switch (GetSpellInfo()->SpellFamilyName)
diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.h b/src/server/game/Spells/Auras/SpellAuraEffects.h
index 5a85012f857..28a5beafa2c 100644
--- a/src/server/game/Spells/Auras/SpellAuraEffects.h
+++ b/src/server/game/Spells/Auras/SpellAuraEffects.h
@@ -280,7 +280,6 @@ class AuraEffect
void HandleAuraOverrideSpells(AuraApplication const* aurApp, uint8 mode, bool apply) const;
void HandleAuraSetVehicle(AuraApplication const* aurApp, uint8 mode, bool apply) const;
void HandlePreventResurrection(AuraApplication const* aurApp, uint8 mode, bool apply) const;
- void HandleOverrideActionbar(AuraApplication const* aurApp, uint8 mode, bool apply) const;
// aura effect periodic tick handlers
void HandlePeriodicDummyAuraTick(Unit* target, Unit* caster) const;