aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRiztazz <felianther15@gmail.com>2017-11-11 12:31:40 +0100
committerShauren <shauren.trinity@gmail.com>2021-02-06 21:41:51 +0100
commitdffef65da2863078e48972e7dc0ea225d39389e9 (patch)
tree0c800b219f4c38764105fdabf149dbbe5b34f659
parent1240acb132e8310fa8702e9eb80ce6a35e8499f9 (diff)
Scripts/Stratholme: spawn Timmy the Cruel if conditions are met (#20750)
* Timmy the cruel * Rename some variables and use sniffed spawn position * codestyle * Use areaboundary instead * include order * aokromes request * remove static * never cp on tc (cherry picked from commit c69825d96d6c7ff847c196c908e1040cb7a8d5db)
-rw-r--r--src/server/scripts/EasternKingdoms/Stratholme/instance_stratholme.cpp42
-rw-r--r--src/server/scripts/EasternKingdoms/Stratholme/stratholme.h15
2 files changed, 52 insertions, 5 deletions
diff --git a/src/server/scripts/EasternKingdoms/Stratholme/instance_stratholme.cpp b/src/server/scripts/EasternKingdoms/Stratholme/instance_stratholme.cpp
index 04268b037b3..a73987affe1 100644
--- a/src/server/scripts/EasternKingdoms/Stratholme/instance_stratholme.cpp
+++ b/src/server/scripts/EasternKingdoms/Stratholme/instance_stratholme.cpp
@@ -23,6 +23,7 @@ SDCategory: Stratholme
EndScriptData */
#include "ScriptMgr.h"
+#include "AreaBoundary.h"
#include "Creature.h"
#include "EventMap.h"
#include "GameObject.h"
@@ -33,17 +34,15 @@ EndScriptData */
#include "stratholme.h"
#include <sstream>
-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:
@@ -54,16 +53,22 @@ class instance_stratholme : public InstanceMapScript
instance_stratholme_InstanceMapScript(InstanceMap* 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;
@@ -82,6 +87,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 f3f5121bb5a..97464d6ef02 100644
--- a/src/server/scripts/EasternKingdoms/Stratholme/stratholme.h
+++ b/src/server/scripts/EasternKingdoms/Stratholme/stratholme.h
@@ -56,6 +56,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
@@ -83,6 +91,13 @@ 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
+};
+
template <class AI, class T>
inline AI* GetStratholmeAI(T* obj)
{