diff options
author | Gildor <gildor55@gmail.com> | 2020-08-05 14:16:19 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-08-05 14:16:19 +0200 |
commit | 174ac958009222aeef83520101a28963f8c63b0e (patch) | |
tree | c1207627df4c2b1f4ece86fda449cfaadae95e82 /src | |
parent | 9bf57958e36721fa301f62c4a5c6bd88c58edc28 (diff) |
Scripts/Naxxramas: Frogger event improvements (#25202)
* Scripts/Naxxramas: Frogger event improvements
* Prevent Living Poison accumulation
* Now Living Poison cast Explode
* check for a nearby player
* move event to the frogger trigger's AI
* Initialize and removing unnecessary things
* applying suggestions
* remove unnecessary header
* Rename 9999_99_99_99_world.sql to 2020_08_05_00_world.sql
Diffstat (limited to 'src')
4 files changed, 75 insertions, 19 deletions
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(); |