Core/Auras: Call Aura::HandleAuraSpecificMods in Aura::SetStackAmount to preserve compatibility with older scripts.

This commit is contained in:
QAston
2011-06-11 10:55:19 +02:00
parent 38de636e30
commit 76bb3ca21c
4 changed files with 33 additions and 7 deletions
+2 -2
View File
@@ -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
@@ -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()))
+29 -3
View File
@@ -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;
}
+2 -1
View File
@@ -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);