From fb0e0eb11711d45e2f62078eeb39985bd7bfc816 Mon Sep 17 00:00:00 2001 From: Aokromes Date: Sun, 12 Nov 2017 13:19:19 +0100 Subject: [PATCH] Scripts/Stratholme: spawn Timmy the Cruel if conditions are met --- .../Stratholme/instance_stratholme.cpp | 42 +++++++++-- .../EasternKingdoms/Stratholme/stratholme.h | 15 ++++ .../Kalimdor/zone_durotar_area_echo_isles.cpp | 73 +++++++++++++++++++ 3 files changed, 125 insertions(+), 5 deletions(-) create mode 100644 src/server/scripts/Kalimdor/zone_durotar_area_echo_isles.cpp diff --git a/src/server/scripts/EasternKingdoms/Stratholme/instance_stratholme.cpp b/src/server/scripts/EasternKingdoms/Stratholme/instance_stratholme.cpp index e0edf1d189c..91594c7b1c0 100644 --- a/src/server/scripts/EasternKingdoms/Stratholme/instance_stratholme.cpp +++ b/src/server/scripts/EasternKingdoms/Stratholme/instance_stratholme.cpp @@ -24,22 +24,21 @@ SDCategory: Stratholme EndScriptData */ #include "ScriptMgr.h" +#include "AreaBoundary.h" #include "ScriptedCreature.h" #include "InstanceScript.h" #include "stratholme.h" #include "Player.h" -enum Misc -{ - MAX_ENCOUNTER = 6 -}; - enum InstanceEvents { EVENT_BARON_RUN = 1, EVENT_SLAUGHTER_SQUARE = 2 }; +Position const timmyTheCruelSpawnPosition = { 3625.358f, -3188.108f, 130.3985f, 4.834562f }; +EllipseBoundary const beforeScarletGate(Position(3671.158f, -3181.79f), 60.0f, 40.0f); + class instance_stratholme : public InstanceMapScript { public: @@ -50,16 +49,22 @@ class instance_stratholme : public InstanceMapScript instance_stratholme_InstanceMapScript(Map* map) : InstanceScript(map) { SetHeaders(DataHeader); + for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) EncounterState[i] = NOT_STARTED; for (uint8 i = 0; i < 5; ++i) IsSilverHandDead[i] = false; + + timmySpawned = false; + scarletsKilled = 0; } uint32 EncounterState[MAX_ENCOUNTER]; + uint8 scarletsKilled; bool IsSilverHandDead[5]; + bool timmySpawned; ObjectGuid serviceEntranceGUID; ObjectGuid gauntletGate1GUID; @@ -78,6 +83,33 @@ class instance_stratholme : public InstanceMapScript GuidSet abomnationGUID; EventMap events; + void OnUnitDeath(Unit* who) override + { + switch (who->GetEntry()) + { + case NPC_CRIMSON_GUARDSMAN: + case NPC_CRIMSON_CONJUROR: + case NPC_CRIMSON_INITATE: + case NPC_CRIMSON_GALLANT: + { + if (!timmySpawned) + { + Position pos = who->ToCreature()->GetHomePosition(); + // check if they're in front of the entrance + if (beforeScarletGate.IsWithinBoundary(pos)) + { + if (++scarletsKilled >= TIMMY_THE_CRUEL_CRUSADERS_REQUIRED) + { + instance->SummonCreature(NPC_TIMMY_THE_CRUEL, timmyTheCruelSpawnPosition); + timmySpawned = true; + } + } + } + break; + } + } + } + bool StartSlaugtherSquare() { //change to DONE when crystals implemented diff --git a/src/server/scripts/EasternKingdoms/Stratholme/stratholme.h b/src/server/scripts/EasternKingdoms/Stratholme/stratholme.h index 5e2c589dc76..8793a56d4ee 100644 --- a/src/server/scripts/EasternKingdoms/Stratholme/stratholme.h +++ b/src/server/scripts/EasternKingdoms/Stratholme/stratholme.h @@ -54,6 +54,14 @@ enum STRCreatureIds NPC_ABOM_VENOM = 10417, NPC_BLACK_GUARD = 10394, NPC_YSIDA = 16031, + + // Scarlet side creatures + NPC_CRIMSON_GUARDSMAN = 10418, + NPC_CRIMSON_CONJUROR = 10419, + NPC_CRIMSON_INITATE = 10420, + NPC_CRIMSON_GALLANT = 10424, + + NPC_TIMMY_THE_CRUEL = 10808 }; enum STRGameobjectIds @@ -81,5 +89,12 @@ enum STRSpellIds SPELL_BARON_ULTIMATUM = 27861 }; +enum STRMisc +{ + //! amount of crusade monsters required to be killed in order for timmy the cruel to spawn + TIMMY_THE_CRUEL_CRUSADERS_REQUIRED = 15, + MAX_ENCOUNTER = 6 +}; + #endif diff --git a/src/server/scripts/Kalimdor/zone_durotar_area_echo_isles.cpp b/src/server/scripts/Kalimdor/zone_durotar_area_echo_isles.cpp new file mode 100644 index 00000000000..c6bbaed9007 --- /dev/null +++ b/src/server/scripts/Kalimdor/zone_durotar_area_echo_isles.cpp @@ -0,0 +1,73 @@ +/* + * 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 "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "SpellScript.h" +#include "Player.h" + +enum TikiTarget +{ + SPELL_TIKI_TARGET_VISUAL_1 = 71064, + SPELL_TIKI_TARGET_VISUAL_2 = 71065, + SPELL_TIKI_TARGET_VISUAL_3 = 71066 +}; + +/*###### +# npc_tiki_target "Used by entry 38038" +######*/ + +class npc_tiki_target : public CreatureScript +{ +public: + npc_tiki_target() : CreatureScript("npc_tiki_target") { } + + struct npc_tiki_targetAI : public ScriptedAI + { + npc_tiki_targetAI(Creature* creature) : ScriptedAI(creature) { } + + void Reset() override + { + DoCast(me, RAND(SPELL_TIKI_TARGET_VISUAL_1, SPELL_TIKI_TARGET_VISUAL_2, SPELL_TIKI_TARGET_VISUAL_3)); + } + + void DamageTaken(Unit* who, uint32& damage) override + { + if (who->GetTypeId() == TYPEID_UNIT && me->HealthBelowPct(85)) + damage = 0; + } + + void UpdateAI(uint32 diff) override + { + + } + + private: + TaskScheduler _scheduler; + }; + + CreatureAI* GetAI(Creature* creature) const override + { + return new npc_tiki_targetAI(creature); + } +}; + +void AddSC_durotar_area_echo_isles() +{ + new npc_tiki_target(); +} +