aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/server/game/Spells/Auras/SpellAuras.cpp158
1 files changed, 80 insertions, 78 deletions
diff --git a/src/server/game/Spells/Auras/SpellAuras.cpp b/src/server/game/Spells/Auras/SpellAuras.cpp
index a218e238c6f..375f9ef067c 100644
--- a/src/server/game/Spells/Auras/SpellAuras.cpp
+++ b/src/server/game/Spells/Auras/SpellAuras.cpp
@@ -2096,16 +2096,17 @@ void Aura::LoadScripts()
bool Aura::CallScriptCheckAreaTargetHandlers(Unit* target)
{
+ bool result = true;
for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)
{
(*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_CHECK_AREA_TARGET);
std::list<AuraScript::CheckAreaTargetHandler>::iterator hookItrEnd = (*scritr)->DoCheckAreaTarget.end(), hookItr = (*scritr)->DoCheckAreaTarget.begin();
for (; hookItr != hookItrEnd; ++hookItr)
- if (!(*hookItr).Call(*scritr, target))
- return false;
+ result &= hookItr->Call(*scritr, target);
+
(*scritr)->_FinishScriptCall();
}
- return true;
+ return result;
}
void Aura::CallScriptDispel(DispelInfo* dispelInfo)
@@ -2115,7 +2116,8 @@ void Aura::CallScriptDispel(DispelInfo* dispelInfo)
(*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_DISPEL);
std::list<AuraScript::AuraDispelHandler>::iterator hookItrEnd = (*scritr)->OnDispel.end(), hookItr = (*scritr)->OnDispel.begin();
for (; hookItr != hookItrEnd; ++hookItr)
- (*hookItr).Call(*scritr, dispelInfo);
+ hookItr->Call(*scritr, dispelInfo);
+
(*scritr)->_FinishScriptCall();
}
}
@@ -2127,7 +2129,8 @@ void Aura::CallScriptAfterDispel(DispelInfo* dispelInfo)
(*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_AFTER_DISPEL);
std::list<AuraScript::AuraDispelHandler>::iterator hookItrEnd = (*scritr)->AfterDispel.end(), hookItr = (*scritr)->AfterDispel.begin();
for (; hookItr != hookItrEnd; ++hookItr)
- (*hookItr).Call(*scritr, dispelInfo);
+ hookItr->Call(*scritr, dispelInfo);
+
(*scritr)->_FinishScriptCall();
}
}
@@ -2140,14 +2143,15 @@ bool Aura::CallScriptEffectApplyHandlers(AuraEffect const* aurEff, AuraApplicati
(*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_EFFECT_APPLY, aurApp);
std::list<AuraScript::EffectApplyHandler>::iterator effEndItr = (*scritr)->OnEffectApply.end(), effItr = (*scritr)->OnEffectApply.begin();
for (; effItr != effEndItr; ++effItr)
- {
- if ((*effItr).IsEffectAffected(m_spellInfo, aurEff->GetEffIndex()))
- (*effItr).Call(*scritr, aurEff, mode);
- }
+ if (effItr->IsEffectAffected(m_spellInfo, aurEff->GetEffIndex()))
+ effItr->Call(*scritr, aurEff, mode);
+
if (!preventDefault)
preventDefault = (*scritr)->_IsDefaultActionPrevented();
+
(*scritr)->_FinishScriptCall();
}
+
return preventDefault;
}
@@ -2159,12 +2163,12 @@ bool Aura::CallScriptEffectRemoveHandlers(AuraEffect const* aurEff, AuraApplicat
(*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_EFFECT_REMOVE, aurApp);
std::list<AuraScript::EffectApplyHandler>::iterator effEndItr = (*scritr)->OnEffectRemove.end(), effItr = (*scritr)->OnEffectRemove.begin();
for (; effItr != effEndItr; ++effItr)
- {
- if ((*effItr).IsEffectAffected(m_spellInfo, aurEff->GetEffIndex()))
- (*effItr).Call(*scritr, aurEff, mode);
- }
+ if (effItr->IsEffectAffected(m_spellInfo, aurEff->GetEffIndex()))
+ effItr->Call(*scritr, aurEff, mode);
+
if (!preventDefault)
preventDefault = (*scritr)->_IsDefaultActionPrevented();
+
(*scritr)->_FinishScriptCall();
}
return preventDefault;
@@ -2177,10 +2181,9 @@ void Aura::CallScriptAfterEffectApplyHandlers(AuraEffect const* aurEff, AuraAppl
(*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_EFFECT_AFTER_APPLY, aurApp);
std::list<AuraScript::EffectApplyHandler>::iterator effEndItr = (*scritr)->AfterEffectApply.end(), effItr = (*scritr)->AfterEffectApply.begin();
for (; effItr != effEndItr; ++effItr)
- {
- if ((*effItr).IsEffectAffected(m_spellInfo, aurEff->GetEffIndex()))
- (*effItr).Call(*scritr, aurEff, mode);
- }
+ if (effItr->IsEffectAffected(m_spellInfo, aurEff->GetEffIndex()))
+ effItr->Call(*scritr, aurEff, mode);
+
(*scritr)->_FinishScriptCall();
}
}
@@ -2192,10 +2195,9 @@ void Aura::CallScriptAfterEffectRemoveHandlers(AuraEffect const* aurEff, AuraApp
(*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_EFFECT_AFTER_REMOVE, aurApp);
std::list<AuraScript::EffectApplyHandler>::iterator effEndItr = (*scritr)->AfterEffectRemove.end(), effItr = (*scritr)->AfterEffectRemove.begin();
for (; effItr != effEndItr; ++effItr)
- {
- if ((*effItr).IsEffectAffected(m_spellInfo, aurEff->GetEffIndex()))
- (*effItr).Call(*scritr, aurEff, mode);
- }
+ if (effItr->IsEffectAffected(m_spellInfo, aurEff->GetEffIndex()))
+ effItr->Call(*scritr, aurEff, mode);
+
(*scritr)->_FinishScriptCall();
}
}
@@ -2208,14 +2210,15 @@ bool Aura::CallScriptEffectPeriodicHandlers(AuraEffect const* aurEff, AuraApplic
(*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_EFFECT_PERIODIC, aurApp);
std::list<AuraScript::EffectPeriodicHandler>::iterator effEndItr = (*scritr)->OnEffectPeriodic.end(), effItr = (*scritr)->OnEffectPeriodic.begin();
for (; effItr != effEndItr; ++effItr)
- {
- if ((*effItr).IsEffectAffected(m_spellInfo, aurEff->GetEffIndex()))
- (*effItr).Call(*scritr, aurEff);
- }
+ if (effItr->IsEffectAffected(m_spellInfo, aurEff->GetEffIndex()))
+ effItr->Call(*scritr, aurEff);
+
if (!preventDefault)
preventDefault = (*scritr)->_IsDefaultActionPrevented();
+
(*scritr)->_FinishScriptCall();
}
+
return preventDefault;
}
@@ -2226,10 +2229,9 @@ void Aura::CallScriptEffectUpdatePeriodicHandlers(AuraEffect* aurEff)
(*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_EFFECT_UPDATE_PERIODIC);
std::list<AuraScript::EffectUpdatePeriodicHandler>::iterator effEndItr = (*scritr)->OnEffectUpdatePeriodic.end(), effItr = (*scritr)->OnEffectUpdatePeriodic.begin();
for (; effItr != effEndItr; ++effItr)
- {
- if ((*effItr).IsEffectAffected(m_spellInfo, aurEff->GetEffIndex()))
- (*effItr).Call(*scritr, aurEff);
- }
+ if (effItr->IsEffectAffected(m_spellInfo, aurEff->GetEffIndex()))
+ effItr->Call(*scritr, aurEff);
+
(*scritr)->_FinishScriptCall();
}
}
@@ -2241,10 +2243,9 @@ void Aura::CallScriptEffectCalcAmountHandlers(AuraEffect const* aurEff, int32 &
(*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_EFFECT_CALC_AMOUNT);
std::list<AuraScript::EffectCalcAmountHandler>::iterator effEndItr = (*scritr)->DoEffectCalcAmount.end(), effItr = (*scritr)->DoEffectCalcAmount.begin();
for (; effItr != effEndItr; ++effItr)
- {
- if ((*effItr).IsEffectAffected(m_spellInfo, aurEff->GetEffIndex()))
- (*effItr).Call(*scritr, aurEff, amount, canBeRecalculated);
- }
+ if (effItr->IsEffectAffected(m_spellInfo, aurEff->GetEffIndex()))
+ effItr->Call(*scritr, aurEff, amount, canBeRecalculated);
+
(*scritr)->_FinishScriptCall();
}
}
@@ -2256,10 +2257,9 @@ void Aura::CallScriptEffectCalcPeriodicHandlers(AuraEffect const* aurEff, bool &
(*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_EFFECT_CALC_PERIODIC);
std::list<AuraScript::EffectCalcPeriodicHandler>::iterator effEndItr = (*scritr)->DoEffectCalcPeriodic.end(), effItr = (*scritr)->DoEffectCalcPeriodic.begin();
for (; effItr != effEndItr; ++effItr)
- {
- if ((*effItr).IsEffectAffected(m_spellInfo, aurEff->GetEffIndex()))
- (*effItr).Call(*scritr, aurEff, isPeriodic, amplitude);
- }
+ if (effItr->IsEffectAffected(m_spellInfo, aurEff->GetEffIndex()))
+ effItr->Call(*scritr, aurEff, isPeriodic, amplitude);
+
(*scritr)->_FinishScriptCall();
}
}
@@ -2271,10 +2271,9 @@ void Aura::CallScriptEffectCalcSpellModHandlers(AuraEffect const* aurEff, SpellM
(*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_EFFECT_CALC_SPELLMOD);
std::list<AuraScript::EffectCalcSpellModHandler>::iterator effEndItr = (*scritr)->DoEffectCalcSpellMod.end(), effItr = (*scritr)->DoEffectCalcSpellMod.begin();
for (; effItr != effEndItr; ++effItr)
- {
- if ((*effItr).IsEffectAffected(m_spellInfo, aurEff->GetEffIndex()))
- (*effItr).Call(*scritr, aurEff, spellMod);
- }
+ if (effItr->IsEffectAffected(m_spellInfo, aurEff->GetEffIndex()))
+ effItr->Call(*scritr, aurEff, spellMod);
+
(*scritr)->_FinishScriptCall();
}
}
@@ -2286,11 +2285,13 @@ void Aura::CallScriptEffectAbsorbHandlers(AuraEffect* aurEff, AuraApplication co
(*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_EFFECT_ABSORB, aurApp);
std::list<AuraScript::EffectAbsorbHandler>::iterator effEndItr = (*scritr)->OnEffectAbsorb.end(), effItr = (*scritr)->OnEffectAbsorb.begin();
for (; effItr != effEndItr; ++effItr)
- {
- if ((*effItr).IsEffectAffected(m_spellInfo, aurEff->GetEffIndex()))
- (*effItr).Call(*scritr, aurEff, dmgInfo, absorbAmount);
- }
- defaultPrevented = (*scritr)->_IsDefaultActionPrevented();
+
+ if (effItr->IsEffectAffected(m_spellInfo, aurEff->GetEffIndex()))
+ effItr->Call(*scritr, aurEff, dmgInfo, absorbAmount);
+
+ if (!defaultPrevented)
+ defaultPrevented = (*scritr)->_IsDefaultActionPrevented();
+
(*scritr)->_FinishScriptCall();
}
}
@@ -2302,10 +2303,9 @@ void Aura::CallScriptEffectAfterAbsorbHandlers(AuraEffect* aurEff, AuraApplicati
(*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_EFFECT_AFTER_ABSORB, aurApp);
std::list<AuraScript::EffectAbsorbHandler>::iterator effEndItr = (*scritr)->AfterEffectAbsorb.end(), effItr = (*scritr)->AfterEffectAbsorb.begin();
for (; effItr != effEndItr; ++effItr)
- {
- if ((*effItr).IsEffectAffected(m_spellInfo, aurEff->GetEffIndex()))
- (*effItr).Call(*scritr, aurEff, dmgInfo, absorbAmount);
- }
+ if (effItr->IsEffectAffected(m_spellInfo, aurEff->GetEffIndex()))
+ effItr->Call(*scritr, aurEff, dmgInfo, absorbAmount);
+
(*scritr)->_FinishScriptCall();
}
}
@@ -2317,10 +2317,9 @@ void Aura::CallScriptEffectManaShieldHandlers(AuraEffect* aurEff, AuraApplicatio
(*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_EFFECT_MANASHIELD, aurApp);
std::list<AuraScript::EffectManaShieldHandler>::iterator effEndItr = (*scritr)->OnEffectManaShield.end(), effItr = (*scritr)->OnEffectManaShield.begin();
for (; effItr != effEndItr; ++effItr)
- {
- if ((*effItr).IsEffectAffected(m_spellInfo, aurEff->GetEffIndex()))
- (*effItr).Call(*scritr, aurEff, dmgInfo, absorbAmount);
- }
+ if (effItr->IsEffectAffected(m_spellInfo, aurEff->GetEffIndex()))
+ effItr->Call(*scritr, aurEff, dmgInfo, absorbAmount);
+
(*scritr)->_FinishScriptCall();
}
}
@@ -2332,10 +2331,9 @@ void Aura::CallScriptEffectAfterManaShieldHandlers(AuraEffect* aurEff, AuraAppli
(*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_EFFECT_AFTER_MANASHIELD, aurApp);
std::list<AuraScript::EffectManaShieldHandler>::iterator effEndItr = (*scritr)->AfterEffectManaShield.end(), effItr = (*scritr)->AfterEffectManaShield.begin();
for (; effItr != effEndItr; ++effItr)
- {
- if ((*effItr).IsEffectAffected(m_spellInfo, aurEff->GetEffIndex()))
- (*effItr).Call(*scritr, aurEff, dmgInfo, absorbAmount);
- }
+ if (effItr->IsEffectAffected(m_spellInfo, aurEff->GetEffIndex()))
+ effItr->Call(*scritr, aurEff, dmgInfo, absorbAmount);
+
(*scritr)->_FinishScriptCall();
}
}
@@ -2347,26 +2345,27 @@ void Aura::CallScriptEffectSplitHandlers(AuraEffect* aurEff, AuraApplication con
(*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_EFFECT_SPLIT, aurApp);
std::list<AuraScript::EffectSplitHandler>::iterator effEndItr = (*scritr)->OnEffectSplit.end(), effItr = (*scritr)->OnEffectSplit.begin();
for (; effItr != effEndItr; ++effItr)
- {
- if ((*effItr).IsEffectAffected(m_spellInfo, aurEff->GetEffIndex()))
- (*effItr).Call(*scritr, aurEff, dmgInfo, splitAmount);
- }
+ if (effItr->IsEffectAffected(m_spellInfo, aurEff->GetEffIndex()))
+ effItr->Call(*scritr, aurEff, dmgInfo, splitAmount);
+
(*scritr)->_FinishScriptCall();
}
}
bool Aura::CallScriptCheckProcHandlers(AuraApplication const* aurApp, ProcEventInfo& eventInfo)
{
+ bool result = true;
for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)
{
(*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_CHECK_PROC, aurApp);
std::list<AuraScript::CheckProcHandler>::iterator hookItrEnd = (*scritr)->DoCheckProc.end(), hookItr = (*scritr)->DoCheckProc.begin();
for (; hookItr != hookItrEnd; ++hookItr)
- if (!(*hookItr).Call(*scritr, eventInfo))
- return false;
+ result &= hookItr->Call(*scritr, eventInfo);
+
(*scritr)->_FinishScriptCall();
}
- return true;
+
+ return result;
}
bool Aura::CallScriptPrepareProcHandlers(AuraApplication const* aurApp, ProcEventInfo& eventInfo)
@@ -2377,12 +2376,14 @@ bool Aura::CallScriptPrepareProcHandlers(AuraApplication const* aurApp, ProcEven
(*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_PREPARE_PROC, aurApp);
std::list<AuraScript::AuraProcHandler>::iterator effEndItr = (*scritr)->DoPrepareProc.end(), effItr = (*scritr)->DoPrepareProc.begin();
for (; effItr != effEndItr; ++effItr)
- (*effItr).Call(*scritr, eventInfo);
+ effItr->Call(*scritr, eventInfo);
+
+ if (prepare)
+ prepare = !(*scritr)->_IsDefaultActionPrevented();
- if (prepare && (*scritr)->_IsDefaultActionPrevented())
- prepare = false;
(*scritr)->_FinishScriptCall();
}
+
return prepare;
}
@@ -2393,7 +2394,8 @@ void Aura::CallScriptProcHandlers(AuraApplication const* aurApp, ProcEventInfo&
(*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_PROC, aurApp);
std::list<AuraScript::AuraProcHandler>::iterator hookItrEnd = (*scritr)->OnProc.end(), hookItr = (*scritr)->OnProc.begin();
for (; hookItr != hookItrEnd; ++hookItr)
- (*hookItr).Call(*scritr, eventInfo);
+ hookItr->Call(*scritr, eventInfo);
+
(*scritr)->_FinishScriptCall();
}
}
@@ -2405,7 +2407,8 @@ void Aura::CallScriptAfterProcHandlers(AuraApplication const* aurApp, ProcEventI
(*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_AFTER_PROC, aurApp);
std::list<AuraScript::AuraProcHandler>::iterator hookItrEnd = (*scritr)->AfterProc.end(), hookItr = (*scritr)->AfterProc.begin();
for (; hookItr != hookItrEnd; ++hookItr)
- (*hookItr).Call(*scritr, eventInfo);
+ hookItr->Call(*scritr, eventInfo);
+
(*scritr)->_FinishScriptCall();
}
}
@@ -2418,12 +2421,12 @@ bool Aura::CallScriptEffectProcHandlers(AuraEffect const* aurEff, AuraApplicatio
(*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_EFFECT_PROC, aurApp);
std::list<AuraScript::EffectProcHandler>::iterator effEndItr = (*scritr)->OnEffectProc.end(), effItr = (*scritr)->OnEffectProc.begin();
for (; effItr != effEndItr; ++effItr)
- {
- if ((*effItr).IsEffectAffected(m_spellInfo, aurEff->GetEffIndex()))
- (*effItr).Call(*scritr, aurEff, eventInfo);
- }
+ if (effItr->IsEffectAffected(m_spellInfo, aurEff->GetEffIndex()))
+ effItr->Call(*scritr, aurEff, eventInfo);
+
if (!preventDefault)
preventDefault = (*scritr)->_IsDefaultActionPrevented();
+
(*scritr)->_FinishScriptCall();
}
return preventDefault;
@@ -2436,10 +2439,9 @@ void Aura::CallScriptAfterEffectProcHandlers(AuraEffect const* aurEff, AuraAppli
(*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_EFFECT_AFTER_PROC, aurApp);
std::list<AuraScript::EffectProcHandler>::iterator effEndItr = (*scritr)->AfterEffectProc.end(), effItr = (*scritr)->AfterEffectProc.begin();
for (; effItr != effEndItr; ++effItr)
- {
- if ((*effItr).IsEffectAffected(m_spellInfo, aurEff->GetEffIndex()))
- (*effItr).Call(*scritr, aurEff, eventInfo);
- }
+ if (effItr->IsEffectAffected(m_spellInfo, aurEff->GetEffIndex()))
+ effItr->Call(*scritr, aurEff, eventInfo);
+
(*scritr)->_FinishScriptCall();
}
}