From 11eab9c3a68a3691597e9b1b5dbbf2654f358410 Mon Sep 17 00:00:00 2001 From: Dan <83884799+elthehablo@users.noreply.github.com> Date: Fri, 12 May 2023 13:20:31 +0200 Subject: [PATCH] fix(Scripts/TheSlavePens): port SAI from bosses to C++ (#16169) * fix * add sql 1 * add sql 2 * remove extra lines * remove dumb stuff keywords in "comment" were messing up the statement * same story todo: get better at SQL * better formatting + two sql statements together * remove old sql query * last fix * fixes to header enum * fix sql to have a more universal format * E e * final sql fix --- .../add_scriptnames_to_bosses.sql | 6 ++ .../SlavePens/boss_mennu_the_betrayer.cpp | 101 ++++++++++++++++++ .../SlavePens/boss_quagmirran.cpp | 73 +++++++++++++ .../SlavePens/boss_rokmar_the_crackler.cpp | 73 +++++++++++++ .../SlavePens/the_slave_pens.h | 13 ++- .../scripts/Outland/outland_script_loader.cpp | 10 +- 6 files changed, 270 insertions(+), 6 deletions(-) create mode 100644 data/sql/updates/pending_db_world/add_scriptnames_to_bosses.sql create mode 100644 src/server/scripts/Outland/CoilfangReservoir/SlavePens/boss_mennu_the_betrayer.cpp create mode 100644 src/server/scripts/Outland/CoilfangReservoir/SlavePens/boss_quagmirran.cpp create mode 100644 src/server/scripts/Outland/CoilfangReservoir/SlavePens/boss_rokmar_the_crackler.cpp diff --git a/data/sql/updates/pending_db_world/add_scriptnames_to_bosses.sql b/data/sql/updates/pending_db_world/add_scriptnames_to_bosses.sql new file mode 100644 index 000000000..5f7b4fbab --- /dev/null +++ b/data/sql/updates/pending_db_world/add_scriptnames_to_bosses.sql @@ -0,0 +1,6 @@ +-- +UPDATE `creature_template` SET `ScriptName` = 'boss_mennu_the_betrayer', `AIName` = '' WHERE `entry` = 17941; +UPDATE `creature_template` SET `ScriptName` = 'boss_quagmirran', `AIName` = '' WHERE `entry` = 17942; +UPDATE `creature_template` SET `ScriptName` = 'boss_rokmar_the_crackler', `AIName` = '' WHERE `entry` = 17991; + +DELETE FROM `smart_scripts` WHERE `entryorguid` IN (17941, 17942, 17991) AND `source_type` = 0; diff --git a/src/server/scripts/Outland/CoilfangReservoir/SlavePens/boss_mennu_the_betrayer.cpp b/src/server/scripts/Outland/CoilfangReservoir/SlavePens/boss_mennu_the_betrayer.cpp new file mode 100644 index 000000000..42b3d63e4 --- /dev/null +++ b/src/server/scripts/Outland/CoilfangReservoir/SlavePens/boss_mennu_the_betrayer.cpp @@ -0,0 +1,101 @@ +/* + * 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 "the_slave_pens.h" + +enum Spells +{ + SPELL_LIGHTNING_BOLT = 35010, + SPELL_HEALING_WARD = 34980, + SPELL_EARTHGRAB_TOTEM = 31981, + SPELL_STONESKIN_TOTEM = 31985, + SPELL_NOVA_TOTEM = 31991 +}; + +enum Text +{ + SAY_AGGRO = 1, + SAY_KILL = 2, + SAY_JUST_DIED = 3 +}; + +struct boss_mennu_the_betrayer : public BossAI +{ + boss_mennu_the_betrayer(Creature* creature) : BossAI(creature, DATA_MENNU_THE_BETRAYER) + { + scheduler.SetValidator([this] + { + return !me->HasUnitState(UNIT_STATE_CASTING); + }); + } + + void Reset() override + { + _Reset(); + + ScheduleHealthCheckEvent(60, [&] { + DoCastSelf(SPELL_HEALING_WARD); + }); + } + + void JustSummoned(Creature* summon) override + { + summon->GetMotionMaster()->Clear(); + } + + void JustEngagedWith(Unit* /*who*/) override + { + _JustEngagedWith(); + Talk(SAY_AGGRO); + + scheduler.Schedule(5s, 8s, [this](TaskContext context) + { + DoCastVictim(SPELL_LIGHTNING_BOLT); + context.Repeat(7s, 10s); + }).Schedule(20s, [this](TaskContext context) + { + DoCastSelf(SPELL_NOVA_TOTEM); + context.Repeat(26s); + }).Schedule(19200ms, [this](TaskContext context) + { + DoCastSelf(SPELL_EARTHGRAB_TOTEM); + context.Repeat(26s); + }).Schedule(18s, [this](TaskContext context) + { + DoCastSelf(SPELL_STONESKIN_TOTEM); + context.Repeat(26s); + }); + } + + void JustDied(Unit* /*killer*/) override + { + _JustDied(); + Talk(SAY_JUST_DIED); + } + + void KilledUnit(Unit* /*victim*/) override + { + Talk(SAY_KILL); + } +}; + +void AddSC_boss_mennu_the_betrayer() +{ + RegisterTheSlavePensCreatureAI(boss_mennu_the_betrayer); +} diff --git a/src/server/scripts/Outland/CoilfangReservoir/SlavePens/boss_quagmirran.cpp b/src/server/scripts/Outland/CoilfangReservoir/SlavePens/boss_quagmirran.cpp new file mode 100644 index 000000000..105b17616 --- /dev/null +++ b/src/server/scripts/Outland/CoilfangReservoir/SlavePens/boss_quagmirran.cpp @@ -0,0 +1,73 @@ +/* + * 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 "the_slave_pens.h" + +enum Spells +{ + SPELL_ACID_SPRAY = 38153, + SPELL_CLEAVE = 40504, + SPELL_POISON_BOLT_VOLLEY_N = 34780, + SPELL_POISON_BOLT_VOLLEY_H = 39340, + SPELL_UPPERCUT = 32055 +}; + +struct boss_quagmirran : public BossAI +{ + boss_quagmirran(Creature* creature) : BossAI(creature, DATA_QUAGMIRRAN) + { + scheduler.SetValidator([this] + { + return !me->HasUnitState(UNIT_STATE_CASTING); + }); + } + + void Reset() override + { + _Reset(); + } + + void JustEngagedWith(Unit* /*who*/) override + { + _JustEngagedWith(); + + scheduler.Schedule(9100ms, [this](TaskContext context) + { + DoCastVictim(SPELL_CLEAVE); + context.Repeat(18800ms, 24800ms); + }).Schedule(20300ms, [this](TaskContext context) + { + DoCastVictim(SPELL_UPPERCUT); + context.Repeat(21800ms); + }).Schedule(25200ms, [this](TaskContext context) + { + DoCastVictim(SPELL_ACID_SPRAY); + context.Repeat(25s); + }).Schedule(31800ms, [this](TaskContext context) + { + DoCastSelf(DUNGEON_MODE(SPELL_POISON_BOLT_VOLLEY_N, SPELL_POISON_BOLT_VOLLEY_H)); + context.Repeat(24400ms); + }); + } +}; + +void AddSC_boss_quagmirran() +{ + RegisterTheSlavePensCreatureAI(boss_quagmirran); +} \ No newline at end of file diff --git a/src/server/scripts/Outland/CoilfangReservoir/SlavePens/boss_rokmar_the_crackler.cpp b/src/server/scripts/Outland/CoilfangReservoir/SlavePens/boss_rokmar_the_crackler.cpp new file mode 100644 index 000000000..04253f8d4 --- /dev/null +++ b/src/server/scripts/Outland/CoilfangReservoir/SlavePens/boss_rokmar_the_crackler.cpp @@ -0,0 +1,73 @@ +/* + * 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 "the_slave_pens.h" + +enum Spells +{ + SPELL_ENSNARING_MOSS = 31948, + SPELL_FRENZY = 34970, + SPELL_GRIEVOUS_WOUND_N = 31956, + SPELL_GRIEVOUS_WOUND_H = 38801, + SPELL_WATER_SPIT = 35008 +}; + +struct boss_rokmar_the_crackler : public BossAI +{ + boss_rokmar_the_crackler(Creature* creature) : BossAI(creature, DATA_ROKMAR_THE_CRACKLER) + { + scheduler.SetValidator([this] + { + return !me->HasUnitState(UNIT_STATE_CASTING); + }); + } + + void Reset() override + { + _Reset(); + + ScheduleHealthCheckEvent(20, [&] { + DoCastSelf(SPELL_FRENZY); + }); + } + + void JustEngagedWith(Unit* /*who*/) override + { + _JustEngagedWith(); + + scheduler.Schedule(8s, [this] (TaskContext context) + { + DoCastVictim(DUNGEON_MODE(SPELL_GRIEVOUS_WOUND_N, SPELL_GRIEVOUS_WOUND_H)); + context.Repeat(20700ms); + }).Schedule(15300ms, [this](TaskContext context) + { + DoCastRandomTarget(SPELL_ENSNARING_MOSS); + context.Repeat(26s); + }).Schedule(10700ms, [this](TaskContext context) + { + DoCastSelf(SPELL_WATER_SPIT); + context.Repeat(19s); + }); + } +}; + +void AddSC_boss_rokmar_the_crackler() +{ + RegisterTheSlavePensCreatureAI(boss_rokmar_the_crackler); +} diff --git a/src/server/scripts/Outland/CoilfangReservoir/SlavePens/the_slave_pens.h b/src/server/scripts/Outland/CoilfangReservoir/SlavePens/the_slave_pens.h index e467bcbc0..d54aa1c72 100644 --- a/src/server/scripts/Outland/CoilfangReservoir/SlavePens/the_slave_pens.h +++ b/src/server/scripts/Outland/CoilfangReservoir/SlavePens/the_slave_pens.h @@ -27,10 +27,11 @@ uint32 const EncounterCount = 3; enum SPDataTypes { - DATA_MENNU_THE_BETRAYER = 1, - DATA_ROKMAR_THE_CRACKLER = 2, - DATA_QUAGMIRRAN = 3, - DATA_AHUNE = 4, + DATA_MENNU_THE_BETRAYER = 0, + DATA_ROKMAR_THE_CRACKLER = 1, + DATA_QUAGMIRRAN = 2, + DATA_AHUNE = 3, + MAX_ENCOUNTER = 4, DATA_AHUNE_BUNNY = 5, DATA_FROZEN_CORE = 6, DATA_FLAMECALLER_000 = 7, @@ -65,6 +66,8 @@ enum SPCreaturesIds NPC_SHAMAN_BEAM_BUNNY_002 = 25966, NPC_WHISP_DEST_BUNNY = 26120, NPC_WHISP_SOURCE_BUNNY = 26121, + NPC_MENNU_THE_BETRAYER = 17941, + NPC_ROKMAR_THE_CRACKLER = 17991, NPC_QUAGMIRRAN = 17942 }; @@ -80,4 +83,6 @@ inline AI* GetTheSlavePensAI(T* obj) return GetInstanceAI(obj, SPScriptName); } +#define RegisterTheSlavePensCreatureAI(ai_name) RegisterCreatureAIWithFactory (ai_name, GetTheSlavePensAI) + #endif // SLAVE_PENS_H diff --git a/src/server/scripts/Outland/outland_script_loader.cpp b/src/server/scripts/Outland/outland_script_loader.cpp index 272a0c317..aa72e7127 100644 --- a/src/server/scripts/Outland/outland_script_loader.cpp +++ b/src/server/scripts/Outland/outland_script_loader.cpp @@ -58,6 +58,9 @@ void AddSC_boss_the_black_stalker(); void AddSC_instance_the_underbog(); void AddSC_the_slave_pens(); // The Slave Pens void AddSC_boss_ahune(); +void AddSC_boss_mennu_the_betrayer(); +void AddSC_boss_rokmar_the_crackler(); +void AddSC_boss_quagmirran(); void AddSC_instance_the_slave_pens(); void AddSC_boss_gruul(); //Gruul's Lair void AddSC_boss_high_king_maulgar(); @@ -154,8 +157,11 @@ void AddOutlandScripts() AddSC_boss_ghazan(); AddSC_boss_the_black_stalker(); AddSC_instance_the_underbog(); - AddSC_the_slave_pens(); // The Slave Pens + AddSC_the_slave_pens(); //CR The Slave Pens AddSC_boss_ahune(); + AddSC_boss_mennu_the_betrayer(); + AddSC_boss_rokmar_the_crackler(); + AddSC_boss_quagmirran(); AddSC_instance_the_slave_pens(); AddSC_boss_gruul(); //Gruul's Lair AddSC_boss_high_king_maulgar(); @@ -207,4 +213,4 @@ void AddOutlandScripts() AddSC_shattrath_city(); AddSC_terokkar_forest(); //AddSC_zangarmarsh(); -} +} \ No newline at end of file