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