AzerothCore 3.3.5a
OpenSource WoW Emulator
Loading...
Searching...
No Matches
instance_the_black_morass::instance_the_black_morass_InstanceMapScript Struct Reference
Inheritance diagram for instance_the_black_morass::instance_the_black_morass_InstanceMapScript:
InstanceScript ZoneScript

Public Member Functions

 instance_the_black_morass_InstanceMapScript (Map *map)
 
void CleanupInstance ()
 
bool SetBossState (uint32 type, EncounterState state) override
 
void OnPlayerEnter (Player *player) override
 
void ScheduleNextPortal (Milliseconds time, Position lastPosition)
 
void OnCreatureCreate (Creature *creature) override
 
void OnCreatureRemove (Creature *creature) override
 
void SetData (uint32 type, uint32 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)
 
- 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)
 

Protected Attributes

std::list< Position_availableRiftPositions
 
GuidSet _encounterNPCs
 
uint8 _currentRift
 
int8 _shieldPercent
 
bool _canSpawnPortal
 
TaskScheduler _scheduler
 

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

instance_the_black_morass::instance_the_black_morass_InstanceMapScript::instance_the_black_morass_InstanceMapScript ( Map map)
inline
51 : InstanceScript(map)
52 {
56 _currentRift = 0;
57 _shieldPercent = 100;
58 _encounterNPCs.clear();
59 _canSpawnPortal = true; // Delay after bosses
60 }
#define DataHeader
Definition: blackrock_depths.h:23
uint32 const EncounterCount
Definition: blackrock_spire.h:23
ObjectData const creatureData[1]
Definition: instance_the_black_morass.cpp:34
Definition: InstanceScript.h:140
void SetBossNumber(uint32 number)
Definition: InstanceScript.h:265
void SetHeaders(std::string const &dataHeaders)
Definition: InstanceScript.cpp:137
void LoadObjectData(ObjectData const *creatureData, ObjectData const *gameObjectData)
Definition: InstanceScript.cpp:172
bool _canSpawnPortal
Definition: instance_the_black_morass.cpp:450
GuidSet _encounterNPCs
Definition: instance_the_black_morass.cpp:447
int8 _shieldPercent
Definition: instance_the_black_morass.cpp:449
uint8 _currentRift
Definition: instance_the_black_morass.cpp:448

References _canSpawnPortal, _currentRift, _encounterNPCs, _shieldPercent, creatureData, DataHeader, EncounterCount, InstanceScript::LoadObjectData(), InstanceScript::SetBossNumber(), and InstanceScript::SetHeaders().

Member Function Documentation

◆ CleanupInstance()

void instance_the_black_morass::instance_the_black_morass_InstanceMapScript::CleanupInstance ( )
inline
63 {
64 _currentRift = 0;
65 _shieldPercent = 100;
66
69
70 for (Position const& pos : PortalLocation)
71 {
72 _availableRiftPositions.push_back(pos);
73 }
74
75 instance->LoadGrid(-2023.0f, 7121.0f);
76 if (Creature* medivh = GetCreature(DATA_MEDIVH))
77 {
78 medivh->DespawnOrUnsummon(0ms, 3s);
79 }
80 }
const Position PortalLocation[4]
Definition: instance_the_black_morass.cpp:26
@ DATA_MEDIVH
Definition: the_black_morass.h:38
TaskScheduler & CancelAll()
Definition: TaskScheduler.cpp:33
Definition: Creature.h:46
Definition: Position.h:28
Creature * GetCreature(uint32 type)
Definition: InstanceScript.cpp:99
Map * instance
Definition: InstanceScript.h:146
void LoadGrid(float x, float y)
Definition: Map.cpp:494
std::list< Position > _availableRiftPositions
Definition: instance_the_black_morass.cpp:446
TaskScheduler _scheduler
Definition: instance_the_black_morass.cpp:451

References _availableRiftPositions, _currentRift, _scheduler, _shieldPercent, TaskScheduler::CancelAll(), DATA_MEDIVH, InstanceScript::GetCreature(), InstanceScript::instance, Map::LoadGrid(), and PortalLocation.

Referenced by OnPlayerEnter().

◆ GetData()

uint32 instance_the_black_morass::instance_the_black_morass_InstanceMapScript::GetData ( uint32  type) const
inlineoverridevirtual

Reimplemented from ZoneScript.

429 {
430 switch (type)
431 {
433 return _shieldPercent;
434 case DATA_RIFT_NUMBER:
435 return _currentRift;
436 }
437 return 0;
438 }
@ DATA_RIFT_NUMBER
Definition: the_black_morass.h:42
@ DATA_SHIELD_PERCENT
Definition: the_black_morass.h:41

References DATA_RIFT_NUMBER, and DATA_SHIELD_PERCENT.

◆ OnCreatureCreate()

void instance_the_black_morass::instance_the_black_morass_InstanceMapScript::OnCreatureCreate ( Creature creature)
inlineoverridevirtual

Reimplemented from InstanceScript.

231 {
232 switch (creature->GetEntry())
233 {
234 case NPC_TIME_RIFT:
237 case NPC_TEMPORUS:
239 case NPC_AEONUS:
242 case NPC_RIFT_LORD:
243 case NPC_RIFT_LORD_2:
254 _encounterNPCs.insert(creature->GetGUID());
255 break;
256 }
257
259 }
@ NPC_TIME_RIFT
Definition: culling_of_stratholme.h:59
@ NPC_AEONUS
Definition: the_black_morass.h:76
@ NPC_INFINITE_EXECUTIONER_2
Definition: the_black_morass.h:86
@ NPC_INFINITE_EXECUTIONER
Definition: the_black_morass.h:81
@ NPC_INFINITE_ASSASIN_2
Definition: the_black_morass.h:84
@ NPC_INFINITE_WHELP
Definition: the_black_morass.h:79
@ NPC_INFINITE_VANQUISHER
Definition: the_black_morass.h:82
@ NPC_INFINITE_TIMEREAVER
Definition: the_black_morass.h:75
@ NPC_RIFT_KEEPER_WARLOCK
Definition: the_black_morass.h:67
@ NPC_DP_BEAM_STALKER
Definition: the_black_morass.h:91
@ NPC_INFINITE_CHRONO_LORD
Definition: the_black_morass.h:73
@ NPC_INFINITE_VANQUISHER_2
Definition: the_black_morass.h:87
@ NPC_RIFT_LORD_2
Definition: the_black_morass.h:70
@ NPC_INFINITE_ASSASIN
Definition: the_black_morass.h:78
@ NPC_RIFT_LORD
Definition: the_black_morass.h:69
@ NPC_TEMPORUS
Definition: the_black_morass.h:74
@ NPC_INFINITE_CHRONOMANCER
Definition: the_black_morass.h:80
@ NPC_INFINITE_CHRONOMANCER_2
Definition: the_black_morass.h:85
@ NPC_RIFT_KEEPER_MAGE
Definition: the_black_morass.h:68
@ NPC_CHRONO_LORD_DEJA
Definition: the_black_morass.h:72
uint32 GetEntry() const
Definition: Object.h:109
static ObjectGuid GetGUID(Object const *o)
Definition: Object.h:106
void OnCreatureCreate(Creature *creature) override
Definition: InstanceScript.cpp:58

References Object::GetEntry(), Object::GetGUID(), NPC_AEONUS, NPC_CHRONO_LORD_DEJA, NPC_DP_BEAM_STALKER, NPC_INFINITE_ASSASIN, NPC_INFINITE_ASSASIN_2, NPC_INFINITE_CHRONO_LORD, NPC_INFINITE_CHRONOMANCER, NPC_INFINITE_CHRONOMANCER_2, NPC_INFINITE_EXECUTIONER, NPC_INFINITE_EXECUTIONER_2, NPC_INFINITE_TIMEREAVER, NPC_INFINITE_VANQUISHER, NPC_INFINITE_VANQUISHER_2, NPC_INFINITE_WHELP, NPC_RIFT_KEEPER_MAGE, NPC_RIFT_KEEPER_WARLOCK, NPC_RIFT_LORD, NPC_RIFT_LORD_2, NPC_TEMPORUS, NPC_TIME_RIFT, and InstanceScript::OnCreatureCreate().

◆ OnCreatureRemove()

void instance_the_black_morass::instance_the_black_morass_InstanceMapScript::OnCreatureRemove ( Creature creature)
inlineoverridevirtual

Reimplemented from InstanceScript.

262 {
263 switch (creature->GetEntry())
264 {
265 case NPC_TIME_RIFT:
266 if (_currentRift < 18)
267 {
268 if (_availableRiftPositions.size() < 3)
269 {
270 ScheduleNextPortal((_currentRift >= 13 ? 2min : 90s), creature->GetHomePosition());
271 }
272 else
273 {
274 ScheduleNextPortal(1s, creature->GetHomePosition());
275 }
276 }
277
278 _availableRiftPositions.push_back(creature->GetHomePosition());
279 [[fallthrough]];
282 case NPC_TEMPORUS:
284 case NPC_AEONUS:
287 case NPC_RIFT_LORD:
288 case NPC_RIFT_LORD_2:
298 _encounterNPCs.erase(creature->GetGUID());
299 break;
300 }
301
303 }
void GetHomePosition(float &x, float &y, float &z, float &ori) const
Definition: Creature.h:330
void OnCreatureRemove(Creature *creature) override
Definition: InstanceScript.cpp:64
void ScheduleNextPortal(Milliseconds time, Position lastPosition)
Definition: instance_the_black_morass.cpp:176

References Object::GetEntry(), Object::GetGUID(), Creature::GetHomePosition(), NPC_AEONUS, NPC_CHRONO_LORD_DEJA, NPC_INFINITE_ASSASIN, NPC_INFINITE_ASSASIN_2, NPC_INFINITE_CHRONO_LORD, NPC_INFINITE_CHRONOMANCER, NPC_INFINITE_CHRONOMANCER_2, NPC_INFINITE_EXECUTIONER, NPC_INFINITE_EXECUTIONER_2, NPC_INFINITE_TIMEREAVER, NPC_INFINITE_VANQUISHER, NPC_INFINITE_VANQUISHER_2, NPC_INFINITE_WHELP, NPC_RIFT_KEEPER_MAGE, NPC_RIFT_KEEPER_WARLOCK, NPC_RIFT_LORD, NPC_RIFT_LORD_2, NPC_TEMPORUS, NPC_TIME_RIFT, and InstanceScript::OnCreatureRemove().

◆ OnPlayerEnter()

void instance_the_black_morass::instance_the_black_morass_InstanceMapScript::OnPlayerEnter ( Player player)
inlineoverridevirtual

Reimplemented from InstanceScript.

165 {
167 {
169 }
170
174 }
@ DONE
Definition: InstanceScript.h:59
@ WORLD_STATE_BM_SHIELD
Definition: the_black_morass.h:51
@ WORLD_STATE_BM_RIFT
Definition: the_black_morass.h:52
@ WORLD_STATE_BM
Definition: the_black_morass.h:50
@ DATA_AEONUS
Definition: the_black_morass.h:35
void SendUpdateWorldState(uint32 variable, uint32 value) const
Definition: PlayerUpdates.cpp:2194
EncounterState GetBossState(uint32 id) const
Definition: InstanceScript.h:230
uint32 GetPlayersCountExceptGMs() const
Definition: Map.cpp:2729
void CleanupInstance()
Definition: instance_the_black_morass.cpp:62

References _currentRift, _shieldPercent, CleanupInstance(), DATA_AEONUS, DONE, InstanceScript::GetBossState(), Map::GetPlayersCountExceptGMs(), InstanceScript::instance, Player::SendUpdateWorldState(), WORLD_STATE_BM, WORLD_STATE_BM_RIFT, and WORLD_STATE_BM_SHIELD.

◆ ScheduleNextPortal()

void instance_the_black_morass::instance_the_black_morass_InstanceMapScript::ScheduleNextPortal ( Milliseconds  time,
Position  lastPosition 
)
inline
177 {
179
180 _scheduler.Schedule(time, [this, lastPosition](TaskContext context)
181 {
183 {
184 // Spawning prevented - there's a 150s delay after a boss dies.
185 if (!_canSpawnPortal)
186 {
187 return;
188 }
189
190 Position spawnPos;
191 if (!_availableRiftPositions.empty())
192 {
193 if (_availableRiftPositions.size() > 1)
194 {
195 spawnPos = Acore::Containers::SelectRandomContainerElementIf(_availableRiftPositions, [&](Position pos) -> bool
196 {
197 return pos != lastPosition;
198 });
199 }
200 else
201 {
202 spawnPos = Acore::Containers::SelectRandomContainerElement(_availableRiftPositions);
203 }
204
205 _availableRiftPositions.remove(spawnPos);
206
208
210
211 // Here we check if we have available rift spots.
212 if (_currentRift < 18)
213 {
214 if (!_availableRiftPositions.empty())
215 {
216 context.Repeat((_currentRift >= 13 ? 2min : 90s));
217 }
218 else
219 {
220 context.Repeat(4s);
221 }
222 }
223 }
224 }
225
227 });
228 }
@ CONTEXT_GROUP_RIFTS
Definition: the_black_morass.h:101
TaskScheduler & Schedule(std::chrono::duration< _Rep, _Period > const &time, task_handler_t const &task)
Definition: TaskScheduler.h:217
TaskScheduler & CancelGroup(group_t const group)
Definition: TaskScheduler.cpp:41
Definition: TaskScheduler.h:400
TaskContext & SetGroup(TaskScheduler::group_t const group)
Sets the event in the given group.
Definition: TaskScheduler.cpp:187
void DoUpdateWorldState(uint32 worldstateId, uint32 worldstateValue)
Definition: InstanceScript.cpp:519
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:2129

References _availableRiftPositions, _canSpawnPortal, _currentRift, _scheduler, TaskScheduler::CancelGroup(), CONTEXT_GROUP_RIFTS, DATA_MEDIVH, InstanceScript::DoUpdateWorldState(), InstanceScript::GetCreature(), InstanceScript::instance, NPC_TIME_RIFT, TaskScheduler::Schedule(), TaskContext::SetGroup(), Map::SummonCreature(), and WORLD_STATE_BM_RIFT.

Referenced by SetBossState().

◆ SetBossState()

bool instance_the_black_morass::instance_the_black_morass_InstanceMapScript::SetBossState ( uint32  type,
EncounterState  state 
)
inlineoverridevirtual

Reimplemented from InstanceScript.

83 {
84 if (!InstanceScript::SetBossState(type, state))
85 {
86 return false;
87 }
88
89 if (state == DONE)
90 {
91 switch (type)
92 {
93 case DATA_AEONUS:
94 {
95 if (Creature* medivh = GetCreature(DATA_MEDIVH))
96 {
97 medivh->AI()->DoAction(ACTION_OUTRO);
98 }
99
100 instance->DoForAllPlayers([&](Player* player)
101 {
103 {
104 player->AreaExploredOrEventHappens(QUEST_OPENING_PORTAL);
105 }
106
108 {
109 player->AreaExploredOrEventHappens(QUEST_MASTER_TOUCH);
110 }
111 });
112
113 for (ObjectGuid const& guid : _encounterNPCs)
114 {
115 if (Creature* creature = instance->GetCreature(guid))
116 {
117 switch (creature->GetEntry())
118 {
121 case NPC_RIFT_LORD:
122 case NPC_RIFT_LORD_2:
123 case NPC_TIME_RIFT:
133 creature->DespawnOrUnsummon();
134 break;
135 default:
136 break;
137 }
138 }
139 }
140
141 break;
142 }
144 case DATA_TEMPORUS:
145 {
146 _canSpawnPortal = false;
147
148 _scheduler.Schedule(2min + 30s, [this](TaskContext)
149 {
150 _canSpawnPortal = true;
151 });
152
153 ScheduleNextPortal(2min + 30s, Position(0.0f, 0.0f, 0.0f, 0.0f));
154 break;
155 }
156 default:
157 break;
158 }
159 }
160
161 return true;
162 }
@ QUEST_STATUS_INCOMPLETE
Definition: QuestDef.h:103
@ ACTION_OUTRO
Definition: the_black_morass.h:99
@ QUEST_MASTER_TOUCH
Definition: the_black_morass.h:58
@ QUEST_OPENING_PORTAL
Definition: the_black_morass.h:57
@ DATA_TEMPORUS
Definition: the_black_morass.h:34
@ DATA_CHRONO_LORD_DEJA
Definition: the_black_morass.h:33
Definition: ObjectGuid.h:120
Definition: Player.h:1046
QuestStatus GetQuestStatus(uint32 quest_id) const
Definition: PlayerQuest.cpp:1414
virtual bool SetBossState(uint32 id, EncounterState state)
Definition: InstanceScript.cpp:317
Creature * GetCreature(ObjectGuid const guid)
Definition: Map.cpp:3293
void DoForAllPlayers(std::function< void(Player *)> exec)
Definition: Map.cpp:3792

References _canSpawnPortal, _encounterNPCs, _scheduler, ACTION_OUTRO, DATA_AEONUS, DATA_CHRONO_LORD_DEJA, DATA_MEDIVH, DATA_TEMPORUS, Map::DoForAllPlayers(), DONE, Map::GetCreature(), InstanceScript::GetCreature(), Player::GetQuestStatus(), InstanceScript::instance, NPC_INFINITE_ASSASIN, NPC_INFINITE_ASSASIN_2, NPC_INFINITE_CHRONOMANCER, NPC_INFINITE_CHRONOMANCER_2, NPC_INFINITE_EXECUTIONER, NPC_INFINITE_EXECUTIONER_2, NPC_INFINITE_VANQUISHER, NPC_INFINITE_VANQUISHER_2, NPC_INFINITE_WHELP, NPC_RIFT_KEEPER_MAGE, NPC_RIFT_KEEPER_WARLOCK, NPC_RIFT_LORD, NPC_RIFT_LORD_2, NPC_TIME_RIFT, QUEST_MASTER_TOUCH, QUEST_OPENING_PORTAL, QUEST_STATUS_INCOMPLETE, TaskScheduler::Schedule(), ScheduleNextPortal(), and InstanceScript::SetBossState().

◆ SetData()

void instance_the_black_morass::instance_the_black_morass_InstanceMapScript::SetData ( uint32  type,
uint32  data 
)
inlineoverridevirtual

Reimplemented from ZoneScript.

306 {
307 switch (type)
308 {
309 case DATA_MEDIVH:
310 {
314
315 ScheduleNextPortal(3s, Position(0.0f, 0.0f, 0.0f, 0.0f));
316
317 for (ObjectGuid const& guid : _encounterNPCs)
318 {
319 if (guid.GetEntry() == NPC_DP_BEAM_STALKER)
320 {
321 if (Creature* creature = instance->GetCreature(guid))
322 {
323 if (!creature->IsAlive())
324 {
325 creature->Respawn(true);
326 }
327 }
328 break;
329 }
330 }
331
332 break;
333 }
335 {
336 if (_shieldPercent <= 0)
337 {
338 return;
339 }
340
341 _shieldPercent -= data;
342 if (_shieldPercent < 0)
343 {
344 _shieldPercent = 0;
345 }
346
348
349 if (!_shieldPercent)
350 {
351 if (Creature* medivh = GetCreature(DATA_MEDIVH))
352 {
353 if (medivh->IsAlive() && medivh->IsAIEnabled)
354 {
355 medivh->SetImmuneToNPC(true);
356 medivh->AI()->Talk(SAY_MEDIVH_DEATH);
357
358 for (ObjectGuid const& guid : _encounterNPCs)
359 {
360 if (Creature* creature = instance->GetCreature(guid))
361 {
362 creature->InterruptNonMeleeSpells(true);
363 }
364 }
365
366 // Step 1 - Medivh loses all auras.
368 {
369 if (Creature* medivh = GetCreature(DATA_MEDIVH))
370 {
371 medivh->RemoveAllAuras();
372 }
373
374 // Step 2 - Medivh dies and visual effect NPCs are despawned.
375 _scheduler.Schedule(500ms, [this](TaskContext)
376 {
377 if (Creature* medivh = GetCreature(DATA_MEDIVH))
378 {
379 medivh->KillSelf(false);
380
381 GuidSet encounterNPCSCopy = _encounterNPCs;
382 for (ObjectGuid const& guid : encounterNPCSCopy)
383 {
384 switch (guid.GetEntry())
385 {
386 case NPC_TIME_RIFT:
387 case NPC_DP_EMITTER_STALKER:
388 case NPC_DP_CRYSTAL_STALKER:
389 case NPC_DP_BEAM_STALKER:
390 if (Creature* creature = instance->GetCreature(guid))
391 {
392 creature->DespawnOrUnsummon();
393 }
394 break;
395 default:
396 break;
397 }
398 }
399 }
400
401 // Step 3 - All summoned creatures despawn
403 {
404 GuidSet encounterNPCSCopy = _encounterNPCs;
405 for (ObjectGuid const& guid : encounterNPCSCopy)
406 {
407 if (Creature* creature = instance->GetCreature(guid))
408 {
409 creature->CastSpell(creature, SPELL_TELEPORT_VISUAL, true);
410 creature->DespawnOrUnsummon(1200ms, 0s);
411 }
412 }
413
415 });
416 });
417 });
418 }
419 }
420 }
421 break;
422 }
423 default:
424 break;
425 }
426 }
std::set< ObjectGuid > GuidSet
Definition: ObjectGuid.h:255
@ SAY_MEDIVH_DEATH
Definition: the_black_morass.h:107
@ DATA_DAMAGE_SHIELD
Definition: the_black_morass.h:40

References DATA_DAMAGE_SHIELD, DATA_MEDIVH, NPC_DP_BEAM_STALKER, SAY_MEDIVH_DEATH, WORLD_STATE_BM, WORLD_STATE_BM_RIFT, and WORLD_STATE_BM_SHIELD.

◆ Update()

void instance_the_black_morass::instance_the_black_morass_InstanceMapScript::Update ( uint32  diff)
inlineoverridevirtual

Reimplemented from InstanceScript.

441 {
442 _scheduler.Update(diff);
443 }
TaskScheduler & Update(success_t const &callback=EmptyCallback)
Definition: TaskScheduler.cpp:15

Member Data Documentation

◆ _availableRiftPositions

std::list<Position> instance_the_black_morass::instance_the_black_morass_InstanceMapScript::_availableRiftPositions
protected

◆ _canSpawnPortal

bool instance_the_black_morass::instance_the_black_morass_InstanceMapScript::_canSpawnPortal
protected

◆ _currentRift

uint8 instance_the_black_morass::instance_the_black_morass_InstanceMapScript::_currentRift
protected

◆ _encounterNPCs

GuidSet instance_the_black_morass::instance_the_black_morass_InstanceMapScript::_encounterNPCs
protected

◆ _scheduler

TaskScheduler instance_the_black_morass::instance_the_black_morass_InstanceMapScript::_scheduler
protected

◆ _shieldPercent

int8 instance_the_black_morass::instance_the_black_morass_InstanceMapScript::_shieldPercent
protected