diff --git a/data/sql/updates/pending_db_world/rev_1659884404778685600.sql b/data/sql/updates/pending_db_world/rev_1659884404778685600.sql new file mode 100644 index 000000000..3e21fa88f --- /dev/null +++ b/data/sql/updates/pending_db_world/rev_1659884404778685600.sql @@ -0,0 +1,2 @@ +-- +UPDATE `creature_template` SET `ScriptName`='npc_hivezara_stinger' WHERE `entry`=15327; diff --git a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/ruins_of_ahnqiraj.cpp b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/ruins_of_ahnqiraj.cpp new file mode 100644 index 000000000..5675b922a --- /dev/null +++ b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/ruins_of_ahnqiraj.cpp @@ -0,0 +1,86 @@ +/* + * This file is part of the AzerothCore Project. See AUTHORS file for Copyright information + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU Affero General Public License as published by the + * Free Software Foundation; either version 3 of the License, or (at your + * option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see . + */ + +#include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "ruins_of_ahnqiraj.h" +#include "TaskScheduler.h" + +enum Spells +{ + SPELL_HIVEZARA_CATALYST = 25187, + SPELL_STINGER_CHARGE_NORMAL = 25190, + SPELL_STINGER_CHARGE_BUFFED = 25191 +}; + +struct npc_hivezara_stinger : public ScriptedAI +{ + npc_hivezara_stinger(Creature* creature) : ScriptedAI(creature) + { + } + + void Reset() override + { + _scheduler.CancelAll(); + } + + void EnterCombat(Unit* who) override + { + DoCast(who ,who->HasAura(SPELL_HIVEZARA_CATALYST) ? SPELL_STINGER_CHARGE_BUFFED : SPELL_STINGER_CHARGE_NORMAL, true); + + _scheduler.Schedule(5s, [this](TaskContext context) + { + Unit* target = SelectTarget(SelectTargetMethod::Random, 1, [&](Unit* u) + { + return u && !u->IsPet() && u->IsWithinDist2d(me, 20.f) && u->HasAura(SPELL_HIVEZARA_CATALYST); + }); + if (!target) + { + target = SelectTarget(SelectTargetMethod::Random, 1, [&](Unit* u) + { + return u && !u->IsPet() && u->IsWithinDist2d(me, 20.f); + }); + } + + if (target) + { + DoCast(target, target->HasAura(SPELL_HIVEZARA_CATALYST) ? SPELL_STINGER_CHARGE_BUFFED : SPELL_STINGER_CHARGE_NORMAL, true); + } + + context.Repeat(4500ms, 6500ms); + }); + } + + void UpdateAI(uint32 diff) override + { + if (!UpdateVictim()) + { + return; + } + + _scheduler.Update(diff, + std::bind(&ScriptedAI::DoMeleeAttackIfReady, this)); + } + +private: + TaskScheduler _scheduler; +}; + +void AddSC_ruins_of_ahnqiraj() +{ + RegisterRuinsOfAhnQirajCreatureAI(npc_hivezara_stinger); +} diff --git a/src/server/scripts/Kalimdor/kalimdor_script_loader.cpp b/src/server/scripts/Kalimdor/kalimdor_script_loader.cpp index c3391cbdd..e628322e3 100644 --- a/src/server/scripts/Kalimdor/kalimdor_script_loader.cpp +++ b/src/server/scripts/Kalimdor/kalimdor_script_loader.cpp @@ -57,6 +57,7 @@ void AddSC_boss_moam(); void AddSC_boss_buru(); void AddSC_boss_ayamiss(); void AddSC_boss_ossirian(); +void AddSC_ruins_of_ahnqiraj(); void AddSC_instance_ruins_of_ahnqiraj(); void AddSC_boss_cthun(); //Temple of ahn'qiraj void AddSC_boss_viscidus(); @@ -139,6 +140,7 @@ void AddKalimdorScripts() AddSC_boss_buru(); AddSC_boss_ayamiss(); AddSC_boss_ossirian(); + AddSC_ruins_of_ahnqiraj(); AddSC_instance_ruins_of_ahnqiraj(); AddSC_boss_cthun(); //Temple of ahn'qiraj AddSC_boss_viscidus();