TrinityCore
Loading...
Searching...
No Matches
instance_karazhan.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/* ScriptData
19SDName: Instance_Karazhan
20SD%Complete: 70
21SDComment: Instance Script for Karazhan to help in various encounters. @todo GameObject visibility for Opera event.
22SDCategory: Karazhan
23EndScriptData */
24
25#include "ScriptMgr.h"
26#include "Creature.h"
27#include "GameObject.h"
28#include "InstanceScript.h"
29#include "karazhan.h"
30#include "Map.h"
31
32/*
330 - Attumen + Midnight (optional)
341 - Moroes
352 - Maiden of Virtue (optional)
363 - Hyakiss the Lurker / Rokad the Ravager / Shadikith the Glider
374 - Opera Event
385 - Curator
396 - Shade of Aran (optional)
407 - Terestian Illhoof (optional)
418 - Netherspite (optional)
429 - Chess Event
4310 - Prince Malchezzar
4411 - Nightbane
45*/
46
48{
49 { -10960.981445f, -1940.138428f, 46.178097f, 4.12f }, // Hyakiss the Lurker
50 { -10945.769531f, -2040.153320f, 49.474438f, 0.077f }, // Shadikith the Glider
51 { -10899.903320f, -2085.573730f, 49.474449f, 1.38f } // Rokad the Ravager
52};
53
55{
56public:
58
60 {
62 }
63
65 {
67 {
70
71 // 1 - OZ, 2 - HOOD, 3 - RAJ, this never gets altered.
73 OzDeathCount = 0;
75 }
76
77 void OnCreatureCreate(Creature* creature) override
78 {
79 switch (creature->GetEntry())
80 {
81 case NPC_KILREK:
82 KilrekGUID = creature->GetGUID();
83 break;
85 TerestianGUID = creature->GetGUID();
86 break;
87 case NPC_MOROES:
88 MoroesGUID = creature->GetGUID();
89 break;
90 case NPC_NIGHTBANE:
91 NightbaneGUID = creature->GetGUID();
92 break;
93 default:
94 break;
95 }
96 }
97
98 void OnUnitDeath(Unit* unit) override
99 {
100 Creature* creature = unit->ToCreature();
101 if (!creature)
102 return;
103
104 switch (creature->GetEntry())
105 {
108 case NPC_SHADOWBAT:
111 case NPC_PHASE_HOUND:
112 case NPC_DREADBEAST:
113 case NPC_SHADOWBEAST:
115 {
118 {
120 {
123 break;
126 break;
129 break;
130 }
131 }
132 }
133 break;
138 break;
139 default:
140 break;
141 }
142 }
143
144 void SetData(uint32 type, uint32 data) override
145 {
146 switch (type)
147 {
149 if (data == SPECIAL)
150 ++OzDeathCount;
151 else if (data == IN_PROGRESS)
152 OzDeathCount = 0;
153 break;
154 }
155 }
156
157 bool SetBossState(uint32 type, EncounterState state) override
158 {
159 if (!InstanceScript::SetBossState(type, state))
160 return false;
161
162 switch (type)
163 {
165 if (state == DONE)
166 {
170 sideEntrance->RemoveFlag(GO_FLAG_LOCKED);
172 }
173 break;
174 case DATA_CHESS:
175 if (state == DONE)
177 break;
178 default:
179 break;
180 }
181
182 return true;
183 }
184
185 void SetGuidData(uint32 type, ObjectGuid data) override
186 {
187 if (type == DATA_IMAGE_OF_MEDIVH)
188 ImageGUID = data;
189 }
190
192 {
193 switch (go->GetEntry())
194 {
195 case GO_STAGE_CURTAIN:
196 CurtainGUID = go->GetGUID();
197 break;
202 break;
207 break;
209 LibraryDoor = go->GetGUID();
210 break;
211 case GO_MASSIVE_DOOR:
212 MassiveDoor = go->GetGUID();
213 break;
215 GamesmansDoor = go->GetGUID();
216 break;
219 break;
221 NetherspaceDoor = go->GetGUID();
222 break;
224 MastersTerraceDoor[0] = go->GetGUID();
225 break;
227 MastersTerraceDoor[1] = go->GetGUID();
228 break;
233 else
235 break;
238 break;
239 case GO_BLACKENED_URN:
241 break;
242 }
243
244 switch (OperaEvent)
245 {
247 case EVENT_OZ:
248 break;
249
250 case EVENT_HOOD:
251 break;
252
253 case EVENT_RAJ:
254 break;
255 }
256 }
257
258 uint32 GetData(uint32 type) const override
259 {
260 switch (type)
261 {
263 return OperaEvent;
265 return OzDeathCount;
266 }
267
268 return 0;
269 }
270
271 ObjectGuid GetGuidData(uint32 type) const override
272 {
273 switch (type)
274 {
275 case DATA_KILREK:
276 return KilrekGUID;
277 case DATA_TERESTIAN:
278 return TerestianGUID;
279 case DATA_MOROES:
280 return MoroesGUID;
281 case DATA_NIGHTBANE:
282 return NightbaneGUID;
284 return StageDoorLeftGUID;
286 return StageDoorRightGUID;
287 case DATA_GO_CURTAINS:
288 return CurtainGUID;
290 return LibraryDoor;
292 return MassiveDoor;
294 return SideEntranceDoor;
296 return GamesmansDoor;
298 return GamesmansExitDoor;
300 return NetherspaceDoor;
302 return MastersTerraceDoor[0];
304 return MastersTerraceDoor[1];
306 return ImageGUID;
308 return BlackenedUrnGUID;
309 }
310
311 return ObjectGuid::Empty;
312 }
313
314 private:
325 ObjectGuid LibraryDoor; // Door at Shade of Aran
326 ObjectGuid MassiveDoor; // Door at Netherspite
327 ObjectGuid SideEntranceDoor; // Side Entrance
328 ObjectGuid GamesmansDoor; // Door before Chess
329 ObjectGuid GamesmansExitDoor; // Door after Chess
330 ObjectGuid NetherspaceDoor; // Door at Malchezaar
335 };
336};
337
339{
340 new instance_karazhan();
341}
uint32_t uint32
Definition Define.h:133
EncounterState
@ IN_PROGRESS
@ DONE
@ SPECIAL
@ TO_BE_DECIDED
uint32 urand(uint32 min, uint32 max)
Definition Random.cpp:42
@ GO_FLAG_LOCKED
@ GO_STATE_ACTIVE
#define DataHeader
uint32 const EncounterCount
void SetGoState(GOState state)
void RemoveFlag(GameObjectFlags flags)
Definition GameObject.h:172
void SetFlag(GameObjectFlags flags)
Definition GameObject.h:171
void SetBossNumber(uint32 number)
virtual bool SetBossState(uint32 id, EncounterState state)
void HandleGameObject(ObjectGuid guid, bool open, GameObject *go=nullptr)
InstanceMap * instance
void UpdateEncounterStateForKilledCreature(uint32 creatureId, Unit *source)
EncounterState GetBossState(uint32 id) const
void DoRespawnGameObject(ObjectGuid guid, Seconds timeToDespawn=1min)
void SetHeaders(std::string const &dataHeaders)
GameObject * GetGameObject(ObjectGuid const &guid)
Definition Map.cpp:4430
TempSummon * SummonCreature(uint32 entry, Position const &pos, SummonPropertiesEntry const *properties=nullptr, uint32 duration=0, WorldObject *summoner=nullptr, uint32 spellId=0, uint32 vehId=0, ObjectGuid privateObjectOwner=ObjectGuid::Empty)
Definition Object.cpp:1852
static ObjectGuid const Empty
Definition ObjectGuid.h:140
static Creature * ToCreature(Object *o)
Definition Object.h:186
uint32 GetEntry() const
Definition Object.h:81
static ObjectGuid GetGUID(Object const *o)
Definition Object.h:78
Definition Unit.h:769
InstanceScript * GetInstanceScript(InstanceMap *map) const override
const Position OptionalSpawn[]
void AddSC_instance_karazhan()
@ NPC_VAMPIRIC_SHADOWBAT
Definition karazhan.h:85
@ NPC_PHASE_HOUND
Definition karazhan.h:87
@ NPC_GREATER_SHADOWBAT
Definition karazhan.h:86
@ NPC_SHADOWBEAST
Definition karazhan.h:89
@ NPC_TERESTIAN_ILLHOOF
Definition karazhan.h:74
@ NPC_MOROES
Definition karazhan.h:75
@ NPC_ROKAD_THE_RAVAGER
Definition karazhan.h:72
@ NPC_SHADOWBAT
Definition karazhan.h:84
@ NPC_HYAKISS_THE_LURKER
Definition karazhan.h:71
@ NPC_KILREK
Definition karazhan.h:90
@ NPC_NIGHTBANE
Definition karazhan.h:76
@ NPC_SHADIKITH_THE_GLIDER
Definition karazhan.h:73
@ NPC_DREADBEAST
Definition karazhan.h:88
@ NPC_COLDMIST_WIDOW
Definition karazhan.h:82
@ NPC_COLDMIST_STALKER
Definition karazhan.h:83
#define KZScriptName
Definition karazhan.h:23
@ OPTIONAL_BOSS_REQUIRED_DEATH_COUNT
Definition karazhan.h:112
@ EVENT_HOOD
Definition karazhan.h:65
@ EVENT_OZ
Definition karazhan.h:64
@ EVENT_RAJ
Definition karazhan.h:66
@ DATA_KILREK
Definition karazhan.h:45
@ DATA_GO_STAGEDOORRIGHT
Definition karazhan.h:48
@ DATA_GO_CURTAINS
Definition karazhan.h:46
@ DATA_GO_MASSIVE_DOOR
Definition karazhan.h:50
@ DATA_GO_STAGEDOORLEFT
Definition karazhan.h:47
@ DATA_GO_GAME_EXIT_DOOR
Definition karazhan.h:53
@ DATA_OPTIONAL_BOSS
Definition karazhan.h:33
@ DATA_IMAGE_OF_MEDIVH
Definition karazhan.h:55
@ DATA_CHESS
Definition karazhan.h:39
@ DATA_MASTERS_TERRACE_DOOR_1
Definition karazhan.h:56
@ DATA_TERESTIAN
Definition karazhan.h:37
@ DATA_GO_GAME_DOOR
Definition karazhan.h:52
@ DATA_MOROES
Definition karazhan.h:31
@ DATA_GO_SIDE_ENTRANCE_DOOR
Definition karazhan.h:58
@ DATA_GO_LIBRARY_DOOR
Definition karazhan.h:49
@ DATA_GO_BLACKENED_URN
Definition karazhan.h:59
@ DATA_NIGHTBANE
Definition karazhan.h:41
@ DATA_MASTERS_TERRACE_DOOR_2
Definition karazhan.h:57
@ DATA_OPERA_OZ_DEATHCOUNT
Definition karazhan.h:43
@ DATA_OPERA_PERFORMANCE
Definition karazhan.h:34
@ DATA_GO_NETHER_DOOR
Definition karazhan.h:51
@ GO_BLACKENED_URN
Definition karazhan.h:107
@ GO_STAGE_DOOR_RIGHT
Definition karazhan.h:97
@ GO_STAGE_CURTAIN
Definition karazhan.h:95
@ GO_PRIVATE_LIBRARY_DOOR
Definition karazhan.h:98
@ GO_MASSIVE_DOOR
Definition karazhan.h:99
@ GO_STAGE_DOOR_LEFT
Definition karazhan.h:96
@ GO_NETHERSPACE_DOOR
Definition karazhan.h:102
@ GO_GAMESMAN_HALL_EXIT_DOOR
Definition karazhan.h:101
@ GO_SIDE_ENTRANCE_DOOR
Definition karazhan.h:105
@ GO_MASTERS_TERRACE_DOOR
Definition karazhan.h:103
@ GO_MASTERS_TERRACE_DOOR2
Definition karazhan.h:104
@ GO_GAMESMAN_HALL_DOOR
Definition karazhan.h:100
@ GO_DUST_COVERED_CHEST
Definition karazhan.h:106
bool SetBossState(uint32 type, EncounterState state) override
void SetGuidData(uint32 type, ObjectGuid data) override