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 "CreatureAI.h"
22#include "GameObject.h"
23#include "InstanceScript.h"
24#include "Map.h"
25
31
32static constexpr ObjectData creatureData[] =
33{
35};
36
46
47static constexpr DungeonEncounterData encounters[] =
48{
49 { DATA_ZEREKETH, {{ 1916 }} },
50 { DATA_DALLIAH, {{ 1913 }} },
51 { DATA_SOCCOTHRATES, {{ 1915 }} },
52 { DATA_HARBINGER_SKYRISS, {{ 1914 }} }
53};
54
56{
57 public:
59
61 {
74
75 void OnCreatureCreate(Creature* creature) override
76 {
78
79 switch (creature->GetEntry())
80 {
81 case NPC_DALLIAH:
82 DalliahGUID = creature->GetGUID();
83 break;
85 SoccothratesGUID = creature->GetGUID();
86 break;
87 case NPC_MILLHOUSE:
88 MillhouseGUID = creature->GetGUID();
89 break;
90 default:
91 break;
92 }
93 }
94
95 void SetData(uint32 type, uint32 data) override
96 {
97 switch (type)
98 {
99 case DATA_WARDEN_1:
100 case DATA_WARDEN_2:
101 case DATA_WARDEN_3:
102 case DATA_WARDEN_4:
103 case DATA_WARDEN_5:
104 StasisPodStates[type - DATA_WARDEN_1] = uint8(data);
105 break;
107 ConversationState = uint8(data);
108 break;
109 default:
110 break;
111 }
112 }
113
114 uint32 GetData(uint32 type) const override
115 {
116 switch (type)
117 {
118 case DATA_WARDEN_1:
119 case DATA_WARDEN_2:
120 case DATA_WARDEN_3:
121 case DATA_WARDEN_4:
122 case DATA_WARDEN_5:
123 return StasisPodStates[type - DATA_WARDEN_1];
125 return ConversationState;
126 default:
127 break;
128 }
129 return 0;
130 }
131
132 ObjectGuid GetGuidData(uint32 data) const override
133 {
134 switch (data)
135 {
136 case DATA_DALLIAH:
137 return DalliahGUID;
139 return SoccothratesGUID;
140 default:
141 break;
142 }
143 return ObjectGuid::Empty;
144 }
145
146 bool SetBossState(uint32 type, EncounterState state) override
147 {
148 if (!InstanceScript::SetBossState(type, state))
149 return false;
150
151 switch (type)
152 {
154 if (state == NOT_STARTED || state == FAIL)
155 {
161 }
162 if (state == DONE)
163 {
164 if (!instance->IsHeroic())
165 break;
166
167 if (Creature* millhouse = instance->GetCreature(MillhouseGUID))
168 if (millhouse->IsAlive())
170 }
171 if (state == FAIL)
172 {
173 if (Creature* mellichar = GetCreature(DATA_MELLICHAR))
174 mellichar->AI()->DoAction(ACTION_RESET_PRISON);
175 }
176 break;
177 default:
178 break;
179 }
180 return true;
181 }
182
183 protected:
187
190 };
191
193 {
195 }
196};
197
199{
200 new instance_arcatraz();
201}
uint8_t uint8
Definition Define.h:156
uint32_t uint32
Definition Define.h:154
EncounterState
@ FAIL
@ DONE
@ NOT_STARTED
#define DataHeader
uint32 const EncounterCount
#define ArcatrazScriptName
Definition arcatraz.h:23
@ ACTION_RESET_PRISON
Definition arcatraz.h:79
@ SPELL_QID_10886
Definition arcatraz.h:74
@ NPC_MILLHOUSE
Definition arcatraz.h:57
@ NPC_MELLICHAR
Definition arcatraz.h:56
@ NPC_DALLIAH
Definition arcatraz.h:54
@ NPC_SOCCOTHRATES
Definition arcatraz.h:55
@ GO_CONTAINMENT_CORE_SECURITY_FIELD_ALPHA
Definition arcatraz.h:62
@ GO_WARDENS_SHIELD
Definition arcatraz.h:69
@ GO_STASIS_POD_OMEGA
Definition arcatraz.h:68
@ GO_STASIS_POD_ALPHA
Definition arcatraz.h:64
@ GO_STASIS_POD_GAMMA
Definition arcatraz.h:67
@ GO_STASIS_POD_BETA
Definition arcatraz.h:65
@ GO_CONTAINMENT_CORE_SECURITY_FIELD_BETA
Definition arcatraz.h:63
@ GO_STASIS_POD_DELTA
Definition arcatraz.h:66
@ DATA_WARDEN_4
Definition arcatraz.h:41
@ DATA_MELLICHAR
Definition arcatraz.h:43
@ DATA_WARDENS_SHIELD
Definition arcatraz.h:44
@ DATA_STASIS_POD_DELTA
Definition arcatraz.h:47
@ DATA_ZEREKETH
Definition arcatraz.h:31
@ DATA_SOCCOTHRATES
Definition arcatraz.h:33
@ DATA_STASIS_POD_GAMMA
Definition arcatraz.h:48
@ DATA_CONVERSATION
Definition arcatraz.h:37
@ DATA_WARDEN_2
Definition arcatraz.h:39
@ DATA_STASIS_POD_BETA
Definition arcatraz.h:46
@ DATA_WARDEN_3
Definition arcatraz.h:40
@ DATA_HARBINGER_SKYRISS
Definition arcatraz.h:34
@ DATA_STASIS_POD_OMEGA
Definition arcatraz.h:49
@ DATA_DALLIAH
Definition arcatraz.h:32
@ DATA_WARDEN_1
Definition arcatraz.h:38
@ DATA_WARDEN_5
Definition arcatraz.h:42
@ DATA_STASIS_POD_ALPHA
Definition arcatraz.h:45
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)
Creature * GetCreature(uint32 type)
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)
void LoadDoorData(std::span< DoorData const > data)
bool IsHeroic() const
Definition Map.cpp:3347
Creature * GetCreature(ObjectGuid const &guid)
Definition Map.cpp:3578
static ObjectGuid const Empty
Definition ObjectGuid.h:314
uint32 GetEntry() const
Definition Object.h:89
InstanceScript * GetInstanceScript(InstanceMap *map) const override
static constexpr ObjectData creatureData[]
void AddSC_instance_arcatraz()
static constexpr DoorData doorData[]
static constexpr ObjectData gameObjectData[]
static constexpr DungeonEncounterData encounters[]
bool SetBossState(uint32 type, EncounterState state) override
void SetData(uint32 type, uint32 data) override