TrinityCore
Loading...
Searching...
No Matches
instance_halls_of_origination.cpp
Go to the documentation of this file.
1/*
2 * This file is part of the TrinityCore Project. See AUTHORS file for Copyright information
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the
6 * Free Software Foundation; either version 2 of the License, or (at your
7 * option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18#include "ScriptMgr.h"
19#include "Creature.h"
20#include "CreatureAI.h"
21#include "GameObject.h"
23#include "InstanceScript.h"
24#include "Map.h"
25
41
49
54
55static constexpr DungeonEncounterData encounters[] =
56{
57 { BOSS_TEMPLE_GUARDIAN_ANHUUR, {{ 1080 }} },
58 { BOSS_EARTHRAGER_PTAH, {{ 1076 }} },
59 { BOSS_ANRAPHET, {{ 1075 }} },
60 { BOSS_ISISET, {{ 1077 }} },
61 { BOSS_AMMUNAE, {{ 1074 }} },
62 { BOSS_SETESH, {{ 1079 }} },
63 { BOSS_RAJH, {{ 1078 }} }
64};
65
67{
68 public:
70
72 {
82
83 void OnGameObjectCreate(GameObject* go) override
84 {
86
87 switch (go->GetEntry())
88 {
91 [[fallthrough]];
102 AddDoor(go, true);
103 break;
104 case GO_ANHUURS_DOOR:
105 AnhuursDoorGUID = go->GetGUID();
106 AddDoor(go, true);
107 break;
110 break;
113 break;
114 case GO_SUN_MIRROR:
115 SunMirrorGUID = go->GetGUID();
116 break;
117 case GO_ANRAPHET_DOOR:
119 break;
120 }
121 }
122
145
146 uint32 GetData(uint32 data) const override
147 {
148 switch (data)
149 {
151 return _deadElementals;
152 default:
153 break;
154 }
155
156 return 0;
157 }
158
159 ObjectGuid GetGuidData(uint32 type) const override
160 {
161 switch (type)
162 {
164 return AnhuursBridgeGUID;
165 case DATA_ANHUUR_DOOR:
166 return AnhuursDoorGUID;
171 }
172
173 return InstanceScript::GetGuidData(type);
174 }
175
177 {
178 _deadElementals += inc;
179 if (_deadElementals == 4)
180 {
182 mirror->SetGoState(GO_STATE_ACTIVE);
184 door->SetGoState(GO_STATE_ACTIVE);
185 }
186 }
187
188 void OnUnitDeath(Unit* unit) override
189 {
191
192 Creature* creature = unit->ToCreature();
193 if (!creature)
194 return;
195
196 switch (creature->GetEntry())
197 {
198 case NPC_FIRE_WARDEN:
199 case NPC_EARTH_WARDEN:
200 case NPC_WATER_WARDEN:
201 case NPC_AIR_WARDEN:
202 uint32 data = creature->GetEntry() - WARDEN_ENTRY_DATA_DELTA;
203 SetBossState(data, IN_PROGRESS); // Needs to be set to IN_PROGRESS or else the gameobjects state won't be updated
204 SetBossState(data, DONE);
207 brann->AI()->DoAction(ACTION_ELEMENTAL_DIED);
208 break;
209 }
210 }
211
212 void AfterDataLoad() override
213 {
216 }
217
218 protected:
226 };
227
232};
233
uint32_t uint32
Definition Define.h:154
@ IN_PROGRESS
@ DONE
@ GO_STATE_ACTIVE
#define DataHeader
uint32 const EncounterCount
ObjectGuid const & GetGUID() const
Definition BaseEntity.h:163
void SetBossNumber(uint32 number)
virtual bool SetBossState(uint32 id, EncounterState state)
Creature * GetCreature(uint32 type)
virtual ObjectGuid GetGuidData(uint32 type) const override
virtual void OnGameObjectRemove(GameObject *go) override
void LoadObjectData(std::span< ObjectData const > creatureData, std::span< ObjectData const > gameObjectData)
InstanceMap * instance
void SetHeaders(std::string_view dataHeaders)
void LoadDungeonEncounterData(std::span< DungeonEncounterData const > encounters)
EncounterState GetBossState(uint32 id) const
virtual void OnGameObjectCreate(GameObject *go) override
virtual void AddDoor(GameObject *door, bool add)
void LoadDoorData(std::span< DoorData const > data)
GameObject * GetGameObject(ObjectGuid const &guid)
Definition Map.cpp:3552
uint32 GetEntry() const
Definition Object.h:89
Creature * ToCreature()
Definition Object.h:121
Definition Unit.h:635
virtual void OnUnitDeath(Unit *unit)
Definition ZoneScript.h:85
InstanceScript * GetInstanceScript(InstanceMap *map) const override
@ GO_ANHUURS_RIGHT_BEACON
@ GO_LIFT_OF_THE_MAKERS
@ GO_ANHUURS_BRIDGE
@ GO_DOODAD_ULDUM_LASERBEAMS01
@ GO_DOODAD_ULDUM_LIGHTMACHINE_03
@ GO_DOODAD_ULDUM_ELEVATOR_COL01
@ GO_DOODAD_ULDUM_LIGHTMACHINE_01
@ GO_ANHUURS_DOOR
@ GO_SUN_MIRROR
@ GO_DOODAD_ULDUM_LASERBEAMS_01
@ GO_ANRAPHET_DOOR
@ GO_DOODAD_ULDUM_LASERBEAMS_03
@ GO_ANHUURS_LEFT_BEACON
@ GO_VAULT_OF_LIGHTS_DOOR
@ GO_DOODAD_ULDUM_LIGHTMACHINE_04
@ GO_DOODAD_ULDUM_LIGHTMACHINE_02
@ GO_DOODAD_ULDUM_LASERBEAMS_02
@ ACTION_ELEMENTAL_DIED
@ WARDEN_ENTRY_DATA_DELTA
@ NPC_ANRAPHET
@ NPC_TEMPLE_GUARDIAN_ANHUUR
@ NPC_WATER_WARDEN
@ NPC_AIR_WARDEN
@ NPC_BRANN_BRONZEBEARD_0
@ NPC_EARTHRAGER_PTAH
@ NPC_EARTH_WARDEN
@ NPC_FIRE_WARDEN
#define HoOScriptName
@ BOSS_AMMUNAE
@ BOSS_TEMPLE_GUARDIAN_ANHUUR
@ DATA_ANHUUR_RIGHT_BEACON
@ DATA_LIFT_OF_THE_MAKERS
@ BOSS_ISISET
@ BOSS_SETESH
@ BOSS_WATER_WARDEN
@ BOSS_FIRE_WARDEN
@ DATA_BRANN_BRONZEBEARD
@ DATA_DEAD_ELEMENTALS
@ DATA_ANHUUR_BRIDGE
@ BOSS_EARTH_WARDEN
@ BOSS_AIR_WARDEN
@ DATA_ANHUUR_DOOR
@ BOSS_ANRAPHET
@ BOSS_VAULT_OF_LIGHTS
@ DATA_ANHUUR_LEFT_BEACON
@ BOSS_EARTHRAGER_PTAH
static constexpr ObjectData creatureData[]
static constexpr DoorData doorData[]
void AddSC_instance_halls_of_origination()
static constexpr ObjectData gameObjectData[]
static constexpr DungeonEncounterData encounters[]