AzeorthCore 3.3.5a
OpenSource WoW Emulator
Loading...
Searching...
No Matches
instance_mechanar::instance_mechanar_InstanceMapScript Struct Reference
Inheritance diagram for instance_mechanar::instance_mechanar_InstanceMapScript:
InstanceScript ZoneScript

Public Member Functions

 instance_mechanar_InstanceMapScript (Map *map)
 
void OnGameObjectCreate (GameObject *gameObject) override
 
void OnGameObjectRemove (GameObject *gameObject) override
 
void OnCreatureCreate (Creature *creature) override
 
void OnUnitDeath (Unit *unit) override
 
PlayerGetPassagePlayer (float x)
 
void DoSummonAction (Creature *summon, Player *player)
 
void Update (uint32 diff) override
 
bool SetBossState (uint32 type, EncounterState state) override
 
std::string GetSaveData () override
 
void Load (const char *str) override
 
- Public Member Functions inherited from InstanceScript
 InstanceScript (Map *map)
 
 ~InstanceScript () override
 
virtual void Initialize ()
 
virtual void Load (char const *data)
 
virtual void CreatureLooted (Creature *, LootType)
 
virtual std::string GetSaveData ()
 
void SaveToDB ()
 
virtual void Update (uint32)
 
virtual bool IsEncounterInProgress () const
 
void OnCreatureCreate (Creature *creature) override
 
void OnCreatureRemove (Creature *creature) override
 
void OnGameObjectCreate (GameObject *go) override
 
void OnGameObjectRemove (GameObject *go) override
 
ObjectGuid GetObjectGuid (uint32 type) const
 
ObjectGuid GetGuidData (uint32 type) const override
 
CreatureGetCreature (uint32 type)
 
GameObjectGetGameObject (uint32 type)
 
virtual void OnPlayerEnter (Player *)
 
virtual void OnPlayerAreaUpdate (Player *, uint32, uint32)
 
void HandleGameObject (ObjectGuid guid, bool open, GameObject *go=nullptr)
 
void DoUseDoorOrButton (ObjectGuid guid, uint32 withRestoreTime=0, bool useAlternativeState=false)
 
void DoRespawnGameObject (ObjectGuid guid, uint32 timeToDespawn=MINUTE)
 
void DoRespawnCreature (ObjectGuid guid, bool force=false)
 
void DoRespawnCreature (uint32 type, bool force=false)
 
void DoUpdateWorldState (uint32 worldstateId, uint32 worldstateValue)
 
void DoSendNotifyToInstance (char const *format,...)
 
void DoUpdateAchievementCriteria (AchievementCriteriaTypes type, uint32 miscValue1=0, uint32 miscValue2=0, Unit *unit=nullptr)
 
void DoStartTimedAchievement (AchievementCriteriaTimedTypes type, uint32 entry)
 
void DoStopTimedAchievement (AchievementCriteriaTimedTypes type, uint32 entry)
 
void DoRemoveAurasDueToSpellOnPlayers (uint32 spell)
 
void DoCastSpellOnPlayers (uint32 spell)
 
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
 
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)
 
- 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

ObjectGuid _pathaleonGUID
 
uint32 _passageTimer
 
uint32 _passageEncounter
 
GuidSet _passageGUIDs
 

Additional Inherited Members

- Static Public Member Functions inherited from InstanceScript
static std::string GetBossStateName (uint8 state)
 
- Public Attributes inherited from InstanceScript
Mapinstance
 
- Protected Member Functions inherited from InstanceScript
void SetBossNumber (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)
 
void AddObject (GameObject *obj, bool add)
 
void AddObject (WorldObject *obj, uint32 type, bool add)
 
void AddDoor (GameObject *door, bool add)
 
void AddMinion (Creature *minion, bool add)
 
void UpdateDoorState (GameObject *door)
 
void UpdateMinionState (Creature *minion, EncounterState state)
 
std::string LoadBossState (char const *data)
 
std::string GetBossSaveData ()
 

Detailed Description

Constructor & Destructor Documentation

◆ instance_mechanar_InstanceMapScript()

instance_mechanar::instance_mechanar_InstanceMapScript::instance_mechanar_InstanceMapScript ( Map map)
inline
37 : InstanceScript(map)
38 {
41
43 _passageTimer = 0;
44 _passageGUIDs.clear();
45 }
#define MAX_ENCOUNTER
Definition: violet_hold.h:21
static DoorData const doorData[]
Definition: instance_mechanar.cpp:22
Definition: InstanceScript.h:140
void SetBossNumber(uint32 number)
Definition: InstanceScript.h:258
void LoadDoorData(DoorData const *data)
Definition: InstanceScript.cpp:148
GuidSet _passageGUIDs
Definition: instance_mechanar.cpp:255
uint32 _passageTimer
Definition: instance_mechanar.cpp:253
uint32 _passageEncounter
Definition: instance_mechanar.cpp:254

References _passageEncounter, _passageGUIDs, _passageTimer, doorData, InstanceScript::LoadDoorData(), MAX_ENCOUNTER, and InstanceScript::SetBossNumber().

Member Function Documentation

◆ DoSummonAction()

void instance_mechanar::instance_mechanar_InstanceMapScript::DoSummonAction ( Creature summon,
Player player 
)
inline
100 {
101 summon->CastSpell(summon, SPELL_TELEPORT_VISUAL, true);
102 summon->AI()->AttackStart(player);
103 _passageGUIDs.insert(summon->GetGUID());
104 }
@ SPELL_TELEPORT_VISUAL
Definition: boss_kiljaeden.cpp:695
virtual void AttackStart(Unit *)
Definition: UnitAI.cpp:28
CreatureAI * AI() const
Definition: Creature.h:134
static ObjectGuid GetGUID(Object const *o)
Definition: Object.h:106
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:1428

References _passageGUIDs, Creature::AI(), UnitAI::AttackStart(), Unit::CastSpell(), Object::GetGUID(), and SPELL_TELEPORT_VISUAL.

Referenced by Update().

◆ GetPassagePlayer()

Player * instance_mechanar::instance_mechanar_InstanceMapScript::GetPassagePlayer ( float  x)
inline
90 {
91 Map::PlayerList const& pl = instance->GetPlayers();
92 for (Map::PlayerList::const_iterator itr = pl.begin(); itr != pl.end(); ++itr)
93 if (Player* player = itr->GetSource())
94 if (player->GetPositionX() < x && player->GetPositionZ() > 24.0f && player->GetPositionY() > -30.0f)
95 return player;
96 return nullptr;
97 }
Definition: LinkedList.h:139
Definition: Player.h:1046
Map * instance
Definition: InstanceScript.h:146
PlayerList const & GetPlayers() const
Definition: Map.h:484
Definition: MapRefMgr.h:26
iterator begin()
Definition: MapRefMgr.h:36
iterator end()
Definition: MapRefMgr.h:37

References MapRefMgr::begin(), MapRefMgr::end(), Map::GetPlayers(), and InstanceScript::instance.

Referenced by Update().

◆ GetSaveData()

std::string instance_mechanar::instance_mechanar_InstanceMapScript::GetSaveData ( )
inlineoverridevirtual

Reimplemented from InstanceScript.

204 {
206
207 std::ostringstream saveStream;
208 // Xinef: no space needed
209 saveStream << "M E " << GetBossSaveData() << _passageEncounter;
210
212 return saveStream.str();
213 }
#define OUT_SAVE_INST_DATA_COMPLETE
Definition: InstanceScript.h:28
#define OUT_SAVE_INST_DATA
Definition: InstanceScript.h:27
std::string GetBossSaveData()
Definition: InstanceScript.cpp:357

References _passageEncounter, InstanceScript::GetBossSaveData(), OUT_SAVE_INST_DATA, and OUT_SAVE_INST_DATA_COMPLETE.

◆ Load()

void instance_mechanar::instance_mechanar_InstanceMapScript::Load ( const char *  str)
inlineoverridevirtual

Reimplemented from InstanceScript.

216 {
217 if (!str)
218 {
220 return;
221 }
222
224
225 char dataHead1, dataHead2;
226
227 std::istringstream loadStream(str);
228 loadStream >> dataHead1 >> dataHead2;
229
230 if (dataHead1 == 'M' && dataHead2 == 'E')
231 {
232 for (uint32 i = 0; i < MAX_ENCOUNTER; ++i)
233 {
234 uint32 tmpState;
235 loadStream >> tmpState;
236 if (tmpState == IN_PROGRESS || tmpState > SPECIAL)
237 tmpState = NOT_STARTED;
238 SetBossState(i, EncounterState(tmpState));
239 }
240
241 loadStream >> _passageEncounter;
244 }
245 else
247
249 }
std::uint32_t uint32
Definition: Define.h:108
#define OUT_LOAD_INST_DATA_FAIL
Definition: InstanceScript.h:31
EncounterState
Definition: InstanceScript.h:55
@ IN_PROGRESS
Definition: InstanceScript.h:57
@ SPECIAL
Definition: InstanceScript.h:60
@ NOT_STARTED
Definition: InstanceScript.h:56
#define OUT_LOAD_INST_DATA_COMPLETE
Definition: InstanceScript.h:30
#define OUT_LOAD_INST_DATA(a)
Definition: InstanceScript.h:29
@ ENCOUNTER_PASSAGE_DONE
Definition: mechanar.h:45
@ ENCOUNTER_PASSAGE_PHASE6
Definition: mechanar.h:44
bool SetBossState(uint32 type, EncounterState state) override
Definition: instance_mechanar.cpp:195

References _passageEncounter, ENCOUNTER_PASSAGE_DONE, ENCOUNTER_PASSAGE_PHASE6, IN_PROGRESS, MAX_ENCOUNTER, NOT_STARTED, OUT_LOAD_INST_DATA, OUT_LOAD_INST_DATA_COMPLETE, OUT_LOAD_INST_DATA_FAIL, SetBossState(), and SPECIAL.

◆ OnCreatureCreate()

void instance_mechanar::instance_mechanar_InstanceMapScript::OnCreatureCreate ( Creature creature)
inlineoverridevirtual

Reimplemented from InstanceScript.

76 {
77 if (creature->GetEntry() == NPC_PATHALEON_THE_CALCULATOR)
78 _pathaleonGUID = creature->GetGUID();
79 }
@ NPC_PATHALEON_THE_CALCULATOR
Definition: mechanar.h:56
uint32 GetEntry() const
Definition: Object.h:109
ObjectGuid _pathaleonGUID
Definition: instance_mechanar.cpp:252

References _pathaleonGUID, Object::GetEntry(), Object::GetGUID(), and NPC_PATHALEON_THE_CALCULATOR.

◆ OnGameObjectCreate()

void instance_mechanar::instance_mechanar_InstanceMapScript::OnGameObjectCreate ( GameObject gameObject)
inlineoverridevirtual

Reimplemented from InstanceScript.

48 {
49 switch (gameObject->GetEntry())
50 {
51 case GO_DOOR_MOARG_1:
52 case GO_DOOR_MOARG_2:
54 AddDoor(gameObject, true);
55 break;
56 default:
57 break;
58 }
59 }
@ GO_DOOR_MOARG_1
Definition: mechanar.h:61
@ GO_DOOR_MOARG_2
Definition: mechanar.h:62
@ GO_DOOR_NETHERMANCER
Definition: mechanar.h:63
void AddDoor(GameObject *door, bool add)
Definition: InstanceScript.cpp:271

References InstanceScript::AddDoor(), Object::GetEntry(), GO_DOOR_MOARG_1, GO_DOOR_MOARG_2, and GO_DOOR_NETHERMANCER.

◆ OnGameObjectRemove()

void instance_mechanar::instance_mechanar_InstanceMapScript::OnGameObjectRemove ( GameObject gameObject)
inlineoverridevirtual

Reimplemented from InstanceScript.

62 {
63 switch (gameObject->GetEntry())
64 {
65 case GO_DOOR_MOARG_1:
66 case GO_DOOR_MOARG_2:
68 AddDoor(gameObject, false);
69 break;
70 default:
71 break;
72 }
73 }

References InstanceScript::AddDoor(), Object::GetEntry(), GO_DOOR_MOARG_1, GO_DOOR_MOARG_2, and GO_DOOR_NETHERMANCER.

◆ OnUnitDeath()

void instance_mechanar::instance_mechanar_InstanceMapScript::OnUnitDeath ( Unit unit)
inlineoverridevirtual

Reimplemented from ZoneScript.

82 {
83 if (unit->GetTypeId() == TYPEID_UNIT)
85 if (_passageGUIDs.find(unit->GetGUID()) != _passageGUIDs.end())
86 _passageGUIDs.erase(unit->GetGUID());
87 }
@ TYPEID_UNIT
Definition: ObjectGuid.h:37
@ ENCOUNTER_PASSAGE_NOT_STARTED
Definition: mechanar.h:38
TypeID GetTypeId() const
Definition: Object.h:121

References _passageEncounter, _passageGUIDs, ENCOUNTER_PASSAGE_DONE, ENCOUNTER_PASSAGE_NOT_STARTED, Object::GetGUID(), Object::GetTypeId(), and TYPEID_UNIT.

◆ SetBossState()

bool instance_mechanar::instance_mechanar_InstanceMapScript::SetBossState ( uint32  type,
EncounterState  state 
)
inlineoverridevirtual

Reimplemented from InstanceScript.

196 {
197 if (!InstanceScript::SetBossState(type, state))
198 return false;
199
200 return true;
201 }
virtual bool SetBossState(uint32 id, EncounterState state)
Definition: InstanceScript.cpp:305

References InstanceScript::SetBossState().

Referenced by Load().

◆ Update()

void instance_mechanar::instance_mechanar_InstanceMapScript::Update ( uint32  diff)
inlineoverridevirtual

Reimplemented from InstanceScript.

107 {
109 return;
110
111 _passageTimer += diff;
112 if (_passageTimer >= 1000)
113 {
114 _passageTimer = 0;
116 {
117 if (Player* player = GetPassagePlayer(250.0f))
118 {
120 for (uint8 i = 0; i < 4; ++i)
121 {
122 Position pos = {238.0f, -27.0f + 3.0f * i, 26.328f, 0.0f};
123 if (Creature* creature = instance->SummonCreature(i == 1 || i == 2 ? NPC_SUNSEEKER_ASTROMAGE : NPC_BLOODWARDER_CENTURION, pos))
124 DoSummonAction(creature, player);
125 }
126 }
127 }
128
129 if (!_passageGUIDs.empty())
130 return;
131
133 {
134 if (Player* player = GetPassagePlayer(250.0f))
135 {
137 {
138 Position pos = {214.37f, -23.5f, 24.88f, 0.0f};
140 DoSummonAction(creature, player);
141 }
143 {
144 for (uint8 i = 0; i < 3; ++i)
145 {
146 Position pos = {199.76f, -26.0f + 2.5f * i, 24.88f, 0.0f};
148 DoSummonAction(creature, player);
149 }
150 }
152 SaveToDB();
153 }
154 }
155 else
156 {
157 if (Player* player = GetPassagePlayer(148.0f))
158 {
160 {
161 for (uint8 i = 0; i < 3; ++i)
162 {
163 Position pos = {135.0f + 2.5f * i, 36.76f, 24.88f, M_PI * 1.5f};
165 DoSummonAction(creature, player);
166 }
167 }
169 {
170 Position pos = {137.62f, 62.23f, 24.88f, M_PI * 1.5f};
172 DoSummonAction(creature, player);
173 }
175 {
176 for (uint8 i = 0; i < 4; ++i)
177 {
178 Position pos = {133.0f + 3.5f * i, 92.88f, 26.38f, M_PI * 1.5f};
179 if (Creature* creature = instance->SummonCreature(i == 1 || i == 2 ? NPC_SUNSEEKER_ASTROMAGE : NPC_SUNSEEKER_ENGINEER, pos))
180 DoSummonAction(creature, player);
181 }
182 }
184 {
186 creature->AI()->DoAction(1);
187 }
189 SaveToDB();
190 }
191 }
192 }
193 }
std::uint8_t uint8
Definition: Define.h:110
@ NPC_BLOODWARDER_PHYSICIAN
Definition: mechanar.h:53
@ NPC_BLOODWARDER_CENTURION
Definition: mechanar.h:52
@ NPC_SUNSEEKER_ENGINEER
Definition: mechanar.h:51
@ NPC_SUNSEEKER_ASTROMAGE
Definition: mechanar.h:50
@ NPC_TEMPEST_KEEPER_DESTROYER
Definition: mechanar.h:54
@ ENCOUNTER_PASSAGE_PHASE4
Definition: mechanar.h:42
@ ENCOUNTER_PASSAGE_PHASE1
Definition: mechanar.h:39
@ ENCOUNTER_PASSAGE_PHASE2
Definition: mechanar.h:40
@ ENCOUNTER_PASSAGE_PHASE5
Definition: mechanar.h:43
@ ENCOUNTER_PASSAGE_PHASE3
Definition: mechanar.h:41
Definition: Creature.h:46
Definition: Position.h:28
void SaveToDB()
Definition: InstanceScript.cpp:40
TempSummon * SummonCreature(uint32 entry, Position const &pos, SummonPropertiesEntry const *properties=nullptr, uint32 duration=0, WorldObject *summoner=nullptr, uint32 spellId=0, uint32 vehId=0)
Definition: Object.cpp:2117
Creature * GetCreature(ObjectGuid const guid)
Definition: Map.cpp:3290
Player * GetPassagePlayer(float x)
Definition: instance_mechanar.cpp:89
void DoSummonAction(Creature *summon, Player *player)
Definition: instance_mechanar.cpp:99

References _passageEncounter, _passageGUIDs, _passageTimer, _pathaleonGUID, DoSummonAction(), ENCOUNTER_PASSAGE_DONE, ENCOUNTER_PASSAGE_NOT_STARTED, ENCOUNTER_PASSAGE_PHASE1, ENCOUNTER_PASSAGE_PHASE2, ENCOUNTER_PASSAGE_PHASE3, ENCOUNTER_PASSAGE_PHASE4, ENCOUNTER_PASSAGE_PHASE5, ENCOUNTER_PASSAGE_PHASE6, Map::GetCreature(), GetPassagePlayer(), InstanceScript::instance, NPC_BLOODWARDER_CENTURION, NPC_BLOODWARDER_PHYSICIAN, NPC_SUNSEEKER_ASTROMAGE, NPC_SUNSEEKER_ENGINEER, NPC_TEMPEST_KEEPER_DESTROYER, InstanceScript::SaveToDB(), and Map::SummonCreature().

Member Data Documentation

◆ _passageEncounter

uint32 instance_mechanar::instance_mechanar_InstanceMapScript::_passageEncounter
private

◆ _passageGUIDs

GuidSet instance_mechanar::instance_mechanar_InstanceMapScript::_passageGUIDs
private

◆ _passageTimer

uint32 instance_mechanar::instance_mechanar_InstanceMapScript::_passageTimer
private

◆ _pathaleonGUID

ObjectGuid instance_mechanar::instance_mechanar_InstanceMapScript::_pathaleonGUID
private

Referenced by OnCreatureCreate(), and Update().