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

Public Member Functions

 instance_mount_hyjal_InstanceMapScript (Map *map)
 
void Initialize () override
 
void OnGameObjectCreate (GameObject *go) override
 
void OnCreatureCreate (Creature *creature) override
 
void OnUnitDeath (Unit *unit) override
 
void SetData (uint32 type, uint32 data) override
 
uint32 GetData (uint32 type) const override
 
void ScheduleWaves (Milliseconds, uint8 startWaves, uint8 maxWaves, Milliseconds timerptr[])
 
void Update (uint32 diff) override
 
void OnPlayerInWaterStateUpdate (Player *player, bool inWater) 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

int32 trash
 
uint8 _currentWave
 
uint8 _bossWave
 
uint8 _retreat
 
GuidSet _encounterNPCs
 
GuidSet _summonedNPCs
 
GuidSet _baseAlliance
 
GuidSet _baseHorde
 
GuidVector _infernalTargets
 
GuidSet _baseNightElf
 
GuidSet _ancientGemAlliance
 
GuidSet _ancientGemHorde
 
GuidSet _roaringFlameAlliance
 
GuidSet _roaringFlameHorde
 

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

instance_hyjal::instance_mount_hyjal_InstanceMapScript::instance_mount_hyjal_InstanceMapScript ( Map map)
inline
84 : InstanceScript(map)
85 {
90 }
#define DataHeader
Definition: blackrock_depths.h:23
uint32 const EncounterCount
Definition: blackrock_spire.h:23
ObjectData const creatureData[]
Definition: instance_hyjal.cpp:40
DoorData const doorData[]
Definition: instance_hyjal.cpp:33
Definition: InstanceScript.h:142
void SetBossNumber(uint32 number)
Definition: InstanceScript.h:285
void LoadDoorData(DoorData const *data)
Definition: InstanceScript.cpp:161
void SetHeaders(std::string const &dataHeaders)
Definition: InstanceScript.cpp:138
void LoadObjectData(ObjectData const *creatureData, ObjectData const *gameObjectData)
Definition: InstanceScript.cpp:173

References creatureData, DataHeader, doorData, EncounterCount, InstanceScript::LoadDoorData(), InstanceScript::LoadObjectData(), InstanceScript::SetBossNumber(), and InstanceScript::SetHeaders().

Member Function Documentation

◆ GetData()

uint32 instance_hyjal::instance_mount_hyjal_InstanceMapScript::GetData ( uint32  type) const
inlineoverridevirtual

Reimplemented from ZoneScript.

503 {
504 switch (type)
505 {
506 case DATA_WAVE_STATUS:
507 return _currentWave;
508 break;
509 case DATA_BOSS_WAVE:
510 return _bossWave;
511 }
512 return 0;
513 }
@ DATA_BOSS_WAVE
Definition: hyjal.h:51
@ DATA_WAVE_STATUS
Definition: hyjal.h:50
uint8 _currentWave
Definition: instance_hyjal.cpp:570
uint8 _bossWave
Definition: instance_hyjal.cpp:571

References DATA_BOSS_WAVE, and DATA_WAVE_STATUS.

◆ Initialize()

void instance_hyjal::instance_mount_hyjal_InstanceMapScript::Initialize ( )
inlineoverridevirtual

Reimplemented from InstanceScript.

93 {
95 _retreat = 0;
96 trash = 0;
97 _currentWave = 0;
98 _encounterNPCs.clear();
99 _summonedNPCs.clear();
100 _baseAlliance.clear();
101 _baseHorde.clear();
102 _infernalTargets.clear();
103 _baseNightElf.clear();
104 _roaringFlameAlliance.clear();
105 _roaringFlameHorde.clear();
106 _ancientGemAlliance.clear();
107 _ancientGemHorde.clear();
108 }
@ TO_BE_DECIDED
Definition: InstanceScript.h:62
GuidSet _ancientGemAlliance
Definition: instance_hyjal.cpp:579
int32 trash
Definition: instance_hyjal.cpp:569
GuidSet _ancientGemHorde
Definition: instance_hyjal.cpp:580
GuidSet _baseNightElf
Definition: instance_hyjal.cpp:578
GuidVector _infernalTargets
Definition: instance_hyjal.cpp:577
GuidSet _baseHorde
Definition: instance_hyjal.cpp:576
GuidSet _summonedNPCs
Definition: instance_hyjal.cpp:574
GuidSet _roaringFlameAlliance
Definition: instance_hyjal.cpp:581
GuidSet _roaringFlameHorde
Definition: instance_hyjal.cpp:582
uint8 _retreat
Definition: instance_hyjal.cpp:572
GuidSet _baseAlliance
Definition: instance_hyjal.cpp:575
GuidSet _encounterNPCs
Definition: instance_hyjal.cpp:573

References _ancientGemAlliance, _ancientGemHorde, _baseAlliance, _baseHorde, _baseNightElf, _bossWave, _currentWave, _encounterNPCs, _infernalTargets, _retreat, _roaringFlameAlliance, _roaringFlameHorde, _summonedNPCs, TO_BE_DECIDED, and trash.

◆ OnCreatureCreate()

void instance_hyjal::instance_mount_hyjal_InstanceMapScript::OnCreatureCreate ( Creature creature)
inlineoverridevirtual

Reimplemented from InstanceScript.

133 {
134 switch (creature->GetEntry())
135 {
136 // Alliance base
143 case NPC_JAINA:
144 _baseAlliance.insert(creature->GetGUID());
145 break;
146 // Horde base
148 case NPC_HORDE_SHAMAN:
149 case NPC_HORDE_GRUNT:
153 case NPC_HORDE_PEON:
154 case NPC_THRALL:
155 _baseHorde.insert(creature->GetGUID());
156 break;
157 // Elf base
163 case NPC_NELF_ARCHER:
165 case NPC_DRYAD:
166 case NPC_TYRANDE:
167 _baseNightElf.insert(creature->GetGUID());
168 break;
169
171 _infernalTargets.push_back(creature->GetGUID());
172 break;
173
174 case NPC_WINTERCHILL:
175 case NPC_ANETHERON:
176 case NPC_KAZROGAL:
177 case NPC_AZGALOR:
178 case NPC_NECRO:
179 case NPC_ABOMI:
180 case NPC_GHOUL:
181 case NPC_BANSH:
182 case NPC_CRYPT:
183 case NPC_STALK:
184 case NPC_GARGO:
185 case NPC_FROST:
186 case NPC_INFER:
188 creature->AI()->DoAction(_bossWave);
189 else if (_retreat)
190 creature->AI()->DoAction(_retreat);
191
192 if (creature->IsSummon() && _bossWave != TO_BE_DECIDED)
193 {
194 DoUpdateWorldState(WORLD_STATE_ENEMYCOUNT, ++trash); // Update the instance wave count on new trash spawn
195 _encounterNPCs.insert(creature->GetGUID()); // Used for despawning on wipe
196 }
197 break;
200 case NPC_DIRE_WOLF:
202 if (creature->IsSummon())
203 {
204 _summonedNPCs.insert(creature->GetGUID());
205 }
206 break;
207 }
209 }
@ NPC_JAINA
Definition: zone_undercity.cpp:418
@ NPC_THRALL
Definition: zone_undercity.cpp:447
@ NPC_GHOUL
Definition: chapter1.cpp:395
@ NPC_INFERNAL_TARGET
Definition: karazhan.h:137
@ NPC_DRUID_OF_THE_TALON
Definition: hyjal.h:104
@ NPC_NELF_ANCIENT_OF_WAR
Definition: hyjal.h:108
@ NPC_GARGO
Definition: hyjal.h:69
@ NPC_WINTERCHILL
Definition: hyjal.h:114
@ NPC_HORDE_PEON
Definition: hyjal.h:97
@ NPC_STALK
Definition: hyjal.h:72
@ NPC_INFER
Definition: hyjal.h:71
@ NPC_KAZROGAL
Definition: hyjal.h:116
@ NPC_NELF_ANCIENT_OF_LORE
Definition: hyjal.h:107
@ NPC_ALLIANCE_KNIGHT
Definition: hyjal.h:82
@ NPC_DRYAD
Definition: hyjal.h:111
@ NPC_ALLIANCE_FOOTMAN
Definition: hyjal.h:83
@ NPC_NELF_ANCIENT_PROT
Definition: hyjal.h:106
@ NPC_HORDE_WITCH_DOCTOR
Definition: hyjal.h:96
@ NPC_FROST
Definition: hyjal.h:70
@ NPC_HORDE_SHAMAN
Definition: hyjal.h:92
@ NPC_GUARDIAN_ELEMENTAL
Definition: hyjal.h:87
@ NPC_HORDE_HEADHUNTER
Definition: hyjal.h:91
@ NPC_DRUID_OF_THE_CLAW
Definition: hyjal.h:105
@ NPC_TYRANDE
Definition: hyjal.h:103
@ NPC_TOWERING_INFERNAL
Definition: hyjal.h:122
@ NPC_LESSER_DOOMGUARD
Definition: hyjal.h:123
@ NPC_NECRO
Definition: hyjal.h:67
@ NPC_ALLIANCE_RIFLEMAN
Definition: hyjal.h:84
@ NPC_HORDE_HEALING_WARD
Definition: hyjal.h:94
@ NPC_ABOMI
Definition: hyjal.h:66
@ NPC_NELF_HUNTRESS
Definition: hyjal.h:110
@ NPC_HORDE_GRUNT
Definition: hyjal.h:93
@ NPC_DIRE_WOLF
Definition: hyjal.h:100
@ NPC_CRYPT
Definition: hyjal.h:65
@ NPC_TAUREN_WARRIOR
Definition: hyjal.h:95
@ NPC_ANETHERON
Definition: hyjal.h:115
@ NPC_ALLIANCE_PRIEST
Definition: hyjal.h:85
@ NPC_ALLIANCE_SORCERESS
Definition: hyjal.h:86
@ NPC_BANSH
Definition: hyjal.h:68
@ NPC_NELF_ARCHER
Definition: hyjal.h:109
@ NPC_AZGALOR
Definition: hyjal.h:117
@ NPC_ALLIANCE_PEASANT
Definition: hyjal.h:81
@ WORLD_STATE_ENEMYCOUNT
Definition: hyjal.h:58
virtual void DoAction(int32)
Definition: UnitAI.h:212
CreatureAI * AI() const
Definition: Creature.h:143
uint32 GetEntry() const
Definition: Object.h:112
static ObjectGuid GetGUID(Object const *o)
Definition: Object.h:109
bool IsSummon() const
Definition: Unit.h:707
void OnCreatureCreate(Creature *creature) override
Definition: InstanceScript.cpp:58
void DoUpdateWorldState(uint32 worldstateId, uint32 worldstateValue)
Definition: InstanceScript.cpp:577

References _baseAlliance, _baseHorde, _baseNightElf, _bossWave, _encounterNPCs, _infernalTargets, _retreat, _summonedNPCs, Creature::AI(), UnitAI::DoAction(), InstanceScript::DoUpdateWorldState(), Object::GetEntry(), Object::GetGUID(), Unit::IsSummon(), NPC_ABOMI, NPC_ALLIANCE_FOOTMAN, NPC_ALLIANCE_KNIGHT, NPC_ALLIANCE_PEASANT, NPC_ALLIANCE_PRIEST, NPC_ALLIANCE_RIFLEMAN, NPC_ALLIANCE_SORCERESS, NPC_ANETHERON, NPC_AZGALOR, NPC_BANSH, NPC_CRYPT, NPC_DIRE_WOLF, NPC_DRUID_OF_THE_CLAW, NPC_DRUID_OF_THE_TALON, NPC_DRYAD, NPC_FROST, NPC_GARGO, NPC_GHOUL, NPC_GUARDIAN_ELEMENTAL, NPC_HORDE_GRUNT, NPC_HORDE_HEADHUNTER, NPC_HORDE_HEALING_WARD, NPC_HORDE_PEON, NPC_HORDE_SHAMAN, NPC_HORDE_WITCH_DOCTOR, NPC_INFER, NPC_INFERNAL_TARGET, NPC_JAINA, NPC_KAZROGAL, NPC_LESSER_DOOMGUARD, NPC_NECRO, NPC_NELF_ANCIENT_OF_LORE, NPC_NELF_ANCIENT_OF_WAR, NPC_NELF_ANCIENT_PROT, NPC_NELF_ARCHER, NPC_NELF_HUNTRESS, NPC_STALK, NPC_TAUREN_WARRIOR, NPC_THRALL, NPC_TOWERING_INFERNAL, NPC_TYRANDE, NPC_WINTERCHILL, InstanceScript::OnCreatureCreate(), TO_BE_DECIDED, trash, and WORLD_STATE_ENEMYCOUNT.

◆ OnGameObjectCreate()

void instance_hyjal::instance_mount_hyjal_InstanceMapScript::OnGameObjectCreate ( GameObject go)
inlineoverridevirtual

Reimplemented from InstanceScript.

111 {
112 switch (go->GetEntry())
113 {
114 case GO_ANCIENT_GEM:
115 if (go->GetPositionY() > -2500.f)
116 _ancientGemAlliance.insert(go->GetGUID());
117 else
118 _ancientGemHorde.insert(go->GetGUID());
119 go->DespawnOrUnsummon();
120 break;
121 case GO_FLAME:
122 if (go->GetPositionX() < 5360.f)
123 _roaringFlameAlliance.insert(go->GetGUID());
124 else
125 _roaringFlameHorde.insert(go->GetGUID());
126 go->DespawnOrUnsummon();
127 break;
128 }
130 }
@ GO_FLAME
Definition: hyjal.h:131
@ GO_ANCIENT_GEM
Definition: hyjal.h:130
void DespawnOrUnsummon(Milliseconds delay=0ms, Seconds forcedRespawnTime=0s)
Definition: GameObject.cpp:933
float GetPositionX() const
Definition: Position.h:117
float GetPositionY() const
Definition: Position.h:118
void OnGameObjectCreate(GameObject *go) override
Definition: InstanceScript.cpp:70

References _ancientGemAlliance, _ancientGemHorde, _roaringFlameAlliance, _roaringFlameHorde, GameObject::DespawnOrUnsummon(), Object::GetEntry(), Object::GetGUID(), Position::GetPositionX(), Position::GetPositionY(), GO_ANCIENT_GEM, GO_FLAME, and InstanceScript::OnGameObjectCreate().

◆ OnPlayerInWaterStateUpdate()

void instance_hyjal::instance_mount_hyjal_InstanceMapScript::OnPlayerInWaterStateUpdate ( Player player,
bool  inWater 
)
inlineoverridevirtual

Reimplemented from InstanceScript.

561 {
562 if (inWater && player->GetAreaId() == AREA_NORDRASSIL)
563 {
564 player->CastSpell(player, SPELL_ETERNAL_SILENCE, true);
565 }
566 }
@ SPELL_ETERNAL_SILENCE
Definition: hyjal.h:151
@ AREA_NORDRASSIL
Definition: hyjal.h:149
uint32 GetAreaId() const
Definition: Object.cpp:3152
SpellCastResult CastSpell(SpellCastTargets const &targets, SpellInfo const *spellInfo, CustomSpellValues const *value, TriggerCastFlags triggerFlags=TRIGGERED_NONE, Item *castItem=nullptr, AuraEffect const *triggeredByAura=nullptr, ObjectGuid originalCaster=ObjectGuid::Empty)
Definition: Unit.cpp:1168

References AREA_NORDRASSIL, Unit::CastSpell(), WorldObject::GetAreaId(), and SPELL_ETERNAL_SILENCE.

◆ OnUnitDeath()

void instance_hyjal::instance_mount_hyjal_InstanceMapScript::OnUnitDeath ( Unit unit)
inlineoverridevirtual

Reimplemented from ZoneScript.

212 {
214
215 if (Creature* creature = unit->ToCreature())
216 {
217 switch (creature->GetEntry())
218 {
219 case NPC_NECRO:
220 case NPC_ABOMI:
221 case NPC_GHOUL:
222 case NPC_BANSH:
223 case NPC_CRYPT:
224 case NPC_GARGO:
225 case NPC_FROST:
226 case NPC_INFER:
227 case NPC_STALK:
228 if (creature->IsSummon())
229 {
231 {
232 DoUpdateWorldState(WORLD_STATE_ENEMYCOUNT, --trash); // Update the instance wave count on new trash death
233 _encounterNPCs.erase(creature->GetGUID()); // Used for despawning on wipe
234
235 if (trash == 0) // It can reach negatives if trash spawned after a retreat are killed, it shouldn't affect anything. Also happens on retail
237 }
238 }
239 break;
242 case NPC_DIRE_WOLF:
244 _summonedNPCs.erase(creature->GetGUID());
245 break;
246 case NPC_WINTERCHILL:
247 case NPC_ANETHERON:
248 case NPC_KAZROGAL:
249 case NPC_AZGALOR:
250 if (Creature* jaina = GetCreature(DATA_JAINA))
251 jaina->SetNpcFlag(UNIT_NPC_FLAG_GOSSIP);
252 if (Creature* thrall = GetCreature(DATA_THRALL))
253 thrall->SetNpcFlag(UNIT_NPC_FLAG_GOSSIP);
255 break;
256 }
257 }
258 else if (unit->IsPlayer() && GetBossState(DATA_ARCHIMONDE) == IN_PROGRESS)
259 {
260 if (Creature* archimonde = GetCreature(DATA_ARCHIMONDE))
261 archimonde->AI()->SetGUID(unit->GetGUID(), GUID_GAIN_SOUL_CHARGE_PLAYER);
262 }
263 }
@ IN_PROGRESS
Definition: InstanceScript.h:58
@ UNIT_NPC_FLAG_GOSSIP
Definition: UnitDefines.h:294
@ GUID_GAIN_SOUL_CHARGE_PLAYER
Definition: hyjal.h:153
@ DATA_RESET_WAVES
Definition: hyjal.h:49
@ DATA_JAINA
Definition: hyjal.h:40
@ DATA_THRALL
Definition: hyjal.h:41
@ DATA_SPAWN_WAVES
Definition: hyjal.h:44
@ DATA_ARCHIMONDE
Definition: hyjal.h:35
Definition: Creature.h:46
bool IsPlayer() const
Definition: Object.h:197
Creature * ToCreature()
Definition: Object.h:202
Creature * GetCreature(uint32 type)
Definition: InstanceScript.cpp:100
EncounterState GetBossState(uint32 id) const
Definition: InstanceScript.h:235
virtual void OnUnitDeath(Unit *)
Definition: ZoneScript.h:41
void SetData(uint32 type, uint32 data) override
Definition: instance_hyjal.cpp:265

References _bossWave, _encounterNPCs, _summonedNPCs, DATA_ARCHIMONDE, DATA_JAINA, DATA_RESET_WAVES, DATA_SPAWN_WAVES, DATA_THRALL, InstanceScript::DoUpdateWorldState(), InstanceScript::GetBossState(), InstanceScript::GetCreature(), Object::GetGUID(), GUID_GAIN_SOUL_CHARGE_PLAYER, IN_PROGRESS, Object::IsPlayer(), NPC_ABOMI, NPC_ANETHERON, NPC_AZGALOR, NPC_BANSH, NPC_CRYPT, NPC_DIRE_WOLF, NPC_FROST, NPC_GARGO, NPC_GHOUL, NPC_GUARDIAN_ELEMENTAL, NPC_INFER, NPC_KAZROGAL, NPC_LESSER_DOOMGUARD, NPC_NECRO, NPC_STALK, NPC_TOWERING_INFERNAL, NPC_WINTERCHILL, ZoneScript::OnUnitDeath(), SetData(), TO_BE_DECIDED, Object::ToCreature(), trash, UNIT_NPC_FLAG_GOSSIP, and WORLD_STATE_ENEMYCOUNT.

◆ ScheduleWaves()

void instance_hyjal::instance_mount_hyjal_InstanceMapScript::ScheduleWaves ( Milliseconds  ,
uint8  startWaves,
uint8  maxWaves,
Milliseconds  timerptr[] 
)
inline
516 {
517 // No overlapping!
519 trash = 0; // Reset counter here to avoid resetting the counter from scheduled waves. Required because creatures killed for RP events counts towards the kill counter as well, confirmed in Retail.
520
521 scheduler.Schedule(1ms, [this, startWaves, maxWaves, timerptr](TaskContext context)
522 {
523 // If all waves reached, cancel scheduling new ones
524 if (_currentWave >= maxWaves)
525 return;
526
527 instance->SummonCreatureGroup(startWaves + _currentWave); // _currentWave should be 0 when this function is first called
528
529 // Check if it's time to summon Infernals
531 {
532 switch (_currentWave + 1)
533 {
534 case 3:
535 case 4:
536 case 7:
538 break;
539 default:
540 break;
541 }
542 }
543
544 context.Repeat(timerptr[_currentWave]);
545 if (++_currentWave < maxWaves && _bossWave != TO_BE_DECIDED)
546 {
549 }
550
552 });
553 }
@ DONE
Definition: InstanceScript.h:60
@ CONTEXT_GROUP_WAVES
Definition: hyjal.h:147
@ WORLD_STATE_WAVES
Definition: hyjal.h:56
@ WORLD_STATE_ENEMY
Definition: hyjal.h:57
@ DATA_SPAWN_INFERNALS
Definition: hyjal.h:45
@ DATA_KAZROGAL
Definition: hyjal.h:33
@ DATA_AZGALOR
Definition: hyjal.h:34
TaskScheduler & Schedule(std::chrono::duration< _Rep, _Period > const &time, task_handler_t const &task)
Definition: TaskScheduler.h:229
TaskScheduler & CancelGroup(group_t const group)
Definition: TaskScheduler.cpp:53
Definition: TaskScheduler.h:415
TaskContext & Repeat(std::chrono::duration< _Rep, _Period > const &duration)
Definition: TaskScheduler.h:485
TaskContext & SetGroup(TaskScheduler::group_t const group)
Sets the event in the given group.
Definition: TaskScheduler.cpp:217
Map * instance
Definition: InstanceScript.h:148
TaskScheduler scheduler
Definition: InstanceScript.h:282
void SummonCreatureGroup(uint8 group, std::list< TempSummon * > *list=nullptr)
Definition: Object.cpp:2278

References CONTEXT_GROUP_WAVES, DATA_AZGALOR, DATA_KAZROGAL, DATA_SPAWN_INFERNALS, DONE, TaskContext::Repeat(), TaskContext::SetGroup(), TO_BE_DECIDED, WORLD_STATE_ENEMY, and WORLD_STATE_WAVES.

Referenced by SetData().

◆ SetData()

void instance_hyjal::instance_mount_hyjal_InstanceMapScript::SetData ( uint32  type,
uint32  data 
)
inlineoverridevirtual

Reimplemented from ZoneScript.

266 {
267 switch (type)
268 {
272 // Spawn Ancient Gems
273 for (ObjectGuid const& guid : _ancientGemAlliance)
274 if (GameObject* gem = instance->GetGameObject(guid))
275 gem->Respawn();
276
277 // Move all alliance NPCs near Jaina (only happens in this base, not Horde's)
278 if (Creature* jaina = GetCreature(DATA_JAINA))
279 {
280 for (ObjectGuid const& guid : _baseAlliance)
281 {
282 if (Creature* creature = instance->GetCreature(guid))
283 {
284 if (creature->IsAlive())
285 {
286 float x, y, z;
287 jaina->GetNearPoint(creature, x, y, z, 10.f, 0, jaina->GetAngle(creature));
288 creature->SetWalk(true);
289 creature->GetMotionMaster()->MovePoint(1, x, y, z);
290 }
291 }
292 }
293 }
294
295 // Despawn all alliance NPCs
296 scheduler.Schedule(21000ms, [this](TaskContext)
297 {
298 for (ObjectGuid const& guid : _baseAlliance)
299 if (Creature* creature = instance->GetCreature(guid))
300 creature->DespawnOrUnsummon();
301
302 // Spawn Roaring Flame after a delay
303 scheduler.Schedule(30s, [this](TaskContext)
304 {
305 for (ObjectGuid const& guid : _roaringFlameAlliance)
306 {
307 if (GameObject* flame = instance->GetGameObject(guid))
308 flame->Respawn();
309 }
310 });
311 });
312
313 // Spawn Overrun waves
315
316 SaveToDB();
317 break;
321 for (ObjectGuid const& guid : _ancientGemHorde)
322 {
323 if (GameObject* gem = instance->GetGameObject(guid))
324 gem->Respawn();
325 }
326
327 if (Creature* jaina = GetCreature(DATA_JAINA))
328 {
329 for (ObjectGuid const& guid : _baseHorde)
330 {
331 if (Creature* creature = instance->GetCreature(guid))
332 {
333 if (creature->IsAlive())
334 {
335 float x, y, z;
336 jaina->GetNearPoint(creature, x, y, z, 10.f, 0, jaina->GetAngle(creature));
337 creature->SetWalk(true);
338 creature->GetMotionMaster()->MovePoint(1, x, y, z);
339 }
340 }
341 }
342 }
343
344 scheduler.Schedule(21000ms, [this](TaskContext)
345 {
346 for (ObjectGuid const& guid : _baseHorde)
347 if (Creature* creature = instance->GetCreature(guid))
348 creature->DespawnOrUnsummon();
349
350 scheduler.Schedule(30s, [this](TaskContext)
351 {
352 for (ObjectGuid const& guid : _roaringFlameHorde)
353 if (GameObject* flame = instance->GetGameObject(guid))
354 flame->Respawn();
355 });
356 });
357
359
360 SaveToDB();
361 break;
362 case DATA_SPAWN_WAVES:
363 _retreat = 0;
365 {
367 for (ObjectGuid const& guid : _baseAlliance)
368 if (Creature* creature = instance->GetCreature(guid))
369 creature->Respawn();
372 }
373 else if (GetBossState(DATA_ANETHERON) != DONE)
374 {
376 for (ObjectGuid const& guid : _baseAlliance)
377 if (Creature* creature = instance->GetCreature(guid))
378 creature->Respawn();
381 }
382 else if (GetBossState(DATA_KAZROGAL) != DONE)
383 {
385 for (ObjectGuid const& guid : _baseHorde)
386 if (Creature* creature = instance->GetCreature(guid))
387 creature->Respawn();
390 }
391 else if (GetBossState(DATA_AZGALOR) != DONE)
392 {
394 for (ObjectGuid const& guid : _baseHorde)
395 if (Creature* creature = instance->GetCreature(guid))
396 creature->Respawn();
399 }
400 else if (GetBossState(DATA_ARCHIMONDE) != DONE)
401 {
404 }
405
407 {
409 scheduler.Schedule(30s, [this](TaskContext context)
410 {
412 {
413 // Reset the instance if its empty.
414 // This is necessary because bosses get stuck fighting unreachable mobs.
415 // Remove this when we are sure pathing no longer causes this.
418 else
419 context.Repeat();
420 }
421 });
422 }
423
424 break;
426 {
427 uint8 doubleInfernalCount = 2;
428 // Uses SmartAI
429 for (ObjectGuid const& guid : _infernalTargets)
430 {
431 if (Creature* target = instance->GetCreature(guid))
432 {
433 if (doubleInfernalCount > 0)
434 {
435 target->AI()->SetData(DATA_SPAWN_INFERNALS, 2); // Spawns 2 infernals, as there are only 6 spawns, some summon 2
436 doubleInfernalCount--;
437 }
438 else
439 target->AI()->SetData(DATA_SPAWN_INFERNALS, 1);
440 }
441 }
442 }
443 break;
445 if (Creature* archimonde = GetCreature(DATA_ARCHIMONDE))
446 archimonde->DespawnOrUnsummon(0s, 300s);
447 [[fallthrough]];
449 case DATA_RESET_HORDE:
451 {
452 for (ObjectGuid const& guid : _baseAlliance)
453 if (Creature* creature = instance->GetCreature(guid))
454 creature->DespawnOrUnsummon(0s, 300s);
455 }
456
458 {
459 for (ObjectGuid const& guid : _baseHorde)
460 if (Creature* creature = instance->GetCreature(guid))
461 creature->DespawnOrUnsummon(0s, 300s);
462 }
463
464 for (ObjectGuid const& guid : _baseNightElf)
465 if (Creature* creature = instance->GetCreature(guid))
466 creature->DespawnOrUnsummon(0s, 300s);
467
468 for (ObjectGuid const& guid : _encounterNPCs)
469 if (Creature* creature = instance->GetCreature(guid))
470 creature->DespawnOrUnsummon();
471
472 // also force despawn boss summons
473 for (ObjectGuid const& guid : _summonedNPCs)
474 if (Creature* creature = instance->GetCreature(guid))
475 creature->DespawnOrUnsummon();
476
479
481 break;
482 case DATA_RESET_WAVES:
484 _encounterNPCs.clear();
485 _summonedNPCs.clear();
486 _currentWave = 0;
487 trash = 0;
489 _retreat = 0;
493 break;
494 }
495
496 if (data == DONE)
497 {
498 SaveToDB();
499 }
500 }
std::uint8_t uint8
Definition: Define.h:109
@ NOT_STARTED
Definition: InstanceScript.h:57
Milliseconds hyjalRetreatTimers[2][MAX_WAVES_RETREAT]
Definition: instance_hyjal.cpp:62
Milliseconds hyjalWaveTimers[4][MAX_WAVES_STANDARD]
Definition: instance_hyjal.cpp:54
Milliseconds hyjalNightElfWaveTimers[1][MAX_WAVES_NIGHT_ELF]
Definition: instance_hyjal.cpp:68
@ START_WAVE_WINTERCHILL
Definition: hyjal.h:139
@ MAX_WAVES_RETREAT
Definition: hyjal.h:137
@ START_WAVE_ALLIANCE_RETREAT
Definition: hyjal.h:143
@ START_WAVE_NIGHT_ELF
Definition: hyjal.h:145
@ START_WAVE_ANETHERON
Definition: hyjal.h:140
@ START_WAVE_AZGALOR
Definition: hyjal.h:142
@ START_WAVE_KAZROGAL
Definition: hyjal.h:141
@ START_WAVE_HORDE_RETREAT
Definition: hyjal.h:144
@ MAX_WAVES_STANDARD
Definition: hyjal.h:136
@ MAX_WAVES_NIGHT_ELF
Definition: hyjal.h:138
@ DATA_RESET_HORDE
Definition: hyjal.h:47
@ DATA_RESET_NIGHT_ELF
Definition: hyjal.h:48
@ DATA_RESET_ALLIANCE
Definition: hyjal.h:46
@ DATA_WINTERCHILL
Definition: hyjal.h:31
@ DATA_ANETHERON
Definition: hyjal.h:32
@ DATA_ALLIANCE_RETREAT
Definition: hyjal.h:37
@ DATA_HORDE_RETREAT
Definition: hyjal.h:38
Definition: GameObject.h:121
Definition: ObjectGuid.h:118
virtual bool SetBossState(uint32 id, EncounterState state)
Definition: InstanceScript.cpp:351
virtual bool IsEncounterInProgress() const
Definition: InstanceScript.cpp:122
void SaveToDB()
Definition: InstanceScript.cpp:41
GameObject * GetGameObject(ObjectGuid const guid)
Definition: Map.cpp:3319
Creature * GetCreature(ObjectGuid const guid)
Definition: Map.cpp:3314
uint32 GetPlayersCountExceptGMs() const
Definition: Map.cpp:2745
void ScheduleWaves(Milliseconds, uint8 startWaves, uint8 maxWaves, Milliseconds timerptr[])
Definition: instance_hyjal.cpp:515

References _ancientGemAlliance, _ancientGemHorde, _baseAlliance, _baseHorde, _baseNightElf, _bossWave, _currentWave, _encounterNPCs, _infernalTargets, _retreat, _summonedNPCs, TaskScheduler::CancelGroup(), CONTEXT_GROUP_WAVES, DATA_ALLIANCE_RETREAT, DATA_ANETHERON, DATA_ARCHIMONDE, DATA_AZGALOR, DATA_HORDE_RETREAT, DATA_JAINA, DATA_KAZROGAL, DATA_RESET_ALLIANCE, DATA_RESET_HORDE, DATA_RESET_NIGHT_ELF, DATA_RESET_WAVES, DATA_SPAWN_INFERNALS, DATA_SPAWN_WAVES, DATA_WINTERCHILL, DONE, InstanceScript::DoUpdateWorldState(), InstanceScript::GetBossState(), Map::GetCreature(), InstanceScript::GetCreature(), Map::GetGameObject(), Map::GetPlayersCountExceptGMs(), hyjalNightElfWaveTimers, hyjalRetreatTimers, hyjalWaveTimers, InstanceScript::instance, InstanceScript::IsEncounterInProgress(), MAX_WAVES_NIGHT_ELF, MAX_WAVES_RETREAT, MAX_WAVES_STANDARD, NOT_STARTED, TaskContext::Repeat(), InstanceScript::SaveToDB(), TaskScheduler::Schedule(), InstanceScript::scheduler, ScheduleWaves(), InstanceScript::SetBossState(), SetData(), START_WAVE_ALLIANCE_RETREAT, START_WAVE_ANETHERON, START_WAVE_AZGALOR, START_WAVE_HORDE_RETREAT, START_WAVE_KAZROGAL, START_WAVE_NIGHT_ELF, START_WAVE_WINTERCHILL, TO_BE_DECIDED, trash, WORLD_STATE_ENEMY, WORLD_STATE_ENEMYCOUNT, and WORLD_STATE_WAVES.

Referenced by OnUnitDeath(), and SetData().

◆ Update()

void instance_hyjal::instance_mount_hyjal_InstanceMapScript::Update ( uint32  diff)
inlineoverridevirtual

Reimplemented from InstanceScript.

556 {
557 scheduler.Update(diff);
558 }
TaskScheduler & Update(success_t const &callback=EmptyCallback)
Definition: TaskScheduler.cpp:27

Member Data Documentation

◆ _ancientGemAlliance

GuidSet instance_hyjal::instance_mount_hyjal_InstanceMapScript::_ancientGemAlliance
protected

◆ _ancientGemHorde

GuidSet instance_hyjal::instance_mount_hyjal_InstanceMapScript::_ancientGemHorde
protected

◆ _baseAlliance

GuidSet instance_hyjal::instance_mount_hyjal_InstanceMapScript::_baseAlliance
protected

◆ _baseHorde

GuidSet instance_hyjal::instance_mount_hyjal_InstanceMapScript::_baseHorde
protected

◆ _baseNightElf

GuidSet instance_hyjal::instance_mount_hyjal_InstanceMapScript::_baseNightElf
protected

◆ _bossWave

uint8 instance_hyjal::instance_mount_hyjal_InstanceMapScript::_bossWave
protected

◆ _currentWave

uint8 instance_hyjal::instance_mount_hyjal_InstanceMapScript::_currentWave
protected

Referenced by Initialize(), and SetData().

◆ _encounterNPCs

GuidSet instance_hyjal::instance_mount_hyjal_InstanceMapScript::_encounterNPCs
protected

◆ _infernalTargets

GuidVector instance_hyjal::instance_mount_hyjal_InstanceMapScript::_infernalTargets
protected

◆ _retreat

uint8 instance_hyjal::instance_mount_hyjal_InstanceMapScript::_retreat
protected

◆ _roaringFlameAlliance

GuidSet instance_hyjal::instance_mount_hyjal_InstanceMapScript::_roaringFlameAlliance
protected

Referenced by Initialize(), and OnGameObjectCreate().

◆ _roaringFlameHorde

GuidSet instance_hyjal::instance_mount_hyjal_InstanceMapScript::_roaringFlameHorde
protected

Referenced by Initialize(), and OnGameObjectCreate().

◆ _summonedNPCs

GuidSet instance_hyjal::instance_mount_hyjal_InstanceMapScript::_summonedNPCs
protected

◆ trash

int32 instance_hyjal::instance_mount_hyjal_InstanceMapScript::trash
protected