TrinityCore
instance_utgarde_keep.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 "GameObject.h"
21#include "InstanceScript.h"
22#include "utgarde_keep.h"
23
25{
29};
30
32{
35 { 0, 0 }
36};
37
39{
40 { DATA_PRINCE_KELESETH, {{ 2026 }} },
41 { DATA_SKARVALD_DALRONN, {{ 2024 }} },
42 { DATA_INGVAR, {{ 2025 }} }
43};
44
46{
47 public:
49
51 {
53 {
59 }
60
61 void OnCreatureCreate(Creature* creature) override
62 {
63 switch (creature->GetEntry())
64 {
66 PrinceKelesethGUID = creature->GetGUID();
67 break;
68 case NPC_SKARVALD:
69 SkarvaldGUID = creature->GetGUID();
70 AddMinion(creature, true);
71 break;
72 case NPC_DALRONN:
73 DalronnGUID = creature->GetGUID();
74 AddMinion(creature, true);
75 break;
76 case NPC_INGVAR:
77 IngvarGUID = creature->GetGUID();
78 break;
79 default:
80 break;
81 }
82 }
83
84 void OnCreatureRemove(Creature* creature) override
85 {
86 switch (creature->GetEntry())
87 {
88 case NPC_SKARVALD:
89 case NPC_DALRONN:
90 AddMinion(creature, false);
91 break;
92 default:
93 break;
94 }
95 }
96
97 void OnGameObjectCreate(GameObject* go) override
98 {
100
101 switch (go->GetEntry())
102 {
103 case GO_BELLOW_1:
104 Forges[0].BellowGUID = go->GetGUID();
106 break;
107 case GO_BELLOW_2:
108 Forges[1].BellowGUID = go->GetGUID();
110 break;
111 case GO_BELLOW_3:
112 Forges[2].BellowGUID = go->GetGUID();
114 break;
115 case GO_FORGEFIRE_1:
116 Forges[0].FireGUID = go->GetGUID();
118 break;
119 case GO_FORGEFIRE_2:
120 Forges[1].FireGUID = go->GetGUID();
122 break;
123 case GO_FORGEFIRE_3:
124 Forges[2].FireGUID = go->GetGUID();
126 break;
128 Forges[0].AnvilGUID = go->GetGUID();
130 break;
132 Forges[1].AnvilGUID = go->GetGUID();
134 break;
136 Forges[2].AnvilGUID = go->GetGUID();
138 break;
139 default:
140 break;
141 }
142 }
143
144 ObjectGuid GetGuidData(uint32 type) const override
145 {
146 switch (type)
147 {
149 return PrinceKelesethGUID;
150 case DATA_SKARVALD:
151 return SkarvaldGUID;
152 case DATA_DALRONN:
153 return DalronnGUID;
154 case DATA_INGVAR:
155 return IngvarGUID;
156 default:
157 break;
158 }
159
160 return ObjectGuid::Empty;
161 }
162
163 void SetData(uint32 type, uint32 data) override
164 {
165 switch (type)
166 {
167 case DATA_FORGE_1:
168 case DATA_FORGE_2:
169 case DATA_FORGE_3:
170 {
171 uint8 i = type - DATA_FORGE_1;
172 HandleGameObject(Forges[i].AnvilGUID, data != NOT_STARTED);
173 HandleGameObject(Forges[i].BellowGUID, data != NOT_STARTED);
174 HandleGameObject(Forges[i].FireGUID, data != NOT_STARTED);
175 Forges[i].Event = data;
176 break;
177 }
178 default:
179 break;
180 }
181 }
182
183 void AfterDataLoad() override
184 {
186 for (uint8 i = 0; i < 3; ++i)
187 Forges[i].Event = DONE;
188 }
189
190 protected:
192
197 };
198
200 {
202 }
203};
204
206{
208}
uint8_t uint8
Definition: Define.h:144
uint32_t uint32
Definition: Define.h:142
@ DONE
@ NOT_STARTED
#define DataHeader
uint32 const EncounterCount
void SetBossNumber(uint32 number)
void HandleGameObject(ObjectGuid guid, bool open, GameObject *go=nullptr)
void LoadDungeonEncounterData(T const &encounters)
void AddMinion(Creature *minion, bool add)
EncounterState GetBossState(uint32 id) const
virtual void OnGameObjectCreate(GameObject *go) override
void LoadMinionData(MinionData const *data)
void LoadDoorData(DoorData const *data)
void SetHeaders(std::string const &dataHeaders)
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
@ DATA_PRINCE_KELESETH
@ NPC_PRINCE_KELESETH
void AddSC_instance_utgarde_keep()
MinionData const minionData[]
DoorData const doorData[]
DungeonEncounterData const encounters[]
ObjectGuid AnvilGUID
Definition: utgarde_keep.h:83
ObjectGuid BellowGUID
Definition: utgarde_keep.h:84
uint32 Event
Definition: utgarde_keep.h:87
ObjectGuid FireGUID
Definition: utgarde_keep.h:85
@ DATA_DALRONN
Definition: utgarde_keep.h:37
@ DATA_FORGE_2
Definition: utgarde_keep.h:40
@ DATA_SKARVALD_DALRONN
Definition: utgarde_keep.h:32
@ DATA_FORGE_1
Definition: utgarde_keep.h:39
@ DATA_FORGE_3
Definition: utgarde_keep.h:41
@ DATA_SKARVALD
Definition: utgarde_keep.h:36
@ DATA_INGVAR
Definition: utgarde_keep.h:33
@ GO_FORGEFIRE_3
Definition: utgarde_keep.h:69
@ GO_GIANT_PORTCULLIS_1
Definition: utgarde_keep.h:75
@ GO_BELLOW_3
Definition: utgarde_keep.h:65
@ GO_GLOWING_ANVIL_1
Definition: utgarde_keep.h:71
@ GO_GLOWING_ANVIL_2
Definition: utgarde_keep.h:72
@ GO_BELLOW_1
Definition: utgarde_keep.h:63
@ GO_GIANT_PORTCULLIS_2
Definition: utgarde_keep.h:76
@ GO_BELLOW_2
Definition: utgarde_keep.h:64
@ GO_FORGEFIRE_2
Definition: utgarde_keep.h:68
@ GO_GLOWING_ANVIL_3
Definition: utgarde_keep.h:73
@ GO_FORGEFIRE_1
Definition: utgarde_keep.h:67
#define UKScriptName
Definition: utgarde_keep.h:23
@ NPC_SKARVALD
Definition: utgarde_keep.h:47
@ NPC_INGVAR
Definition: utgarde_keep.h:49
@ NPC_DALRONN
Definition: utgarde_keep.h:48