From 73fdcfe83f83115cc77b60f3d9302aa23234667b Mon Sep 17 00:00:00 2001 From: Rochet2 Date: Sat, 17 Jun 2017 00:32:15 +0300 Subject: [PATCH] Remove AttackedBy hook. Use CREATURE_EVENT_ON_DAMAGE_TAKEN instead - for more read https://github.com/TrinityCore/TrinityCore/commit/1660bb7d27d6f42b49012a6b57e3c2b2eab20fd3 (TC removed it) --- CreatureHooks.cpp | 9 --------- ElunaCreatureAI.h | 7 ------- Hooks.h | 2 +- LuaEngine.h | 1 - 4 files changed, 1 insertion(+), 18 deletions(-) diff --git a/CreatureHooks.cpp b/CreatureHooks.cpp index b2bd2e8..7bc74c4 100644 --- a/CreatureHooks.cpp +++ b/CreatureHooks.cpp @@ -208,15 +208,6 @@ bool Eluna::EnterEvadeMode(Creature* me) return CallAllFunctionsBool(CreatureEventBindings, CreatureUniqueBindings, entry_key, unique_key); } -// Called when the creature is target of hostile action: swing, hostile spell landed, fear/etc) -bool Eluna::AttackedBy(Creature* me, Unit* attacker) -{ - START_HOOK_WITH_RETVAL(CREATURE_EVENT_ON_ATTACKED_AT, me, false); - Push(me); - Push(attacker); - return CallAllFunctionsBool(CreatureEventBindings, CreatureUniqueBindings, entry_key, unique_key); -} - // Called when creature is spawned or respawned (for reseting variables) bool Eluna::JustRespawned(Creature* me) { diff --git a/ElunaCreatureAI.h b/ElunaCreatureAI.h index 4d4ac61..0c1f66a 100644 --- a/ElunaCreatureAI.h +++ b/ElunaCreatureAI.h @@ -140,13 +140,6 @@ struct ElunaCreatureAI : ScriptedAI } #endif - // Called when the creature is target of hostile action: swing, hostile spell landed, fear/etc) - void AttackedBy(Unit* attacker) override - { - if (!sEluna->AttackedBy(me, attacker)) - ScriptedAI::AttackedBy(attacker); - } - // Called when creature is spawned or respawned (for reseting variables) void JustRespawned() override { diff --git a/Hooks.h b/Hooks.h index 7c82929..4791db3 100644 --- a/Hooks.h +++ b/Hooks.h @@ -260,7 +260,7 @@ namespace Hooks CREATURE_EVENT_ON_RECEIVE_EMOTE = 8, // (event, creature, player, emoteid) - Can return true to stop normal action CREATURE_EVENT_ON_DAMAGE_TAKEN = 9, // (event, creature, attacker, damage) - Can return new damage CREATURE_EVENT_ON_PRE_COMBAT = 10, // (event, creature, target) - Can return true to stop normal action - CREATURE_EVENT_ON_ATTACKED_AT = 11, // (event, creature, attacker) - Can return true to stop normal action + // UNUSED CREATURE_EVENT_ON_OWNER_ATTACKED = 12, // (event, creature, target) - Can return true to stop normal action // Not on mangos CREATURE_EVENT_ON_OWNER_ATTACKED_AT = 13, // (event, creature, attacker) - Can return true to stop normal action // Not on mangos CREATURE_EVENT_ON_HIT_BY_SPELL = 14, // (event, creature, caster, spellid) - Can return true to stop normal action diff --git a/LuaEngine.h b/LuaEngine.h index 29424b5..6a84648 100644 --- a/LuaEngine.h +++ b/LuaEngine.h @@ -377,7 +377,6 @@ public: bool MovementInform(Creature* me, uint32 type, uint32 id); bool AttackStart(Creature* me, Unit* target); bool EnterEvadeMode(Creature* me); - bool AttackedBy(Creature* me, Unit* attacker); bool JustRespawned(Creature* me); bool JustReachedHome(Creature* me); bool ReceiveEmote(Creature* me, Player* player, uint32 emoteId);