diff options
author | QAston <qaston@gmail.com> | 2011-06-21 19:58:11 +0200 |
---|---|---|
committer | QAston <qaston@gmail.com> | 2011-06-21 19:59:17 +0200 |
commit | c4818f189216242594dff60c52a776f76927fb9a (patch) | |
tree | 2f3f07284148478277f9ad65370045c8e0392832 | |
parent | 65233f8e665ad5a0a4c411f9cb0bb56ae9406caf (diff) |
Core/Auras: Fix refresh of auras with spellmodifiers applied to currently cast spell.
-rwxr-xr-x | src/server/game/Entities/Player/Player.cpp | 12 | ||||
-rwxr-xr-x | src/server/game/Entities/Player/Player.h | 3 | ||||
-rwxr-xr-x | src/server/game/Entities/Unit/Unit.h | 4 | ||||
-rwxr-xr-x | src/server/game/Spells/Auras/SpellAuras.cpp | 8 | ||||
-rwxr-xr-x | src/server/game/Spells/Auras/SpellAuras.h | 2 |
5 files changed, 25 insertions, 4 deletions
diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index d30455b8825..bf5d03cf7c1 100755 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -19609,7 +19609,7 @@ void Player::AddSpellMod(SpellModifier* mod, bool apply) } // Restore spellmods in case of failed cast -void Player::RestoreSpellMods(Spell* spell, uint32 ownerAuraId) +void Player::RestoreSpellMods(Spell* spell, uint32 ownerAuraId, Aura* aura) { if (!spell || spell->m_appliedMods.empty()) return; @@ -19628,6 +19628,9 @@ void Player::RestoreSpellMods(Spell* spell, uint32 ownerAuraId) if (ownerAuraId && (ownerAuraId != mod->ownerAura->GetSpellProto()->Id)) continue; + if (aura && mod->ownerAura != aura) + continue; + // check if mod affected this spell Spell::UsedSpellMods::iterator iterMod = spell->m_appliedMods.find(mod->ownerAura); if (iterMod == spell->m_appliedMods.end()) @@ -19653,6 +19656,13 @@ void Player::RestoreSpellMods(Spell* spell, uint32 ownerAuraId) } } +void Player::RestoreAllSpellMods(uint32 ownerAuraId, Aura* aura) +{ + for (uint32 i = 0; i < CURRENT_MAX_SPELL; ++i) + if (m_currentSpells[i]) + RestoreSpellMods(m_currentSpells[i], ownerAuraId, aura); +} + void Player::RemoveSpellMods(Spell* spell) { if (!spell) diff --git a/src/server/game/Entities/Player/Player.h b/src/server/game/Entities/Player/Player.h index 0b789ae4e29..a84af725be4 100755 --- a/src/server/game/Entities/Player/Player.h +++ b/src/server/game/Entities/Player/Player.h @@ -1658,7 +1658,8 @@ class Player : public Unit, public GridObject<Player> bool IsAffectedBySpellmod(SpellEntry const *spellInfo, SpellModifier *mod, Spell* spell = NULL); template <class T> T ApplySpellMod(uint32 spellId, SpellModOp op, T &basevalue, Spell* spell = NULL); void RemoveSpellMods(Spell* spell); - void RestoreSpellMods(Spell* spell, uint32 ownerAuraId=0); + void RestoreSpellMods(Spell* spell, uint32 ownerAuraId = 0, Aura* aura = NULL); + void RestoreAllSpellMods(uint32 ownerAuraId = 0, Aura* aura = NULL); void DropModCharge(SpellModifier* mod, Spell* spell); void SetSpellModTakingSpell(Spell* spell, bool apply); diff --git a/src/server/game/Entities/Unit/Unit.h b/src/server/game/Entities/Unit/Unit.h index ed2b21bf6db..4497a9ea61c 100755 --- a/src/server/game/Entities/Unit/Unit.h +++ b/src/server/game/Entities/Unit/Unit.h @@ -2115,6 +2115,8 @@ class Unit : public WorldObject bool m_isSorted; uint32 m_transform; + Spell* m_currentSpells[CURRENT_MAX_SPELL]; + AuraMap m_ownedAuras; AuraApplicationMap m_appliedAuras; AuraList m_removedAuras; @@ -2185,8 +2187,6 @@ class Unit : public WorldObject uint32 m_CombatTimer; uint32 m_lastManaUse; // msecs - Spell* m_currentSpells[CURRENT_MAX_SPELL]; - Diminishing m_Diminishing; // Manage all Units that are threatened by us HostileRefManager m_HostileRefManager; diff --git a/src/server/game/Spells/Auras/SpellAuras.cpp b/src/server/game/Spells/Auras/SpellAuras.cpp index 553146c1bcb..6a0c969822b 100755 --- a/src/server/game/Spells/Auras/SpellAuras.cpp +++ b/src/server/game/Spells/Auras/SpellAuras.cpp @@ -826,6 +826,7 @@ bool Aura::ModStackAmount(int32 num, AuraRemoveMode removeMode) if (refresh) { + RefreshSpellMods(); RefreshTimers(); // reset charges @@ -835,6 +836,13 @@ bool Aura::ModStackAmount(int32 num, AuraRemoveMode removeMode) return false; } +void Aura::RefreshSpellMods() +{ + for (Aura::ApplicationMap::const_iterator appIter = m_applications.begin(); appIter != m_applications.end(); ++appIter) + if (Player * player = appIter->second->GetTarget()->ToPlayer()) + player->RestoreAllSpellMods(0, this); +} + bool Aura::IsPassive() const { return IsPassiveSpell(GetSpellProto()); diff --git a/src/server/game/Spells/Auras/SpellAuras.h b/src/server/game/Spells/Auras/SpellAuras.h index fcd03152aa4..c51ae74b958 100755 --- a/src/server/game/Spells/Auras/SpellAuras.h +++ b/src/server/game/Spells/Auras/SpellAuras.h @@ -142,6 +142,8 @@ class Aura void SetStackAmount(uint8 num); bool ModStackAmount(int32 num, AuraRemoveMode removeMode = AURA_REMOVE_BY_DEFAULT); + void RefreshSpellMods(); + uint8 GetCasterLevel() const { return m_casterLevel; } bool IsPassive() const; |