1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
|
/*
* This file is part of the AzerothCore Project. See AUTHORS file for Copyright information
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "GameEventMgr.h"
#include "GameObjectAI.h"
#include "GameObjectScript.h"
#include "InstanceMapScript.h"
#include "InstanceScript.h"
#include "zulgurub.h"
DoorData const doorData[] =
{
{ GO_FORCEFIELD, DATA_ARLOKK, DOOR_TYPE_ROOM },
{ 0, 0, DOOR_TYPE_ROOM }
};
ObjectData const creatureData[] =
{
{ NPC_HIGH_PRIEST_THEKAL, DATA_THEKAL },
{ NPC_ZEALOT_LORKHAN, DATA_LORKHAN },
{ NPC_ZEALOT_ZATH, DATA_ZATH },
{ NPC_PRIESTESS_MARLI, DATA_MARLI },
{ 0, 0 }
};
class instance_zulgurub : public InstanceMapScript
{
public:
instance_zulgurub(): InstanceMapScript(ZGScriptName, MAP_ZUL_GURUB) { }
struct instance_zulgurub_InstanceMapScript : public InstanceScript
{
instance_zulgurub_InstanceMapScript(Map* map) : InstanceScript(map)
{
SetHeaders(DataHeader);
SetBossNumber(EncounterCount);
LoadDoorData(doorData);
LoadObjectData(creatureData, nullptr);
}
void OnCreatureCreate(Creature* creature) override
{
InstanceScript::OnCreatureCreate(creature);
switch (creature->GetEntry())
{
case NPC_JINDO_THE_HEXXER:
_jindoTheHexxerGUID = creature->GetGUID();
break;
case NPC_VILEBRANCH_SPEAKER:
_vilebranchSpeakerGUID = creature->GetGUID();
break;
case NPC_ARLOKK:
_arlokkGUID = creature->GetGUID();
break;
case NPC_HAKKAR:
_hakkarGUID = creature->GetGUID();
break;
case NPC_SPAWN_OF_MARLI:
if (Creature* marli = GetCreature(DATA_MARLI))
{
marli->AI()->JustSummoned(creature);
}
break;
case NPC_GAHZRANKA:
_gahzrankaGUID = creature->GetGUID();
break;
case NPC_GRILEK:
case NPC_HAZZARAH:
case NPC_RENATAKI:
case NPC_WUSHOOLAY:
_edgeOfMadnessGUID = creature->GetGUID();
break;
default:
break;
}
}
void OnGameObjectCreate(GameObject* go) override
{
InstanceScript::OnGameObjectCreate(go);
switch (go->GetEntry())
{
case GO_GONG_OF_BETHEKK:
_goGongOfBethekkGUID = go->GetGUID();
if (GetBossState(DATA_ARLOKK) == DONE)
go->SetGameObjectFlag(GO_FLAG_NOT_SELECTABLE);
else
go->RemoveGameObjectFlag(GO_FLAG_NOT_SELECTABLE);
break;
default:
break;
}
}
ObjectGuid GetGuidData(uint32 uiData) const override
{
switch (uiData)
{
case DATA_JINDO:
return _jindoTheHexxerGUID;
case NPC_ARLOKK:
return _arlokkGUID;
case GO_GONG_OF_BETHEKK:
return _goGongOfBethekkGUID;
case DATA_HAKKAR:
return _hakkarGUID;
case DATA_EDGE_OF_MADNESS:
return _edgeOfMadnessGUID;
}
return ObjectGuid::Empty;
}
uint32 GetData(uint32 type) const override
{
if (type == DATA_GAHZRANKA)
{
return _gahzrankaGUID || GetBossState(DATA_GAHZRANKA) == DONE;
}
return 0;
}
void RemoveHakkarPowerStack()
{
if (Creature* hakkar = instance->GetCreature(_hakkarGUID))
{
hakkar->CastSpell(hakkar, SPELL_HAKKAR_POWER_DOWN, true);
}
}
bool SetBossState(uint32 type, EncounterState state) override
{
if (!InstanceScript::SetBossState(type, state))
return false;
switch (type)
{
case DATA_JEKLIK:
case DATA_VENOXIS:
case DATA_MARLI:
case DATA_ARLOKK:
case DATA_THEKAL:
if (state == DONE)
RemoveHakkarPowerStack();
break;
default:
break;
}
return true;
}
private:
// If all High Priest bosses were killed. Ohgan is added too.
// Jindo is needed for healfunction.
ObjectGuid _jindoTheHexxerGUID;
ObjectGuid _vilebranchSpeakerGUID;
ObjectGuid _arlokkGUID;
ObjectGuid _goGongOfBethekkGUID;
ObjectGuid _hakkarGUID;
ObjectGuid _gahzrankaGUID;
ObjectGuid _edgeOfMadnessGUID;
};
InstanceScript* GetInstanceScript(InstanceMap* map) const override
{
return new instance_zulgurub_InstanceMapScript(map);
}
};
enum EdgeOfMadnessEnum
{
EVENT_EDGE_OF_MADNESS_GRILEK = 27,
EVENT_EDGE_OF_MADNESS_HAZZARAH = 28,
EVENT_EDGE_OF_MADNESS_RENATAKI = 29,
EVENT_EDGE_OF_MADNESS_WUSHOOLAY = 30
};
std::vector<std::pair<uint32, uint32>> BrazierOfMadnessContainer =
{
{ EVENT_EDGE_OF_MADNESS_GRILEK, NPC_GRILEK },
{ EVENT_EDGE_OF_MADNESS_HAZZARAH, NPC_HAZZARAH },
{ EVENT_EDGE_OF_MADNESS_RENATAKI, NPC_RENATAKI },
{ EVENT_EDGE_OF_MADNESS_WUSHOOLAY, NPC_WUSHOOLAY }
};
Position const edgeOfMagnessSummonPos = { -11901.229f, -1906.366f, 65.358f, 0.942f };
struct go_brazier_of_madness : public GameObjectAI
{
go_brazier_of_madness(GameObject* go) : GameObjectAI(go) { }
bool GossipHello(Player* /*player*/, bool reportUse) override
{
if (reportUse)
{
return true;
}
if (InstanceScript* instanceScript = me->GetInstanceScript())
{
if (instanceScript->GetGuidData(DATA_EDGE_OF_MADNESS))
{
return false;
}
}
uint32 bossEntry = 0;
for (uint8 i = 0; i < 4; ++i)
{
if (sGameEventMgr->IsActiveEvent(BrazierOfMadnessContainer[i].first))
{
bossEntry = BrazierOfMadnessContainer[i].second;
break;
}
}
if (bossEntry)
{
me->SummonCreature(bossEntry, edgeOfMagnessSummonPos, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 2 * HOUR * IN_MILLISECONDS);
}
return false;
}
};
void AddSC_instance_zulgurub()
{
new instance_zulgurub();
RegisterGameObjectAI(go_brazier_of_madness);
}
|