TrinityCore
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
26{
30};
31
33{
34 { DATA_ZEREKETH, {{ 1916 }} },
35 { DATA_DALLIAH, {{ 1913 }} },
36 { DATA_SOCCOTHRATES, {{ 1915 }} },
37 { DATA_HARBINGER_SKYRISS, {{ 1914 }} }
38};
39
41{
42 public:
44
46 {
48 {
53
55
56 memset(StasisPodStates, NOT_STARTED, 5 * sizeof(uint8));
57 }
58
59 void OnCreatureCreate(Creature* creature) override
60 {
62
63 switch (creature->GetEntry())
64 {
65 case NPC_DALLIAH:
66 DalliahGUID = creature->GetGUID();
67 break;
69 SoccothratesGUID = creature->GetGUID();
70 break;
71 case NPC_MELLICHAR:
72 MellicharGUID = creature->GetGUID();
73 break;
74 case NPC_MILLHOUSE:
75 MillhouseGUID = creature->GetGUID();
76 break;
77 default:
78 break;
79 }
80 }
81
82 void OnGameObjectCreate(GameObject* go) override
83 {
85
86 switch (go->GetEntry())
87 {
89 StasisPodGUIDs[0] = go->GetGUID();
90 break;
92 StasisPodGUIDs[1] = go->GetGUID();
93 break;
95 StasisPodGUIDs[2] = go->GetGUID();
96 break;
98 StasisPodGUIDs[3] = go->GetGUID();
99 break;
101 StasisPodGUIDs[4] = go->GetGUID();
102 break;
105 break;
106 default:
107 break;
108 }
109 }
110
111 void SetData(uint32 type, uint32 data) override
112 {
113 switch (type)
114 {
115 case DATA_WARDEN_1:
116 case DATA_WARDEN_2:
117 case DATA_WARDEN_3:
118 case DATA_WARDEN_4:
119 case DATA_WARDEN_5:
120 if (data == IN_PROGRESS)
122 StasisPodStates[type - DATA_WARDEN_1] = uint8(data);
123 break;
125 ConversationState = uint8(data);
126 break;
127 default:
128 break;
129 }
130 }
131
132 uint32 GetData(uint32 type) const override
133 {
134 switch (type)
135 {
136 case DATA_WARDEN_1:
137 case DATA_WARDEN_2:
138 case DATA_WARDEN_3:
139 case DATA_WARDEN_4:
140 case DATA_WARDEN_5:
141 return StasisPodStates[type - DATA_WARDEN_1];
143 return ConversationState;
144 default:
145 break;
146 }
147 return 0;
148 }
149
150 ObjectGuid GetGuidData(uint32 data) const override
151 {
152 switch (data)
153 {
154 case DATA_DALLIAH:
155 return DalliahGUID;
157 return SoccothratesGUID;
158 case DATA_MELLICHAR:
159 return MellicharGUID;
161 return WardensShieldGUID;
162 default:
163 break;
164 }
165 return ObjectGuid::Empty;
166 }
167
168 bool SetBossState(uint32 type, EncounterState state) override
169 {
170 if (!InstanceScript::SetBossState(type, state))
171 return false;
172
173 switch (type)
174 {
176 if (state == NOT_STARTED || state == FAIL)
177 {
183 }
184 else if (state == DONE)
185 {
186 if (!instance->IsHeroic())
187 break;
188
189 if (Creature* millhouse = instance->GetCreature(MillhouseGUID))
190 if (millhouse->IsAlive())
192 }
193 break;
194 default:
195 break;
196 }
197 return true;
198 }
199
200 protected:
207
210 };
211
213 {
215 }
216};
217
219{
220 new instance_arcatraz();
221}
uint8_t uint8
Definition: Define.h:144
uint32_t uint32
Definition: Define.h:142
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
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)
void LoadDungeonEncounterData(T const &encounters)
InstanceMap * instance
virtual void OnGameObjectCreate(GameObject *go) override
void LoadDoorData(DoorData const *data)
void SetHeaders(std::string const &dataHeaders)
bool IsHeroic() const
Definition: Map.cpp:3282
Creature * GetCreature(ObjectGuid const &guid)
Definition: Map.cpp:3479
static ObjectGuid const Empty
Definition: ObjectGuid.h:274
uint32 GetEntry() const
Definition: Object.h:161
static ObjectGuid GetGUID(Object const *o)
Definition: Object.h:159
InstanceScript * GetInstanceScript(InstanceMap *map) const override
DoorData const doorData[]
void AddSC_instance_arcatraz()
DungeonEncounterData const encounters[]
bool SetBossState(uint32 type, EncounterState state) override
ObjectGuid GetGuidData(uint32 data) const override
void SetData(uint32 type, uint32 data) override