From 2d9aeacfd7301dc8ed99bacc998bac52d4208888 Mon Sep 17 00:00:00 2001 From: Girip Dragos Andrei Date: Sat, 17 Jun 2017 08:44:27 +0000 Subject: [PATCH] Wailing Caverns --- .../4.3.4/9999_99_99_99_wailing_caverns.sql | 27 ++++ .../Kalimdor/WailingCaverns/boss_kresh.cpp | 85 +++++++++++ .../WailingCaverns/boss_lady_anacondra.cpp | 132 ++++++++++++++++++ .../WailingCaverns/boss_lord_cobrahn.cpp | 120 ++++++++++++++++ .../WailingCaverns/boss_lord_pythas.cpp | 116 +++++++++++++++ .../WailingCaverns/boss_lord_serpentis.cpp | 109 +++++++++++++++ .../Kalimdor/WailingCaverns/boss_skum.cpp | 88 ++++++++++++ .../boss_verdan_the_everliving.cpp | 88 ++++++++++++ .../instance_wailing_caverns.cpp | 117 ++++++---------- .../WailingCaverns/wailing_caverns.cpp | 81 +++++------ .../Kalimdor/WailingCaverns/wailing_caverns.h | 61 ++++++-- .../Kalimdor/kalimdor_script_loader.cpp | 14 ++ 12 files changed, 904 insertions(+), 134 deletions(-) create mode 100644 sql/updates/world/4.3.4/9999_99_99_99_wailing_caverns.sql create mode 100644 src/server/scripts/Kalimdor/WailingCaverns/boss_kresh.cpp create mode 100644 src/server/scripts/Kalimdor/WailingCaverns/boss_lady_anacondra.cpp create mode 100644 src/server/scripts/Kalimdor/WailingCaverns/boss_lord_cobrahn.cpp create mode 100644 src/server/scripts/Kalimdor/WailingCaverns/boss_lord_pythas.cpp create mode 100644 src/server/scripts/Kalimdor/WailingCaverns/boss_lord_serpentis.cpp create mode 100644 src/server/scripts/Kalimdor/WailingCaverns/boss_skum.cpp create mode 100644 src/server/scripts/Kalimdor/WailingCaverns/boss_verdan_the_everliving.cpp diff --git a/sql/updates/world/4.3.4/9999_99_99_99_wailing_caverns.sql b/sql/updates/world/4.3.4/9999_99_99_99_wailing_caverns.sql new file mode 100644 index 00000000000..10dae590138 --- /dev/null +++ b/sql/updates/world/4.3.4/9999_99_99_99_wailing_caverns.sql @@ -0,0 +1,27 @@ +-- Lady Anacondra +DELETE FROM `smart_scripts` WHERE `entryorguid` = 3671; +UPDATE `creature_template` SET `AIName` = '', `ScriptName` = 'boss_lady_anacondra' WHERE `entry` = 3671; + +-- Kresh +DELETE FROM `smart_scripts` WHERE `entryorguid` = 3653; +UPDATE `creature_template` SET `AIName` = '', `ScriptName` = 'boss_kresh' WHERE `entry` = 3653; + +-- Lord Pythas +DELETE FROM `smart_scripts` WHERE `entryorguid` = 3670; +UPDATE `creature_template` SET `AIName` = '', `ScriptName` = 'boss_lord_pythas' WHERE `entry` = 3670; + +-- Lord Cobrahn +DELETE FROM `smart_scripts` WHERE `entryorguid` = 3669; +UPDATE `creature_template` SET `AIName` = '', `ScriptName` = 'boss_lord_cobrahn' WHERE `entry` = 3669; + +-- Lord Serpentis +DELETE FROM `smart_scripts` WHERE `entryorguid` = 3673; +UPDATE `creature_template` SET `AIName` = '', `ScriptName` = 'boss_lord_serpentis' WHERE `entry` = 3673; + +-- Verdan the Everliving +DELETE FROM `smart_scripts` WHERE `entryorguid` = 5775; +UPDATE `creature_template` SET `AIName` = '', `ScriptName` = 'boss_verdan_the_everliving' WHERE `entry` = 5775; + +-- Skum +DELETE FROM `smart_scripts` WHERE `entryorguid` = 3674; +UPDATE `creature_template` SET `AIName` = '', `ScriptName` ='boss_skum' WHERE `entry` = 3674; \ No newline at end of file diff --git a/src/server/scripts/Kalimdor/WailingCaverns/boss_kresh.cpp b/src/server/scripts/Kalimdor/WailingCaverns/boss_kresh.cpp new file mode 100644 index 00000000000..4de76e6e097 --- /dev/null +++ b/src/server/scripts/Kalimdor/WailingCaverns/boss_kresh.cpp @@ -0,0 +1,85 @@ +/* + * Copyright (C) 2008-2017 TrinityCore + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 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 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 "ScriptedCreature.h" +#include "ScriptMgr.h" +#include "wailing_caverns.h" + +enum Spells +{ + SPELL_CRUSHING_BITE = 80362 +}; + +enum Events +{ + EVENT_CRUSHING_BITE = 1 +}; + +class boss_kresh : public CreatureScript +{ +public: + boss_kresh() : CreatureScript("boss_kresh") { } + + struct boss_kreshAI : public BossAI + { + boss_kreshAI(Creature* creature) : BossAI(creature, DATA_KRESH) { } + + void EnterCombat(Unit* /*who*/) override + { + _EnterCombat(); + + events.ScheduleEvent(EVENT_CRUSHING_BITE, Seconds(6)); + } + + void UpdateAI(uint32 diff) override + { + if (!UpdateVictim()) + return; + + events.Update(diff); + + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; + + while (uint32 eventId = events.ExecuteEvent()) + { + switch (eventId) + { + case EVENT_CRUSHING_BITE: + DoCastVictim(SPELL_CRUSHING_BITE); + events.Repeat(Seconds(16)); + break; + default: + break; + } + } + + DoMeleeAttackIfReady(); + } + }; + + CreatureAI* GetAI(Creature* creature) const override + { + return GetWailingCavernsAI(creature); + } +}; + + +void AddSC_boss_kresh() +{ + new boss_kresh(); +} diff --git a/src/server/scripts/Kalimdor/WailingCaverns/boss_lady_anacondra.cpp b/src/server/scripts/Kalimdor/WailingCaverns/boss_lady_anacondra.cpp new file mode 100644 index 00000000000..f71fd951202 --- /dev/null +++ b/src/server/scripts/Kalimdor/WailingCaverns/boss_lady_anacondra.cpp @@ -0,0 +1,132 @@ +/* + * Copyright (C) 2008-2017 TrinityCore + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 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 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 "ScriptedCreature.h" +#include "ScriptMgr.h" +#include "wailing_caverns.h" + +enum Texts +{ + SAY_AGGRO = 0 +}; + +enum Spells +{ + SPELL_NATURE_CHANNELING = 13236, + SPELL_LIGHTNING_BOLT = 20295, + SPELL_DRUID_SLUMBER = 8040, + SPELL_THORNS_AURA = 8148, + SPELL_HEALING_TOUCH = 23381 +}; + +enum Events +{ + EVENT_LIGHTNING_BOLT = 1, + EVENT_DRUID_SLUMBER = 2, + EVENT_THORNS_AURA = 3, + EVENT_HEALING_TOUCH = 4 +}; + +class boss_lady_anacondra : public CreatureScript +{ +public: + boss_lady_anacondra() : CreatureScript("boss_lady_anacondra") { } + + struct boss_lady_anacondraAI : public BossAI + { + boss_lady_anacondraAI(Creature* creature) : BossAI(creature, DATA_LADY_ANACONDRA) { } + + void InitializeAI() override + { + BossAI::InitializeAI(); + me->SetStandState(UNIT_STAND_STATE_KNEEL); + DoCastSelf(SPELL_NATURE_CHANNELING); + } + + void JustReachedHome() override + { + BossAI::JustReachedHome(); + me->SetStandState(UNIT_STAND_STATE_KNEEL); + DoCastSelf(SPELL_NATURE_CHANNELING); + } + + void EnterCombat(Unit* /*who*/) override + { + _EnterCombat(); + Talk(SAY_AGGRO); + + me->RemoveAurasDueToSpell(SPELL_NATURE_CHANNELING); + me->SetStandState(UNIT_STAND_STATE_STAND); + + events.ScheduleEvent(EVENT_LIGHTNING_BOLT, Seconds(1)); + events.ScheduleEvent(EVENT_DRUID_SLUMBER, Seconds(8)); + events.ScheduleEvent(EVENT_THORNS_AURA, Seconds(15)); + events.ScheduleEvent(EVENT_HEALING_TOUCH, Seconds(49)); + } + + void UpdateAI(uint32 diff) override + { + if (!UpdateVictim()) + return; + + events.Update(diff); + + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; + + while (uint32 eventId = events.ExecuteEvent()) + { + switch (eventId) + { + case EVENT_LIGHTNING_BOLT: + DoCastVictim(SPELL_LIGHTNING_BOLT); + events.Repeat(Seconds(4)); + break; + case EVENT_DRUID_SLUMBER: + if(Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100.0f, true)) + DoCast(target, SPELL_DRUID_SLUMBER); + events.Repeat(Seconds(12)); + break; + case EVENT_THORNS_AURA: + DoCastSelf(SPELL_THORNS_AURA); + break; + case EVENT_HEALING_TOUCH: + DoCastSelf(SPELL_HEALING_TOUCH); + break; + default: + break; + } + + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; + } + + DoMeleeAttackIfReady(); + } + }; + + CreatureAI* GetAI(Creature* creature) const override + { + return GetWailingCavernsAI(creature); + } +}; + + +void AddSC_boss_lady_anacondra() +{ + new boss_lady_anacondra(); +} diff --git a/src/server/scripts/Kalimdor/WailingCaverns/boss_lord_cobrahn.cpp b/src/server/scripts/Kalimdor/WailingCaverns/boss_lord_cobrahn.cpp new file mode 100644 index 00000000000..a24c8d99ae7 --- /dev/null +++ b/src/server/scripts/Kalimdor/WailingCaverns/boss_lord_cobrahn.cpp @@ -0,0 +1,120 @@ +/* + * Copyright (C) 2008-2017 TrinityCore + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 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 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 "ScriptedCreature.h" +#include "ScriptMgr.h" +#include "wailing_caverns.h" + +enum Texts +{ + SAY_AGGRO = 0 +}; + +enum Spells +{ + SPELL_LIGHTNING_BOLT = 20805, + SPELL_DRUID_SLUMBER = 8040, + SPELL_COBRAHN_SERPENT_FORM = 7965, + SPELL_POISON = 744 +}; + +enum Events +{ + EVENT_LIGHTNING_BOLT = 1, + EVENT_DRUID_SLUMBER = 2, + EVENT_COBRAHN_SERPENT_FORM = 3, + EVENT_POISON = 4 +}; + +enum Phases +{ + PHASE_NORMAL = 1, + PHASE_SERPENT_FORM = 2 +}; + +class boss_lord_cobrahn : public CreatureScript +{ +public: + boss_lord_cobrahn() : CreatureScript("boss_lord_cobrahn") { } + + struct boss_lord_cobrahnAI : public BossAI + { + boss_lord_cobrahnAI(Creature* creature) : BossAI(creature, DATA_LORD_COBRAHN) { } + + void EnterCombat(Unit* /*who*/) override + { + _EnterCombat(); + Talk(SAY_AGGRO); + events.SetPhase(PHASE_NORMAL); + events.ScheduleEvent(EVENT_LIGHTNING_BOLT, Seconds(1), 0, PHASE_NORMAL); + events.ScheduleEvent(EVENT_DRUID_SLUMBER, Seconds(20), 0, PHASE_NORMAL); + events.ScheduleEvent(EVENT_COBRAHN_SERPENT_FORM, Seconds(38), 0, PHASE_NORMAL); + } + + void UpdateAI(uint32 diff) override + { + if (!UpdateVictim()) + return; + + events.Update(diff); + + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; + + while (uint32 eventId = events.ExecuteEvent()) + { + switch (eventId) + { + case EVENT_LIGHTNING_BOLT: + DoCastVictim(SPELL_LIGHTNING_BOLT); + events.ScheduleEvent(EVENT_LIGHTNING_BOLT, Seconds(1), 0, PHASE_NORMAL); + break; + case EVENT_DRUID_SLUMBER: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100.0f, true)) + DoCast(target, SPELL_DRUID_SLUMBER); + break; + case EVENT_COBRAHN_SERPENT_FORM: + events.SetPhase(PHASE_SERPENT_FORM); + DoCastSelf(SPELL_COBRAHN_SERPENT_FORM); + events.ScheduleEvent(EVENT_POISON, Seconds(13), PHASE_SERPENT_FORM); + break; + case EVENT_POISON: + DoCastVictim(SPELL_POISON); + break; + default: + break; + } + + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; + } + + DoMeleeAttackIfReady(); + } + }; + + CreatureAI* GetAI(Creature* creature) const override + { + return GetWailingCavernsAI(creature); + } +}; + + +void AddSC_boss_lord_cobrahn() +{ + new boss_lord_cobrahn(); +} diff --git a/src/server/scripts/Kalimdor/WailingCaverns/boss_lord_pythas.cpp b/src/server/scripts/Kalimdor/WailingCaverns/boss_lord_pythas.cpp new file mode 100644 index 00000000000..7033944f902 --- /dev/null +++ b/src/server/scripts/Kalimdor/WailingCaverns/boss_lord_pythas.cpp @@ -0,0 +1,116 @@ +/* + * Copyright (C) 2008-2017 TrinityCore + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 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 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 "ScriptedCreature.h" +#include "ScriptMgr.h" +#include "wailing_caverns.h" + +enum Texts +{ + SAY_AGGRO = 0 +}; + +enum Spells +{ + SPELL_LIGHTNING_BOLT = 20805, + SPELL_HEALING_TOUCH = 11431, + SPELL_THUNDERCLAP = 8147, + SPELL_DRUID_SLUMBER = 8040, +}; + +enum Events +{ + EVENT_LIGHTNING_BOLT = 1, + EVENT_HEALING_TOUCH = 2, + EVENT_THUNDERCLAP = 3, + EVENT_DRUID_SLUMBER = 4 +}; + +class boss_lord_pythas : public CreatureScript +{ +public: + boss_lord_pythas() : CreatureScript("boss_lord_pythas") { } + + struct boss_lord_pythasAI : public BossAI + { + boss_lord_pythasAI(Creature* creature) : BossAI(creature, DATA_LORD_PYTHAS) { } + + void EnterCombat(Unit* /*who*/) override + { + Talk(SAY_AGGRO); + _EnterCombat(); + + events.ScheduleEvent(EVENT_LIGHTNING_BOLT, Seconds(3)); + events.ScheduleEvent(EVENT_THUNDERCLAP, Seconds(19)); + events.ScheduleEvent(EVENT_HEALING_TOUCH, Seconds(14)); + events.ScheduleEvent(EVENT_DRUID_SLUMBER, Seconds(35)); + } + + void UpdateAI(uint32 diff) override + { + if (!UpdateVictim()) + return; + + events.Update(diff); + + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; + + while (uint32 eventId = events.ExecuteEvent()) + { + switch (eventId) + { + case EVENT_LIGHTNING_BOLT: + DoCastVictim(SPELL_LIGHTNING_BOLT); + events.Repeat(Seconds(11)); + break; + case EVENT_THUNDERCLAP: + DoCastAOE(SPELL_THUNDERCLAP); + events.Repeat(Seconds(33)); + break; + case EVENT_HEALING_TOUCH: + DoCastSelf(SPELL_HEALING_TOUCH); + events.Repeat(Seconds(31)); + break; + case EVENT_DRUID_SLUMBER: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100.0f, true)) + DoCast(target, SPELL_DRUID_SLUMBER); + events.Repeat(Seconds(19)); + break; + default: + break; + } + + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; + } + + DoMeleeAttackIfReady(); + } + }; + + CreatureAI* GetAI(Creature* creature) const override + { + return GetWailingCavernsAI(creature); + } +}; + + +void AddSC_boss_lord_pythas() +{ + new boss_lord_pythas(); +} diff --git a/src/server/scripts/Kalimdor/WailingCaverns/boss_lord_serpentis.cpp b/src/server/scripts/Kalimdor/WailingCaverns/boss_lord_serpentis.cpp new file mode 100644 index 00000000000..22d93673b42 --- /dev/null +++ b/src/server/scripts/Kalimdor/WailingCaverns/boss_lord_serpentis.cpp @@ -0,0 +1,109 @@ +/* + * Copyright (C) 2008-2017 TrinityCore + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 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 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 "ScriptedCreature.h" +#include "ScriptMgr.h" +#include "wailing_caverns.h" + +enum Texts +{ + SAY_AGGRO = 0 +}; + +enum Spells +{ + SPELL_LIGHTNING_BOLT = 12167, + SPELL_DRUID_SLUMBER = 8040, + SPELL_HEALING_TOUCH = 23381 +}; + +enum Events +{ + EVENT_LIGHTNING_BOLT = 1, + EVENT_HEALING_TOUCH = 2, + EVENT_DRUID_SLUMBER = 3 +}; + +class boss_lord_serpentis : public CreatureScript +{ +public: + boss_lord_serpentis() : CreatureScript("boss_lord_serpentis") { } + + struct boss_lord_serpentisAI : public BossAI + { + boss_lord_serpentisAI(Creature* creature) : BossAI(creature, DATA_LORD_SERPENTIS) { } + + void EnterCombat(Unit* /*who*/) override + { + Talk(SAY_AGGRO); + _EnterCombat(); + + events.ScheduleEvent(EVENT_LIGHTNING_BOLT, Seconds(1)); + events.ScheduleEvent(EVENT_HEALING_TOUCH, Seconds(27)); + events.ScheduleEvent(EVENT_DRUID_SLUMBER, Seconds(7)); + } + + void UpdateAI(uint32 diff) override + { + if (!UpdateVictim()) + return; + + events.Update(diff); + + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; + + while (uint32 eventId = events.ExecuteEvent()) + { + switch (eventId) + { + case EVENT_LIGHTNING_BOLT: + DoCastVictim(SPELL_LIGHTNING_BOLT); + events.Repeat(Seconds(15)); + break; + case EVENT_HEALING_TOUCH: + DoCastSelf(SPELL_HEALING_TOUCH); + events.Repeat(Seconds(9)); + break; + case EVENT_DRUID_SLUMBER: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100.0f, true)) + DoCast(target, SPELL_DRUID_SLUMBER); + events.Repeat(Seconds(40)); + break; + default: + break; + } + + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; + } + + DoMeleeAttackIfReady(); + } + }; + + CreatureAI* GetAI(Creature* creature) const override + { + return GetWailingCavernsAI(creature); + } +}; + + +void AddSC_boss_lord_serpentis() +{ + new boss_lord_serpentis(); +} diff --git a/src/server/scripts/Kalimdor/WailingCaverns/boss_skum.cpp b/src/server/scripts/Kalimdor/WailingCaverns/boss_skum.cpp new file mode 100644 index 00000000000..443158bb59f --- /dev/null +++ b/src/server/scripts/Kalimdor/WailingCaverns/boss_skum.cpp @@ -0,0 +1,88 @@ +/* + * Copyright (C) 2008-2017 TrinityCore + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 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 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 "ScriptedCreature.h" +#include "ScriptMgr.h" +#include "wailing_caverns.h" + +enum Spells +{ + SPELL_CHAINED_BOLT = 6254 +}; + +enum Events +{ + EVENT_CHAINED_BOLT = 1 +}; + +class boss_skum : public CreatureScript +{ +public: + boss_skum() : CreatureScript("boss_skum") { } + + struct boss_skumAI : public BossAI + { + boss_skumAI(Creature* creature) : BossAI(creature, DATA_SKUM) { } + + void EnterCombat(Unit* /*who*/) override + { + _EnterCombat(); + + events.ScheduleEvent(EVENT_CHAINED_BOLT, Seconds(3), Seconds(4)); + } + + void UpdateAI(uint32 diff) override + { + if (!UpdateVictim()) + return; + + events.Update(diff); + + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; + + while (uint32 eventId = events.ExecuteEvent()) + { + switch (eventId) + { + case EVENT_CHAINED_BOLT: + DoCastVictim(SPELL_CHAINED_BOLT); + events.Repeat(randtime(Seconds(3), Seconds(4))); + break; + default: + break; + } + + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; + } + + DoMeleeAttackIfReady(); + } + }; + + CreatureAI* GetAI(Creature* creature) const override + { + return GetWailingCavernsAI(creature); + } +}; + + +void AddSC_boss_skum() +{ + new boss_skum(); +} diff --git a/src/server/scripts/Kalimdor/WailingCaverns/boss_verdan_the_everliving.cpp b/src/server/scripts/Kalimdor/WailingCaverns/boss_verdan_the_everliving.cpp new file mode 100644 index 00000000000..d92d7838bbf --- /dev/null +++ b/src/server/scripts/Kalimdor/WailingCaverns/boss_verdan_the_everliving.cpp @@ -0,0 +1,88 @@ +/* + * Copyright (C) 2008-2017 TrinityCore + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 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 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 "ScriptedCreature.h" +#include "ScriptMgr.h" +#include "wailing_caverns.h" + +enum Spells +{ + SPELL_GRASPING_VINES = 8142 +}; + +enum Events +{ + EVENT_GRASPING_VINES = 1 +}; + +class boss_verdan_the_everliving : public CreatureScript +{ +public: + boss_verdan_the_everliving() : CreatureScript("boss_verdan_the_everliving") { } + + struct boss_verdan_the_everlivingAI : public BossAI + { + boss_verdan_the_everlivingAI(Creature* creature) : BossAI(creature, DATA_VERDAN_THE_EVERLIVING) { } + + void EnterCombat(Unit* /*who*/) override + { + _EnterCombat(); + + events.ScheduleEvent(EVENT_GRASPING_VINES, Seconds(20),Seconds(35)); + } + + void UpdateAI(uint32 diff) override + { + if (!UpdateVictim()) + return; + + events.Update(diff); + + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; + + while (uint32 eventId = events.ExecuteEvent()) + { + switch (eventId) + { + case EVENT_GRASPING_VINES: + DoCastVictim(SPELL_GRASPING_VINES); + events.Repeat(Seconds(20), Seconds(35)); + break; + default: + break; + } + + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; + } + + DoMeleeAttackIfReady(); + } + }; + + CreatureAI* GetAI(Creature* creature) const override + { + return GetWailingCavernsAI(creature); + } +}; + + +void AddSC_boss_verdan_the_everliving() +{ + new boss_verdan_the_everliving(); +} diff --git a/src/server/scripts/Kalimdor/WailingCaverns/instance_wailing_caverns.cpp b/src/server/scripts/Kalimdor/WailingCaverns/instance_wailing_caverns.cpp index 672bae016c1..cbf7ca779b2 100644 --- a/src/server/scripts/Kalimdor/WailingCaverns/instance_wailing_caverns.cpp +++ b/src/server/scripts/Kalimdor/WailingCaverns/instance_wailing_caverns.cpp @@ -1,6 +1,5 @@ /* * Copyright (C) 2008-2017 TrinityCore - * Copyright (C) 2006-2009 ScriptDev2 * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the @@ -27,117 +26,83 @@ EndScriptData */ #include "InstanceScript.h" #include "wailing_caverns.h" -#define MAX_ENCOUNTER 9 +ObjectData const creatureData[] = +{ + { NPC_LADY_ANACONDRA, DATA_LADY_ANACONDRA }, + { NPC_LORD_COBRAHN, DATA_LORD_COBRAHN }, + { NPC_LORD_PYTHAS, DATA_LORD_PYTHAS }, + { NPC_LORD_SERPENTIS, DATA_LORD_SERPENTIS }, + { 0, 0 } // END + +}; class instance_wailing_caverns : public InstanceMapScript { public: - instance_wailing_caverns() : InstanceMapScript("instance_wailing_caverns", 43) { } - - InstanceScript* GetInstanceScript(InstanceMap* map) const override - { - return new instance_wailing_caverns_InstanceMapScript(map); - } + instance_wailing_caverns() : InstanceMapScript(WCScriptName, 43) { } struct instance_wailing_caverns_InstanceMapScript : public InstanceScript { instance_wailing_caverns_InstanceMapScript(Map* map) : InstanceScript(map) { SetHeaders(DataHeader); - memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); + SetBossNumber(EncounterCount); + LoadObjectData(creatureData, nullptr); yelled = false; } - uint32 m_auiEncounter[MAX_ENCOUNTER]; - - bool yelled; - ObjectGuid NaralexGUID; - void OnCreatureCreate(Creature* creature) override { - if (creature->GetEntry() == DATA_NARALEX) - NaralexGUID = creature->GetGUID(); + InstanceScript::OnCreatureCreate(creature); + + switch (creature->GetEntry()) + { + case NPC_LADY_ANACONDRA: + case NPC_LORD_COBRAHN: + case NPC_LORD_PYTHAS: + case NPC_LORD_SERPENTIS: + case NPC_MUTANUS_THE_DEVOURER: + case NPC_KRESH: + case NPC_SKUM: + case NPC_VERDAN_THE_EVERLIVING: + case NPC_NARALEX: + WailingCavernsGUIDs.emplace_back(creature->GetGUID()); + break; + } } void SetData(uint32 type, uint32 data) override { switch (type) { - case TYPE_LORD_COBRAHN: m_auiEncounter[0] = data;break; - case TYPE_LORD_PYTHAS: m_auiEncounter[1] = data;break; - case TYPE_LADY_ANACONDRA: m_auiEncounter[2] = data;break; - case TYPE_LORD_SERPENTIS: m_auiEncounter[3] = data;break; - case TYPE_NARALEX_EVENT: m_auiEncounter[4] = data;break; - case TYPE_NARALEX_PART1: m_auiEncounter[5] = data;break; - case TYPE_NARALEX_PART2: m_auiEncounter[6] = data;break; - case TYPE_NARALEX_PART3: m_auiEncounter[7] = data;break; - case TYPE_MUTANUS_THE_DEVOURER: m_auiEncounter[8] = data;break; - case TYPE_NARALEX_YELLED: yelled = true; break; + case DATA_NARALEX_YELLED: + yelled = true; + break; } - if (data == DONE)SaveToDB(); } uint32 GetData(uint32 type) const override { switch (type) { - case TYPE_LORD_COBRAHN: return m_auiEncounter[0]; - case TYPE_LORD_PYTHAS: return m_auiEncounter[1]; - case TYPE_LADY_ANACONDRA: return m_auiEncounter[2]; - case TYPE_LORD_SERPENTIS: return m_auiEncounter[3]; - case TYPE_NARALEX_EVENT: return m_auiEncounter[4]; - case TYPE_NARALEX_PART1: return m_auiEncounter[5]; - case TYPE_NARALEX_PART2: return m_auiEncounter[6]; - case TYPE_NARALEX_PART3: return m_auiEncounter[7]; - case TYPE_MUTANUS_THE_DEVOURER: return m_auiEncounter[8]; - case TYPE_NARALEX_YELLED: return yelled; + case DATA_NARALEX_YELLED: + return yelled; } return 0; } - ObjectGuid GetGuidData(uint32 data) const override - { - if (data == DATA_NARALEX)return NaralexGUID; - return ObjectGuid::Empty; - } - - std::string GetSaveData() override - { - OUT_SAVE_INST_DATA; - - std::ostringstream saveStream; - saveStream << m_auiEncounter[0] << ' ' << m_auiEncounter[1] << ' ' << m_auiEncounter[2] << ' ' - << m_auiEncounter[3] << ' ' << m_auiEncounter[4] << ' ' << m_auiEncounter[5] << ' ' - << m_auiEncounter[6] << ' ' << m_auiEncounter[7] << ' ' << m_auiEncounter[8]; - - OUT_SAVE_INST_DATA_COMPLETE; - return saveStream.str(); - } - - void Load(const char* in) override - { - if (!in) - { - OUT_LOAD_INST_DATA_FAIL; - return; - } - - OUT_LOAD_INST_DATA(in); - - std::istringstream loadStream(in); - loadStream >> m_auiEncounter[0] >> m_auiEncounter[1] >> m_auiEncounter[2] >> m_auiEncounter[3] - >> m_auiEncounter[4] >> m_auiEncounter[5] >> m_auiEncounter[6] >> m_auiEncounter[7] >> m_auiEncounter[8]; - - for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) - if (m_auiEncounter[i] != DONE) - m_auiEncounter[i] = NOT_STARTED; - - OUT_LOAD_INST_DATA_COMPLETE; - } + private: + bool yelled; + GuidVector WailingCavernsGUIDs; }; + InstanceScript* GetInstanceScript(InstanceMap* map) const override + { + return new instance_wailing_caverns_InstanceMapScript(map); + } + }; void AddSC_instance_wailing_caverns() diff --git a/src/server/scripts/Kalimdor/WailingCaverns/wailing_caverns.cpp b/src/server/scripts/Kalimdor/WailingCaverns/wailing_caverns.cpp index 810aa789eab..36eb2f584ba 100644 --- a/src/server/scripts/Kalimdor/WailingCaverns/wailing_caverns.cpp +++ b/src/server/scripts/Kalimdor/WailingCaverns/wailing_caverns.cpp @@ -65,13 +65,7 @@ enum Enums SPELL_MARK_OF_THE_WILD_RANK_2 = 5232, SPELL_SERPENTINE_CLEANSING = 6270, SPELL_NARALEXS_AWAKENING = 6271, - SPELL_FLIGHT_FORM = 33943, - - NPC_DEVIATE_RAVAGER = 3636, - NPC_DEVIATE_VIPER = 5755, - NPC_DEVIATE_MOCCASIN = 5762, - NPC_NIGHTMARE_ECTOPLASM = 5763, - NPC_MUTANUS_THE_DEVOURER = 3654, + SPELL_FLIGHT_FORM = 33943 }; class npc_disciple_of_naralex : public CreatureScript @@ -79,11 +73,6 @@ class npc_disciple_of_naralex : public CreatureScript public: npc_disciple_of_naralex() : CreatureScript("npc_disciple_of_naralex") { } - CreatureAI* GetAI(Creature* creature) const override - { - return GetInstanceAI(creature); - } - bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) override { ClearGossipMenuFor(player); @@ -92,7 +81,7 @@ public: { CloseGossipMenuFor(player); if (instance) - instance->SetData(TYPE_NARALEX_EVENT, IN_PROGRESS); + instance->SetData(DATA_NARALEX_EVENT, IN_PROGRESS); creature->AI()->Talk(SAY_MAKE_PREPARATIONS); @@ -108,21 +97,19 @@ public: bool OnGossipHello(Player* player, Creature* creature) override { - InstanceScript* instance = creature->GetInstanceScript(); - - if (instance) + if(InstanceScript* instance = creature->GetInstanceScript()) { creature->CastSpell(player, SPELL_MARK_OF_THE_WILD_RANK_2, true); - if ((instance->GetData(TYPE_LORD_COBRAHN) == DONE) && (instance->GetData(TYPE_LORD_PYTHAS) == DONE) && - (instance->GetData(TYPE_LADY_ANACONDRA) == DONE) && (instance->GetData(TYPE_LORD_SERPENTIS) == DONE)) + if ((instance->GetBossState(DATA_LORD_COBRAHN) == DONE) && (instance->GetBossState(DATA_LORD_PYTHAS) == DONE) && + (instance->GetBossState(DATA_LADY_ANACONDRA) == DONE) && (instance->GetBossState(DATA_LORD_SERPENTIS) == DONE)) { AddGossipItemFor(player, GOSSIP_OPTION_LET_EVENT_BEGIN, 0, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); SendGossipMenuFor(player, NPC_TEXT_FANGLORDS_ARE_DEAD, creature->GetGUID()); - if (!instance->GetData(TYPE_NARALEX_YELLED)) + if (!instance->GetData(DATA_NARALEX_YELLED)) { creature->AI()->Talk(SAY_AT_LAST); - instance->SetData(TYPE_NARALEX_YELLED, 1); + instance->SetData(DATA_NARALEX_YELLED, 1); } } else @@ -145,10 +132,7 @@ public: me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); } - uint32 eventTimer; - uint32 currentEvent; - uint32 eventProgress; - InstanceScript* instance; + void WaypointReached(uint32 waypointId) override { @@ -156,25 +140,25 @@ public: { case 4: eventProgress = 1; - currentEvent = TYPE_NARALEX_PART1; - instance->SetData(TYPE_NARALEX_PART1, IN_PROGRESS); + currentEvent = DATA_NARALEX_PART1; + instance->SetData(DATA_NARALEX_PART1, IN_PROGRESS); break; case 5: Talk(SAY_MUST_CONTINUE); - instance->SetData(TYPE_NARALEX_PART1, DONE); + instance->SetData(DATA_NARALEX_PART1, DONE); break; case 11: eventProgress = 1; - currentEvent = TYPE_NARALEX_PART2; - instance->SetData(TYPE_NARALEX_PART2, IN_PROGRESS); + currentEvent = DATA_NARALEX_PART2; + instance->SetData(DATA_NARALEX_PART2, IN_PROGRESS); break; case 19: Talk(SAY_BEYOND_THIS_CORRIDOR); break; case 24: eventProgress = 1; - currentEvent = TYPE_NARALEX_PART3; - instance->SetData(TYPE_NARALEX_PART3, IN_PROGRESS); + currentEvent = DATA_NARALEX_PART3; + instance->SetData(DATA_NARALEX_PART3, IN_PROGRESS); break; } } @@ -191,10 +175,10 @@ public: void JustDied(Unit* /*slayer*/) override { - instance->SetData(TYPE_NARALEX_EVENT, FAIL); - instance->SetData(TYPE_NARALEX_PART1, FAIL); - instance->SetData(TYPE_NARALEX_PART2, FAIL); - instance->SetData(TYPE_NARALEX_PART3, FAIL); + instance->SetData(DATA_NARALEX_EVENT, FAIL); + instance->SetData(DATA_NARALEX_PART1, FAIL); + instance->SetData(DATA_NARALEX_PART2, FAIL); + instance->SetData(DATA_NARALEX_PART3, FAIL); } void JustSummoned(Creature* summoned) override @@ -204,7 +188,7 @@ public: void UpdateAI(uint32 diff) override { - if (currentEvent != TYPE_NARALEX_PART3) + if (currentEvent != DATA_NARALEX_PART3) npc_escortAI::UpdateAI(diff); if (eventTimer <= diff) @@ -214,7 +198,7 @@ public: { switch (currentEvent) { - case TYPE_NARALEX_PART1: + case DATA_NARALEX_PART1: if (eventProgress == 1) { ++eventProgress; @@ -223,7 +207,7 @@ public: me->SummonCreature(NPC_DEVIATE_RAVAGER, -72.9506f, 216.645f, -93.6756f, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 5000); } break; - case TYPE_NARALEX_PART2: + case DATA_NARALEX_PART2: if (eventProgress == 1) { ++eventProgress; @@ -240,12 +224,12 @@ public: { //CAST_AI(npc_escort::npc_escortAI, me->AI())->SetCanDefend(true); Talk(SAY_CAVERNS_PURIFIED); - instance->SetData(TYPE_NARALEX_PART2, DONE); + instance->SetData(DATA_NARALEX_PART2, DONE); if (me->HasAura(SPELL_SERPENTINE_CLEANSING)) me->RemoveAura(SPELL_SERPENTINE_CLEANSING); } break; - case TYPE_NARALEX_PART3: + case DATA_NARALEX_PART3: if (eventProgress == 1) { ++eventProgress; @@ -297,10 +281,10 @@ public: naralex->AI()->Talk(EMOTE_HORRENDOUS_VISION); me->SummonCreature(NPC_MUTANUS_THE_DEVOURER, 150.872f, 262.905f, -103.503f, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 300000); Talk(SAY_MUTANUS_THE_DEVOURER); - instance->SetData(TYPE_MUTANUS_THE_DEVOURER, IN_PROGRESS); + instance->SetData(DATA_MUTANUS_THE_DEVOURER, IN_PROGRESS); } else - if (eventProgress == 6 && instance->GetData(TYPE_MUTANUS_THE_DEVOURER) == DONE) + if (eventProgress == 6 && instance->GetData(DATA_MUTANUS_THE_DEVOURER) == DONE) { ++eventProgress; eventTimer = 3000; @@ -362,15 +346,26 @@ public: if (Creature* naralex = instance->instance->GetCreature(instance->GetGuidData(DATA_NARALEX))) naralex->SetVisible(false); me->SetVisible(false); - instance->SetData(TYPE_NARALEX_PART3, DONE); + instance->SetData(DATA_NARALEX_PART3, DONE); } break; } } } else eventTimer -= diff; } + + private: + uint32 eventTimer; + uint32 currentEvent; + uint32 eventProgress; + InstanceScript* instance; }; + CreatureAI* GetAI(Creature* creature) const override + { + return GetWailingCavernsAI(creature); + } + }; void AddSC_wailing_caverns() diff --git a/src/server/scripts/Kalimdor/WailingCaverns/wailing_caverns.h b/src/server/scripts/Kalimdor/WailingCaverns/wailing_caverns.h index 1b655815934..3eabc0f4b0a 100644 --- a/src/server/scripts/Kalimdor/WailingCaverns/wailing_caverns.h +++ b/src/server/scripts/Kalimdor/WailingCaverns/wailing_caverns.h @@ -1,6 +1,5 @@ /* * Copyright (C) 2008-2017 TrinityCore - * Copyright (C) 2006-2009 ScriptDev2 * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the @@ -20,21 +19,53 @@ #define DEF_WAILING_CAVERNS_H #define DataHeader "WC" +#define WCScriptName "instance_wailing_caverns" -enum WCDataTypes +uint32 const EncounterCount = 8; + +enum Data { - TYPE_LORD_COBRAHN = 1, - TYPE_LORD_PYTHAS = 2, - TYPE_LADY_ANACONDRA = 3, - TYPE_LORD_SERPENTIS = 4, - TYPE_NARALEX_EVENT = 5, - TYPE_NARALEX_PART1 = 6, - TYPE_NARALEX_PART2 = 7, - TYPE_NARALEX_PART3 = 8, - TYPE_MUTANUS_THE_DEVOURER = 9, - TYPE_NARALEX_YELLED = 10, - - DATA_NARALEX = 3679, + DATA_LORD_COBRAHN = 1, + DATA_LORD_PYTHAS = 2, + DATA_LADY_ANACONDRA = 3, + DATA_LORD_SERPENTIS = 4, + DATA_NARALEX_EVENT = 5, + DATA_NARALEX_PART1 = 6, + DATA_NARALEX_PART2 = 7, + DATA_NARALEX_PART3 = 8, + DATA_MUTANUS_THE_DEVOURER = 9, + DATA_NARALEX_YELLED = 10, + DATA_NARALEX = 11, + DATA_SKUM = 12, + DATA_KRESH = 13, + DATA_VERDAN_THE_EVERLIVING = 14 }; -#endif +enum Creatures +{ + // Bosses + NPC_LADY_ANACONDRA = 3671, + NPC_LORD_COBRAHN = 3669, + NPC_KRESH = 3653, + NPC_LORD_PYTHAS = 3670, + NPC_SKUM = 3674, + NPC_LORD_SERPENTIS = 3673, + NPC_VERDAN_THE_EVERLIVING = 5775, + NPC_MUTANUS_THE_DEVOURER = 3654, + NPC_NARALEX = 3679, + + // Adds + NPC_DEVIATE_RAVAGER = 3636, + NPC_DEVIATE_VIPER = 5755, + NPC_DEVIATE_MOCCASIN = 5762, + NPC_NIGHTMARE_ECTOPLASM = 5763, + NPC_DRUID_OF_THE_FANG = 3840, +}; + +template +AI* GetWailingCavernsAI(T* obj) +{ + return GetInstanceAI(obj, WCScriptName); +} + +#endif // WAILING_CAVERNS_H diff --git a/src/server/scripts/Kalimdor/kalimdor_script_loader.cpp b/src/server/scripts/Kalimdor/kalimdor_script_loader.cpp index fa70078a345..f1e0c58f11c 100644 --- a/src/server/scripts/Kalimdor/kalimdor_script_loader.cpp +++ b/src/server/scripts/Kalimdor/kalimdor_script_loader.cpp @@ -83,6 +83,13 @@ void AddSC_npc_anubisath_sentinel(); void AddSC_instance_temple_of_ahnqiraj(); void AddSC_wailing_caverns(); //Wailing caverns void AddSC_instance_wailing_caverns(); +void AddSC_boss_lady_anacondra(); +void AddSC_boss_kresh(); +void AddSC_boss_lord_pythas(); +void AddSC_boss_lord_cobrahn(); +void AddSC_boss_lord_serpentis(); +void AddSC_boss_verdan_the_everliving(); +void AddSC_boss_skum(); void AddSC_boss_zum_rah(); //Zul'Farrak void AddSC_zulfarrak(); void AddSC_instance_zulfarrak(); @@ -185,6 +192,13 @@ void AddKalimdorScripts() AddSC_instance_temple_of_ahnqiraj(); AddSC_wailing_caverns(); //Wailing caverns AddSC_instance_wailing_caverns(); + AddSC_boss_lady_anacondra(); + AddSC_boss_kresh(); + AddSC_boss_lord_pythas(); + AddSC_boss_lord_cobrahn(); + AddSC_boss_lord_serpentis(); + AddSC_boss_verdan_the_everliving(); + AddSC_boss_skum(); AddSC_boss_zum_rah(); //Zul'Farrak AddSC_zulfarrak(); AddSC_instance_zulfarrak();