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

instance_hyjal::instance_mount_hyjal_InstanceMapScript::instance_mount_hyjal_InstanceMapScript ( Map map)
inline
83 : InstanceScript(map)
84 {
89 }
ObjectData const creatureData[]
Definition: instance_hyjal.cpp:39
DoorData const doorData[]
Definition: instance_hyjal.cpp:32
#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 LoadDoorData(DoorData const *data)
Definition: InstanceScript.cpp:164
void SetHeaders(std::string const &dataHeaders)
Definition: InstanceScript.cpp:141
void LoadObjectData(ObjectData const *creatureData, ObjectData const *gameObjectData)
Definition: InstanceScript.cpp:176

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.

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

References DATA_BOSS_WAVE, and DATA_WAVE_STATUS.

◆ Initialize()

void instance_hyjal::instance_mount_hyjal_InstanceMapScript::Initialize ( )
inlineoverridevirtual

Reimplemented from InstanceScript.

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

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.

132 {
133 switch (creature->GetEntry())
134 {
135 // Alliance base
142 case NPC_JAINA:
143 _baseAlliance.insert(creature->GetGUID());
144 break;
145 // Horde base
147 case NPC_HORDE_SHAMAN:
148 case NPC_HORDE_GRUNT:
152 case NPC_HORDE_PEON:
153 case NPC_THRALL:
154 _baseHorde.insert(creature->GetGUID());
155 break;
156 // Elf base
162 case NPC_NELF_ARCHER:
164 case NPC_DRYAD:
165 case NPC_TYRANDE:
166 _baseNightElf.insert(creature->GetGUID());
167 break;
168
170 _infernalTargets.push_back(creature->GetGUID());
171 break;
172
173 case NPC_WINTERCHILL:
174 case NPC_ANETHERON:
175 case NPC_KAZROGAL:
176 case NPC_AZGALOR:
177 case NPC_NECRO:
178 case NPC_ABOMI:
179 case NPC_GHOUL:
180 case NPC_BANSH:
181 case NPC_CRYPT:
182 case NPC_STALK:
183 case NPC_GARGO:
184 case NPC_FROST:
185 case NPC_INFER:
187 creature->AI()->DoAction(_bossWave);
188 else if (_retreat)
189 creature->AI()->DoAction(_retreat);
190
191 if (creature->IsSummon() && _bossWave != TO_BE_DECIDED)
192 {
193 DoUpdateWorldState(WORLD_STATE_ENEMYCOUNT, ++trash); // Update the instance wave count on new trash spawn
194 _encounterNPCs.insert(creature->GetGUID()); // Used for despawning on wipe
195 }
196 break;
199 case NPC_DIRE_WOLF:
201 if (creature->IsSummon())
202 {
203 _summonedNPCs.insert(creature->GetGUID());
204 }
205 break;
206 }
208 }
@ 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
@ NPC_GHOUL
Definition: chapter1.cpp:393
@ NPC_JAINA
Definition: zone_undercity.cpp:418
@ NPC_THRALL
Definition: zone_undercity.cpp:447
@ NPC_INFERNAL_TARGET
Definition: karazhan.h:137
virtual void DoAction(int32)
Definition: UnitAI.h:212
CreatureAI * AI() const
Definition: Creature.h:140
uint32 GetEntry() const
Definition: Object.h:115
static ObjectGuid GetGUID(Object const *o)
Definition: Object.h:112
bool IsSummon() const
Definition: Unit.h:751
void OnCreatureCreate(Creature *creature) override
Definition: InstanceScript.cpp:58
void DoUpdateWorldState(uint32 worldstateId, uint32 worldstateValue)
Definition: InstanceScript.cpp:603

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.

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

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.

560 {
561 if (inWater && player->GetAreaId() == AREA_NORDRASSIL)
562 {
563 player->CastSpell(player, SPELL_ETERNAL_SILENCE, true);
564 }
565 }
@ SPELL_ETERNAL_SILENCE
Definition: hyjal.h:151
@ AREA_NORDRASSIL
Definition: hyjal.h:149
uint32 GetAreaId() const
Definition: Object.cpp:3165
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:1167

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.

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

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
515 {
516 // No overlapping!
518 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.
519
520 scheduler.Schedule(1ms, [this, startWaves, maxWaves, timerptr](TaskContext context)
521 {
522 // If all waves reached, cancel scheduling new ones
523 if (_currentWave >= maxWaves)
524 return;
525
526 instance->SummonCreatureGroup(startWaves + _currentWave); // _currentWave should be 0 when this function is first called
527
528 // Check if it's time to summon Infernals
530 {
531 switch (_currentWave + 1)
532 {
533 case 3:
534 case 4:
535 case 7:
537 break;
538 default:
539 break;
540 }
541 }
542
543 context.Repeat(timerptr[_currentWave]);
544 if (++_currentWave < maxWaves && _bossWave != TO_BE_DECIDED)
545 {
548 }
549
551 });
552 }
@ 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
@ DONE
Definition: InstanceScript.h:60
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
Map * instance
Definition: InstanceScript.h:148
TaskScheduler scheduler
Definition: InstanceScript.h:282
void SummonCreatureGroup(uint8 group, std::list< TempSummon * > *list=nullptr)
Definition: Object.cpp:2289

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.

265 {
266 switch (type)
267 {
271 // Spawn Ancient Gems
272 for (ObjectGuid const& guid : _ancientGemAlliance)
273 if (GameObject* gem = instance->GetGameObject(guid))
274 gem->Respawn();
275
276 // Move all alliance NPCs near Jaina (only happens in this base, not Horde's)
277 if (Creature* jaina = GetCreature(DATA_JAINA))
278 {
279 for (ObjectGuid const& guid : _baseAlliance)
280 {
281 if (Creature* creature = instance->GetCreature(guid))
282 {
283 if (creature->IsAlive())
284 {
285 float x, y, z;
286 jaina->GetNearPoint(creature, x, y, z, 10.f, 0, jaina->GetAngle(creature));
287 creature->SetWalk(true);
288 creature->GetMotionMaster()->MovePoint(1, x, y, z);
289 }
290 }
291 }
292 }
293
294 // Despawn all alliance NPCs
295 scheduler.Schedule(21000ms, [this](TaskContext)
296 {
297 for (ObjectGuid const& guid : _baseAlliance)
298 if (Creature* creature = instance->GetCreature(guid))
299 creature->DespawnOrUnsummon();
300
301 // Spawn Roaring Flame after a delay
302 scheduler.Schedule(30s, [this](TaskContext)
303 {
304 for (ObjectGuid const& guid : _roaringFlameAlliance)
305 {
306 if (GameObject* flame = instance->GetGameObject(guid))
307 flame->Respawn();
308 }
309 });
310 });
311
312 // Spawn Overrun waves
314
315 SaveToDB();
316 break;
320 for (ObjectGuid const& guid : _ancientGemHorde)
321 {
322 if (GameObject* gem = instance->GetGameObject(guid))
323 gem->Respawn();
324 }
325
326 if (Creature* jaina = GetCreature(DATA_JAINA))
327 {
328 for (ObjectGuid const& guid : _baseHorde)
329 {
330 if (Creature* creature = instance->GetCreature(guid))
331 {
332 if (creature->IsAlive())
333 {
334 float x, y, z;
335 jaina->GetNearPoint(creature, x, y, z, 10.f, 0, jaina->GetAngle(creature));
336 creature->SetWalk(true);
337 creature->GetMotionMaster()->MovePoint(1, x, y, z);
338 }
339 }
340 }
341 }
342
343 scheduler.Schedule(21000ms, [this](TaskContext)
344 {
345 for (ObjectGuid const& guid : _baseHorde)
346 if (Creature* creature = instance->GetCreature(guid))
347 creature->DespawnOrUnsummon();
348
349 scheduler.Schedule(30s, [this](TaskContext)
350 {
351 for (ObjectGuid const& guid : _roaringFlameHorde)
352 if (GameObject* flame = instance->GetGameObject(guid))
353 flame->Respawn();
354 });
355 });
356
358
359 SaveToDB();
360 break;
361 case DATA_SPAWN_WAVES:
362 _retreat = 0;
364 {
366 for (ObjectGuid const& guid : _baseAlliance)
367 if (Creature* creature = instance->GetCreature(guid))
368 creature->Respawn();
371 }
372 else if (GetBossState(DATA_ANETHERON) != DONE)
373 {
375 for (ObjectGuid const& guid : _baseAlliance)
376 if (Creature* creature = instance->GetCreature(guid))
377 creature->Respawn();
380 }
381 else if (GetBossState(DATA_KAZROGAL) != DONE)
382 {
384 for (ObjectGuid const& guid : _baseHorde)
385 if (Creature* creature = instance->GetCreature(guid))
386 creature->Respawn();
389 }
390 else if (GetBossState(DATA_AZGALOR) != DONE)
391 {
393 for (ObjectGuid const& guid : _baseHorde)
394 if (Creature* creature = instance->GetCreature(guid))
395 creature->Respawn();
398 }
399 else if (GetBossState(DATA_ARCHIMONDE) != DONE)
400 {
403 }
404
406 {
408 scheduler.Schedule(30s, [this](TaskContext context)
409 {
411 {
412 // Reset the instance if its empty.
413 // This is necessary because bosses get stuck fighting unreachable mobs.
414 // Remove this when we are sure pathing no longer causes this.
417 else
418 context.Repeat();
419 }
420 });
421 }
422
423 break;
425 {
426 uint8 doubleInfernalCount = 2;
427 // Uses SmartAI
428 for (ObjectGuid const& guid : _infernalTargets)
429 {
430 if (Creature* target = instance->GetCreature(guid))
431 {
432 if (doubleInfernalCount > 0)
433 {
434 target->AI()->SetData(DATA_SPAWN_INFERNALS, 2); // Spawns 2 infernals, as there are only 6 spawns, some summon 2
435 doubleInfernalCount--;
436 }
437 else
438 target->AI()->SetData(DATA_SPAWN_INFERNALS, 1);
439 }
440 }
441 }
442 break;
444 if (Creature* archimonde = GetCreature(DATA_ARCHIMONDE))
445 archimonde->DespawnOrUnsummon(0s, 300s);
446 [[fallthrough]];
448 case DATA_RESET_HORDE:
450 {
451 for (ObjectGuid const& guid : _baseAlliance)
452 if (Creature* creature = instance->GetCreature(guid))
453 creature->DespawnOrUnsummon(0s, 300s);
454 }
455
457 {
458 for (ObjectGuid const& guid : _baseHorde)
459 if (Creature* creature = instance->GetCreature(guid))
460 creature->DespawnOrUnsummon(0s, 300s);
461 }
462
463 for (ObjectGuid const& guid : _baseNightElf)
464 if (Creature* creature = instance->GetCreature(guid))
465 creature->DespawnOrUnsummon(0s, 300s);
466
467 for (ObjectGuid const& guid : _encounterNPCs)
468 if (Creature* creature = instance->GetCreature(guid))
469 creature->DespawnOrUnsummon();
470
471 // also force despawn boss summons
472 for (ObjectGuid const& guid : _summonedNPCs)
473 if (Creature* creature = instance->GetCreature(guid))
474 creature->DespawnOrUnsummon();
475
478
480 break;
481 case DATA_RESET_WAVES:
483 _encounterNPCs.clear();
484 _summonedNPCs.clear();
485 _currentWave = 0;
486 trash = 0;
488 _retreat = 0;
492 break;
493 }
494
495 if (data == DONE)
496 {
497 SaveToDB();
498 }
499 }
std::uint8_t uint8
Definition: Define.h:109
Milliseconds hyjalRetreatTimers[2][MAX_WAVES_RETREAT]
Definition: instance_hyjal.cpp:61
Milliseconds hyjalWaveTimers[4][MAX_WAVES_STANDARD]
Definition: instance_hyjal.cpp:53
Milliseconds hyjalNightElfWaveTimers[1][MAX_WAVES_NIGHT_ELF]
Definition: instance_hyjal.cpp:67
@ 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
@ NOT_STARTED
Definition: InstanceScript.h:57
Definition: GameObject.h:120
Definition: ObjectGuid.h:118
virtual bool SetBossState(uint32 id, EncounterState state)
Definition: InstanceScript.cpp:373
virtual bool IsEncounterInProgress() const
Definition: InstanceScript.cpp:125
void SaveToDB()
Definition: InstanceScript.cpp:41
GameObject * GetGameObject(ObjectGuid const guid)
Definition: Map.cpp:3322
Creature * GetCreature(ObjectGuid const guid)
Definition: Map.cpp:3317
uint32 GetPlayersCountExceptGMs() const
Definition: Map.cpp:2748
void ScheduleWaves(Milliseconds, uint8 startWaves, uint8 maxWaves, Milliseconds timerptr[])
Definition: instance_hyjal.cpp:514

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.

555 {
556 scheduler.Update(diff);
557 }
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