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
|
/*
* This file is part of the TrinityCore 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 "ScriptMgr.h"
#include "CreatureTextMgr.h"
#include "GameObject.h"
#include "InstanceScript.h"
#include "MotionMaster.h"
#include "ObjectAccessor.h"
#include "Player.h"
#include "ScriptedCreature.h"
#include "zulaman.h"
enum Says
{
// Vol'jin
SAY_INTRO_1 = 0,
SAY_INTRO_2 = 1,
SAY_INTRO_3 = 2,
SAY_INTRO_4 = 3,
SAY_INTRO_FAIL = 4,
// Hex Lord Malacrass
SAY_HEXLOR_INTRO = 0
};
enum Spells
{
// Vol'jin
SPELL_BANGING_THE_GONG = 45225
};
enum Events
{
EVENT_INTRO_MOVEPOINT_1 = 1,
EVENT_INTRO_MOVEPOINT_2 = 2,
EVENT_INTRO_MOVEPOINT_3 = 3,
EVENT_BANGING_THE_GONG = 4,
EVENT_START_DOOR_OPENING_1 = 5,
EVENT_START_DOOR_OPENING_2 = 6,
EVENT_START_DOOR_OPENING_3 = 7,
EVENT_START_DOOR_OPENING_4 = 8,
EVENT_START_DOOR_OPENING_5 = 9,
EVENT_START_DOOR_OPENING_6 = 10,
EVENT_START_DOOR_OPENING_7 = 11
};
enum Points
{
POINT_INTRO = 1,
POINT_STRANGE_GONG = 2,
POINT_START_DOOR_OPENING_1 = 3,
POINT_START_DOOR_OPENING_2 = 4
};
enum Misc
{
ITEM_VIRTUAL_ITEM = 5301,
GOSSIP_MENU_START_INTRO = 12797,
};
Position const VoljinIntroWaypoint[4] =
{
{ 117.7349f, 1662.77f, 42.02156f, 0.0f },
{ 132.14f, 1645.143f, 42.02158f, 0.0f },
{ 121.8901f, 1639.118f, 42.23253f, 0.0f },
{ 122.618f, 1639.546f, 42.11659f, 0.0f },
};
class npc_voljin_zulaman : public CreatureScript
{
public:
npc_voljin_zulaman() : CreatureScript("npc_voljin_zulaman") { }
struct npc_voljin_zulamanAI : public ScriptedAI
{
npc_voljin_zulamanAI(Creature* creature) : ScriptedAI(creature), _instance(creature->GetInstanceScript())
{
me->SetDisplayFromModel(0);
if (_instance->GetData(DATA_ZULAMAN_STATE) == NOT_STARTED)
me->SetNpcFlag(UNIT_NPC_FLAG_GOSSIP);
}
void Reset() override
{
_gongCount = 0;
}
bool OnGossipSelect(Player* player, uint32 menuId, uint32 gossipListId) override
{
if (_instance->GetData(DATA_ZULAMAN_STATE) != NOT_STARTED)
return true;
if (menuId == GOSSIP_MENU_START_INTRO && !gossipListId)
{
_events.Reset();
me->SetMountDisplayId(0);
me->RemoveNpcFlag(UNIT_NPC_FLAG_GOSSIP);
me->ReplaceAllDynamicFlags(UNIT_DYNFLAG_NONE);
_events.ScheduleEvent(EVENT_INTRO_MOVEPOINT_1, 1s);
Talk(SAY_INTRO_1, player);
me->SetWalk(true);
}
return false;
}
void DoAction(int32 action) override
{
if (action == ACTION_START_ZULAMAN)
{
if (++_gongCount == 10)
_events.ScheduleEvent(EVENT_START_DOOR_OPENING_1, 500ms);
}
}
void UpdateAI(uint32 diff) override
{
_events.Update(diff);
while (uint32 eventId = _events.ExecuteEvent())
{
switch (eventId)
{
case EVENT_INTRO_MOVEPOINT_1:
me->GetMotionMaster()->MovePoint(POINT_INTRO, VoljinIntroWaypoint[0]);
_events.ScheduleEvent(EVENT_INTRO_MOVEPOINT_2, 1s);
break;
case EVENT_INTRO_MOVEPOINT_2:
me->GetMotionMaster()->MovePoint(POINT_STRANGE_GONG, VoljinIntroWaypoint[1]);
_events.ScheduleEvent(EVENT_INTRO_MOVEPOINT_3, 4s);
break;
case EVENT_INTRO_MOVEPOINT_3:
Talk(SAY_INTRO_2);
_events.ScheduleEvent(EVENT_BANGING_THE_GONG, 3s);
break;
case EVENT_BANGING_THE_GONG:
DoCast(me, SPELL_BANGING_THE_GONG);
if (GameObject* strangeGong = ObjectAccessor::GetGameObject(*me, _instance->GetGuidData(DATA_STRANGE_GONG)))
strangeGong->RemoveFlag(GO_FLAG_NOT_SELECTABLE);
me->SetVirtualItem(0, uint32(ITEM_VIRTUAL_ITEM));
break;
case EVENT_START_DOOR_OPENING_1:
me->RemoveAura(SPELL_BANGING_THE_GONG);
_events.ScheduleEvent(EVENT_START_DOOR_OPENING_2, 500ms);
break;
case EVENT_START_DOOR_OPENING_2:
me->SetVirtualItem(0, uint32(0));
if (GameObject* strangeGong = ObjectAccessor::GetGameObject(*me, _instance->GetGuidData(DATA_STRANGE_GONG)))
strangeGong->SetFlag(GO_FLAG_NOT_SELECTABLE);
_events.ScheduleEvent(EVENT_START_DOOR_OPENING_3, 500ms);
break;
case EVENT_START_DOOR_OPENING_3:
me->GetMotionMaster()->MovePoint(POINT_START_DOOR_OPENING_1, VoljinIntroWaypoint[2]);
break;
case EVENT_START_DOOR_OPENING_4:
_instance->SetData(DATA_ZULAMAN_STATE, IN_PROGRESS);
if (GameObject* masiveGate = ObjectAccessor::GetGameObject(*me, _instance->GetGuidData(DATA_MASSIVE_GATE)))
masiveGate->SetGoState(GO_STATE_ACTIVE);
_events.ScheduleEvent(EVENT_START_DOOR_OPENING_5, 3s);
break;
case EVENT_START_DOOR_OPENING_5:
Talk(SAY_INTRO_4);
_events.ScheduleEvent(EVENT_START_DOOR_OPENING_6, 6s);
break;
case EVENT_START_DOOR_OPENING_6:
_events.ScheduleEvent(EVENT_START_DOOR_OPENING_7, 6s);
break;
case EVENT_START_DOOR_OPENING_7:
if (Creature* hexLordTrigger = ObjectAccessor::GetCreature(*me, _instance->GetGuidData(DATA_HEXLORD_TRIGGER)))
sCreatureTextMgr->SendChat(hexLordTrigger, SAY_HEXLOR_INTRO, nullptr, CHAT_MSG_ADDON, LANG_ADDON, TEXT_RANGE_MAP);
break;
default:
break;
}
}
}
void MovementInform(uint32 movementType, uint32 pointId) override
{
if (movementType != POINT_MOTION_TYPE)
return;
switch (pointId)
{
case POINT_STRANGE_GONG:
if (GameObject* strangeGong = ObjectAccessor::GetGameObject(*me, _instance->GetGuidData(DATA_STRANGE_GONG)))
me->SetFacingToObject(strangeGong); // setInFront
break;
case POINT_START_DOOR_OPENING_1:
me->SetFacingTo(4.747295f);
me->GetMotionMaster()->MovePoint(POINT_START_DOOR_OPENING_2, VoljinIntroWaypoint[3]);
Talk(SAY_INTRO_3);
_events.ScheduleEvent(EVENT_START_DOOR_OPENING_4, 4500ms);
break;
default:
break;
}
}
private:
InstanceScript* _instance;
EventMap _events;
uint8 _gongCount = 0;
};
CreatureAI* GetAI(Creature* creature) const override
{
return GetZulAmanAI<npc_voljin_zulamanAI>(creature);
}
};
void AddSC_zulaman()
{
new npc_voljin_zulaman();
}
|