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

Protected Attributes

std::list< Position_availableRiftPositions
 
GuidSet _encounterNPCs
 
uint8 _currentRift
 
int8 _shieldPercent
 
bool _noBossSpawnDelay
 
EventStatus _eventStatus
 
TaskScheduler _scheduler
 

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

instance_the_black_morass::instance_the_black_morass_InstanceMapScript::instance_the_black_morass_InstanceMapScript ( Map map)
inline
53 : InstanceScript(map)
54 {
58 _currentRift = 0;
59 _shieldPercent = 100;
60 _encounterNPCs.clear();
61 _noBossSpawnDelay = true; // Delay after bosses
63 }
#define DataHeader
Definition: blackrock_depths.h:23
uint32 const EncounterCount
Definition: blackrock_spire.h:23
ObjectData const creatureData[]
Definition: instance_the_black_morass.cpp:35
@ EVENT_PREPARE
Definition: the_black_morass.h:54
Definition: InstanceScript.h:141
void SetBossNumber(uint32 number)
Definition: InstanceScript.h:271
void SetHeaders(std::string const &dataHeaders)
Definition: InstanceScript.cpp:137
void LoadObjectData(ObjectData const *creatureData, ObjectData const *gameObjectData)
Definition: InstanceScript.cpp:172
EventStatus _eventStatus
Definition: instance_the_black_morass.cpp:467
GuidSet _encounterNPCs
Definition: instance_the_black_morass.cpp:463
bool _noBossSpawnDelay
Definition: instance_the_black_morass.cpp:466
int8 _shieldPercent
Definition: instance_the_black_morass.cpp:465
uint8 _currentRift
Definition: instance_the_black_morass.cpp:464

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

Member Function Documentation

◆ CleanupInstance()

void instance_the_black_morass::instance_the_black_morass_InstanceMapScript::CleanupInstance ( )
inline
66 {
67 _currentRift = 0;
68 _shieldPercent = 100;
69
72
73 for (Position const& pos : PortalLocation)
74 {
75 _availableRiftPositions.push_back(pos);
76 }
77
78 // prevent getting stuck if event fails during boss break
79 _noBossSpawnDelay = true;
80
81 instance->LoadGrid(-2023.0f, 7121.0f);
82 if (Creature* medivh = GetCreature(DATA_MEDIVH))
83 {
84 medivh->Respawn();
85 }
86 for (ObjectGuid const& guid : _encounterNPCs)
87 {
88 if (guid.GetEntry() == NPC_DP_BEAM_STALKER)
89 {
90 if (Creature* creature = instance->GetCreature(guid))
91 {
92 creature->Respawn();
93 }
94 break;
95 }
96 }
97 }
const Position PortalLocation[4]
Definition: instance_the_black_morass.cpp:27
@ NPC_DP_BEAM_STALKER
Definition: the_black_morass.h:94
@ DATA_MEDIVH
Definition: the_black_morass.h:38
TaskScheduler & CancelAll()
Definition: TaskScheduler.cpp:45
Definition: Creature.h:46
Definition: ObjectGuid.h:120
Definition: Position.h:28
Creature * GetCreature(uint32 type)
Definition: InstanceScript.cpp:99
Map * instance
Definition: InstanceScript.h:147
void LoadGrid(float x, float y)
Definition: Map.cpp:492
Creature * GetCreature(ObjectGuid const guid)
Definition: Map.cpp:3307
std::list< Position > _availableRiftPositions
Definition: instance_the_black_morass.cpp:462
TaskScheduler _scheduler
Definition: instance_the_black_morass.cpp:468

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

Referenced by OnPlayerEnter().

◆ GetData()

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

Reimplemented from ZoneScript.

445 {
446 switch (type)
447 {
449 return _shieldPercent;
450 case DATA_RIFT_NUMBER:
451 return _currentRift;
452 }
453 return 0;
454 }
@ 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.

240 {
241 switch (creature->GetEntry())
242 {
243 case NPC_TIME_RIFT:
246 case NPC_TEMPORUS:
248 case NPC_AEONUS:
251 case NPC_RIFT_LORD:
252 case NPC_RIFT_LORD_2:
264 _encounterNPCs.insert(creature->GetGUID());
265 break;
266 }
267
269 }
@ NPC_TIME_RIFT
Definition: culling_of_stratholme.h:59
@ NPC_DP_EMITTER_STALKER
Definition: the_black_morass.h:92
@ NPC_AEONUS
Definition: the_black_morass.h:79
@ NPC_INFINITE_ASSASSIN_2
Definition: the_black_morass.h:87
@ NPC_INFINITE_EXECUTIONER_2
Definition: the_black_morass.h:89
@ NPC_INFINITE_EXECUTIONER
Definition: the_black_morass.h:84
@ NPC_INFINITE_WHELP
Definition: the_black_morass.h:82
@ NPC_INFINITE_VANQUISHER
Definition: the_black_morass.h:85
@ NPC_INFINITE_TIMEREAVER
Definition: the_black_morass.h:78
@ NPC_RIFT_KEEPER_WARLOCK
Definition: the_black_morass.h:70
@ NPC_INFINITE_CHRONO_LORD
Definition: the_black_morass.h:76
@ NPC_INFINITE_VANQUISHER_2
Definition: the_black_morass.h:90
@ NPC_INFINITE_ASSASSIN
Definition: the_black_morass.h:81
@ NPC_RIFT_LORD_2
Definition: the_black_morass.h:73
@ NPC_RIFT_LORD
Definition: the_black_morass.h:72
@ NPC_TEMPORUS
Definition: the_black_morass.h:77
@ NPC_INFINITE_CHRONOMANCER
Definition: the_black_morass.h:83
@ NPC_INFINITE_CHRONOMANCER_2
Definition: the_black_morass.h:88
@ NPC_RIFT_KEEPER_MAGE
Definition: the_black_morass.h:71
@ NPC_CHRONO_LORD_DEJA
Definition: the_black_morass.h:75
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:57

References Object::GetEntry(), Object::GetGUID(), NPC_AEONUS, NPC_CHRONO_LORD_DEJA, NPC_DP_BEAM_STALKER, NPC_DP_EMITTER_STALKER, NPC_INFINITE_ASSASSIN, NPC_INFINITE_ASSASSIN_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.

272 {
273 switch (creature->GetEntry())
274 {
275 case NPC_TIME_RIFT:
277 {
278 if (_availableRiftPositions.size() < 3)
279 {
280 ScheduleNextPortal((_currentRift >= 13 ? 2min : 90s), creature->GetHomePosition());
281 }
282 else
283 {
284 ScheduleNextPortal(1s, creature->GetHomePosition());
285 }
286 }
287
288 _availableRiftPositions.push_back(creature->GetHomePosition());
289 [[fallthrough]];
292 case NPC_TEMPORUS:
294 case NPC_AEONUS:
297 case NPC_RIFT_LORD:
298 case NPC_RIFT_LORD_2:
309 _encounterNPCs.erase(creature->GetGUID());
310 break;
311 }
312
314 }
@ EVENT_IN_PROGRESS
Definition: the_black_morass.h:55
void GetHomePosition(float &x, float &y, float &z, float &ori) const
Definition: Creature.h:332
void OnCreatureRemove(Creature *creature) override
Definition: InstanceScript.cpp:63
void ScheduleNextPortal(Milliseconds time, Position lastPosition)
Definition: instance_the_black_morass.cpp:193

References EVENT_IN_PROGRESS, Object::GetEntry(), Object::GetGUID(), Creature::GetHomePosition(), NPC_AEONUS, NPC_CHRONO_LORD_DEJA, NPC_DP_EMITTER_STALKER, NPC_INFINITE_ASSASSIN, NPC_INFINITE_ASSASSIN_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.

182 {
184 {
186 }
187
191 }
@ DONE
Definition: InstanceScript.h:60
@ WORLD_STATE_BM_SHIELD
Definition: the_black_morass.h:48
@ WORLD_STATE_BM_RIFT
Definition: the_black_morass.h:49
@ WORLD_STATE_BM
Definition: the_black_morass.h:47
@ DATA_AEONUS
Definition: the_black_morass.h:35
void SendUpdateWorldState(uint32 variable, uint32 value) const
Definition: PlayerUpdates.cpp:2197
EncounterState GetBossState(uint32 id) const
Definition: InstanceScript.h:231
uint32 GetPlayersCountExceptGMs() const
Definition: Map.cpp:2740
void CleanupInstance()
Definition: instance_the_black_morass.cpp:65

References _currentRift, _eventStatus, _shieldPercent, CleanupInstance(), DATA_AEONUS, DONE, EVENT_IN_PROGRESS, 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
194 {
195 // only one rift can be scheduled at any time
197
198 _scheduler.Schedule(time, [this, lastPosition](TaskContext context)
199 {
201 {
202 // Spawning prevented: after-boss-delay or event failed/not started or last portal spawned
204 {
205 return;
206 }
207
208 Position spawnPos;
209 if (!_availableRiftPositions.empty())
210 {
211 if (_availableRiftPositions.size() > 1)
212 {
213 spawnPos = Acore::Containers::SelectRandomContainerElementIf(_availableRiftPositions, [&](Position pos) -> bool
214 {
215 return pos != lastPosition;
216 });
217 }
218 else
219 {
220 spawnPos = Acore::Containers::SelectRandomContainerElement(_availableRiftPositions);
221 }
222
223 _availableRiftPositions.remove(spawnPos);
224
226
228
229 // queue next portal if group doesn't kill keepers fast enough
230 context.Repeat((_currentRift >= 13 ? 2min : 90s));
231 }
232 // if no rift positions are available, the next rift will be scheduled in OnCreatureRemove
233 }
234
236 });
237 }
@ CONTEXT_GROUP_RIFTS
Definition: the_black_morass.h:104
TaskScheduler & Schedule(std::chrono::duration< _Rep, _Period > const &time, task_handler_t const &task)
Definition: TaskScheduler.h:232
TaskScheduler & CancelGroup(group_t const group)
Definition: TaskScheduler.cpp:53
Definition: TaskScheduler.h:418
TaskContext & Repeat(std::chrono::duration< _Rep, _Period > const &duration)
Definition: TaskScheduler.h:488
TaskContext & SetGroup(TaskScheduler::group_t const group)
Sets the event in the given group.
Definition: TaskScheduler.cpp:217
void DoUpdateWorldState(uint32 worldstateId, uint32 worldstateValue)
Definition: InstanceScript.cpp:576
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 _availableRiftPositions, _currentRift, _eventStatus, _noBossSpawnDelay, _scheduler, TaskScheduler::CancelGroup(), CONTEXT_GROUP_RIFTS, DATA_MEDIVH, InstanceScript::DoUpdateWorldState(), EVENT_PREPARE, InstanceScript::GetCreature(), InstanceScript::instance, NPC_TIME_RIFT, TaskContext::Repeat(), 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.

100 {
101 if (!InstanceScript::SetBossState(type, state))
102 {
103 return false;
104 }
105
106 if (state == DONE)
107 {
108 switch (type)
109 {
110 case DATA_AEONUS:
111 {
112 if (Creature* medivh = GetCreature(DATA_MEDIVH))
113 {
114 medivh->AI()->DoAction(ACTION_OUTRO);
115 }
116
117 instance->DoForAllPlayers([&](Player* player)
118 {
120 {
121 player->AreaExploredOrEventHappens(QUEST_OPENING_PORTAL);
122 }
123
125 {
126 player->AreaExploredOrEventHappens(QUEST_MASTER_TOUCH);
127 }
128 });
129
130 for (ObjectGuid const& guid : _encounterNPCs)
131 {
132 if (Creature* creature = instance->GetCreature(guid))
133 {
134 switch (creature->GetEntry())
135 {
138 case NPC_RIFT_LORD:
139 case NPC_RIFT_LORD_2:
140 case NPC_TIME_RIFT:
150 creature->DespawnOrUnsummon(1);
151 break;
152 default:
153 break;
154 }
155 }
156 }
157
158 break;
159 }
161 case DATA_TEMPORUS:
162 {
163 _noBossSpawnDelay = false;
164
165 _scheduler.Schedule(2min + 30s, [this](TaskContext)
166 {
167 _noBossSpawnDelay = true;
168 ScheduleNextPortal(0s, Position(0.0f, 0.0f, 0.0f, 0.0f));
169 });
170
171 break;
172 }
173 default:
174 break;
175 }
176 }
177
178 return true;
179 }
@ QUEST_STATUS_INCOMPLETE
Definition: QuestDef.h:103
@ ACTION_OUTRO
Definition: the_black_morass.h:102
@ QUEST_MASTER_TOUCH
Definition: the_black_morass.h:61
@ QUEST_OPENING_PORTAL
Definition: the_black_morass.h:60
@ DATA_TEMPORUS
Definition: the_black_morass.h:34
@ DATA_CHRONO_LORD_DEJA
Definition: the_black_morass.h:33
Definition: Player.h:1056
QuestStatus GetQuestStatus(uint32 quest_id) const
Definition: PlayerQuest.cpp:1416
virtual bool SetBossState(uint32 id, EncounterState state)
Definition: InstanceScript.cpp:350
void DoForAllPlayers(std::function< void(Player *)> exec)
Definition: Map.cpp:3817

References _encounterNPCs, _noBossSpawnDelay, _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_ASSASSIN, NPC_INFINITE_ASSASSIN_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.

317 {
318 switch (type)
319 {
320 case DATA_MEDIVH:
321 {
323
327
328 ScheduleNextPortal(3s, Position(0.0f, 0.0f, 0.0f, 0.0f));
329
330 break;
331 }
333 {
334 if (_shieldPercent <= 0)
335 {
336 return;
337 }
338
339 _shieldPercent -= data;
340 if (_shieldPercent < 0)
341 {
342 _shieldPercent = 0;
343 }
344
346
347 if (!_shieldPercent)
348 {
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 // Don't despawn permanent visual effect NPC twice or it won't respawn correctly
408 if (guid.GetEntry() == NPC_DP_BEAM_STALKER)
409 {
410 continue;
411 }
412
413 if (Creature* creature = instance->GetCreature(guid))
414 {
415 creature->CastSpell(creature, SPELL_TELEPORT_VISUAL, true);
416 creature->DespawnOrUnsummon(1200ms, 0s);
417 }
418 }
419
421
422 // Step 4 - Schedule instance cleanup without player interaction
423 _scheduler.Schedule(300s, [this](TaskContext)
424 {
426
430 });
431 });
432 });
433 });
434 }
435 }
436 }
437 break;
438 }
439 default:
440 break;
441 }
442 }
std::set< ObjectGuid > GuidSet
Definition: ObjectGuid.h:255
@ SAY_MEDIVH_DEATH
Definition: the_black_morass.h:110
@ DATA_DAMAGE_SHIELD
Definition: the_black_morass.h:40

References DATA_DAMAGE_SHIELD, DATA_MEDIVH, EVENT_IN_PROGRESS, EVENT_PREPARE, 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.

457 {
458 _scheduler.Update(diff);
459 }
TaskScheduler & Update(success_t const &callback=EmptyCallback)
Definition: TaskScheduler.cpp:27

Member Data Documentation

◆ _availableRiftPositions

std::list<Position> instance_the_black_morass::instance_the_black_morass_InstanceMapScript::_availableRiftPositions
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

◆ _eventStatus

EventStatus instance_the_black_morass::instance_the_black_morass_InstanceMapScript::_eventStatus
protected

◆ _noBossSpawnDelay

bool instance_the_black_morass::instance_the_black_morass_InstanceMapScript::_noBossSpawnDelay
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