Merge pull request #4821 from devilcoredev/fix_001

Core/AuraScript: Add OnDispel and AfterDispel hook to AuraScript
This commit is contained in:
QAston
2012-02-04 06:09:57 -08:00
7 changed files with 100 additions and 6 deletions
@@ -2085,6 +2085,30 @@ bool Aura::CallScriptCheckAreaTargetHandlers(Unit* target)
return true;
}
void Aura::CallScriptDispel(DispelInfo* dispelInfo)
{
for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end() ; ++scritr)
{
(*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);
(*scritr)->_FinishScriptCall();
}
}
void Aura::CallScriptAfterDispel(DispelInfo* dispelInfo)
{
for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end() ; ++scritr)
{
(*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);
(*scritr)->_FinishScriptCall();
}
}
bool Aura::CallScriptEffectApplyHandlers(AuraEffect const* aurEff, AuraApplication const* aurApp, AuraEffectHandleModes mode)
{
bool preventDefault = false;
@@ -201,6 +201,8 @@ class Aura
// AuraScript
void LoadScripts();
bool CallScriptCheckAreaTargetHandlers(Unit* target);
void CallScriptDispel(DispelInfo* dispelInfo);
void CallScriptAfterDispel(DispelInfo* dispelInfo);
bool CallScriptEffectApplyHandlers(AuraEffect const* aurEff, AuraApplication const* aurApp, AuraEffectHandleModes mode);
bool CallScriptEffectRemoveHandlers(AuraEffect const* aurEff, AuraApplication const* aurApp, AuraEffectHandleModes mode);
void CallScriptAfterEffectApplyHandlers(AuraEffect const* aurEff, AuraApplication const* aurApp, AuraEffectHandleModes mode);