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
30
32{
33 public:
35
37 {
44
45 void OnCreatureCreate(Creature* creature) override
46 {
47 switch (creature->GetEntry())
48 {
50 PrinceKelesethGUID = creature->GetGUID();
51 break;
52 case NPC_SKARVALD:
53 SkarvaldGUID = creature->GetGUID();
54 break;
55 case NPC_DALRONN:
56 DalronnGUID = creature->GetGUID();
57 break;
58 case NPC_INGVAR:
59 IngvarGUID = creature->GetGUID();
60 break;
61 default:
62 break;
63 }
64 }
65
66 void OnGameObjectCreate(GameObject* go) override
67 {
69
70 switch (go->GetEntry())
71 {
72 case GO_BELLOW_1:
73 Forges[0].BellowGUID = go->GetGUID();
75 break;
76 case GO_BELLOW_2:
77 Forges[1].BellowGUID = go->GetGUID();
79 break;
80 case GO_BELLOW_3:
81 Forges[2].BellowGUID = go->GetGUID();
83 break;
84 case GO_FORGEFIRE_1:
85 Forges[0].FireGUID = go->GetGUID();
87 break;
88 case GO_FORGEFIRE_2:
89 Forges[1].FireGUID = go->GetGUID();
91 break;
92 case GO_FORGEFIRE_3:
93 Forges[2].FireGUID = go->GetGUID();
95 break;
97 Forges[0].AnvilGUID = go->GetGUID();
99 break;
101 Forges[1].AnvilGUID = go->GetGUID();
103 break;
105 Forges[2].AnvilGUID = go->GetGUID();
107 break;
108 default:
109 break;
110 }
111 }
112
113 ObjectGuid GetGuidData(uint32 type) const override
114 {
115 switch (type)
116 {
118 return PrinceKelesethGUID;
119 case DATA_SKARVALD:
120 return SkarvaldGUID;
121 case DATA_DALRONN:
122 return DalronnGUID;
123 case DATA_INGVAR:
124 return IngvarGUID;
125 default:
126 break;
127 }
128
129 return ObjectGuid::Empty;
130 }
131
132 void SetData(uint32 type, uint32 data) override
133 {
134 switch (type)
135 {
136 case DATA_FORGE_1:
137 case DATA_FORGE_2:
138 case DATA_FORGE_3:
139 {
140 uint8 i = type - DATA_FORGE_1;
141 HandleGameObject(Forges[i].AnvilGUID, data != NOT_STARTED);
142 HandleGameObject(Forges[i].BellowGUID, data != NOT_STARTED);
143 HandleGameObject(Forges[i].FireGUID, data != NOT_STARTED);
144 Forges[i].Event = data;
145
146 if (data == DONE)
147 SaveToDB();
148 break;
149 }
150 default:
151 break;
152 }
153 }
154
155 void WriteSaveDataMore(std::ostringstream& data) override
156 {
157 for (uint8 i = 0; i < 3; ++i)
158 data << Forges[i].Event << ' ';
159 }
160
161 void ReadSaveDataMore(std::istringstream& data) override
162 {
163 for (uint8 i = 0; i < 3; ++i)
164 data >> Forges[i].Event;
165 }
166
167 protected:
169
174 };
175
177 {
179 }
180};
181
uint8_t uint8
Definition Define.h:135
uint32_t uint32
Definition Define.h:133
@ DONE
@ NOT_STARTED
@ DOOR_TYPE_ROOM
@ DOOR_TYPE_PASSAGE
#define DataHeader
uint32 const EncounterCount
void SetBossNumber(uint32 number)
void HandleGameObject(ObjectGuid guid, bool open, GameObject *go=nullptr)
virtual void OnGameObjectCreate(GameObject *go) override
void LoadDoorData(DoorData const *data)
void SetHeaders(std::string const &dataHeaders)
static ObjectGuid const Empty
Definition ObjectGuid.h:140
uint32 GetEntry() const
Definition Object.h:81
static ObjectGuid GetGUID(Object const *o)
Definition Object.h:78
InstanceScript * GetInstanceScript(InstanceMap *map) const override
@ DATA_PRINCE_KELESETH
@ NPC_PRINCE_KELESETH
void AddSC_instance_utgarde_keep()
DoorData const doorData[]
ObjectGuid AnvilGUID
ObjectGuid BellowGUID
uint32 Event
ObjectGuid FireGUID
@ DATA_DALRONN
@ DATA_FORGE_2
@ 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