Project SkyFire Core
SkyFire 5.4.8 server core API documentation
Toggle main menu visibility
Loading...
Searching...
No Matches
instance_shadow_labyrinth.cpp
Go to the documentation of this file.
1
/*
2
* This file is part of Project SkyFire https://www.projectskyfire.org.
3
* See LICENSE.md file for Copyright information
4
*/
5
6
#include "
ScriptMgr.h
"
7
#include "
InstanceScript.h
"
8
#include "
ScriptedCreature.h
"
9
#include "
shadow_labyrinth.h
"
10
11
DoorData
const
doorData
[] =
12
{
13
{
GO_REFECTORY_DOOR
,
DATA_BLACKHEART_THE_INCITER
,
DOOR_TYPE_PASSAGE
,
BOUNDARY_NONE
},
14
{
GO_SCREAMING_HALL_DOOR
,
DATA_GRANDMASTER_VORPIL
,
DOOR_TYPE_PASSAGE
,
BOUNDARY_NONE
},
15
{ 0, 0,
DOOR_TYPE_ROOM
,
BOUNDARY_NONE
}
// END
16
};
17
18
class
instance_shadow_labyrinth
:
public
InstanceMapScript
19
{
20
public
:
21
instance_shadow_labyrinth
() :
InstanceMapScript
(
SLScriptName
, 555) { }
22
23
struct
instance_shadow_labyrinth_InstanceMapScript
:
public
InstanceScript
24
{
25
instance_shadow_labyrinth_InstanceMapScript
(
Map
* map) :
InstanceScript
(map)
26
{
27
SetBossNumber
(
EncounterCount
);
28
LoadDoorData
(
doorData
);
29
30
AmbassadorHellmawGUID
= 0;
31
GrandmasterVorpilGUID
= 0;
32
FelOverseerCount
= 0;
33
}
34
35
void
OnCreatureCreate
(
Creature
* creature)
OVERRIDE
36
{
37
switch
(creature->GetEntry())
38
{
39
case
NPC_AMBASSADOR_HELLMAW
:
40
AmbassadorHellmawGUID
= creature->GetGUID();
41
break
;
42
case
NPC_GRANDMASTER_VORPIL
:
43
GrandmasterVorpilGUID
= creature->GetGUID();
44
break
;
45
case
NPC_FEL_OVERSEER
:
46
if
(creature->IsAlive())
47
{
48
++
FelOverseerCount
;
49
if
(
Creature
* hellmaw =
instance
->GetCreature(
AmbassadorHellmawGUID
))
50
hellmaw->AI()->DoAction(
ACTION_AMBASSADOR_HELLMAW_BANISH
);
51
}
52
break
;
53
default
:
54
break
;
55
}
56
}
57
58
void
OnGameObjectCreate
(
GameObject
* go)
OVERRIDE
59
{
60
switch
(go->GetEntry())
61
{
62
case
GO_REFECTORY_DOOR
:
63
case
GO_SCREAMING_HALL_DOOR
:
64
AddDoor
(go,
true
);
65
break
;
66
default
:
67
break
;
68
}
69
}
70
71
void
OnGameObjectRemove
(
GameObject
* go)
OVERRIDE
72
{
73
switch
(go->GetEntry())
74
{
75
case
GO_REFECTORY_DOOR
:
76
case
GO_SCREAMING_HALL_DOOR
:
77
AddDoor
(go,
false
);
78
break
;
79
default
:
80
break
;
81
}
82
}
83
84
void
OnUnitDeath
(
Unit
* unit)
OVERRIDE
85
{
86
Creature
* creature = unit->
ToCreature
();
87
if
(!creature)
88
return
;
89
90
if
(creature->
GetEntry
() ==
NPC_FEL_OVERSEER
)
91
{
92
if
(
FelOverseerCount
)
93
--
FelOverseerCount
;
94
95
if
(!
FelOverseerCount
)
96
if
(
Creature
* hellmaw =
instance
->GetCreature(
AmbassadorHellmawGUID
))
97
hellmaw->AI()->DoAction(
ACTION_AMBASSADOR_HELLMAW_INTRO
);
98
}
99
}
100
101
uint32
GetData
(
uint32
type)
const
OVERRIDE
102
{
103
switch
(type)
104
{
105
case
DATA_FEL_OVERSEER
:
106
return
!
FelOverseerCount
? 1 : 0;
107
default
:
108
break
;
109
}
110
return
0;
111
}
112
113
uint64
GetData64
(
uint32
type)
const
OVERRIDE
114
{
115
switch
(type)
116
{
117
case
DATA_GRANDMASTER_VORPIL
:
118
return
GrandmasterVorpilGUID
;
119
default
:
120
break
;
121
}
122
return
0;
123
}
124
125
std::string
GetSaveData
()
OVERRIDE
126
{
127
OUT_SAVE_INST_DATA
;
128
129
std::ostringstream saveStream;
130
saveStream <<
"S L "
<<
GetBossSaveData
();
131
132
OUT_SAVE_INST_DATA_COMPLETE
;
133
return
saveStream.str();
134
}
135
136
void
Load
(
char
const
* str)
OVERRIDE
137
{
138
if
(!str)
139
{
140
OUT_LOAD_INST_DATA_FAIL
;
141
return
;
142
}
143
144
OUT_LOAD_INST_DATA
(str);
145
146
char
dataHead1, dataHead2;
147
148
std::istringstream loadStream(str);
149
loadStream >> dataHead1 >> dataHead2;
150
151
if
(dataHead1 ==
'S'
&& dataHead2 ==
'L'
)
152
{
153
for
(
uint32
i = 0; i <
EncounterCount
; ++i)
154
{
155
uint32
tmpState;
156
loadStream >> tmpState;
157
if
(tmpState ==
IN_PROGRESS
|| tmpState >
SPECIAL
)
158
tmpState =
NOT_STARTED
;
159
SetBossState
(i,
EncounterState
(tmpState));
160
}
161
}
162
else
163
OUT_LOAD_INST_DATA_FAIL
;
164
165
OUT_LOAD_INST_DATA_COMPLETE
;
166
}
167
168
protected
:
169
uint64
AmbassadorHellmawGUID
;
170
uint64
GrandmasterVorpilGUID
;
171
uint32
FelOverseerCount
;
172
};
173
174
InstanceScript
*
GetInstanceScript
(
InstanceMap
* map)
const
OVERRIDE
175
{
176
return
new
instance_shadow_labyrinth_InstanceMapScript
(map);
177
}
178
};
179
180
void
AddSC_instance_shadow_labyrinth
()
181
{
182
new
instance_shadow_labyrinth
();
183
}
uint32
std::uint32_t uint32
Definition
Define.h:77
OVERRIDE
#define OVERRIDE
Definition
Define.h:60
uint64
std::uint64_t uint64
Definition
Define.h:76
InstanceScript.h
OUT_LOAD_INST_DATA_FAIL
#define OUT_LOAD_INST_DATA_FAIL
Definition
InstanceScript.h:18
EncounterState
EncounterState
Definition
InstanceScript.h:45
IN_PROGRESS
@ IN_PROGRESS
Definition
InstanceScript.h:47
SPECIAL
@ SPECIAL
Definition
InstanceScript.h:50
NOT_STARTED
@ NOT_STARTED
Definition
InstanceScript.h:46
OUT_SAVE_INST_DATA_COMPLETE
#define OUT_SAVE_INST_DATA_COMPLETE
Definition
InstanceScript.h:15
OUT_LOAD_INST_DATA_COMPLETE
#define OUT_LOAD_INST_DATA_COMPLETE
Definition
InstanceScript.h:17
OUT_SAVE_INST_DATA
#define OUT_SAVE_INST_DATA
Definition
InstanceScript.h:14
OUT_LOAD_INST_DATA
#define OUT_LOAD_INST_DATA(a)
Definition
InstanceScript.h:16
DOOR_TYPE_ROOM
@ DOOR_TYPE_ROOM
Definition
InstanceScript.h:56
DOOR_TYPE_PASSAGE
@ DOOR_TYPE_PASSAGE
Definition
InstanceScript.h:57
BOUNDARY_NONE
@ BOUNDARY_NONE
Definition
InstanceScript.h:64
ScriptMgr.h
ScriptedCreature.h
EncounterCount
uint32 const EncounterCount
Definition
baradin_hold.h:15
Creature
Definition
Creature.h:427
GameObject
Definition
GameObject.h:629
InstanceMap
Definition
Map.h:637
InstanceMapScript::InstanceMapScript
InstanceMapScript(const char *name, uint32 mapId)
Definition
ScriptMgr.cpp:1412
InstanceScript
Definition
InstanceScript.h:123
InstanceScript::InstanceScript
InstanceScript(Map *map)
Definition
InstanceScript.h:125
InstanceScript::SetBossNumber
void SetBossNumber(uint32 number)
Definition
InstanceScript.h:212
InstanceScript::SetBossState
virtual bool SetBossState(uint32 id, EncounterState state)
Definition
InstanceScript.cpp:182
InstanceScript::instance
Map * instance
Definition
InstanceScript.h:129
InstanceScript::GetBossSaveData
std::string GetBossSaveData()
Definition
InstanceScript.cpp:239
InstanceScript::AddDoor
void AddDoor(GameObject *door, bool add)
Definition
InstanceScript.cpp:126
InstanceScript::LoadDoorData
void LoadDoorData(DoorData const *data)
Definition
InstanceScript.cpp:64
Map
Definition
Map.h:238
Object::GetEntry
uint32 GetEntry() const
Definition
Object.h:125
Object::ToCreature
Creature * ToCreature()
Definition
Object.h:207
Unit
Definition
Unit.h:1367
instance_shadow_labyrinth
Definition
instance_shadow_labyrinth.cpp:19
instance_shadow_labyrinth::instance_shadow_labyrinth
instance_shadow_labyrinth()
Definition
instance_shadow_labyrinth.cpp:21
instance_shadow_labyrinth::GetInstanceScript
InstanceScript * GetInstanceScript(InstanceMap *map) const OVERRIDE
Definition
instance_shadow_labyrinth.cpp:174
doorData
DoorData const doorData[]
Definition
instance_baradin_hold.cpp:10
doorData
DoorData const doorData[]
Definition
instance_shadow_labyrinth.cpp:11
AddSC_instance_shadow_labyrinth
void AddSC_instance_shadow_labyrinth()
Definition
instance_shadow_labyrinth.cpp:180
shadow_labyrinth.h
ACTION_AMBASSADOR_HELLMAW_BANISH
@ ACTION_AMBASSADOR_HELLMAW_BANISH
Definition
shadow_labyrinth.h:41
ACTION_AMBASSADOR_HELLMAW_INTRO
@ ACTION_AMBASSADOR_HELLMAW_INTRO
Definition
shadow_labyrinth.h:40
GO_REFECTORY_DOOR
@ GO_REFECTORY_DOOR
Definition
shadow_labyrinth.h:34
GO_SCREAMING_HALL_DOOR
@ GO_SCREAMING_HALL_DOOR
Definition
shadow_labyrinth.h:35
NPC_GRANDMASTER_VORPIL
@ NPC_GRANDMASTER_VORPIL
Definition
shadow_labyrinth.h:28
NPC_FEL_OVERSEER
@ NPC_FEL_OVERSEER
Definition
shadow_labyrinth.h:29
NPC_AMBASSADOR_HELLMAW
@ NPC_AMBASSADOR_HELLMAW
Definition
shadow_labyrinth.h:27
SLScriptName
#define SLScriptName
Definition
shadow_labyrinth.h:9
DATA_GRANDMASTER_VORPIL
@ DATA_GRANDMASTER_VORPIL
Definition
shadow_labyrinth.h:18
DATA_FEL_OVERSEER
@ DATA_FEL_OVERSEER
Definition
shadow_labyrinth.h:22
DATA_BLACKHEART_THE_INCITER
@ DATA_BLACKHEART_THE_INCITER
Definition
shadow_labyrinth.h:17
DoorData
Definition
InstanceScript.h:82
instance_shadow_labyrinth::instance_shadow_labyrinth_InstanceMapScript
Definition
instance_shadow_labyrinth.cpp:24
instance_shadow_labyrinth::instance_shadow_labyrinth_InstanceMapScript::GrandmasterVorpilGUID
uint64 GrandmasterVorpilGUID
Definition
instance_shadow_labyrinth.cpp:170
instance_shadow_labyrinth::instance_shadow_labyrinth_InstanceMapScript::GetData
uint32 GetData(uint32 type) const OVERRIDE
Definition
instance_shadow_labyrinth.cpp:101
instance_shadow_labyrinth::instance_shadow_labyrinth_InstanceMapScript::OnUnitDeath
void OnUnitDeath(Unit *unit) OVERRIDE
Definition
instance_shadow_labyrinth.cpp:84
instance_shadow_labyrinth::instance_shadow_labyrinth_InstanceMapScript::Load
void Load(char const *str) OVERRIDE
Definition
instance_shadow_labyrinth.cpp:136
instance_shadow_labyrinth::instance_shadow_labyrinth_InstanceMapScript::OnGameObjectCreate
void OnGameObjectCreate(GameObject *go) OVERRIDE
Definition
instance_shadow_labyrinth.cpp:58
instance_shadow_labyrinth::instance_shadow_labyrinth_InstanceMapScript::GetData64
uint64 GetData64(uint32 type) const OVERRIDE
Definition
instance_shadow_labyrinth.cpp:113
instance_shadow_labyrinth::instance_shadow_labyrinth_InstanceMapScript::GetSaveData
std::string GetSaveData() OVERRIDE
Definition
instance_shadow_labyrinth.cpp:125
instance_shadow_labyrinth::instance_shadow_labyrinth_InstanceMapScript::FelOverseerCount
uint32 FelOverseerCount
Definition
instance_shadow_labyrinth.cpp:171
instance_shadow_labyrinth::instance_shadow_labyrinth_InstanceMapScript::instance_shadow_labyrinth_InstanceMapScript
instance_shadow_labyrinth_InstanceMapScript(Map *map)
Definition
instance_shadow_labyrinth.cpp:25
instance_shadow_labyrinth::instance_shadow_labyrinth_InstanceMapScript::OnGameObjectRemove
void OnGameObjectRemove(GameObject *go) OVERRIDE
Definition
instance_shadow_labyrinth.cpp:71
instance_shadow_labyrinth::instance_shadow_labyrinth_InstanceMapScript::AmbassadorHellmawGUID
uint64 AmbassadorHellmawGUID
Definition
instance_shadow_labyrinth.cpp:169
instance_shadow_labyrinth::instance_shadow_labyrinth_InstanceMapScript::OnCreatureCreate
void OnCreatureCreate(Creature *creature) OVERRIDE
Definition
instance_shadow_labyrinth.cpp:35
src
server
scripts
Outland
Auchindoun
ShadowLabyrinth
instance_shadow_labyrinth.cpp
Generated on
for Project SkyFire Core by
1.17.0