Core/Spells: Allow ProcessEvent hook to run in EffectSendEvent when spell caster is a player
This commit is contained in:
@@ -62,6 +62,7 @@
|
|||||||
#include "ScriptMgr.h"
|
#include "ScriptMgr.h"
|
||||||
#include "GameObjectAI.h"
|
#include "GameObjectAI.h"
|
||||||
#include "AccountMgr.h"
|
#include "AccountMgr.h"
|
||||||
|
#include "InstanceScript.h"
|
||||||
|
|
||||||
pEffect SpellEffects[TOTAL_SPELL_EFFECTS]=
|
pEffect SpellEffects[TOTAL_SPELL_EFFECTS]=
|
||||||
{
|
{
|
||||||
@@ -2141,7 +2142,7 @@ void Spell::EffectSendEvent(SpellEffIndex effIndex)
|
|||||||
&& effectHandleMode != SPELL_EFFECT_HANDLE_HIT)
|
&& effectHandleMode != SPELL_EFFECT_HANDLE_HIT)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Object* target = NULL;
|
WorldObject* target = NULL;
|
||||||
|
|
||||||
// call events for target if present
|
// call events for target if present
|
||||||
if (effectHandleMode == SPELL_EFFECT_HANDLE_HIT_TARGET)
|
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);
|
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())
|
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);
|
m_caster->GetMap()->ScriptsStart(sEventScripts, m_spellInfo->Effects[effIndex].MiscValue, m_caster, target);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user