From 0f0beb01488aad0cc33a83afa9c43a906866db3a Mon Sep 17 00:00:00 2001 From: UltraNix <80540499+UltraNix@users.noreply.github.com> Date: Sat, 27 Aug 2022 14:44:52 +0200 Subject: [PATCH] fix(Scripts/TempleOfAhnQiraj): Aggro Drones. (#12737) * fix(Scripts/Temple of AhnQiraj): Aggro Drones. Fixes #12716 * fix build Co-authored-by: Angelo Venturini --- .../rev_1660487789222263800.sql | 4 +++ .../TempleOfAhnQiraj/temple_of_ahnqiraj.cpp | 34 +++++++++++++++++++ 2 files changed, 38 insertions(+) create mode 100644 data/sql/updates/pending_db_world/rev_1660487789222263800.sql diff --git a/data/sql/updates/pending_db_world/rev_1660487789222263800.sql b/data/sql/updates/pending_db_world/rev_1660487789222263800.sql new file mode 100644 index 000000000..1804a5187 --- /dev/null +++ b/data/sql/updates/pending_db_world/rev_1660487789222263800.sql @@ -0,0 +1,4 @@ +-- +DELETE FROM `spell_script_names` WHERE `spell_id`=25153; +INSERT INTO `spell_script_names` VALUES +(25153,'spell_aggro_drones'); diff --git a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/temple_of_ahnqiraj.cpp b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/temple_of_ahnqiraj.cpp index 9b319ed4c..925a943c7 100644 --- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/temple_of_ahnqiraj.cpp +++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/temple_of_ahnqiraj.cpp @@ -17,6 +17,7 @@ #include "ScriptMgr.h" #include "ScriptedCreature.h" +#include "SpellScript.h" #include "temple_of_ahnqiraj.h" #include "TaskScheduler.h" @@ -150,7 +151,40 @@ private: bool _enraged; }; +enum NPCs +{ + NPC_VEKNISS_DRONE = 15300 +}; + +class spell_aggro_drones : public SpellScript +{ + PrepareSpellScript(spell_aggro_drones); + + void HandleDummy(SpellEffIndex /*effIndex*/) + { + if (Unit* caster = GetCaster()) + { + if (Creature* target = GetHitCreature()) + { + if (target->GetEntry() == NPC_VEKNISS_DRONE) + { + if (Unit* victim = caster->GetVictim()) + { + target->AI()->AttackStart(victim); + } + } + } + } + } + + void Register() override + { + OnEffectHitTarget += SpellEffectFn(spell_aggro_drones::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + } +}; + void AddSC_temple_of_ahnqiraj() { RegisterTempleOfAhnQirajCreatureAI(npc_anubisath_defender); + RegisterSpellScript(spell_aggro_drones); }