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

Public Member Functions

 instance_vault_of_archavon_InstanceMapScript (Map *map)
 
void Initialize () override
 
void OnPlayerEnter (Player *) override
 
void Update (uint32 diff) override
 
bool IsEncounterInProgress () const override
 
void OnCreatureCreate (Creature *creature) override
 
ObjectGuid GetGuidData (uint32 identifier) const override
 
uint32 GetData (uint32 identifier) const override
 
void SetData (uint32 type, uint32 data) override
 
bool CheckAchievementCriteriaMeet (uint32 criteria_id, Player const *, Unit const *, uint32) override
 
void ReadSaveDataMore (std::istringstream &data) override
 
void WriteSaveDataMore (std::ostringstream &data) 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)
 

Private Attributes

time_t ArchavonDeath
 
time_t EmalonDeath
 
time_t KoralonDeath
 
uint32 checkTimer
 
bool stoned
 
uint32 m_auiEncounter [MAX_ENCOUNTER]
 
ObjectGuid bossGUIDs [MAX_ENCOUNTER]
 

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

instance_vault_of_archavon::instance_vault_of_archavon_InstanceMapScript::instance_vault_of_archavon_InstanceMapScript ( Map map)
inline
41 : InstanceScript(map)
42 {
43 }
Definition: InstanceScript.h:142

Member Function Documentation

◆ CheckAchievementCriteriaMeet()

bool instance_vault_of_archavon::instance_vault_of_archavon_InstanceMapScript::CheckAchievementCriteriaMeet ( uint32  criteria_id,
Player const *  ,
Unit const *  ,
uint32   
)
inlineoverridevirtual

Reimplemented from InstanceScript.

213 {
214 switch (criteria_id)
215 {
219 {
220 // instance difficulty check is already done in db (achievement_criteria_data)
221 // int() for Visual Studio, compile errors with std::abs(time_t)
222 return (std::abs(int(ArchavonDeath - EmalonDeath)) < MINUTE && \
223 std::abs(int(EmalonDeath - KoralonDeath)) < MINUTE && \
224 std::abs(int(KoralonDeath - ArchavonDeath)) < MINUTE);
225 }
226 break;
227 default:
228 break;
229 }
230
231 return false;
232 }
constexpr auto MINUTE
Definition: Common.h:47
@ CRITERIA_EARTH_WIND_FIRE_25
Definition: vault_of_archavon.h:48
@ CRITERIA_EARTH_WIND_FIRE_10
Definition: vault_of_archavon.h:47
time_t ArchavonDeath
Definition: instance_vault_of_archavon.cpp:251
time_t KoralonDeath
Definition: instance_vault_of_archavon.cpp:253
time_t EmalonDeath
Definition: instance_vault_of_archavon.cpp:252

References ArchavonDeath, CRITERIA_EARTH_WIND_FIRE_10, CRITERIA_EARTH_WIND_FIRE_25, EmalonDeath, KoralonDeath, and MINUTE.

◆ GetData()

uint32 instance_vault_of_archavon::instance_vault_of_archavon_InstanceMapScript::GetData ( uint32  identifier) const
inlineoverridevirtual

Reimplemented from ZoneScript.

171 {
172 if (identifier == DATA_STONED)
173 return (uint32)stoned;
174 return 0;
175 }
std::uint32_t uint32
Definition: Define.h:107
@ DATA_STONED
Definition: vault_of_archavon.h:42
bool stoned
Definition: instance_vault_of_archavon.cpp:255

References DATA_STONED, and stoned.

◆ GetGuidData()

ObjectGuid instance_vault_of_archavon::instance_vault_of_archavon_InstanceMapScript::GetGuidData ( uint32  identifier) const
inlineoverridevirtual

Reimplemented from InstanceScript.

163 {
164 if (identifier < MAX_ENCOUNTER)
165 return bossGUIDs[identifier];
166
167 return ObjectGuid::Empty;
168 }
#define MAX_ENCOUNTER
Definition: violet_hold.h:21
static ObjectGuid const Empty
Definition: ObjectGuid.h:120
ObjectGuid bossGUIDs[MAX_ENCOUNTER]
Definition: instance_vault_of_archavon.cpp:258

References bossGUIDs, ObjectGuid::Empty, and MAX_ENCOUNTER.

◆ Initialize()

void instance_vault_of_archavon::instance_vault_of_archavon_InstanceMapScript::Initialize ( )
inlineoverridevirtual

Reimplemented from InstanceScript.

46 {
48 memset(&m_auiEncounter, 0, sizeof(m_auiEncounter));
49
50 ArchavonDeath = 0;
51 EmalonDeath = 0;
52 KoralonDeath = 0;
53 checkTimer = 0;
54 stoned = false;
55 }
#define DataHeader
Definition: blackrock_depths.h:23
void SetHeaders(std::string const &dataHeaders)
Definition: InstanceScript.cpp:141
uint32 m_auiEncounter[MAX_ENCOUNTER]
Definition: instance_vault_of_archavon.cpp:257
uint32 checkTimer
Definition: instance_vault_of_archavon.cpp:254

References ArchavonDeath, checkTimer, DataHeader, EmalonDeath, KoralonDeath, m_auiEncounter, InstanceScript::SetHeaders(), and stoned.

◆ IsEncounterInProgress()

bool instance_vault_of_archavon::instance_vault_of_archavon_InstanceMapScript::IsEncounterInProgress ( ) const
inlineoverridevirtual

Reimplemented from InstanceScript.

131 {
132 for (uint8 i = 0; i < MAX_ENCOUNTER; ++i)
133 if (m_auiEncounter[i] == IN_PROGRESS)
134 return true;
135
136 Battlefield* bf = sBattlefieldMgr->GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG);
137 if (!bf || bf->IsWarTime() || bf->GetTimer() <= 10 * MINUTE * IN_MILLISECONDS)
138 return true;
139
140 return false;
141 }
constexpr auto IN_MILLISECONDS
Definition: Common.h:53
std::uint8_t uint8
Definition: Define.h:109
@ BATTLEFIELD_BATTLEID_WG
Definition: Battlefield.h:35
#define sBattlefieldMgr
Definition: BattlefieldMgr.h:77
@ IN_PROGRESS
Definition: InstanceScript.h:58
Definition: Battlefield.h:204
uint32 GetTimer()
Definition: Battlefield.h:352
bool IsWarTime()
Return true if battle is start, false if battle is not started.
Definition: Battlefield.h:247

References BATTLEFIELD_BATTLEID_WG, Battlefield::GetTimer(), IN_MILLISECONDS, IN_PROGRESS, Battlefield::IsWarTime(), m_auiEncounter, MAX_ENCOUNTER, MINUTE, and sBattlefieldMgr.

◆ OnCreatureCreate()

void instance_vault_of_archavon::instance_vault_of_archavon_InstanceMapScript::OnCreatureCreate ( Creature creature)
inlineoverridevirtual

Reimplemented from InstanceScript.

144 {
145 switch (creature->GetEntry())
146 {
147 case CREATURE_TORAVON:
148 bossGUIDs[EVENT_TORAVON] = creature->GetGUID();
149 break;
151 bossGUIDs[EVENT_ARCHAVON] = creature->GetGUID();
152 break;
153 case CREATURE_KORALON:
154 bossGUIDs[EVENT_KORALON] = creature->GetGUID();
155 break;
156 case CREATURE_EMALON:
157 bossGUIDs[EVENT_EMALON] = creature->GetGUID();
158 break;
159 }
160 }
@ CREATURE_EMALON
Definition: vault_of_archavon.h:30
@ CREATURE_KORALON
Definition: vault_of_archavon.h:31
@ CREATURE_ARCHAVON
Definition: vault_of_archavon.h:29
@ CREATURE_TORAVON
Definition: vault_of_archavon.h:32
@ EVENT_TORAVON
Definition: vault_of_archavon.h:40
@ EVENT_KORALON
Definition: vault_of_archavon.h:39
@ EVENT_ARCHAVON
Definition: vault_of_archavon.h:37
@ EVENT_EMALON
Definition: vault_of_archavon.h:38
uint32 GetEntry() const
Definition: Object.h:115
static ObjectGuid GetGUID(Object const *o)
Definition: Object.h:112

References bossGUIDs, CREATURE_ARCHAVON, CREATURE_EMALON, CREATURE_KORALON, CREATURE_TORAVON, EVENT_ARCHAVON, EVENT_EMALON, EVENT_KORALON, EVENT_TORAVON, Object::GetEntry(), and Object::GetGUID().

◆ OnPlayerEnter()

void instance_vault_of_archavon::instance_vault_of_archavon_InstanceMapScript::OnPlayerEnter ( Player )
inlineoverridevirtual

Reimplemented from InstanceScript.

58 {
59 if (stoned)
60 {
61 for (uint8 i = 0; i < MAX_ENCOUNTER; ++i)
63 if (!cr->IsInCombat())
64 cr->RemoveAllAuras();
65
66 stoned = false;
67 }
68 }
Definition: Creature.h:43
Map * instance
Definition: InstanceScript.h:148
Creature * GetCreature(ObjectGuid const guid)
Definition: Map.cpp:3317

References bossGUIDs, Map::GetCreature(), InstanceScript::instance, MAX_ENCOUNTER, and stoned.

◆ ReadSaveDataMore()

void instance_vault_of_archavon::instance_vault_of_archavon_InstanceMapScript::ReadSaveDataMore ( std::istringstream &  data)
inlineoverridevirtual

Reimplemented from InstanceScript.

235 {
236 data >> m_auiEncounter[0];
237 data >> m_auiEncounter[1];
238 data >> m_auiEncounter[2];
239 data >> m_auiEncounter[3];
240 }

References m_auiEncounter.

◆ SetData()

void instance_vault_of_archavon::instance_vault_of_archavon_InstanceMapScript::SetData ( uint32  type,
uint32  data 
)
inlineoverridevirtual

Reimplemented from ZoneScript.

178 {
179 switch (type)
180 {
181 case EVENT_ARCHAVON:
182 case EVENT_EMALON:
183 case EVENT_KORALON:
184 case EVENT_TORAVON:
185 m_auiEncounter[type] = data;
186 break;
187 }
188
189 if (data == DONE)
190 {
191 SaveToDB();
192 switch (type)
193 {
194 case EVENT_ARCHAVON:
196 break;
197 case EVENT_EMALON:
199 break;
200 case EVENT_KORALON:
202 break;
203 default:
204 return;
205 }
206
207 // on every death of Archavon, Emalon and Koralon check our achievement
209 }
210 }
@ SPELL_EARTH_WIND_FIRE_ACHIEVEMENT_CHECK
Definition: vault_of_archavon.h:53
@ DONE
Definition: InstanceScript.h:60
Seconds GetGameTime()
Definition: GameTime.cpp:38
void DoCastSpellOnPlayers(uint32 spell)
Definition: InstanceScript.cpp:676
void SaveToDB()
Definition: InstanceScript.cpp:41

References ArchavonDeath, InstanceScript::DoCastSpellOnPlayers(), DONE, EmalonDeath, EVENT_ARCHAVON, EVENT_EMALON, EVENT_KORALON, EVENT_TORAVON, GameTime::GetGameTime(), KoralonDeath, m_auiEncounter, InstanceScript::SaveToDB(), and SPELL_EARTH_WIND_FIRE_ACHIEVEMENT_CHECK.

◆ Update()

void instance_vault_of_archavon::instance_vault_of_archavon_InstanceMapScript::Update ( uint32  diff)
inlineoverridevirtual

Reimplemented from InstanceScript.

71 {
72 checkTimer += diff;
73 if (checkTimer >= 60000)
74 {
75 checkTimer -= 60000; // one minute
76 if (Battlefield* bf = sBattlefieldMgr->GetBattlefieldByBattleId(BATTLEFIELD_BATTLEID_WG))
77 {
78 if (!bf->IsWarTime())
79 {
80 if (bf->GetTimer() <= (16 * MINUTE * IN_MILLISECONDS) && bf->GetTimer() >= (15 * MINUTE * IN_MILLISECONDS))
81 {
82 Map::PlayerList const& PlayerList = instance->GetPlayers();
83 if (!PlayerList.IsEmpty())
84 for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i)
85 if (Player* player = i->GetSource())
86 player->TextEmote("This instance will reset in 15 minutes.", nullptr, true);
87 }
88 else if (bf->GetTimer() <= (10 * MINUTE * IN_MILLISECONDS) && bf->GetTimer() >= (9 * MINUTE * IN_MILLISECONDS))
89 {
90 for (uint8 i = 0; i < MAX_ENCOUNTER; ++i)
92 if (!cr->IsInCombat())
93 {
94 cr->RemoveAllAuras();
95 if (Aura* aur = cr->AddAura(SPELL_STONED_AURA, cr))
96 {
97 aur->SetMaxDuration(60 * MINUTE * IN_MILLISECONDS);
98 aur->SetDuration(60 * MINUTE * IN_MILLISECONDS);
99 }
100 }
101
102 stoned = true;
103 }
104 else if (bf->GetTimer() <= (2 * MINUTE * IN_MILLISECONDS) && bf->GetTimer() > (MINUTE * IN_MILLISECONDS))
105 {
106 Map::PlayerList const& PlayerList = instance->GetPlayers();
107 if (!PlayerList.IsEmpty())
108 for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i)
109 if (Player* player = i->GetSource())
110 player->TextEmote("This instance is about to reset. Prepare to be removed.", nullptr, true);
111 }
112 else if (bf->GetTimer() <= MINUTE * IN_MILLISECONDS)
113 {
114 for (uint8 i = 0; i < MAX_ENCOUNTER; ++i)
115 if (Creature* cr = instance->GetCreature(bossGUIDs[i]))
116 if (cr->IsInCombat() && cr->AI())
117 cr->AI()->EnterEvadeMode();
118
119 Map::PlayerList const& PlayerList = instance->GetPlayers();
120 if (!PlayerList.IsEmpty())
121 for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i)
122 if (Player* player = i->GetSource())
123 player->TeleportTo(player->m_homebindMapId, player->m_homebindX, player->m_homebindY, player->m_homebindZ, player->GetOrientation());
124 }
125 }
126 }
127 }
128 }
@ SPELL_STONED_AURA
Definition: vault_of_archavon.h:54
bool IsEmpty() const
Definition: LinkedList.h:97
Definition: LinkedList.h:139
Definition: Player.h:1081
PlayerList const & GetPlayers() const
Definition: Map.h:484
Definition: MapRefMgr.h:26
iterator begin()
Definition: MapRefMgr.h:36
iterator end()
Definition: MapRefMgr.h:37
Definition: SpellAuras.h:87

References BATTLEFIELD_BATTLEID_WG, MapRefMgr::begin(), bossGUIDs, checkTimer, MapRefMgr::end(), Map::GetCreature(), Map::GetPlayers(), IN_MILLISECONDS, InstanceScript::instance, LinkedListHead::IsEmpty(), MAX_ENCOUNTER, MINUTE, sBattlefieldMgr, SPELL_STONED_AURA, and stoned.

◆ WriteSaveDataMore()

void instance_vault_of_archavon::instance_vault_of_archavon_InstanceMapScript::WriteSaveDataMore ( std::ostringstream &  data)
inlineoverridevirtual

Reimplemented from InstanceScript.

243 {
244 data << m_auiEncounter[0] << ' '
245 << m_auiEncounter[1] << ' '
246 << m_auiEncounter[2] << ' '
247 << m_auiEncounter[3];
248 }

References m_auiEncounter.

Member Data Documentation

◆ ArchavonDeath

time_t instance_vault_of_archavon::instance_vault_of_archavon_InstanceMapScript::ArchavonDeath
private

◆ bossGUIDs

ObjectGuid instance_vault_of_archavon::instance_vault_of_archavon_InstanceMapScript::bossGUIDs[MAX_ENCOUNTER]
private

◆ checkTimer

uint32 instance_vault_of_archavon::instance_vault_of_archavon_InstanceMapScript::checkTimer
private

Referenced by Initialize(), and Update().

◆ EmalonDeath

time_t instance_vault_of_archavon::instance_vault_of_archavon_InstanceMapScript::EmalonDeath
private

◆ KoralonDeath

time_t instance_vault_of_archavon::instance_vault_of_archavon_InstanceMapScript::KoralonDeath
private

◆ m_auiEncounter

uint32 instance_vault_of_archavon::instance_vault_of_archavon_InstanceMapScript::m_auiEncounter[MAX_ENCOUNTER]
private

◆ stoned

bool instance_vault_of_archavon::instance_vault_of_archavon_InstanceMapScript::stoned
private