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
30static constexpr DungeonEncounterData encounters[] =
31{
32 { DATA_PRINCE_KELESETH, {{ 2026 }} },
33 { DATA_SKARVALD_DALRONN, {{ 2024 }} },
34 { DATA_INGVAR, {{ 2025 }} }
35};
36
38{
39 public:
41
43 {
51
52 void OnCreatureCreate(Creature* creature) override
53 {
54 switch (creature->GetEntry())
55 {
57 PrinceKelesethGUID = creature->GetGUID();
58 break;
59 case NPC_SKARVALD:
60 SkarvaldGUID = creature->GetGUID();
61 break;
62 case NPC_DALRONN:
63 DalronnGUID = creature->GetGUID();
64 break;
65 case NPC_INGVAR:
66 IngvarGUID = creature->GetGUID();
67 break;
68 default:
69 break;
70 }
71 }
72
73 void OnGameObjectCreate(GameObject* go) override
74 {
76
77 switch (go->GetEntry())
78 {
79 case GO_BELLOW_1:
80 Forges[0].BellowGUID = go->GetGUID();
82 break;
83 case GO_BELLOW_2:
84 Forges[1].BellowGUID = go->GetGUID();
86 break;
87 case GO_BELLOW_3:
88 Forges[2].BellowGUID = go->GetGUID();
90 break;
91 case GO_FORGEFIRE_1:
92 Forges[0].FireGUID = go->GetGUID();
94 break;
95 case GO_FORGEFIRE_2:
96 Forges[1].FireGUID = go->GetGUID();
98 break;
99 case GO_FORGEFIRE_3:
100 Forges[2].FireGUID = go->GetGUID();
102 break;
104 Forges[0].AnvilGUID = go->GetGUID();
106 break;
108 Forges[1].AnvilGUID = go->GetGUID();
110 break;
112 Forges[2].AnvilGUID = go->GetGUID();
114 break;
115 default:
116 break;
117 }
118 }
119
120 ObjectGuid GetGuidData(uint32 type) const override
121 {
122 switch (type)
123 {
125 return PrinceKelesethGUID;
126 case DATA_SKARVALD:
127 return SkarvaldGUID;
128 case DATA_DALRONN:
129 return DalronnGUID;
130 case DATA_INGVAR:
131 return IngvarGUID;
132 default:
133 break;
134 }
135
136 return ObjectGuid::Empty;
137 }
138
139 void SetData(uint32 type, uint32 data) override
140 {
141 switch (type)
142 {
143 case DATA_FORGE_1:
144 case DATA_FORGE_2:
145 case DATA_FORGE_3:
146 {
147 uint8 i = type - DATA_FORGE_1;
148 HandleGameObject(Forges[i].AnvilGUID, data != NOT_STARTED);
149 HandleGameObject(Forges[i].BellowGUID, data != NOT_STARTED);
150 HandleGameObject(Forges[i].FireGUID, data != NOT_STARTED);
151 Forges[i].Event = data;
152 break;
153 }
154 default:
155 break;
156 }
157 }
158
159 void AfterDataLoad() override
160 {
162 for (uint8 i = 0; i < 3; ++i)
163 Forges[i].Event = DONE;
164 }
165
166 protected:
168
173 };
174
176 {
178 }
179};
180
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)
EncounterState GetBossState(uint32 id) const
virtual void OnGameObjectCreate(GameObject *go) override
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 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