From f38591565f277f1f60b6389803919065809678fa Mon Sep 17 00:00:00 2001 From: Patman64 Date: Tue, 6 Jan 2015 20:03:00 -0500 Subject: [PATCH] Move On_Reset calls in HookMgr. On_Reset should be called whether or not the hooks that call it have events. --- HookMgr.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/HookMgr.cpp b/HookMgr.cpp index b6ce2f2..70272b7 100644 --- a/HookMgr.cpp +++ b/HookMgr.cpp @@ -1915,10 +1915,11 @@ bool Eluna::DamageTaken(Creature* me, Unit* attacker, uint32& damage) //Called at creature death bool Eluna::JustDied(Creature* me, Unit* killer) { + On_Reset(me); + if (!CreatureEventBindings->HasEvents(CREATURE_EVENT_ON_DIED, me->GetEntry())) return false; - On_Reset(me); LOCK_ELUNA; Push(me); Push(killer); @@ -1989,10 +1990,11 @@ bool Eluna::AttackStart(Creature* me, Unit* target) // Called for reaction at stopping attack at no attackers or targets bool Eluna::EnterEvadeMode(Creature* me) { + On_Reset(me); + if (!CreatureEventBindings->HasEvents(CREATURE_EVENT_ON_LEAVE_COMBAT, me->GetEntry())) return false; - On_Reset(me); LOCK_ELUNA; Push(me); return CallAllFunctionsBool(CreatureEventBindings, CREATURE_EVENT_ON_LEAVE_COMBAT, me->GetEntry()); @@ -2013,10 +2015,11 @@ bool Eluna::AttackedBy(Creature* me, Unit* attacker) // Called when creature is spawned or respawned (for reseting variables) bool Eluna::JustRespawned(Creature* me) { + On_Reset(me); + if (!CreatureEventBindings->HasEvents(CREATURE_EVENT_ON_SPAWN, me->GetEntry())) return false; - On_Reset(me); LOCK_ELUNA; Push(me); return CallAllFunctionsBool(CreatureEventBindings, CREATURE_EVENT_ON_SPAWN, me->GetEntry());