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)
 
virtual void OnPlayerInWaterStateUpdate (Player *, bool)
 
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)
 
void StoreGameObjectState (ObjectGuid::LowType spawnId, uint8 state)
 
uint8 GetStoredGameObjectState (ObjectGuid::LowType spawnId) const
 
void LoadInstanceSavedGameobjectStateData ()
 
bool IsBossDone (uint32 bossId) const
 
bool AllBossesDone () const
 
bool AllBossesDone (std::initializer_list< uint32 > bossIds) const
 
- 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 LoadSummonData (ObjectData const *data)
 
void SetSummoner (Creature *creature)
 
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
49 : InstanceScript(map)
50 {
54 _currentRift = 0;
55 _shieldPercent = 100;
56 _encounterNPCs.clear();
57 _noBossSpawnDelay = true; // Delay after bosses
59 }
@ EVENT_PREPARE
Definition: the_black_morass.h:52
ObjectData const creatureData[]
Definition: instance_the_black_morass.cpp:31
#define DataHeader
Definition: blackrock_depths.h:23
uint32 const EncounterCount
Definition: blackrock_spire.h:23
Definition: InstanceScript.h:142
void SetBossNumber(uint32 number)
Definition: InstanceScript.h:285
void SetHeaders(std::string const &dataHeaders)
Definition: InstanceScript.cpp:141
void LoadObjectData(ObjectData const *creatureData, ObjectData const *gameObjectData)
Definition: InstanceScript.cpp:176
EventStatus _eventStatus
Definition: instance_the_black_morass.cpp:463
GuidSet _encounterNPCs
Definition: instance_the_black_morass.cpp:459
bool _noBossSpawnDelay
Definition: instance_the_black_morass.cpp:462
int8 _shieldPercent
Definition: instance_the_black_morass.cpp:461
uint8 _currentRift
Definition: instance_the_black_morass.cpp:460

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
62 {
63 _currentRift = 0;
64 _shieldPercent = 100;
65
68
69 for (Position const& pos : PortalLocation)
70 {
71 _availableRiftPositions.push_back(pos);
72 }
73
74 // prevent getting stuck if event fails during boss break
75 _noBossSpawnDelay = true;
76
77 instance->LoadGrid(-2023.0f, 7121.0f);
78 if (Creature* medivh = GetCreature(DATA_MEDIVH))
79 {
80 medivh->Respawn();
81 }
82 for (ObjectGuid const& guid : _encounterNPCs)
83 {
84 if (guid.GetEntry() == NPC_DP_BEAM_STALKER)
85 {
86 if (Creature* creature = instance->GetCreature(guid))
87 {
88 creature->Respawn();
89 }
90 break;
91 }
92 }
93 }
@ NPC_DP_BEAM_STALKER
Definition: the_black_morass.h:92
@ DATA_MEDIVH
Definition: the_black_morass.h:36
const Position PortalLocation[4]
Definition: instance_the_black_morass.cpp:23
TaskScheduler & CancelAll()
Definition: TaskScheduler.cpp:45
Definition: Creature.h:43
Definition: ObjectGuid.h:118
Definition: Position.h:27
Creature * GetCreature(uint32 type)
Definition: InstanceScript.cpp:103
Map * instance
Definition: InstanceScript.h:148
void LoadGrid(float x, float y)
Definition: Map.cpp:495
Creature * GetCreature(ObjectGuid const guid)
Definition: Map.cpp:3317
std::list< Position > _availableRiftPositions
Definition: instance_the_black_morass.cpp:458
TaskScheduler _scheduler
Definition: instance_the_black_morass.cpp:464

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.

441 {
442 switch (type)
443 {
445 return _shieldPercent;
446 case DATA_RIFT_NUMBER:
447 return _currentRift;
448 }
449 return 0;
450 }
@ DATA_RIFT_NUMBER
Definition: the_black_morass.h:40
@ DATA_SHIELD_PERCENT
Definition: the_black_morass.h:39

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.

236 {
237 switch (creature->GetEntry())
238 {
239 case NPC_TIME_RIFT:
242 case NPC_TEMPORUS:
244 case NPC_AEONUS:
247 case NPC_RIFT_LORD:
248 case NPC_RIFT_LORD_2:
260 _encounterNPCs.insert(creature->GetGUID());
261 break;
262 }
263
265 }
@ NPC_TIME_RIFT
Definition: culling_of_stratholme.h:59
@ NPC_DP_EMITTER_STALKER
Definition: the_black_morass.h:90
@ NPC_AEONUS
Definition: the_black_morass.h:77
@ NPC_INFINITE_ASSASSIN_2
Definition: the_black_morass.h:85
@ NPC_INFINITE_EXECUTIONER_2
Definition: the_black_morass.h:87
@ NPC_INFINITE_EXECUTIONER
Definition: the_black_morass.h:82
@ NPC_INFINITE_WHELP
Definition: the_black_morass.h:80
@ NPC_INFINITE_VANQUISHER
Definition: the_black_morass.h:83
@ NPC_INFINITE_TIMEREAVER
Definition: the_black_morass.h:76
@ NPC_RIFT_KEEPER_WARLOCK
Definition: the_black_morass.h:68
@ NPC_INFINITE_CHRONO_LORD
Definition: the_black_morass.h:74
@ NPC_INFINITE_VANQUISHER_2
Definition: the_black_morass.h:88
@ NPC_INFINITE_ASSASSIN
Definition: the_black_morass.h:79
@ NPC_RIFT_LORD_2
Definition: the_black_morass.h:71
@ NPC_RIFT_LORD
Definition: the_black_morass.h:70
@ NPC_TEMPORUS
Definition: the_black_morass.h:75
@ NPC_INFINITE_CHRONOMANCER
Definition: the_black_morass.h:81
@ NPC_INFINITE_CHRONOMANCER_2
Definition: the_black_morass.h:86
@ NPC_RIFT_KEEPER_MAGE
Definition: the_black_morass.h:69
@ NPC_CHRONO_LORD_DEJA
Definition: the_black_morass.h:73
uint32 GetEntry() const
Definition: Object.h:115
static ObjectGuid GetGUID(Object const *o)
Definition: Object.h:112
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_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.

268 {
269 switch (creature->GetEntry())
270 {
271 case NPC_TIME_RIFT:
273 {
274 if (_availableRiftPositions.size() < 3)
275 {
276 ScheduleNextPortal((_currentRift >= 13 ? 2min : 90s), creature->GetHomePosition());
277 }
278 else
279 {
280 ScheduleNextPortal(1s, creature->GetHomePosition());
281 }
282 }
283
284 _availableRiftPositions.push_back(creature->GetHomePosition());
285 [[fallthrough]];
288 case NPC_TEMPORUS:
290 case NPC_AEONUS:
293 case NPC_RIFT_LORD:
294 case NPC_RIFT_LORD_2:
305 _encounterNPCs.erase(creature->GetGUID());
306 break;
307 }
308
310 }
@ EVENT_IN_PROGRESS
Definition: the_black_morass.h:53
void GetHomePosition(float &x, float &y, float &z, float &ori) const
Definition: Creature.h:338
void OnCreatureRemove(Creature *creature) override
Definition: InstanceScript.cpp:67
void ScheduleNextPortal(Milliseconds time, Position lastPosition)
Definition: instance_the_black_morass.cpp:189

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.

178 {
180 {
182 }
183
187 }
@ WORLD_STATE_BM_SHIELD
Definition: the_black_morass.h:46
@ WORLD_STATE_BM_RIFT
Definition: the_black_morass.h:47
@ WORLD_STATE_BM
Definition: the_black_morass.h:45
@ DATA_AEONUS
Definition: the_black_morass.h:33
@ DONE
Definition: InstanceScript.h:60
void SendUpdateWorldState(uint32 variable, uint32 value) const
Definition: PlayerUpdates.cpp:2197
EncounterState GetBossState(uint32 id) const
Definition: InstanceScript.h:235
uint32 GetPlayersCountExceptGMs() const
Definition: Map.cpp:2748
void CleanupInstance()
Definition: instance_the_black_morass.cpp:61

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
190 {
191 // only one rift can be scheduled at any time
193
194 _scheduler.Schedule(time, [this, lastPosition](TaskContext context)
195 {
197 {
198 // Spawning prevented: after-boss-delay or event failed/not started or last portal spawned
200 {
201 return;
202 }
203
204 Position spawnPos;
205 if (!_availableRiftPositions.empty())
206 {
207 if (_availableRiftPositions.size() > 1)
208 {
209 spawnPos = Acore::Containers::SelectRandomContainerElementIf(_availableRiftPositions, [&](Position pos) -> bool
210 {
211 return pos != lastPosition;
212 });
213 }
214 else
215 {
216 spawnPos = Acore::Containers::SelectRandomContainerElement(_availableRiftPositions);
217 }
218
219 _availableRiftPositions.remove(spawnPos);
220
222
224
225 // queue next portal if group doesn't kill keepers fast enough
226 context.Repeat((_currentRift >= 13 ? 2min : 90s));
227 }
228 // if no rift positions are available, the next rift will be scheduled in OnCreatureRemove
229 }
230
232 });
233 }
@ CONTEXT_GROUP_RIFTS
Definition: the_black_morass.h:102
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:421
TaskContext & Repeat(std::chrono::duration< _Rep, _Period > const &duration)
Definition: TaskScheduler.h:493
TaskContext & SetGroup(TaskScheduler::group_t const group)
Sets the event in the given group.
Definition: TaskScheduler.cpp:234
void DoUpdateWorldState(uint32 worldstateId, uint32 worldstateValue)
Definition: InstanceScript.cpp:603
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:2174

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.

96 {
97 if (!InstanceScript::SetBossState(type, state))
98 {
99 return false;
100 }
101
102 if (state == DONE)
103 {
104 switch (type)
105 {
106 case DATA_AEONUS:
107 {
108 if (Creature* medivh = GetCreature(DATA_MEDIVH))
109 {
110 medivh->AI()->DoAction(ACTION_OUTRO);
111 }
112
113 instance->DoForAllPlayers([&](Player* player)
114 {
116 {
117 player->AreaExploredOrEventHappens(QUEST_OPENING_PORTAL);
118 }
119
121 {
122 player->AreaExploredOrEventHappens(QUEST_MASTER_TOUCH);
123 }
124 });
125
126 for (ObjectGuid const& guid : _encounterNPCs)
127 {
128 if (Creature* creature = instance->GetCreature(guid))
129 {
130 switch (creature->GetEntry())
131 {
134 case NPC_RIFT_LORD:
135 case NPC_RIFT_LORD_2:
136 case NPC_TIME_RIFT:
146 creature->DespawnOrUnsummon(1);
147 break;
148 default:
149 break;
150 }
151 }
152 }
153
154 break;
155 }
157 case DATA_TEMPORUS:
158 {
159 _noBossSpawnDelay = false;
160
161 _scheduler.Schedule(2min + 30s, [this](TaskContext)
162 {
163 _noBossSpawnDelay = true;
164 ScheduleNextPortal(0s, Position(0.0f, 0.0f, 0.0f, 0.0f));
165 });
166
167 break;
168 }
169 default:
170 break;
171 }
172 }
173
174 return true;
175 }
@ ACTION_OUTRO
Definition: the_black_morass.h:100
@ QUEST_MASTER_TOUCH
Definition: the_black_morass.h:59
@ QUEST_OPENING_PORTAL
Definition: the_black_morass.h:58
@ DATA_TEMPORUS
Definition: the_black_morass.h:32
@ DATA_CHRONO_LORD_DEJA
Definition: the_black_morass.h:31
@ QUEST_STATUS_INCOMPLETE
Definition: QuestDef.h:103
Definition: Player.h:1081
QuestStatus GetQuestStatus(uint32 quest_id) const
Definition: PlayerQuest.cpp:1429
virtual bool SetBossState(uint32 id, EncounterState state)
Definition: InstanceScript.cpp:373
void DoForAllPlayers(std::function< void(Player *)> exec)
Definition: Map.cpp:3827

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.

313 {
314 switch (type)
315 {
316 case DATA_MEDIVH:
317 {
319
323
324 ScheduleNextPortal(3s, Position(0.0f, 0.0f, 0.0f, 0.0f));
325
326 break;
327 }
329 {
330 if (_shieldPercent <= 0)
331 {
332 return;
333 }
334
335 _shieldPercent -= data;
336 if (_shieldPercent < 0)
337 {
338 _shieldPercent = 0;
339 }
340
342
343 if (!_shieldPercent)
344 {
346
347 if (Creature* medivh = GetCreature(DATA_MEDIVH))
348 {
349 if (medivh->IsAlive() && medivh->IsAIEnabled)
350 {
351 medivh->SetImmuneToNPC(true);
352 medivh->AI()->Talk(SAY_MEDIVH_DEATH);
353
354 for (ObjectGuid const& guid : _encounterNPCs)
355 {
356 if (Creature* creature = instance->GetCreature(guid))
357 {
358 creature->InterruptNonMeleeSpells(true);
359 }
360 }
361
362 // Step 1 - Medivh loses all auras.
364 {
365 if (Creature* medivh = GetCreature(DATA_MEDIVH))
366 {
367 medivh->RemoveAllAuras();
368 }
369
370 // Step 2 - Medivh dies and visual effect NPCs are despawned.
371 _scheduler.Schedule(500ms, [this](TaskContext)
372 {
373 if (Creature* medivh = GetCreature(DATA_MEDIVH))
374 {
375 medivh->KillSelf(false);
376
377 GuidSet encounterNPCSCopy = _encounterNPCs;
378 for (ObjectGuid const& guid : encounterNPCSCopy)
379 {
380 switch (guid.GetEntry())
381 {
382 case NPC_TIME_RIFT:
383 case NPC_DP_EMITTER_STALKER:
384 case NPC_DP_CRYSTAL_STALKER:
385 case NPC_DP_BEAM_STALKER:
386 if (Creature* creature = instance->GetCreature(guid))
387 {
388 creature->DespawnOrUnsummon();
389 }
390 break;
391 default:
392 break;
393 }
394 }
395 }
396
397 // Step 3 - All summoned creatures despawn
399 {
400 GuidSet encounterNPCSCopy = _encounterNPCs;
401 for (ObjectGuid const& guid : encounterNPCSCopy)
402 {
403 // Don't despawn permanent visual effect NPC twice or it won't respawn correctly
404 if (guid.GetEntry() == NPC_DP_BEAM_STALKER)
405 {
406 continue;
407 }
408
409 if (Creature* creature = instance->GetCreature(guid))
410 {
411 creature->CastSpell(creature, SPELL_TELEPORT_VISUAL, true);
412 creature->DespawnOrUnsummon(1200ms, 0s);
413 }
414 }
415
417
418 // Step 4 - Schedule instance cleanup without player interaction
419 _scheduler.Schedule(300s, [this](TaskContext)
420 {
422
426 });
427 });
428 });
429 });
430 }
431 }
432 }
433 break;
434 }
435 default:
436 break;
437 }
438 }
@ SAY_MEDIVH_DEATH
Definition: the_black_morass.h:108
@ DATA_DAMAGE_SHIELD
Definition: the_black_morass.h:38
std::set< ObjectGuid > GuidSet
Definition: ObjectGuid.h:253

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.

453 {
454 _scheduler.Update(diff);
455 }
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