TrinityCore
Loading...
Searching...
No Matches
instance_sunken_temple.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/* ScriptData
19SDName: Instance_Sunken_Temple
20SD%Complete: 100
21SDComment:Place Holder
22SDCategory: Sunken Temple
23EndScriptData */
24
25#include "ScriptMgr.h"
26#include "Creature.h"
27#include "GameObject.h"
28#include "InstanceScript.h"
29#include "Map.h"
30#include "sunken_temple.h"
31
41
43{
44 { BOSS_AVATAR_OF_HAKKAR, { { 492 } } },
45 { BOSS_JAMMALAN_THE_PROPHET, { { 488 } } },
46 { BOSS_DREAMSCYTHE, { { 486 } } },
47 { BOSS_WEAVER, { { 487 } } },
48 { BOSS_MORPHAZ, { { 490 } } },
49 { BOSS_HAZZAS, { { 491 } } },
50 { BOSS_SHADE_OF_ERANIKUS, { { 493 } } },
51};
52
53static Position const atalalarianPos = { -466.5134f, 95.19822f, -189.6463f, 0.03490658f };
54static uint8 const nStatues = 6;
56{
57 { -515.553f, 95.25821f, -173.707f, 0.0f },
58 { -419.8487f, 94.48368f, -173.707f, 0.0f },
59 { -491.4003f, 135.9698f, -173.707f, 0.0f },
60 { -491.4909f, 53.48179f, -173.707f, 0.0f },
61 { -443.8549f, 136.1007f, -173.707f, 0.0f },
62 { -443.4171f, 53.83124f, -173.707f, 0.0f }
63};
64
66{
67public:
69
71 {
73 }
74
76 {
78 {
83 State = 0;
84
85 s1 = false;
86 s2 = false;
87 s3 = false;
88 s4 = false;
89 s5 = false;
90 s6 = false;
91 }
92
94
96
97 bool s1;
98 bool s2;
99 bool s3;
100 bool s4;
101 bool s5;
102 bool s6;
103
104 void OnUnitDeath(Unit* unit) override
105 {
106 switch (unit->GetEntry())
107 {
115 default: break;
116 }
117 }
118
119 void OnCreatureCreate(Creature* creature) override
120 {
122
123 switch (creature->GetEntry())
124 {
126 ShadeOfEranikusGUID = creature->GetGUID();
128 creature->SetImmuneToAll(true);
129 break;
130 default:
131 break;
132 }
133 }
134
135 virtual void Update(uint32 /*diff*/) override // correct order goes form 1-6
136 {
137 switch (State)
138 {
140 if (!s1 && !s2 && !s3 && !s4 && !s5 && !s6)
141 {
142 if (GameObject* pAtalaiStatue1 = GetGameObject(GO_ATALAI_STATUE1))
143 UseStatue(pAtalaiStatue1);
144 s1 = true;
145 State = 0;
146 }
147 break;
149 if (s1 && !s2 && !s3 && !s4 && !s5 && !s6)
150 {
151 if (GameObject* pAtalaiStatue2 = GetGameObject(GO_ATALAI_STATUE2))
152 UseStatue(pAtalaiStatue2);
153 s2 = true;
154 State = 0;
155 }
156 break;
158 if (s1 && s2 && !s3 && !s4 && !s5 && !s6)
159 {
160 if (GameObject* pAtalaiStatue3 = GetGameObject(GO_ATALAI_STATUE3))
161 UseStatue(pAtalaiStatue3);
162 s3 = true;
163 State = 0;
164 }
165 break;
167 if (s1 && s2 && s3 && !s4 && !s5 && !s6)
168 {
169 if (GameObject* pAtalaiStatue4 = GetGameObject(GO_ATALAI_STATUE4))
170 UseStatue(pAtalaiStatue4);
171 s4 = true;
172 State = 0;
173 }
174 break;
176 if (s1 && s2 && s3 && s4 && !s5 && !s6)
177 {
178 if (GameObject* pAtalaiStatue5 = GetGameObject(GO_ATALAI_STATUE5))
179 UseStatue(pAtalaiStatue5);
180 s5 = true;
181 State = 0;
182 }
183 break;
185 if (s1 && s2 && s3 && s4 && s5 && !s6)
186 {
187 if (GameObject* pAtalaiStatue6 = GetGameObject(GO_ATALAI_STATUE6))
188 {
189 UseStatue(pAtalaiStatue6);
190 UseLastStatue(pAtalaiStatue6);
191 }
192 s6 = true;
193 State = 0;
194 }
195 break;
196 }
197 }
198
204
212
213 bool SetBossState(uint32 type, EncounterState state) override
214 {
215 if (!InstanceScript::SetBossState(type, state))
216 return false;
217
218 switch (type)
219 {
221 if (state == DONE)
223 creature->SetImmuneToAll(false);
224 break;
225 default:
226 break;
227 }
228 return true;
229 }
230
231 void SetData(uint32 type, uint32 data) override
232 {
233 switch (type)
234 {
235 case EVENT_STATE:
236 State = data;
237 break;
238 default:
239 break;
240 }
241 }
242
243 uint32 GetData(uint32 type) const override
244 {
245 switch (type)
246 {
247 case EVENT_STATE:
248 return State;
249 default:
250 break;
251 }
252 return 0;
253 }
254 };
255};
256
uint8_t uint8
Definition Define.h:156
uint32_t uint32
Definition Define.h:154
EncounterState
@ DONE
@ TEMPSUMMON_CORPSE_TIMED_DESPAWN
@ GO_FLAG_INTERACT_COND
#define DataHeader
ObjectGuid const & GetGUID() const
Definition BaseEntity.h:163
void SetImmuneToAll(bool apply) override
Definition Creature.h:187
void SetFlag(GameObjectFlags flags)
Definition GameObject.h:283
void SetBossNumber(uint32 number)
virtual bool SetBossState(uint32 id, EncounterState state)
virtual void OnCreatureCreate(Creature *creature) 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
GameObject * GetGameObject(uint32 type)
Creature * GetCreature(ObjectGuid const &guid)
Definition Map.cpp:3578
uint32 GetEntry() const
Definition Object.h:89
Definition Unit.h:647
TempSummon * SummonCreature(uint32 entry, Position const &pos, TempSummonType despawnType=TEMPSUMMON_MANUAL_DESPAWN, Milliseconds despawnTime=0s, uint32 vehId=0, uint32 spellId=0, ObjectGuid privateObjectOwner=ObjectGuid::Empty)
Definition Object.cpp:1403
GameObject * SummonGameObject(uint32 entry, Position const &pos, QuaternionData const &rot, Seconds respawnTime, GOSummonType summonType=GO_SUMMON_TIMED_OR_CORPSE_DESPAWN)
Definition Object.cpp:1446
InstanceScript * GetInstanceScript(InstanceMap *map) const override
#define MAX_ENCOUNTER
static Position const statuePositions[nStatues]
static Position const atalalarianPos
static uint8 const nStatues
static constexpr DungeonEncounterData Encounters[]
static constexpr ObjectData gameObjects[]
void AddSC_instance_sunken_temple()
constexpr float GetOrientation() const
Definition Position.h:90
static QuaternionData fromOrientation(float orientation)
bool SetBossState(uint32 type, EncounterState state) override
#define STScriptName
@ NPC_DREAMSCYTHE
@ NPC_JAMMALAN_THE_PROPHET
@ NPC_ATALALARION
@ NPC_SHADE_OF_ERANIKUS
@ NPC_AVATAR_OF_HAKKAR
@ NPC_HAZZAS
@ NPC_MORPHAZ
@ NPC_WEAVER
@ EVENT_STATE
@ GO_ATALAI_STATUE6
@ GO_ATALAI_LIGHT1
@ GO_ATALAI_STATUE5
@ GO_ATALAI_STATUE4
@ GO_ATALAI_STATUE2
@ GO_ATALAI_STATUE3
@ GO_ATALAI_LIGHT2
@ GO_ATALAI_STATUE1
@ BOSS_MORPHAZ
@ BOSS_JAMMALAN_THE_PROPHET
@ BOSS_HAZZAS
@ BOSS_WEAVER
@ BOSS_DREAMSCYTHE
@ BOSS_AVATAR_OF_HAKKAR
@ BOSS_SHADE_OF_ERANIKUS