TrinityCore
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 { DATA_ATTUMEN, {{ 652 }} },
50 { DATA_MOROES, {{ 653 }} },
51 { DATA_MAIDEN_OF_VIRTUE, {{ 654 }} },
52 { DATA_OPERA_PERFORMANCE, {{ 655 }} },
53 { DATA_CURATOR, {{ 656 }} },
54 { DATA_ARAN, {{ 658 }} },
55 { DATA_TERESTIAN, {{ 657 }} },
56 { DATA_NETHERSPITE, {{ 659 }} },
57 { DATA_CHESS, {{ 660 }} },
58 { DATA_MALCHEZZAR, {{ 661 }} },
59 { DATA_NIGHTBANE, {{ 662 }} }
60};
61
63{
64 { -10960.981445f, -1940.138428f, 46.178097f, 4.12f }, // Hyakiss the Lurker
65 { -10945.769531f, -2040.153320f, 49.474438f, 0.077f }, // Shadikith the Glider
66 { -10899.903320f, -2085.573730f, 49.474449f, 1.38f } // Rokad the Ravager
67};
68
70{
71public:
73
75 {
77 }
78
80 {
82 {
86
87 // 1 - OZ, 2 - HOOD, 3 - RAJ, this never gets altered.
89 OzDeathCount = 0;
91 }
92
93 void OnCreatureCreate(Creature* creature) override
94 {
95 switch (creature->GetEntry())
96 {
97 case NPC_KILREK:
98 KilrekGUID = creature->GetGUID();
99 break;
101 TerestianGUID = creature->GetGUID();
102 break;
103 case NPC_MOROES:
104 MoroesGUID = creature->GetGUID();
105 break;
106 case NPC_NIGHTBANE:
107 NightbaneGUID = creature->GetGUID();
108 break;
109 default:
110 break;
111 }
112 }
113
114 void OnUnitDeath(Unit* unit) override
115 {
116 Creature* creature = unit->ToCreature();
117 if (!creature)
118 return;
119
120 switch (creature->GetEntry())
121 {
124 case NPC_SHADOWBAT:
127 case NPC_PHASE_HOUND:
128 case NPC_DREADBEAST:
129 case NPC_SHADOWBEAST:
131 {
134 {
136 {
139 break;
142 break;
145 break;
146 }
147 }
148 }
149 break;
154 break;
155 default:
156 break;
157 }
158 }
159
160 void SetData(uint32 type, uint32 data) override
161 {
162 switch (type)
163 {
165 if (data == SPECIAL)
166 ++OzDeathCount;
167 else if (data == IN_PROGRESS)
168 OzDeathCount = 0;
169 break;
170 }
171 }
172
173 bool SetBossState(uint32 type, EncounterState state) override
174 {
175 if (!InstanceScript::SetBossState(type, state))
176 return false;
177
178 switch (type)
179 {
181 if (state == DONE)
182 {
186 sideEntrance->RemoveFlag(GO_FLAG_LOCKED);
187 }
188 break;
189 case DATA_CHESS:
190 if (state == DONE)
192 break;
193 default:
194 break;
195 }
196
197 return true;
198 }
199
200 void SetGuidData(uint32 type, ObjectGuid data) override
201 {
202 if (type == DATA_IMAGE_OF_MEDIVH)
203 ImageGUID = data;
204 }
205
207 {
208 switch (go->GetEntry())
209 {
210 case GO_STAGE_CURTAIN:
211 CurtainGUID = go->GetGUID();
212 break;
217 break;
222 break;
224 LibraryDoor = go->GetGUID();
225 break;
226 case GO_MASSIVE_DOOR:
227 MassiveDoor = go->GetGUID();
228 break;
230 GamesmansDoor = go->GetGUID();
231 break;
234 break;
236 NetherspaceDoor = go->GetGUID();
237 break;
239 MastersTerraceDoor[0] = go->GetGUID();
240 break;
242 MastersTerraceDoor[1] = go->GetGUID();
243 break;
248 else
250 break;
253 break;
254 case GO_BLACKENED_URN:
256 break;
257 }
258
259 switch (OperaEvent)
260 {
262 case EVENT_OZ:
263 break;
264
265 case EVENT_HOOD:
266 break;
267
268 case EVENT_RAJ:
269 break;
270 }
271 }
272
273 uint32 GetData(uint32 type) const override
274 {
275 switch (type)
276 {
278 return OperaEvent;
280 return OzDeathCount;
281 }
282
283 return 0;
284 }
285
286 ObjectGuid GetGuidData(uint32 type) const override
287 {
288 switch (type)
289 {
290 case DATA_KILREK:
291 return KilrekGUID;
292 case DATA_TERESTIAN:
293 return TerestianGUID;
294 case DATA_MOROES:
295 return MoroesGUID;
296 case DATA_NIGHTBANE:
297 return NightbaneGUID;
299 return StageDoorLeftGUID;
301 return StageDoorRightGUID;
302 case DATA_GO_CURTAINS:
303 return CurtainGUID;
305 return LibraryDoor;
307 return MassiveDoor;
309 return SideEntranceDoor;
311 return GamesmansDoor;
313 return GamesmansExitDoor;
315 return NetherspaceDoor;
317 return MastersTerraceDoor[0];
319 return MastersTerraceDoor[1];
321 return ImageGUID;
323 return BlackenedUrnGUID;
324 }
325
326 return ObjectGuid::Empty;
327 }
328
329 private:
340 ObjectGuid LibraryDoor; // Door at Shade of Aran
341 ObjectGuid MassiveDoor; // Door at Netherspite
342 ObjectGuid SideEntranceDoor; // Side Entrance
343 ObjectGuid GamesmansDoor; // Door before Chess
344 ObjectGuid GamesmansExitDoor; // Door after Chess
345 ObjectGuid NetherspaceDoor; // Door at Malchezaar
350 };
351};
352
354{
355 new instance_karazhan();
356}
uint32_t uint32
Definition: Define.h:142
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:275
void SetFlag(GameObjectFlags flags)
Definition: GameObject.h:274
void SetBossNumber(uint32 number)
virtual bool SetBossState(uint32 id, EncounterState state)
void HandleGameObject(ObjectGuid guid, bool open, GameObject *go=nullptr)
void LoadDungeonEncounterData(T const &encounters)
InstanceMap * instance
EncounterState GetBossState(uint32 id) const
void DoRespawnGameObject(ObjectGuid guid, Seconds timeToDespawn=1min)
void SetHeaders(std::string const &dataHeaders)
TempSummon * SummonCreature(uint32 entry, Position const &pos, SummonPropertiesEntry const *properties=nullptr, Milliseconds duration=0ms, WorldObject *summoner=nullptr, uint32 spellId=0, uint32 vehId=0, ObjectGuid privateObjectOwner=ObjectGuid::Empty, SmoothPhasingInfo const *smoothPhasingInfo=nullptr)
Definition: Object.cpp:1850
GameObject * GetGameObject(ObjectGuid const &guid)
Definition: Map.cpp:3528
static ObjectGuid const Empty
Definition: ObjectGuid.h:275
static Creature * ToCreature(Object *o)
Definition: Object.h:220
uint32 GetEntry() const
Definition: Object.h:162
static ObjectGuid GetGUID(Object const *o)
Definition: Object.h:160
Definition: Unit.h:628
InstanceScript * GetInstanceScript(InstanceMap *map) const override
const Position OptionalSpawn[]
void AddSC_instance_karazhan()
DungeonEncounterData const encounters[]
@ 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_MALCHEZZAR
Definition: karazhan.h:40
@ 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_ATTUMEN
Definition: karazhan.h:30
@ DATA_GO_GAME_EXIT_DOOR
Definition: karazhan.h:53
@ DATA_CURATOR
Definition: karazhan.h:35
@ DATA_OPTIONAL_BOSS
Definition: karazhan.h:33
@ DATA_IMAGE_OF_MEDIVH
Definition: karazhan.h:55
@ DATA_CHESS
Definition: karazhan.h:39
@ DATA_MAIDEN_OF_VIRTUE
Definition: karazhan.h:32
@ DATA_MASTERS_TERRACE_DOOR_1
Definition: karazhan.h:56
@ DATA_NETHERSPITE
Definition: karazhan.h:38
@ 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_ARAN
Definition: karazhan.h:36
@ 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
ObjectGuid GetGuidData(uint32 type) const override
bool SetBossState(uint32 type, EncounterState state) override
void SetGuidData(uint32 type, ObjectGuid data) override
void SetData(uint32 type, uint32 data) override