Core/Spells: Allow ProcessEvent hook to run in EffectSendEvent when spell caster is a player

This commit is contained in:
Shauren
2011-09-30 18:41:30 +02:00
parent cde2427cab
commit 5d37116ea6

View File

@@ -62,6 +62,7 @@
#include "ScriptMgr.h"
#include "GameObjectAI.h"
#include "AccountMgr.h"
#include "InstanceScript.h"
pEffect SpellEffects[TOTAL_SPELL_EFFECTS]=
{
@@ -2141,7 +2142,7 @@ void Spell::EffectSendEvent(SpellEffIndex effIndex)
&& effectHandleMode != SPELL_EFFECT_HANDLE_HIT)
return;
Object* target = NULL;
WorldObject* target = NULL;
// call events for target if present
if (effectHandleMode == SPELL_EFFECT_HANDLE_HIT_TARGET)
@@ -2162,7 +2163,9 @@ void Spell::EffectSendEvent(SpellEffIndex effIndex)
sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "Spell ScriptStart %u for spellid %u in EffectSendEvent ", m_spellInfo->Effects[effIndex].MiscValue, m_spellInfo->Id);
if (ZoneScript* zoneScript = m_caster->GetZoneScript())
zoneScript->ProcessEvent(unitTarget, m_spellInfo->Effects[effIndex].MiscValue);
zoneScript->ProcessEvent(target, m_spellInfo->Effects[effIndex].MiscValue);
else if (InstanceScript* instanceScript = m_caster->GetInstanceScript()) // needed in case Player is the caster
instanceScript->ProcessEvent(target, m_spellInfo->Effects[effIndex].MiscValue);
m_caster->GetMap()->ScriptsStart(sEventScripts, m_spellInfo->Effects[effIndex].MiscValue, m_caster, target);
}