diff options
author | QAston <qaston@gmail.com> | 2011-06-11 10:54:22 +0200 |
---|---|---|
committer | QAston <qaston@gmail.com> | 2011-06-11 10:55:19 +0200 |
commit | 76bb3ca21c0f2bea0047b993e957a7eb1461c119 (patch) | |
tree | df69d1f10fa30b6fddc2901b01635a89e3d91694 /src | |
parent | 38de636e3042ae24eb11a1046e3c8f5249bc85cb (diff) |
Core/Auras: Call Aura::HandleAuraSpecificMods in Aura::SetStackAmount to preserve compatibility with older scripts.
Diffstat (limited to 'src')
-rwxr-xr-x | src/server/game/Entities/Unit/Unit.cpp | 4 | ||||
-rwxr-xr-x | src/server/game/Spells/Auras/SpellAuraEffects.cpp | 1 | ||||
-rwxr-xr-x | src/server/game/Spells/Auras/SpellAuras.cpp | 32 | ||||
-rwxr-xr-x | src/server/game/Spells/Auras/SpellAuras.h | 3 |
4 files changed, 33 insertions, 7 deletions
diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 53bcd21cdf9..8848294cb01 100755 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -3276,7 +3276,7 @@ void Unit::_ApplyAura(AuraApplication * aurApp, uint8 effMask) if (aurApp->GetRemoveMode()) return; - aura->HandleAuraSpecificMods(aurApp, caster, true); + aura->HandleAuraSpecificMods(aurApp, caster, true, false); // apply effects of the aura for (uint8 i = 0 ; i < MAX_SPELL_EFFECTS; ++i) @@ -3358,7 +3358,7 @@ void Unit::_UnapplyAura(AuraApplicationMap::iterator &i, AuraRemoveMode removeMo if (!auraStateFound) ModifyAuraState(auraState, false); - aura->HandleAuraSpecificMods(aurApp, caster, false); + aura->HandleAuraSpecificMods(aurApp, caster, false, false); // only way correctly remove all auras from list //if (removedAuras != m_removedAurasCount) new aura may be added diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp index 00ee8aa1e4f..285e99d5b65 100755 --- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp +++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp @@ -403,7 +403,6 @@ void AuraEffect::GetTargetList(std::list<Unit *> & targetList) const void AuraEffect::GetApplicationList(std::list<AuraApplication*> & applicationList) const { Aura::ApplicationMap const & targetMap = GetBase()->GetApplicationMap(); - // remove all targets which were not added to new list - they no longer deserve area aura for (Aura::ApplicationMap::const_iterator appIter = targetMap.begin(); appIter != targetMap.end(); ++appIter) { if (appIter->second->HasEffect(GetEffIndex())) diff --git a/src/server/game/Spells/Auras/SpellAuras.cpp b/src/server/game/Spells/Auras/SpellAuras.cpp index 4ceaa689a69..822392747aa 100755 --- a/src/server/game/Spells/Auras/SpellAuras.cpp +++ b/src/server/game/Spells/Auras/SpellAuras.cpp @@ -780,9 +780,22 @@ void Aura::SetStackAmount(uint8 stackAmount) { m_stackAmount = stackAmount; Unit * caster = GetCaster(); + + std::list<AuraApplication*> applications; + GetApplicationList(applications); + + for (std::list<AuraApplication*>::const_iterator apptItr = applications.begin(); apptItr != applications.end(); ++apptItr) + if (!(*apptItr)->GetRemoveMode()) + HandleAuraSpecificMods(*apptItr, caster, false, true); + for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i) if (HasEffect(i)) m_effects[i]->ChangeAmount(m_effects[i]->CalculateAmount(caster), false, true); + + for (std::list<AuraApplication*>::const_iterator apptItr = applications.begin(); apptItr != applications.end(); ++apptItr) + if (!(*apptItr)->GetRemoveMode()) + HandleAuraSpecificMods(*apptItr, caster, true, true); + SetNeedClientUpdateForTargets(); } @@ -919,6 +932,15 @@ void Aura::HandleAllEffects(AuraApplication * aurApp, uint8 mode, bool apply) m_effects[i]->HandleEffect(aurApp, mode, apply); } +void Aura::GetApplicationList(std::list<AuraApplication*> & applicationList) const +{ + for (Aura::ApplicationMap::const_iterator appIter = m_applications.begin(); appIter != m_applications.end(); ++appIter) + { + if (appIter->second->GetEffectMask()) + applicationList.push_back(appIter->second); + } +} + void Aura::SetNeedClientUpdateForTargets() const { for (ApplicationMap::const_iterator appIter = m_applications.begin(); appIter != m_applications.end(); ++appIter) @@ -926,7 +948,7 @@ void Aura::SetNeedClientUpdateForTargets() const } // trigger effects on real aura apply/remove -void Aura::HandleAuraSpecificMods(AuraApplication const * aurApp, Unit * caster, bool apply) +void Aura::HandleAuraSpecificMods(AuraApplication const * aurApp, Unit * caster, bool apply, bool onReapply) { Unit * target = aurApp->GetTarget(); AuraRemoveMode removeMode = aurApp->GetRemoveMode(); @@ -1172,7 +1194,7 @@ void Aura::HandleAuraSpecificMods(AuraApplication const * aurApp, Unit * caster, else { // Remove Linked Auras - if (removeMode != AURA_REMOVE_BY_DEATH) + if (!onReapply && removeMode != AURA_REMOVE_BY_DEATH) { if (uint32 customAttr = sSpellMgr->GetSpellCustomAttr(GetId())) { @@ -1312,7 +1334,11 @@ void Aura::HandleAuraSpecificMods(AuraApplication const * aurApp, Unit * caster, switch(GetId()) { case 48018: // Demonic Circle - target->RemoveGameObject(GetId(), true); + // Do not remove GO when aura is removed by stack + // to prevent remove GO added by new spell + // old one is already removed + if (!onReapply) + target->RemoveGameObject(GetId(), true); target->RemoveAura(62388); break; } diff --git a/src/server/game/Spells/Auras/SpellAuras.h b/src/server/game/Spells/Auras/SpellAuras.h index cd805757ecb..69792a6e513 100755 --- a/src/server/game/Spells/Auras/SpellAuras.h +++ b/src/server/game/Spells/Auras/SpellAuras.h @@ -167,12 +167,13 @@ class Aura // Helpers for targets ApplicationMap const & GetApplicationMap() {return m_applications;} + void GetApplicationList(std::list<AuraApplication*> & applicationList) const; const AuraApplication * GetApplicationOfTarget (uint64 const & guid) const { ApplicationMap::const_iterator itr = m_applications.find(guid); if (itr != m_applications.end()) return itr->second; return NULL; } AuraApplication * GetApplicationOfTarget (uint64 const & guid) { ApplicationMap::iterator itr = m_applications.find(guid); if (itr != m_applications.end()) return itr->second; return NULL; } bool IsAppliedOnTarget(uint64 const & guid) const { return m_applications.find(guid) != m_applications.end(); } void SetNeedClientUpdateForTargets() const; - void HandleAuraSpecificMods(AuraApplication const * aurApp, Unit * caster, bool apply); + void HandleAuraSpecificMods(AuraApplication const * aurApp, Unit * caster, bool apply, bool onReapply); bool CanBeAppliedOn(Unit *target); bool CheckAreaTarget(Unit *target); |