TrinityCore
Loading...
Searching...
No Matches
instance_arcatraz.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 "arcatraz.h"
20#include "Creature.h"
21#include "GameObject.h"
22#include "InstanceScript.h"
23#include "Map.h"
24
30
31static constexpr DungeonEncounterData encounters[] =
32{
33 { DATA_ZEREKETH, {{ 1916 }} },
34 { DATA_DALLIAH, {{ 1913 }} },
35 { DATA_SOCCOTHRATES, {{ 1915 }} },
36 { DATA_HARBINGER_SKYRISS, {{ 1914 }} }
37};
38
40{
41 public:
43
45 {
57
58 void OnCreatureCreate(Creature* creature) override
59 {
61
62 switch (creature->GetEntry())
63 {
64 case NPC_DALLIAH:
65 DalliahGUID = creature->GetGUID();
66 break;
68 SoccothratesGUID = creature->GetGUID();
69 break;
70 case NPC_MELLICHAR:
71 MellicharGUID = creature->GetGUID();
72 break;
73 case NPC_MILLHOUSE:
74 MillhouseGUID = creature->GetGUID();
75 break;
76 default:
77 break;
78 }
79 }
80
81 void OnGameObjectCreate(GameObject* go) override
82 {
84
85 switch (go->GetEntry())
86 {
88 StasisPodGUIDs[0] = go->GetGUID();
89 break;
91 StasisPodGUIDs[1] = go->GetGUID();
92 break;
94 StasisPodGUIDs[2] = go->GetGUID();
95 break;
97 StasisPodGUIDs[3] = go->GetGUID();
98 break;
100 StasisPodGUIDs[4] = go->GetGUID();
101 break;
104 break;
105 default:
106 break;
107 }
108 }
109
110 void SetData(uint32 type, uint32 data) override
111 {
112 switch (type)
113 {
114 case DATA_WARDEN_1:
115 case DATA_WARDEN_2:
116 case DATA_WARDEN_3:
117 case DATA_WARDEN_4:
118 case DATA_WARDEN_5:
119 if (data == IN_PROGRESS)
121 StasisPodStates[type - DATA_WARDEN_1] = uint8(data);
122 break;
124 ConversationState = uint8(data);
125 break;
126 default:
127 break;
128 }
129 }
130
131 uint32 GetData(uint32 type) const override
132 {
133 switch (type)
134 {
135 case DATA_WARDEN_1:
136 case DATA_WARDEN_2:
137 case DATA_WARDEN_3:
138 case DATA_WARDEN_4:
139 case DATA_WARDEN_5:
140 return StasisPodStates[type - DATA_WARDEN_1];
142 return ConversationState;
143 default:
144 break;
145 }
146 return 0;
147 }
148
149 ObjectGuid GetGuidData(uint32 data) const override
150 {
151 switch (data)
152 {
153 case DATA_DALLIAH:
154 return DalliahGUID;
156 return SoccothratesGUID;
157 case DATA_MELLICHAR:
158 return MellicharGUID;
160 return WardensShieldGUID;
161 default:
162 break;
163 }
164 return ObjectGuid::Empty;
165 }
166
167 bool SetBossState(uint32 type, EncounterState state) override
168 {
169 if (!InstanceScript::SetBossState(type, state))
170 return false;
171
172 switch (type)
173 {
175 if (state == NOT_STARTED || state == FAIL)
176 {
182 }
183 else if (state == DONE)
184 {
185 if (!instance->IsHeroic())
186 break;
187
188 if (Creature* millhouse = instance->GetCreature(MillhouseGUID))
189 if (millhouse->IsAlive())
191 }
192 break;
193 default:
194 break;
195 }
196 return true;
197 }
198
199 protected:
206
209 };
210
212 {
214 }
215};
216
218{
219 new instance_arcatraz();
220}
uint8_t uint8
Definition Define.h:156
uint32_t uint32
Definition Define.h:154
EncounterState
@ IN_PROGRESS
@ FAIL
@ DONE
@ NOT_STARTED
#define DataHeader
uint32 const EncounterCount
#define ArcatrazScriptName
Definition arcatraz.h:23
@ SPELL_QID_10886
Definition arcatraz.h:70
@ NPC_MILLHOUSE
Definition arcatraz.h:53
@ NPC_MELLICHAR
Definition arcatraz.h:51
@ NPC_DALLIAH
Definition arcatraz.h:49
@ NPC_SOCCOTHRATES
Definition arcatraz.h:50
@ GO_CONTAINMENT_CORE_SECURITY_FIELD_ALPHA
Definition arcatraz.h:58
@ GO_WARDENS_SHIELD
Definition arcatraz.h:65
@ GO_STASIS_POD_OMEGA
Definition arcatraz.h:64
@ GO_STASIS_POD_ALPHA
Definition arcatraz.h:60
@ GO_STASIS_POD_GAMMA
Definition arcatraz.h:63
@ GO_STASIS_POD_BETA
Definition arcatraz.h:61
@ GO_CONTAINMENT_CORE_SECURITY_FIELD_BETA
Definition arcatraz.h:59
@ GO_STASIS_POD_DELTA
Definition arcatraz.h:62
@ DATA_WARDEN_4
Definition arcatraz.h:41
@ DATA_MELLICHAR
Definition arcatraz.h:43
@ DATA_WARDENS_SHIELD
Definition arcatraz.h:44
@ DATA_ZEREKETH
Definition arcatraz.h:31
@ DATA_SOCCOTHRATES
Definition arcatraz.h:33
@ DATA_CONVERSATION
Definition arcatraz.h:37
@ DATA_WARDEN_2
Definition arcatraz.h:39
@ DATA_WARDEN_3
Definition arcatraz.h:40
@ DATA_HARBINGER_SKYRISS
Definition arcatraz.h:34
@ DATA_DALLIAH
Definition arcatraz.h:32
@ DATA_WARDEN_1
Definition arcatraz.h:38
@ DATA_WARDEN_5
Definition arcatraz.h:42
ObjectGuid const & GetGUID() const
Definition BaseEntity.h:163
void SetBossNumber(uint32 number)
virtual bool SetBossState(uint32 id, EncounterState state)
virtual void OnCreatureCreate(Creature *creature) override
void DoCastSpellOnPlayers(uint32 spell, bool includePets=false, bool includeControlled=false)
void HandleGameObject(ObjectGuid guid, bool open, GameObject *go=nullptr)
InstanceMap * instance
void SetHeaders(std::string_view dataHeaders)
void LoadDungeonEncounterData(std::span< DungeonEncounterData const > encounters)
virtual void OnGameObjectCreate(GameObject *go) override
void LoadDoorData(std::span< DoorData const > data)
bool IsHeroic() const
Definition Map.cpp:3311
Creature * GetCreature(ObjectGuid const &guid)
Definition Map.cpp:3542
static ObjectGuid const Empty
Definition ObjectGuid.h:314
uint32 GetEntry() const
Definition Object.h:89
InstanceScript * GetInstanceScript(InstanceMap *map) const override
void AddSC_instance_arcatraz()
static constexpr DoorData doorData[]
static constexpr DungeonEncounterData encounters[]
bool SetBossState(uint32 type, EncounterState state) override