AzerothCore 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
 
void ReadSaveDataMore (std::istringstream &data) override
 
void WriteSaveDataMore (std::ostringstream &data) 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)
 
void DoCastSpellOnPlayer (Player *player, uint32 spell, bool includePets, bool includeControlled)
 
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
 
uint32 GetPersistentData (uint32 index) const
 
void StorePersistentData (uint32 index, uint32 data)
 
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)
 
void DoForAllMinions (uint32 id, std::function< void(Creature *)> exec)
 
- 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
 
TaskScheduler scheduler
 
- Protected Member Functions inherited from InstanceScript
void SetHeaders (std::string const &dataHeaders)
 
void SetBossNumber (uint32 number)
 
void SetPersistentDataCount (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=true)
 
void RemoveObject (Creature *obj)
 
void AddObject (GameObject *obj, bool add=true)
 
void RemoveObject (GameObject *obj)
 
void AddObject (WorldObject *obj, uint32 type, bool add=true)
 
void RemoveObject (WorldObject *obj, uint32 type)
 
void AddDoor (GameObject *door, bool add=true)
 
void RemoveDoor (GameObject *door)
 
void AddMinion (Creature *minion, bool add=true)
 
void RemoveMinion (Creature *minion)
 
void UpdateDoorState (GameObject *door)
 
void UpdateMinionState (Creature *minion, EncounterState state)
 
bool ReadSaveDataHeaders (std::istringstream &data)
 
void ReadSaveDataBossStates (std::istringstream &data)
 
void ReadSavePersistentData (std::istringstream &data)
 
virtual void ReadSaveDataMore (std::istringstream &)
 
void WriteSaveDataHeaders (std::ostringstream &data)
 
void WriteSaveDataBossStates (std::ostringstream &data)
 
void WritePersistentData (std::ostringstream &data)
 
virtual void WriteSaveDataMore (std::ostringstream &)
 

Detailed Description

Constructor & Destructor Documentation

◆ instance_stratholme_InstanceMapScript()

instance_stratholme::instance_stratholme_InstanceMapScript::instance_stratholme_InstanceMapScript ( Map map)
inline
62 : InstanceScript(map)
63 {
65 }
#define DataHeader
Definition: blackrock_depths.h:23
Definition: InstanceScript.h:141
void SetHeaders(std::string const &dataHeaders)
Definition: InstanceScript.cpp:137

References DataHeader, and InstanceScript::SetHeaders().

Member Function Documentation

◆ CheckZiggurats()

void instance_stratholme::instance_stratholme_InstanceMapScript::CheckZiggurats ( )
inline
250 {
251 if (_zigguratState1 == 2 && _zigguratState2 == 2 && _zigguratState3 == 2)
252 {
253 instance->LoadGrid(4035.83f, -3336.31f);
255 baron->AI()->Talk(SAY_BRAON_ZIGGURAT_FALL_YELL);
256
258 gate->SetGoState(GO_STATE_ACTIVE);
260 gate->SetGoState(GO_STATE_ACTIVE);
261 }
262 }
@ GO_STATE_ACTIVE
Definition: GameObjectData.h:690
@ SAY_BRAON_ZIGGURAT_FALL_YELL
Definition: stratholme.h:86
Definition: Creature.h:46
Definition: GameObject.h:122
Map * instance
Definition: InstanceScript.h:147
void LoadGrid(float x, float y)
Definition: Map.cpp:492
GameObject * GetGameObject(ObjectGuid const guid)
Definition: Map.cpp:3312
Creature * GetCreature(ObjectGuid const guid)
Definition: Map.cpp:3307
ObjectGuid _slaughterGateGUID
Definition: instance_stratholme.cpp:582
ObjectGuid _gauntletGateGUID
Definition: instance_stratholme.cpp:583
uint32 _zigguratState3
Definition: instance_stratholme.cpp:571
uint32 _zigguratState2
Definition: instance_stratholme.cpp:570
ObjectGuid _baronRivendareGUID
Definition: instance_stratholme.cpp:584
uint32 _zigguratState1
Definition: instance_stratholme.cpp:569

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
265 {
266 if (!player)
267 return;
268
269 uint32 uiEntry = aPlaguedCritters[urand(0, 2)];
270 for (uint8 i = 0; i < 30; ++i)
271 {
272 float x, y, z;
273 const Position pPos = { player->GetPositionX(), player->GetPositionY(), player->GetPositionZ(), player->GetOrientation() };
274 player->GetRandomPoint(pPos, 8.0f, x, y, z);
275 z = player->GetPositionZ() + 1;
276 player->SummonCreature(uiEntry, x, y, z, 0, TEMPSUMMON_DEAD_DESPAWN, 0)->AI()->AttackStart(player);
277 }
278 }
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:41
virtual void AttackStart(Unit *)
Definition: UnitAI.cpp:27
CreatureAI * AI() const
Definition: Creature.h:136
TempSummon * SummonCreature(uint32 id, const Position &pos, TempSummonType spwtype=TEMPSUMMON_MANUAL_DESPAWN, uint32 despwtime=0, uint32 vehId=0, SummonPropertiesEntry const *properties=nullptr, bool visibleBySummonerOnly=false) const
Definition: Object.cpp:2343
void GetRandomPoint(const Position &srcPos, float distance, float &rand_x, float &rand_y, float &rand_z) const
Definition: Object.cpp:1502
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
603 {
605 {
607 {
608 DoSpawnPlaguedCritters(gate, pPlayer);
609 }
610 }
611 }
Player * GetPlayer(Map const *, ObjectGuid const guid)
Definition: ObjectAccessor.cpp:223
Definition: Player.h:1056
ObjectGuid _trappedPlayerGUID
Definition: instance_stratholme.cpp:587
void DoSpawnPlaguedCritters(uint8, Player *player)
Definition: instance_stratholme.cpp:264

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

Referenced by Update().

◆ gate_delay()

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

References _trapGatesGUIDs, and InstanceScript::DoUseDoorOrButton().

Referenced by Update().

◆ GetData()

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

Reimplemented from ZoneScript.

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

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

Referenced by OnGameObjectCreate().

◆ Initialize()

void instance_stratholme::instance_stratholme_InstanceMapScript::Initialize ( )
inlineoverridevirtual

Reimplemented from InstanceScript.

68 {
70 _baronRunTime = 0;
77
78 _gateTrapsCooldown[0] = false;
79 _gateTrapsCooldown[1] = false;
80
81 events.Reset();
82 }
events
Definition: boss_sartura.cpp:43
uint32 _slaughterNPCs
Definition: instance_stratholme.cpp:573
bool _gateTrapsCooldown[2]
Definition: instance_stratholme.cpp:586
uint32 _baronRunTime
Definition: instance_stratholme.cpp:568
uint32 _baronRunProgress
Definition: instance_stratholme.cpp:567
uint32 _slaughterProgress
Definition: instance_stratholme.cpp:572

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

◆ OnCreatureCreate()

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

Reimplemented from InstanceScript.

92 {
93 switch (creature->GetEntry())
94 {
96 _baronRivendareGUID = creature->GetGUID();
97 break;
99 case NPC_BILE_SPEWER:
100 if (_slaughterProgress == 0)
102 break;
104 if (_slaughterProgress == 1)
106 break;
108 if (_slaughterProgress == 2)
110 break;
111 case NPC_BLACK_GUARD:
112 if (_slaughterProgress == 3)
114 break;
115 }
116 }
@ NPC_MINDLESS_UNDEAD
Definition: stratholme.h:47
@ NPC_BLACK_GUARD
Definition: stratholme.h:48
@ NPC_BILE_SPEWER
Definition: stratholme.h:44
@ NPC_BARON_RIVENDARE
Definition: stratholme.h:43
@ NPC_RAMSTEIN_THE_GORGER
Definition: stratholme.h:46
@ NPC_VENOM_BELCHER
Definition: stratholme.h:45
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.

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

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.

85 {
86 if (_baronRunTime > 0)
87 if (Aura* aura = player->AddAura(SPELL_BARON_ULTIMATUM, player))
88 aura->SetDuration(_baronRunTime * MINUTE * IN_MILLISECONDS);
89 }
constexpr auto IN_MILLISECONDS
Definition: Common.h:55
constexpr auto MINUTE
Definition: Common.h:49
@ SPELL_BARON_ULTIMATUM
Definition: stratholme.h:105
Aura * AddAura(uint32 spellId, Unit *target)
Definition: Unit.cpp:19127
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.

150 {
151 switch (unit->GetEntry())
152 {
154 case NPC_BILE_SPEWER:
157 case NPC_BLACK_GUARD:
158 if (--_slaughterNPCs == 0)
159 {
162 SaveToDB();
163 }
164 break;
166 events.CancelEvent(EVENT_BARON_TIME);
168 break;
169 }
170 }
@ EVENT_BARON_TIME
Definition: stratholme.h:93
void DoRemoveAurasDueToSpellOnPlayers(uint32 spell)
Definition: InstanceScript.cpp:638
void SaveToDB()
Definition: InstanceScript.cpp:40
void ProcessSlaughterEvent()
Definition: instance_stratholme.cpp:118

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
119 {
120 if (_slaughterProgress == 1)
121 {
123 baron->AI()->Talk(SAY_BRAON_SUMMON_RAMSTEIN);
124
125 Position pos = {4032.20f, -3378.06f, 119.75f, 4.67f};
127 }
128 if (_slaughterProgress == 2)
129 {
130 for (uint32 i = 0; i < 33; ++i)
131 events.ScheduleEvent(EVENT_SPAWN_MINDLESS, 5000 + i * 210);
133 if (GameObject* gate = baron->FindNearestGameObject(GO_SLAUGHTER_GATE_SIDE, 200.0f))
134 gate->SetGoState(GO_STATE_ACTIVE);
135 }
136 if (_slaughterProgress == 3)
137 {
138 events.ScheduleEvent(EVENT_SPAWN_BLACK_GUARD, 20000);
139 }
140 if (_slaughterProgress == 4)
141 {
143 baron->AI()->Talk(SAY_BARON_GUARD_DEAD);
145 gate->SetGoState(GO_STATE_ACTIVE);
146 }
147 }
@ SAY_BRAON_SUMMON_RAMSTEIN
Definition: stratholme.h:90
@ SAY_BARON_GUARD_DEAD
Definition: stratholme.h:91
@ EVENT_SPAWN_MINDLESS
Definition: stratholme.h:94
@ EVENT_SPAWN_BLACK_GUARD
Definition: stratholme.h:96
void Talk(uint8 id, WorldObject const *whisperTarget=nullptr, Milliseconds delay=0s)
Causes the creature to talk/say the text assigned to their entry in the creature_text database table.
Definition: CreatureAI.cpp:49
GameObject * FindNearestGameObject(uint32 entry, float range, bool onlySpawned=false) const
Definition: Object.cpp:2443
TempSummon * SummonCreature(uint32 entry, Position const &pos, SummonPropertiesEntry const *properties=nullptr, uint32 duration=0, WorldObject *summoner=nullptr, uint32 spellId=0, uint32 vehId=0, bool visibleBySummonerOnly=false)
Definition: Object.cpp:2154

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().

◆ ReadSaveDataMore()

void instance_stratholme::instance_stratholme_InstanceMapScript::ReadSaveDataMore ( std::istringstream &  data)
inlineoverridevirtual

Reimplemented from InstanceScript.

350 {
351 data >> _baronRunProgress;
352 data >> _baronRunTime;
353 data >> _zigguratState1;
354 data >> _zigguratState2;
355 data >> _zigguratState3;
356 data >> _slaughterProgress;
357 data >> _postboxesOpened;
358
359 if (_baronRunTime)
360 {
361 events.ScheduleEvent(EVENT_BARON_TIME, 60000);
362 }
363
365 {
366 events.ScheduleEvent(EVENT_FORCE_SLAUGHTER_EVENT, 5000);
367 }
368 }
@ EVENT_FORCE_SLAUGHTER_EVENT
Definition: stratholme.h:95

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

◆ SetData()

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

Reimplemented from ZoneScript.

281 {
282 switch (type)
283 {
284 case TYPE_BARON_RUN:
285 {
287 {
289 _baronRunTime = 45;
291 events.ScheduleEvent(EVENT_BARON_TIME, 60000);
292
293 instance->LoadGrid(4035.83f, -3336.31f);
295 baron->AI()->Talk(SAY_BARON_INIT_YELL);
296 }
297 break;
298 }
299 case TYPE_ZIGGURAT1:
300 {
301 if (data == _zigguratState1 + 1)
303
304 if (_zigguratState1 == 1)
306 ziggurat->SetGoState(GO_STATE_ACTIVE);
307
309 break;
310 }
311 case TYPE_ZIGGURAT2:
312 {
313 if (data == _zigguratState2 + 1)
315
316 if (_zigguratState2 == 1)
318 ziggurat->SetGoState(GO_STATE_ACTIVE);
319
321 break;
322 }
323 case TYPE_ZIGGURAT3:
324 {
325 if (data == _zigguratState3 + 1)
327
328 if (_zigguratState3 == 1)
330 ziggurat->SetGoState(GO_STATE_ACTIVE);
331
333 break;
334 }
335 case TYPE_BARON_FIGHT:
336 {
338 gate->SetGoState(data == IN_PROGRESS ? GO_STATE_READY : GO_STATE_ACTIVE);
339 return;
340 }
341 case TYPE_MALLOW:
343 break;
344 }
345
346 SaveToDB();
347 }
@ GO_STATE_READY
Definition: GameObjectData.h:691
@ IN_PROGRESS
Definition: InstanceScript.h:58
@ SAY_BARON_INIT_YELL
Definition: stratholme.h:85
@ TYPE_BARON_FIGHT
Definition: stratholme.h:32
@ DATA_BARON_RUN_NONE
Definition: stratholme.h:35
@ DATA_BARON_RUN_GATE
Definition: stratholme.h:36
@ TYPE_BARON_RUN
Definition: stratholme.h:28
void DoCastSpellOnPlayers(uint32 spell)
Definition: InstanceScript.cpp:649
void CheckZiggurats()
Definition: instance_stratholme.cpp:249

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.

398 {
399 events.Update(diff);
400
401 Map::PlayerList const& players = instance->GetPlayers();
402 // Loop over the two Gate traps, each one has up to three timers (trap reset, gate opening delay, critters spawning delay)
403 for (uint8 i = 0; i < 2; i++)
404 {
405 // if the gate is in cooldown, skip the other checks
406 if (_gateTrapsCooldown[i])
407 break;
408
409 // Check that the trap is not on cooldown, if so check if player/pet is in range
410 for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr)
411 {
412 if (Player* player = itr->GetSource())
413 {
414 // should pet also trigger the trap? could not find any source for it
415 if (!player->IsGameMaster() && player->IsWithinDist2d(aGateTrap[i].m_positionX, aGateTrap[i].m_positionY, 5.5f))
416 {
417 // Check if timer was not already set by another player/pet a few milliseconds before
418 if (_gateTrapsCooldown[i])
419 return;
420
421 _gateTrapsCooldown[i] = true;
422
423 // close the gates
424 if (_trapGatesGUIDs[2 * i])
426 if (_trapGatesGUIDs[2 * i + 1])
428
429 _trappedPlayerGUID = player->GetGUID();
430
431 if (i == 0)
432 {
433 // set timer to reset the trap
434 events.ScheduleEvent(EVENT_GATE1_TRAP, 30 * MINUTE * IN_MILLISECONDS);
435 // set timer to reopen gates
436 events.ScheduleEvent(EVENT_GATE1_DELAY, 20 * IN_MILLISECONDS);
437 // set timer to spawn the plagued critters
439 }
440 else if (i == 1)
441 {
442 // set timer to reset the trap
443 events.ScheduleEvent(EVENT_GATE2_TRAP, 30 * MINUTE * IN_MILLISECONDS);
444 // set timer to reopen gates
445 events.ScheduleEvent(EVENT_GATE2_DELAY, 20 * IN_MILLISECONDS);
446 // set timer to spawn the plagued critters
448 }
449 }
450 }
451 }
452 }
453
454 const int GATE1 = 0;
455 const int GATE2 = 1;
456
457 switch (events.ExecuteEvent())
458 {
459 case EVENT_GATE1_TRAP:
460 _gateTrapsCooldown[GATE1] = false;
461 break;
462 case EVENT_GATE2_TRAP:
463 _gateTrapsCooldown[GATE2] = false;
464 break;
466 gate_delay(GATE1);
467 break;
469 gate_delay(GATE2);
470 break;
472 gate_critter_delay(GATE1);
473 break;
475 gate_critter_delay(GATE2);
476 break;
477 case EVENT_BARON_TIME:
478 {
480 instance->LoadGrid(4035.83f, -3336.31f);
482 if (baron && !baron->IsInCombat())
483 {
484 switch (_baronRunTime)
485 {
486 case 10:
487 baron->AI()->Talk(SAY_BARON_10M);
488 break;
489 case 5:
490 baron->AI()->Talk(SAY_BARON_5M);
491 if (Creature* ysida = baron->FindNearestCreature(NPC_YSIDA, 50.0f))
492 ysida->AI()->SetData(1, 1);
493 break;
494 case 0:
495 baron->AI()->Talk(SAY_BARON_0M);
497 break;
498 }
499 }
500
501 if (_baronRunTime > 0)
502 events.ScheduleEvent(EVENT_BARON_TIME, 60s);
503 else
504 events.ScheduleEvent(EVENT_EXECUTE_PRISONER, 0ms);
505
506 SaveToDB();
507 break;
508 }
510 {
511 instance->LoadGrid(4035.83f, -3336.31f);
513 if (baron && baron->IsAlive())
514 {
515 if (!baron->IsInCombat())
516 {
518 if (Creature* ysida = baron->FindNearestCreature(NPC_YSIDA, 50.0f))
519 Unit::Kill(baron, ysida);
520 }
521 else
522 events.ScheduleEvent(EVENT_EXECUTE_PRISONER, 1s);
523 }
524 break;
525 }
527 {
528 Position pos = {3941.75f, -3393.06f, 119.70f, 0.0f};
530 break;
531 }
533 {
534 Map::PlayerList const& PlayerList = instance->GetPlayers();
535 if (!PlayerList.IsEmpty())
536 for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i)
537 if (Player* player = i->GetSource())
538 if (player->GetDistance2d(4034.97f, -3402.13f) < 50.0f)
539 {
541 return;
542 }
543
544 events.ScheduleEvent(EVENT_FORCE_SLAUGHTER_EVENT, 3s);
545 break;
546 }
548 {
549 for (uint8 i = 0; i < 5; ++i)
551 {
552 guard->SetWalk(true);
553 guard->GetMotionMaster()->MovePoint(0, BlackGuardPos[i + 5]);
554 guard->SetHomePosition(BlackGuardPos[i + 5]);
555 if (i == 0 && guard->AI())
556 guard->AI()->Talk(SAY_BLACK_GUARD_INIT);
557 }
558
560 gate->SetGoState(GO_STATE_ACTIVE);
561 break;
562 }
563 }
564 }
const Position BlackGuardPos[10]
Definition: instance_stratholme.cpp:25
static const Position aGateTrap[]
Definition: instance_stratholme.cpp:47
@ EVENT_GATE1_TRAP
Definition: stratholme.h:98
@ SAY_BLACK_GUARD_INIT
Definition: stratholme.h:84
@ SAY_BARON_10M
Definition: stratholme.h:87
@ SAY_BARON_0M
Definition: stratholme.h:89
@ EVENT_GATE1_DELAY
Definition: stratholme.h:99
@ EVENT_GATE1_CRITTER_DELAY
Definition: stratholme.h:100
@ SAY_BARON_5M
Definition: stratholme.h:88
@ EVENT_GATE2_CRITTER_DELAY
Definition: stratholme.h:103
@ EVENT_GATE2_DELAY
Definition: stratholme.h:102
@ EVENT_EXECUTE_PRISONER
Definition: stratholme.h:97
@ EVENT_GATE2_TRAP
Definition: stratholme.h:101
@ NPC_YSIDA
Definition: stratholme.h:49
@ EMOTE_ONESHOT_ATTACK1H
Definition: SharedDefines.h:1926
bool IsEmpty() const
Definition: LinkedList.h:97
Definition: LinkedList.h:139
Creature * FindNearestCreature(uint32 entry, float range, bool alive=true) const
Definition: Object.cpp:2434
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:17956
bool IsAlive() const
Definition: Unit.h:1822
void HandleEmoteCommand(uint32 emoteId)
Definition: Unit.cpp:1980
bool IsInCombat() const
Definition: Unit.h:1702
PlayerList const & GetPlayers() const
Definition: Map.h:485
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:590
void gate_critter_delay(int gate)
Definition: instance_stratholme.cpp:602

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().

◆ WriteSaveDataMore()

void instance_stratholme::instance_stratholme_InstanceMapScript::WriteSaveDataMore ( std::ostringstream &  data)
inlineoverridevirtual

Reimplemented from InstanceScript.

371 {
372 data << _baronRunProgress << ' '
373 << _baronRunTime << ' '
374 << _zigguratState1 << ' '
375 << _zigguratState2 << ' '
376 << _zigguratState3 << ' '
377 << _slaughterProgress << ' '
379 }

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

Member Data Documentation

◆ _baronRivendareGUID

ObjectGuid instance_stratholme::instance_stratholme_InstanceMapScript::_baronRivendareGUID
private

◆ _baronRunProgress

uint32 instance_stratholme::instance_stratholme_InstanceMapScript::_baronRunProgress
private

◆ _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