diff options
5 files changed, 79 insertions, 19 deletions
diff --git a/sql/updates/world/3.3.5/2020_08_05_00_world.sql b/sql/updates/world/3.3.5/2020_08_05_00_world.sql new file mode 100644 index 00000000000..52dfe308e27 --- /dev/null +++ b/sql/updates/world/3.3.5/2020_08_05_00_world.sql @@ -0,0 +1,4 @@ +-- +UPDATE `smart_scripts` SET `event_phase_mask`=0,`event_flags`=0 WHERE `entryorguid`=16027 AND `source_type`=0; +UPDATE `creature_template` SET `ScriptName`='npc_frogger_trigger_naxx' WHERE `entry`=16082; +UPDATE `creature_summon_groups` SET `summonerId`=16082,`summonerType`=0 WHERE `summonerId`=533 AND `summonerType`=2; diff --git a/src/server/scripts/Northrend/Naxxramas/instance_naxxramas.cpp b/src/server/scripts/Northrend/Naxxramas/instance_naxxramas.cpp index 3f745cbc159..b705820c7f4 100644 --- a/src/server/scripts/Northrend/Naxxramas/instance_naxxramas.cpp +++ b/src/server/scripts/Northrend/Naxxramas/instance_naxxramas.cpp @@ -21,7 +21,6 @@ #include "GameObject.h" #include "InstanceScript.h" #include "Map.h" -#include "MotionMaster.h" #include "naxxramas.h" #include "TemporarySummon.h" @@ -125,9 +124,6 @@ class instance_naxxramas : public InstanceMapScript CurrentWingTaunt = SAY_KELTHUZAD_FIRST_WING_TAUNT; playerDied = 0; - - nextFroggerWave = 0; - events.ScheduleEvent(EVENT_SUMMON_FROGGER_WAVE, 1s); } void OnCreatureCreate(Creature* creature) override @@ -472,16 +468,6 @@ class instance_naxxramas : public InstanceMapScript kelthuzad->AI()->Talk(CurrentWingTaunt); ++CurrentWingTaunt; break; - case EVENT_SUMMON_FROGGER_WAVE: - { - std::list<TempSummon*> spawns; - instance->SummonCreatureGroup(nextFroggerWave, &spawns); - if (!spawns.empty()) - spawns.front()->GetMotionMaster()->MovePath(10 * NPC_FROGGER + nextFroggerWave, false); - events.Repeat(Seconds(1) + Milliseconds(666)); - nextFroggerWave = (nextFroggerWave+1) % 3; - break; - } case EVENT_DIALOGUE_SAPPHIRON_KELTHUZAD: if (Creature* kelthuzad = instance->GetCreature(KelthuzadGUID)) kelthuzad->AI()->Talk(SAY_DIALOGUE_SAPPHIRON_KELTHUZAD); @@ -613,8 +599,6 @@ class instance_naxxramas : public InstanceMapScript /* The Immortal / The Undying */ uint32 playerDied; - int8 nextFroggerWave; - EventMap events; }; diff --git a/src/server/scripts/Northrend/Naxxramas/naxxramas.cpp b/src/server/scripts/Northrend/Naxxramas/naxxramas.cpp new file mode 100644 index 00000000000..fc136d9addf --- /dev/null +++ b/src/server/scripts/Northrend/Naxxramas/naxxramas.cpp @@ -0,0 +1,73 @@ +/* + * This file is part of the TrinityCore 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 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 <http://www.gnu.org/licenses/>. + */ + +#include "ScriptMgr.h" +#include "InstanceScript.h" +#include "MotionMaster.h" +#include "ScriptedCreature.h" +#include "TemporarySummon.h" +#include "naxxramas.h" + +enum NaxxEvents +{ + EVENT_SUMMON_FROGGER_WAVE = 1 +}; + +struct npc_frogger_trigger_naxx : public ScriptedAI +{ + npc_frogger_trigger_naxx(Creature* creature) : ScriptedAI(creature), _nextFroggerWave(0) { } + + void Reset() override + { + _events.Reset(); + _events.ScheduleEvent(EVENT_SUMMON_FROGGER_WAVE, 1s); + _nextFroggerWave = 0; + } + + void UpdateAI(uint32 diff) override + { + _events.Update(diff); + + while (uint32 eventId = _events.ExecuteEvent()) + { + switch (eventId) + { + case EVENT_SUMMON_FROGGER_WAVE: + { + std::list<TempSummon*> spawns; + me->SummonCreatureGroup(_nextFroggerWave, &spawns); + if (!spawns.empty()) + spawns.front()->GetMotionMaster()->MovePath(10 * NPC_FROGGER + _nextFroggerWave, false); + _events.Repeat(1666ms); + _nextFroggerWave = (_nextFroggerWave+1) % 3; + break; + } + default: + break; + } + } + } + +private: + EventMap _events; + uint8 _nextFroggerWave; +}; + +void AddSC_naxxramas() +{ + RegisterNaxxramasCreatureAI(npc_frogger_trigger_naxx); +} diff --git a/src/server/scripts/Northrend/Naxxramas/naxxramas.h b/src/server/scripts/Northrend/Naxxramas/naxxramas.h index 23e2260a563..18f6b6fb318 100644 --- a/src/server/scripts/Northrend/Naxxramas/naxxramas.h +++ b/src/server/scripts/Northrend/Naxxramas/naxxramas.h @@ -183,9 +183,6 @@ enum NAXInstanceEvents // Dialogue that happens after each wing. EVENT_KELTHUZAD_WING_TAUNT, - // Periodic Frogger summon - EVENT_SUMMON_FROGGER_WAVE, - // Dialogue that happens after Sapphiron's death. EVENT_DIALOGUE_SAPPHIRON_KELTHUZAD, EVENT_DIALOGUE_SAPPHIRON_LICHKING, diff --git a/src/server/scripts/Northrend/northrend_script_loader.cpp b/src/server/scripts/Northrend/northrend_script_loader.cpp index 45998deae8d..2ec9e55487d 100644 --- a/src/server/scripts/Northrend/northrend_script_loader.cpp +++ b/src/server/scripts/Northrend/northrend_script_loader.cpp @@ -71,6 +71,7 @@ void AddSC_boss_faerlina(); void AddSC_boss_heigan(); void AddSC_boss_gothik(); void AddSC_boss_thaddius(); +void AddSC_naxxramas(); void AddSC_instance_naxxramas(); // The Nexus Nexus void AddSC_boss_nexus_commanders(); @@ -264,6 +265,7 @@ void AddNorthrendScripts() AddSC_boss_heigan(); AddSC_boss_gothik(); AddSC_boss_thaddius(); + AddSC_naxxramas(); AddSC_instance_naxxramas(); // The Nexus: Nexus AddSC_boss_nexus_commanders(); |