AzeorthCore 3.3.5a
OpenSource WoW Emulator
Loading...
Searching...
No Matches
instance_stratholme::instance_stratholme_InstanceMapScript Struct Reference
Inheritance diagram for instance_stratholme::instance_stratholme_InstanceMapScript:
InstanceScript ZoneScript

Public Member Functions

 instance_stratholme_InstanceMapScript (Map *map)
 
void Initialize () override
 
void OnPlayerEnter (Player *player) override
 
void OnCreatureCreate (Creature *creature) override
 
void ProcessSlaughterEvent ()
 
void OnUnitDeath (Unit *unit) override
 
void OnGameObjectCreate (GameObject *go) override
 
void CheckZiggurats ()
 
void DoSpawnPlaguedCritters (uint8, Player *player)
 
void SetData (uint32 type, uint32 data) override
 
std::string GetSaveData () override
 
void Load (const char *in) override
 
uint32 GetData (uint32 type) const override
 
void Update (uint32 diff) override
 
- Public Member Functions inherited from InstanceScript
 InstanceScript (Map *map)
 
 ~InstanceScript () override
 
virtual void Initialize ()
 
virtual void Load (char const *data)
 
virtual void CreatureLooted (Creature *, LootType)
 
virtual std::string GetSaveData ()
 
void SaveToDB ()
 
virtual void Update (uint32)
 
virtual bool IsEncounterInProgress () const
 
void OnCreatureCreate (Creature *creature) override
 
void OnCreatureRemove (Creature *creature) override
 
void OnGameObjectCreate (GameObject *go) override
 
void OnGameObjectRemove (GameObject *go) override
 
ObjectGuid GetObjectGuid (uint32 type) const
 
ObjectGuid GetGuidData (uint32 type) const override
 
CreatureGetCreature (uint32 type)
 
GameObjectGetGameObject (uint32 type)
 
virtual void OnPlayerEnter (Player *)
 
virtual void OnPlayerAreaUpdate (Player *, uint32, uint32)
 
void HandleGameObject (ObjectGuid guid, bool open, GameObject *go=nullptr)
 
void DoUseDoorOrButton (ObjectGuid guid, uint32 withRestoreTime=0, bool useAlternativeState=false)
 
void DoRespawnGameObject (ObjectGuid guid, uint32 timeToDespawn=MINUTE)
 
void DoRespawnCreature (ObjectGuid guid, bool force=false)
 
void DoRespawnCreature (uint32 type, bool force=false)
 
void DoUpdateWorldState (uint32 worldstateId, uint32 worldstateValue)
 
void DoSendNotifyToInstance (char const *format,...)
 
void DoUpdateAchievementCriteria (AchievementCriteriaTypes type, uint32 miscValue1=0, uint32 miscValue2=0, Unit *unit=nullptr)
 
void DoStartTimedAchievement (AchievementCriteriaTimedTypes type, uint32 entry)
 
void DoStopTimedAchievement (AchievementCriteriaTimedTypes type, uint32 entry)
 
void DoRemoveAurasDueToSpellOnPlayers (uint32 spell)
 
void DoCastSpellOnPlayers (uint32 spell)
 
bool ServerAllowsTwoSideGroups ()
 
virtual bool SetBossState (uint32 id, EncounterState state)
 
EncounterState GetBossState (uint32 id) const
 
CreatureBoundary const * GetBossBoundary (uint32 id) const
 
BossInfo const * GetBossInfo (uint32 id) const
 
virtual bool CheckAchievementCriteriaMeet (uint32, Player const *, Unit const *=nullptr, uint32=0)
 
virtual bool CheckRequiredBosses (uint32, Player const *=nullptr) const
 
void SetCompletedEncountersMask (uint32 newMask, bool save)
 
uint32 GetCompletedEncounterMask () const
 
void SendEncounterUnit (uint32 type, Unit *unit=nullptr, uint8 param1=0, uint8 param2=0)
 
virtual void FillInitialWorldStates (WorldPacket &)
 
uint32 GetEncounterCount () const
 
void MarkAreaTriggerDone (uint32 id)
 
void ResetAreaTriggerDone (uint32 id)
 
bool IsAreaTriggerDone (uint32 id) const
 
virtual void DoAction (int32)
 
- Public Member Functions inherited from ZoneScript
 ZoneScript ()
 
virtual ~ZoneScript ()
 
virtual uint32 GetCreatureEntry (ObjectGuid::LowType, CreatureData const *data)
 
virtual uint32 GetGameObjectEntry (ObjectGuid::LowType, uint32 entry)
 
virtual void OnCreatureCreate (Creature *)
 
virtual void OnCreatureRemove (Creature *)
 
virtual void OnGameObjectCreate (GameObject *)
 
virtual void OnGameObjectRemove (GameObject *)
 
virtual void OnUnitDeath (Unit *)
 
virtual void OnCreatureEvade (Creature *)
 
virtual ObjectGuid GetGuidData (uint32) const
 
virtual void SetGuidData (uint32, ObjectGuid)
 
virtual uint64 GetData64 (uint32) const
 
virtual void SetData64 (uint32, uint64)
 
virtual uint32 GetData (uint32) const
 
virtual void SetData (uint32, uint32)
 
virtual void ProcessEvent (WorldObject *, uint32)
 

Private Member Functions

void gate_delay (int gate)
 
void gate_critter_delay (int gate)
 

Private Attributes

uint32 _baronRunProgress
 
uint32 _baronRunTime
 
uint32 _zigguratState1
 
uint32 _zigguratState2
 
uint32 _zigguratState3
 
uint32 _slaughterProgress
 
uint32 _slaughterNPCs
 
uint32 _postboxesOpened
 
EventMap events
 
ObjectGuid _zigguratDoorsGUID1
 
ObjectGuid _zigguratDoorsGUID2
 
ObjectGuid _zigguratDoorsGUID3
 
ObjectGuid _zigguratDoorsGUID4
 
ObjectGuid _zigguratDoorsGUID5
 
ObjectGuid _slaughterGateGUID
 
ObjectGuid _gauntletGateGUID
 
ObjectGuid _baronRivendareGUID
 
bool _gateTrapsCooldown [2]
 
ObjectGuid _trappedPlayerGUID
 
ObjectGuid _trapGatesGUIDs [4]
 

Additional Inherited Members

- Static Public Member Functions inherited from InstanceScript
static std::string GetBossStateName (uint8 state)
 
- Public Attributes inherited from InstanceScript
Mapinstance
 
- Protected Member Functions inherited from InstanceScript
void SetBossNumber (uint32 number)
 
void LoadBossBoundaries (BossBoundaryData const &data)
 
void LoadDoorData (DoorData const *data)
 
void LoadMinionData (MinionData const *data)
 
void LoadObjectData (ObjectData const *creatureData, ObjectData const *gameObjectData)
 
void AddObject (Creature *obj, bool add)
 
void AddObject (GameObject *obj, bool add)
 
void AddObject (WorldObject *obj, uint32 type, bool add)
 
void AddDoor (GameObject *door, bool add)
 
void AddMinion (Creature *minion, bool add)
 
void UpdateDoorState (GameObject *door)
 
void UpdateMinionState (Creature *minion, EncounterState state)
 
std::string LoadBossState (char const *data)
 
std::string GetBossSaveData ()
 

Detailed Description

Constructor & Destructor Documentation

◆ instance_stratholme_InstanceMapScript()

instance_stratholme::instance_stratholme_InstanceMapScript::instance_stratholme_InstanceMapScript ( Map map)
inline
61 : InstanceScript(map)
62 {
63 }
Definition: InstanceScript.h:140

Member Function Documentation

◆ CheckZiggurats()

void instance_stratholme::instance_stratholme_InstanceMapScript::CheckZiggurats ( )
inline
248 {
249 if (_zigguratState1 == 2 && _zigguratState2 == 2 && _zigguratState3 == 2)
250 {
251 instance->LoadGrid(4035.83f, -3336.31f);
253 baron->AI()->Talk(SAY_BRAON_ZIGGURAT_FALL_YELL);
254
256 gate->SetGoState(GO_STATE_ACTIVE);
258 gate->SetGoState(GO_STATE_ACTIVE);
259 }
260 }
@ GO_STATE_ACTIVE
Definition: GameObject.h:734
@ SAY_BRAON_ZIGGURAT_FALL_YELL
Definition: stratholme.h:85
Definition: Creature.h:46
Definition: GameObject.h:813
Map * instance
Definition: InstanceScript.h:146
void LoadGrid(float x, float y)
Definition: Map.cpp:494
GameObject * GetGameObject(ObjectGuid const guid)
Definition: Map.cpp:3295
Creature * GetCreature(ObjectGuid const guid)
Definition: Map.cpp:3290
ObjectGuid _slaughterGateGUID
Definition: instance_stratholme.cpp:581
ObjectGuid _gauntletGateGUID
Definition: instance_stratholme.cpp:582
uint32 _zigguratState3
Definition: instance_stratholme.cpp:570
uint32 _zigguratState2
Definition: instance_stratholme.cpp:569
ObjectGuid _baronRivendareGUID
Definition: instance_stratholme.cpp:583
uint32 _zigguratState1
Definition: instance_stratholme.cpp:568

References _baronRivendareGUID, _gauntletGateGUID, _slaughterGateGUID, _zigguratState1, _zigguratState2, _zigguratState3, Map::GetCreature(), Map::GetGameObject(), GO_STATE_ACTIVE, InstanceScript::instance, Map::LoadGrid(), and SAY_BRAON_ZIGGURAT_FALL_YELL.

Referenced by SetData().

◆ DoSpawnPlaguedCritters()

void instance_stratholme::instance_stratholme_InstanceMapScript::DoSpawnPlaguedCritters ( uint8  ,
Player player 
)
inline
263 {
264 if (!player)
265 return;
266
267 uint32 uiEntry = aPlaguedCritters[urand(0, 2)];
268 for (uint8 i = 0; i < 30; ++i)
269 {
270 float x, y, z;
271 const Position pPos = { player->GetPositionX(), player->GetPositionY(), player->GetPositionZ(), player->GetOrientation() };
272 player->GetRandomPoint(pPos, 8.0f, x, y, z);
273 z = player->GetPositionZ() + 1;
274 player->SummonCreature(uiEntry, x, y, z, 0, TEMPSUMMON_DEAD_DESPAWN, 0)->AI()->AttackStart(player);
275 }
276 }
std::uint8_t uint8
Definition: Define.h:110
std::uint32_t uint32
Definition: Define.h:108
uint32 urand(uint32 min, uint32 max)
Definition: Random.cpp:44
@ TEMPSUMMON_DEAD_DESPAWN
Definition: Object.h:48
static const uint32 aPlaguedCritters[]
Definition: instance_stratholme.cpp:40
virtual void AttackStart(Unit *)
Definition: UnitAI.cpp:28
CreatureAI * AI() const
Definition: Creature.h:134
TempSummon * SummonCreature(uint32 id, const Position &pos, TempSummonType spwtype=TEMPSUMMON_MANUAL_DESPAWN, uint32 despwtime=0, uint32 vehId=0, SummonPropertiesEntry const *properties=nullptr) const
Definition: Object.cpp:2303
void GetRandomPoint(const Position &srcPos, float distance, float &rand_x, float &rand_y, float &rand_z) const
Definition: Object.cpp:1504
Definition: Position.h:28
float GetPositionZ() const
Definition: Position.h:119
float GetOrientation() const
Definition: Position.h:120
float GetPositionX() const
Definition: Position.h:117
float GetPositionY() const
Definition: Position.h:118

References Creature::AI(), aPlaguedCritters, UnitAI::AttackStart(), Position::GetOrientation(), Position::GetPositionX(), Position::GetPositionY(), Position::GetPositionZ(), WorldObject::GetRandomPoint(), WorldObject::SummonCreature(), TEMPSUMMON_DEAD_DESPAWN, and urand().

Referenced by gate_critter_delay().

◆ gate_critter_delay()

void instance_stratholme::instance_stratholme_InstanceMapScript::gate_critter_delay ( int  gate)
inlineprivate
602 {
604 {
606 {
607 DoSpawnPlaguedCritters(gate, pPlayer);
608 }
609 }
610 }
Player * GetPlayer(Map const *, ObjectGuid const guid)
Definition: ObjectAccessor.cpp:225
Definition: Player.h:1046
ObjectGuid _trappedPlayerGUID
Definition: instance_stratholme.cpp:586
void DoSpawnPlaguedCritters(uint8, Player *player)
Definition: instance_stratholme.cpp:262

References _trappedPlayerGUID, DoSpawnPlaguedCritters(), ObjectAccessor::GetPlayer(), and InstanceScript::instance.

Referenced by Update().

◆ gate_delay()

void instance_stratholme::instance_stratholme_InstanceMapScript::gate_delay ( int  gate)
inlineprivate
590 {
591 if (_trapGatesGUIDs[2 * gate])
592 {
594 }
595 if (_trapGatesGUIDs[2 * gate + 1])
596 {
597 DoUseDoorOrButton(_trapGatesGUIDs[2 * gate + 1]);
598 }
599 }
void DoUseDoorOrButton(ObjectGuid guid, uint32 withRestoreTime=0, bool useAlternativeState=false)
Definition: InstanceScript.cpp:365
ObjectGuid _trapGatesGUIDs[4]
Definition: instance_stratholme.cpp:587

References _trapGatesGUIDs, and InstanceScript::DoUseDoorOrButton().

Referenced by Update().

◆ GetData()

uint32 instance_stratholme::instance_stratholme_InstanceMapScript::GetData ( uint32  type) const
inlineoverridevirtual

Reimplemented from ZoneScript.

381 {
382 switch (type)
383 {
384 case TYPE_ZIGGURAT1:
385 return _zigguratState1;
386 case TYPE_ZIGGURAT2:
387 return _zigguratState2;
388 case TYPE_ZIGGURAT3:
389 return _zigguratState3;
390 case TYPE_MALLOW:
391 return _postboxesOpened;
392 }
393 return 0;
394 }
@ TYPE_ZIGGURAT3
Definition: stratholme.h:30
@ TYPE_ZIGGURAT1
Definition: stratholme.h:28
@ TYPE_ZIGGURAT2
Definition: stratholme.h:29
@ TYPE_MALLOW
Definition: stratholme.h:32
uint32 _postboxesOpened
Definition: instance_stratholme.cpp:573

References _postboxesOpened, _zigguratState1, _zigguratState2, _zigguratState3, TYPE_MALLOW, TYPE_ZIGGURAT1, TYPE_ZIGGURAT2, and TYPE_ZIGGURAT3.

Referenced by OnGameObjectCreate().

◆ GetSaveData()

std::string instance_stratholme::instance_stratholme_InstanceMapScript::GetSaveData ( )
inlineoverridevirtual

Reimplemented from InstanceScript.

348 {
349 std::ostringstream saveStream;
350 saveStream << "S T " << _baronRunProgress << ' ' << _baronRunTime << ' ' << _zigguratState1 << ' ' << _zigguratState2 << ' ' << _zigguratState3 << ' ' << _slaughterProgress << ' ' << _postboxesOpened;
351 return saveStream.str();
352 }
uint32 _baronRunTime
Definition: instance_stratholme.cpp:567
uint32 _baronRunProgress
Definition: instance_stratholme.cpp:566
uint32 _slaughterProgress
Definition: instance_stratholme.cpp:571

References _baronRunProgress, _baronRunTime, _postboxesOpened, _slaughterProgress, _zigguratState1, _zigguratState2, and _zigguratState3.

◆ Initialize()

void instance_stratholme::instance_stratholme_InstanceMapScript::Initialize ( )
inlineoverridevirtual

Reimplemented from InstanceScript.

66 {
68 _baronRunTime = 0;
75
76 _gateTrapsCooldown[0] = false;
77 _gateTrapsCooldown[1] = false;
78
79 events.Reset();
80 }
events
Definition: boss_sartura.cpp:43
uint32 _slaughterNPCs
Definition: instance_stratholme.cpp:572
bool _gateTrapsCooldown[2]
Definition: instance_stratholme.cpp:585

References _baronRunProgress, _baronRunTime, _gateTrapsCooldown, _postboxesOpened, _slaughterNPCs, _slaughterProgress, _zigguratState1, _zigguratState2, and _zigguratState3.

◆ Load()

void instance_stratholme::instance_stratholme_InstanceMapScript::Load ( const char *  in)
inlineoverridevirtual

Reimplemented from InstanceScript.

355 {
356 if (!in)
357 return;
358
359 char dataHead1, dataHead2;
360 std::istringstream loadStream(in);
361 loadStream >> dataHead1 >> dataHead2;
362 if (dataHead1 == 'S' && dataHead2 == 'T')
363 {
364 loadStream >> _baronRunProgress;
365 loadStream >> _baronRunTime;
366 loadStream >> _zigguratState1;
367 loadStream >> _zigguratState2;
368 loadStream >> _zigguratState3;
369 loadStream >> _slaughterProgress;
370 loadStream >> _postboxesOpened;
371 }
372
373 if (_baronRunTime > 0)
374 events.ScheduleEvent(EVENT_BARON_TIME, 60000);
375
377 events.ScheduleEvent(EVENT_FORCE_SLAUGHTER_EVENT, 5000);
378 }
@ EVENT_BARON_TIME
Definition: stratholme.h:92
@ EVENT_FORCE_SLAUGHTER_EVENT
Definition: stratholme.h:94

References _baronRunProgress, _baronRunTime, _postboxesOpened, _slaughterProgress, _zigguratState1, _zigguratState2, _zigguratState3, EVENT_BARON_TIME, and EVENT_FORCE_SLAUGHTER_EVENT.

◆ OnCreatureCreate()

void instance_stratholme::instance_stratholme_InstanceMapScript::OnCreatureCreate ( Creature creature)
inlineoverridevirtual

Reimplemented from InstanceScript.

90 {
91 switch (creature->GetEntry())
92 {
94 _baronRivendareGUID = creature->GetGUID();
95 break;
97 case NPC_BILE_SPEWER:
98 if (_slaughterProgress == 0)
100 break;
102 if (_slaughterProgress == 1)
104 break;
106 if (_slaughterProgress == 2)
108 break;
109 case NPC_BLACK_GUARD:
110 if (_slaughterProgress == 3)
112 break;
113 }
114 }
@ NPC_MINDLESS_UNDEAD
Definition: stratholme.h:46
@ NPC_BLACK_GUARD
Definition: stratholme.h:47
@ NPC_BILE_SPEWER
Definition: stratholme.h:43
@ NPC_BARON_RIVENDARE
Definition: stratholme.h:42
@ NPC_RAMSTEIN_THE_GORGER
Definition: stratholme.h:45
@ NPC_VENOM_BELCHER
Definition: stratholme.h:44
uint32 GetEntry() const
Definition: Object.h:109
static ObjectGuid GetGUID(Object const *o)
Definition: Object.h:106

References _baronRivendareGUID, _slaughterNPCs, _slaughterProgress, Object::GetEntry(), Object::GetGUID(), NPC_BARON_RIVENDARE, NPC_BILE_SPEWER, NPC_BLACK_GUARD, NPC_MINDLESS_UNDEAD, NPC_RAMSTEIN_THE_GORGER, and NPC_VENOM_BELCHER.

◆ OnGameObjectCreate()

void instance_stratholme::instance_stratholme_InstanceMapScript::OnGameObjectCreate ( GameObject go)
inlineoverridevirtual

Reimplemented from InstanceScript.

171 {
172 switch (go->GetEntry())
173 {
175 case GO_HOARD_DOOR:
179 go->UpdateSaveToDb(true);
180 break;
182 go->UpdateSaveToDb(true);
184 if (GetData(TYPE_ZIGGURAT1) >= 1)
186 break;
188 go->UpdateSaveToDb(true);
190 if (GetData(TYPE_ZIGGURAT2) >= 1)
192 break;
194 go->UpdateSaveToDb(true);
196 if (GetData(TYPE_ZIGGURAT3) >= 1)
198 break;
199 case GO_GAUNTLET_GATE:
200 go->UpdateSaveToDb(true);
202 if (_zigguratState1 == 2 && _zigguratState2 == 2 && _zigguratState3 == 2)
204 break;
206 go->UpdateSaveToDb(true);
208 if (_zigguratState1 == 2 && _zigguratState2 == 2 && _zigguratState3 == 2)
210 break;
212 go->UpdateSaveToDb(true);
214 if (_slaughterProgress == 4)
216 break;
218 go->UpdateSaveToDb(true);
220 if (_slaughterProgress == 4)
222 break;
224 go->UpdateSaveToDb(true);
225 if (_slaughterProgress >= 2)
227 break;
229 go->UpdateSaveToDb(true);
230 _trapGatesGUIDs[0] = go->GetGUID();
231 break;
233 go->UpdateSaveToDb(true);
234 _trapGatesGUIDs[1] = go->GetGUID();
235 break;
237 go->UpdateSaveToDb(true);
238 _trapGatesGUIDs[2] = go->GetGUID();
239 break;
241 go->UpdateSaveToDb(true);
242 _trapGatesGUIDs[3] = go->GetGUID();
243 break;
244 }
245 }
@ GO_PORT_TRAP_GATE_4
Definition: stratholme.h:77
@ GO_PORT_TRAP_GATE_1
Definition: stratholme.h:74
@ GO_SLAUGTHER_GATE
Definition: stratholme.h:71
@ GO_GAUNTLET_DOOR_1
Definition: stratholme.h:63
@ GO_ZIGGURAT_DOORS4
Definition: stratholme.h:68
@ GO_HALL_OF_HIGH_COMMAND
Definition: stratholme.h:62
@ GO_ZIGGURAT_DOORS1
Definition: stratholme.h:65
@ GO_PORT_TRAP_GATE_3
Definition: stratholme.h:76
@ GO_ZIGGURAT_DOORS5
Definition: stratholme.h:69
@ GO_GAUNTLET_GATE
Definition: stratholme.h:70
@ GO_ZIGGURAT_DOORS2
Definition: stratholme.h:66
@ GO_PORT_TRAP_GATE_2
Definition: stratholme.h:75
@ GO_ZIGGURAT_DOORS3
Definition: stratholme.h:67
@ GO_GAUNTLET_DOOR_2
Definition: stratholme.h:64
@ GO_CRUSADER_SQUARE_DOOR
Definition: stratholme.h:60
@ GO_SLAUGHTER_GATE_SIDE
Definition: stratholme.h:72
@ GO_HOARD_DOOR
Definition: stratholme.h:61
void SetGoState(GOState state)
Definition: GameObject.cpp:2441
void UpdateSaveToDb(bool enable)
Definition: GameObject.cpp:2549
ObjectGuid _zigguratDoorsGUID4
Definition: instance_stratholme.cpp:579
ObjectGuid _zigguratDoorsGUID1
Definition: instance_stratholme.cpp:576
ObjectGuid _zigguratDoorsGUID2
Definition: instance_stratholme.cpp:577
ObjectGuid _zigguratDoorsGUID5
Definition: instance_stratholme.cpp:580
ObjectGuid _zigguratDoorsGUID3
Definition: instance_stratholme.cpp:578
uint32 GetData(uint32 type) const override
Definition: instance_stratholme.cpp:380

References _gauntletGateGUID, _slaughterGateGUID, _slaughterProgress, _trapGatesGUIDs, _zigguratDoorsGUID1, _zigguratDoorsGUID2, _zigguratDoorsGUID3, _zigguratDoorsGUID4, _zigguratDoorsGUID5, _zigguratState1, _zigguratState2, _zigguratState3, GetData(), Object::GetEntry(), Object::GetGUID(), GO_CRUSADER_SQUARE_DOOR, GO_GAUNTLET_DOOR_1, GO_GAUNTLET_DOOR_2, GO_GAUNTLET_GATE, GO_HALL_OF_HIGH_COMMAND, GO_HOARD_DOOR, GO_PORT_TRAP_GATE_1, GO_PORT_TRAP_GATE_2, GO_PORT_TRAP_GATE_3, GO_PORT_TRAP_GATE_4, GO_SLAUGHTER_GATE_SIDE, GO_SLAUGTHER_GATE, GO_STATE_ACTIVE, GO_ZIGGURAT_DOORS1, GO_ZIGGURAT_DOORS2, GO_ZIGGURAT_DOORS3, GO_ZIGGURAT_DOORS4, GO_ZIGGURAT_DOORS5, GameObject::SetGoState(), TYPE_ZIGGURAT1, TYPE_ZIGGURAT2, TYPE_ZIGGURAT3, and GameObject::UpdateSaveToDb().

◆ OnPlayerEnter()

void instance_stratholme::instance_stratholme_InstanceMapScript::OnPlayerEnter ( Player player)
inlineoverridevirtual

Reimplemented from InstanceScript.

83 {
84 if (_baronRunTime > 0)
85 if (Aura* aura = player->AddAura(SPELL_BARON_ULTIMATUM, player))
86 aura->SetDuration(_baronRunTime * MINUTE * IN_MILLISECONDS);
87 }
constexpr auto IN_MILLISECONDS
Definition: Common.h:62
constexpr auto MINUTE
Definition: Common.h:56
@ SPELL_BARON_ULTIMATUM
Definition: stratholme.h:104
Aura * AddAura(uint32 spellId, Unit *target)
Definition: Unit.cpp:19751
Definition: SpellAuras.h:87

References _baronRunTime, Unit::AddAura(), IN_MILLISECONDS, MINUTE, and SPELL_BARON_ULTIMATUM.

◆ OnUnitDeath()

void instance_stratholme::instance_stratholme_InstanceMapScript::OnUnitDeath ( Unit unit)
inlineoverridevirtual

Reimplemented from ZoneScript.

148 {
149 switch (unit->GetEntry())
150 {
152 case NPC_BILE_SPEWER:
155 case NPC_BLACK_GUARD:
156 if (--_slaughterNPCs == 0)
157 {
160 SaveToDB();
161 }
162 break;
164 events.CancelEvent(EVENT_BARON_TIME);
166 break;
167 }
168 }
void DoRemoveAurasDueToSpellOnPlayers(uint32 spell)
Definition: InstanceScript.cpp:486
void SaveToDB()
Definition: InstanceScript.cpp:40
void ProcessSlaughterEvent()
Definition: instance_stratholme.cpp:116

References _slaughterNPCs, _slaughterProgress, InstanceScript::DoRemoveAurasDueToSpellOnPlayers(), EVENT_BARON_TIME, Object::GetEntry(), NPC_BARON_RIVENDARE, NPC_BILE_SPEWER, NPC_BLACK_GUARD, NPC_MINDLESS_UNDEAD, NPC_RAMSTEIN_THE_GORGER, NPC_VENOM_BELCHER, ProcessSlaughterEvent(), InstanceScript::SaveToDB(), and SPELL_BARON_ULTIMATUM.

◆ ProcessSlaughterEvent()

void instance_stratholme::instance_stratholme_InstanceMapScript::ProcessSlaughterEvent ( )
inline
117 {
118 if (_slaughterProgress == 1)
119 {
121 baron->AI()->Talk(SAY_BRAON_SUMMON_RAMSTEIN);
122
123 Position pos = {4032.20f, -3378.06f, 119.75f, 4.67f};
125 }
126 if (_slaughterProgress == 2)
127 {
128 for (uint32 i = 0; i < 33; ++i)
129 events.ScheduleEvent(EVENT_SPAWN_MINDLESS, 5000 + i * 210);
131 if (GameObject* gate = baron->FindNearestGameObject(GO_SLAUGHTER_GATE_SIDE, 200.0f))
132 gate->SetGoState(GO_STATE_ACTIVE);
133 }
134 if (_slaughterProgress == 3)
135 {
136 events.ScheduleEvent(EVENT_SPAWN_BLACK_GUARD, 20000);
137 }
138 if (_slaughterProgress == 4)
139 {
141 baron->AI()->Talk(SAY_BARON_GUARD_DEAD);
143 gate->SetGoState(GO_STATE_ACTIVE);
144 }
145 }
@ SAY_BRAON_SUMMON_RAMSTEIN
Definition: stratholme.h:89
@ SAY_BARON_GUARD_DEAD
Definition: stratholme.h:90
@ EVENT_SPAWN_MINDLESS
Definition: stratholme.h:93
@ EVENT_SPAWN_BLACK_GUARD
Definition: stratholme.h:95
void Talk(uint8 id, WorldObject const *whisperTarget=nullptr)
Definition: CreatureAI.cpp:58
GameObject * FindNearestGameObject(uint32 entry, float range, bool onlySpawned=false) const
Definition: Object.cpp:2403
TempSummon * SummonCreature(uint32 entry, Position const &pos, SummonPropertiesEntry const *properties=nullptr, uint32 duration=0, WorldObject *summoner=nullptr, uint32 spellId=0, uint32 vehId=0)
Definition: Object.cpp:2117

References _baronRivendareGUID, _slaughterProgress, _zigguratDoorsGUID5, Creature::AI(), EVENT_SPAWN_BLACK_GUARD, EVENT_SPAWN_MINDLESS, WorldObject::FindNearestGameObject(), Map::GetCreature(), Map::GetGameObject(), GO_SLAUGHTER_GATE_SIDE, GO_STATE_ACTIVE, InstanceScript::instance, NPC_RAMSTEIN_THE_GORGER, SAY_BARON_GUARD_DEAD, SAY_BRAON_SUMMON_RAMSTEIN, Map::SummonCreature(), and CreatureAI::Talk().

Referenced by OnUnitDeath(), and Update().

◆ SetData()

void instance_stratholme::instance_stratholme_InstanceMapScript::SetData ( uint32  type,
uint32  data 
)
inlineoverridevirtual

Reimplemented from ZoneScript.

279 {
280 switch (type)
281 {
282 case TYPE_BARON_RUN:
283 {
285 {
287 _baronRunTime = 45;
289 events.ScheduleEvent(EVENT_BARON_TIME, 60000);
290
291 instance->LoadGrid(4035.83f, -3336.31f);
293 baron->AI()->Talk(SAY_BARON_INIT_YELL);
294 }
295 break;
296 }
297 case TYPE_ZIGGURAT1:
298 {
299 if (data == _zigguratState1 + 1)
301
302 if (_zigguratState1 == 1)
304 ziggurat->SetGoState(GO_STATE_ACTIVE);
305
307 break;
308 }
309 case TYPE_ZIGGURAT2:
310 {
311 if (data == _zigguratState2 + 1)
313
314 if (_zigguratState2 == 1)
316 ziggurat->SetGoState(GO_STATE_ACTIVE);
317
319 break;
320 }
321 case TYPE_ZIGGURAT3:
322 {
323 if (data == _zigguratState3 + 1)
325
326 if (_zigguratState3 == 1)
328 ziggurat->SetGoState(GO_STATE_ACTIVE);
329
331 break;
332 }
333 case TYPE_BARON_FIGHT:
334 {
336 gate->SetGoState(data == IN_PROGRESS ? GO_STATE_READY : GO_STATE_ACTIVE);
337 return;
338 }
339 case TYPE_MALLOW:
341 break;
342 }
343
344 SaveToDB();
345 }
@ GO_STATE_READY
Definition: GameObject.h:735
@ IN_PROGRESS
Definition: InstanceScript.h:57
@ SAY_BARON_INIT_YELL
Definition: stratholme.h:84
@ TYPE_BARON_FIGHT
Definition: stratholme.h:31
@ DATA_BARON_RUN_NONE
Definition: stratholme.h:34
@ DATA_BARON_RUN_GATE
Definition: stratholme.h:35
@ TYPE_BARON_RUN
Definition: stratholme.h:27
void DoCastSpellOnPlayers(uint32 spell)
Definition: InstanceScript.cpp:504
void CheckZiggurats()
Definition: instance_stratholme.cpp:247

References _baronRivendareGUID, _baronRunProgress, _baronRunTime, _postboxesOpened, _zigguratDoorsGUID1, _zigguratDoorsGUID2, _zigguratDoorsGUID3, _zigguratDoorsGUID5, _zigguratState1, _zigguratState2, _zigguratState3, CheckZiggurats(), DATA_BARON_RUN_GATE, DATA_BARON_RUN_NONE, InstanceScript::DoCastSpellOnPlayers(), EVENT_BARON_TIME, Map::GetCreature(), Map::GetGameObject(), GO_STATE_ACTIVE, GO_STATE_READY, IN_PROGRESS, InstanceScript::instance, Map::LoadGrid(), InstanceScript::SaveToDB(), SAY_BARON_INIT_YELL, SPELL_BARON_ULTIMATUM, TYPE_BARON_FIGHT, TYPE_BARON_RUN, TYPE_MALLOW, TYPE_ZIGGURAT1, TYPE_ZIGGURAT2, and TYPE_ZIGGURAT3.

◆ Update()

void instance_stratholme::instance_stratholme_InstanceMapScript::Update ( uint32  diff)
inlineoverridevirtual

Reimplemented from InstanceScript.

397 {
398 events.Update(diff);
399
400 Map::PlayerList const& players = instance->GetPlayers();
401 // Loop over the two Gate traps, each one has up to three timers (trap reset, gate opening delay, critters spawning delay)
402 for (uint8 i = 0; i < 2; i++)
403 {
404 // if the gate is in cooldown, skip the other checks
405 if (_gateTrapsCooldown[i])
406 break;
407
408 // Check that the trap is not on cooldown, if so check if player/pet is in range
409 for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr)
410 {
411 if (Player* player = itr->GetSource())
412 {
413 // should pet also trigger the trap? could not find any source for it
414 if (!player->IsGameMaster() && player->IsWithinDist2d(aGateTrap[i].m_positionX, aGateTrap[i].m_positionY, 5.5f))
415 {
416 // Check if timer was not already set by another player/pet a few milliseconds before
417 if (_gateTrapsCooldown[i])
418 return;
419
420 _gateTrapsCooldown[i] = true;
421
422 // close the gates
423 if (_trapGatesGUIDs[2 * i])
425 if (_trapGatesGUIDs[2 * i + 1])
427
428 _trappedPlayerGUID = player->GetGUID();
429
430 if (i == 0)
431 {
432 // set timer to reset the trap
433 events.ScheduleEvent(EVENT_GATE1_TRAP, 30 * MINUTE * IN_MILLISECONDS);
434 // set timer to reopen gates
435 events.ScheduleEvent(EVENT_GATE1_DELAY, 20 * IN_MILLISECONDS);
436 // set timer to spawn the plagued critters
438 }
439 else if (i == 1)
440 {
441 // set timer to reset the trap
442 events.ScheduleEvent(EVENT_GATE2_TRAP, 30 * MINUTE * IN_MILLISECONDS);
443 // set timer to reopen gates
444 events.ScheduleEvent(EVENT_GATE2_DELAY, 20 * IN_MILLISECONDS);
445 // set timer to spawn the plagued critters
447 }
448 }
449 }
450 }
451 }
452
453 const int GATE1 = 0;
454 const int GATE2 = 1;
455
456 switch (events.ExecuteEvent())
457 {
458 case EVENT_GATE1_TRAP:
459 _gateTrapsCooldown[GATE1] = false;
460 break;
461 case EVENT_GATE2_TRAP:
462 _gateTrapsCooldown[GATE2] = false;
463 break;
465 gate_delay(GATE1);
466 break;
468 gate_delay(GATE2);
469 break;
471 gate_critter_delay(GATE1);
472 break;
474 gate_critter_delay(GATE2);
475 break;
476 case EVENT_BARON_TIME:
477 {
479 instance->LoadGrid(4035.83f, -3336.31f);
481 if (baron && !baron->IsInCombat())
482 {
483 switch (_baronRunTime)
484 {
485 case 10:
486 baron->AI()->Talk(SAY_BARON_10M);
487 break;
488 case 5:
489 baron->AI()->Talk(SAY_BARON_5M);
490 if (Creature* ysida = baron->FindNearestCreature(NPC_YSIDA, 50.0f))
491 ysida->AI()->SetData(1, 1);
492 break;
493 case 0:
494 baron->AI()->Talk(SAY_BARON_0M);
496 break;
497 }
498 }
499
500 if (_baronRunTime > 0)
501 events.ScheduleEvent(EVENT_BARON_TIME, 60000);
502 else
503 events.ScheduleEvent(EVENT_EXECUTE_PRISONER, 0);
504
505 SaveToDB();
506 break;
507 }
509 {
510 instance->LoadGrid(4035.83f, -3336.31f);
512 if (baron && baron->IsAlive())
513 {
514 if (!baron->IsInCombat())
515 {
517 if (Creature* ysida = baron->FindNearestCreature(NPC_YSIDA, 50.0f))
518 Unit::Kill(baron, ysida);
519 }
520 else
521 events.ScheduleEvent(EVENT_EXECUTE_PRISONER, 1000);
522 }
523 break;
524 }
526 {
527 Position pos = {3941.75f, -3393.06f, 119.70f, 0.0f};
529 break;
530 }
532 {
533 Map::PlayerList const& PlayerList = instance->GetPlayers();
534 if (!PlayerList.IsEmpty())
535 for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i)
536 if (Player* player = i->GetSource())
537 if (player->GetDistance2d(4034.97f, -3402.13f) < 50.0f)
538 {
540 return;
541 }
542
543 events.ScheduleEvent(EVENT_FORCE_SLAUGHTER_EVENT, 3000);
544 break;
545 }
547 {
548 for (uint8 i = 0; i < 5; ++i)
550 {
551 guard->SetWalk(true);
552 guard->GetMotionMaster()->MovePoint(0, BlackGuardPos[i + 5]);
553 guard->SetHomePosition(BlackGuardPos[i + 5]);
554 if (i == 0 && guard->AI())
555 guard->AI()->Talk(SAY_BLACK_GUARD_INIT);
556 }
557
559 gate->SetGoState(GO_STATE_ACTIVE);
560 break;
561 }
562 }
563 }
const Position BlackGuardPos[10]
Definition: instance_stratholme.cpp:24
static const Position aGateTrap[]
Definition: instance_stratholme.cpp:46
@ EVENT_GATE1_TRAP
Definition: stratholme.h:97
@ SAY_BLACK_GUARD_INIT
Definition: stratholme.h:83
@ SAY_BARON_10M
Definition: stratholme.h:86
@ SAY_BARON_0M
Definition: stratholme.h:88
@ EVENT_GATE1_DELAY
Definition: stratholme.h:98
@ EVENT_GATE1_CRITTER_DELAY
Definition: stratholme.h:99
@ SAY_BARON_5M
Definition: stratholme.h:87
@ EVENT_GATE2_CRITTER_DELAY
Definition: stratholme.h:102
@ EVENT_GATE2_DELAY
Definition: stratholme.h:101
@ EVENT_EXECUTE_PRISONER
Definition: stratholme.h:96
@ EVENT_GATE2_TRAP
Definition: stratholme.h:100
@ NPC_YSIDA
Definition: stratholme.h:48
@ EMOTE_ONESHOT_ATTACK1H
Definition: SharedDefines.h:1898
bool IsEmpty() const
Definition: LinkedList.h:97
Definition: LinkedList.h:139
Creature * FindNearestCreature(uint32 entry, float range, bool alive=true) const
Definition: Object.cpp:2394
float m_positionX
Definition: Position.h:56
float m_positionY
Definition: Position.h:57
static void Kill(Unit *killer, Unit *victim, bool durabilityLoss=true, WeaponAttackType attackType=BASE_ATTACK, SpellInfo const *spellProto=nullptr, Spell const *spell=nullptr)
Definition: Unit.cpp:18608
bool IsAlive() const
Definition: Unit.h:2024
void HandleEmoteCommand(uint32 emoteId)
Definition: Unit.cpp:2345
bool IsInCombat() const
Definition: Unit.h:1724
PlayerList const & GetPlayers() const
Definition: Map.h:484
Definition: MapRefMgr.h:26
iterator begin()
Definition: MapRefMgr.h:36
iterator end()
Definition: MapRefMgr.h:37
void gate_delay(int gate)
Definition: instance_stratholme.cpp:589
void gate_critter_delay(int gate)
Definition: instance_stratholme.cpp:601

References _baronRivendareGUID, _baronRunTime, _gateTrapsCooldown, _trapGatesGUIDs, _trappedPlayerGUID, _zigguratDoorsGUID4, aGateTrap, Creature::AI(), MapRefMgr::begin(), BlackGuardPos, InstanceScript::DoRemoveAurasDueToSpellOnPlayers(), InstanceScript::DoUseDoorOrButton(), EMOTE_ONESHOT_ATTACK1H, MapRefMgr::end(), EVENT_BARON_TIME, EVENT_EXECUTE_PRISONER, EVENT_FORCE_SLAUGHTER_EVENT, EVENT_GATE1_CRITTER_DELAY, EVENT_GATE1_DELAY, EVENT_GATE1_TRAP, EVENT_GATE2_CRITTER_DELAY, EVENT_GATE2_DELAY, EVENT_GATE2_TRAP, EVENT_SPAWN_BLACK_GUARD, EVENT_SPAWN_MINDLESS, WorldObject::FindNearestCreature(), gate_critter_delay(), gate_delay(), Map::GetCreature(), Map::GetGameObject(), Map::GetPlayers(), GO_STATE_ACTIVE, Unit::HandleEmoteCommand(), IN_MILLISECONDS, InstanceScript::instance, Unit::IsAlive(), LinkedListHead::IsEmpty(), Unit::IsInCombat(), Unit::Kill(), Map::LoadGrid(), Position::m_positionX, Position::m_positionY, MINUTE, NPC_BLACK_GUARD, NPC_MINDLESS_UNDEAD, NPC_YSIDA, ProcessSlaughterEvent(), InstanceScript::SaveToDB(), SAY_BARON_0M, SAY_BARON_10M, SAY_BARON_5M, SAY_BLACK_GUARD_INIT, SPELL_BARON_ULTIMATUM, Map::SummonCreature(), and CreatureAI::Talk().

Member Data Documentation

◆ _baronRivendareGUID

ObjectGuid instance_stratholme::instance_stratholme_InstanceMapScript::_baronRivendareGUID
private

◆ _baronRunProgress

uint32 instance_stratholme::instance_stratholme_InstanceMapScript::_baronRunProgress
private

Referenced by GetSaveData(), Initialize(), Load(), and SetData().

◆ _baronRunTime

uint32 instance_stratholme::instance_stratholme_InstanceMapScript::_baronRunTime
private

◆ _gateTrapsCooldown

bool instance_stratholme::instance_stratholme_InstanceMapScript::_gateTrapsCooldown[2]
private

Referenced by Initialize(), and Update().

◆ _gauntletGateGUID

ObjectGuid instance_stratholme::instance_stratholme_InstanceMapScript::_gauntletGateGUID
private

◆ _postboxesOpened

uint32 instance_stratholme::instance_stratholme_InstanceMapScript::_postboxesOpened
private

◆ _slaughterGateGUID

ObjectGuid instance_stratholme::instance_stratholme_InstanceMapScript::_slaughterGateGUID
private

◆ _slaughterNPCs

uint32 instance_stratholme::instance_stratholme_InstanceMapScript::_slaughterNPCs
private

◆ _slaughterProgress

uint32 instance_stratholme::instance_stratholme_InstanceMapScript::_slaughterProgress
private

◆ _trapGatesGUIDs

ObjectGuid instance_stratholme::instance_stratholme_InstanceMapScript::_trapGatesGUIDs[4]
private

◆ _trappedPlayerGUID

ObjectGuid instance_stratholme::instance_stratholme_InstanceMapScript::_trappedPlayerGUID
private

Referenced by gate_critter_delay(), and Update().

◆ _zigguratDoorsGUID1

ObjectGuid instance_stratholme::instance_stratholme_InstanceMapScript::_zigguratDoorsGUID1
private

Referenced by OnGameObjectCreate(), and SetData().

◆ _zigguratDoorsGUID2

ObjectGuid instance_stratholme::instance_stratholme_InstanceMapScript::_zigguratDoorsGUID2
private

Referenced by OnGameObjectCreate(), and SetData().

◆ _zigguratDoorsGUID3

ObjectGuid instance_stratholme::instance_stratholme_InstanceMapScript::_zigguratDoorsGUID3
private

Referenced by OnGameObjectCreate(), and SetData().

◆ _zigguratDoorsGUID4

ObjectGuid instance_stratholme::instance_stratholme_InstanceMapScript::_zigguratDoorsGUID4
private

Referenced by OnGameObjectCreate(), and Update().

◆ _zigguratDoorsGUID5

ObjectGuid instance_stratholme::instance_stratholme_InstanceMapScript::_zigguratDoorsGUID5
private

◆ _zigguratState1

uint32 instance_stratholme::instance_stratholme_InstanceMapScript::_zigguratState1
private

◆ _zigguratState2

uint32 instance_stratholme::instance_stratholme_InstanceMapScript::_zigguratState2
private

◆ _zigguratState3

uint32 instance_stratholme::instance_stratholme_InstanceMapScript::_zigguratState3
private

◆ events

EventMap instance_stratholme::instance_stratholme_InstanceMapScript::events
private