Project SkyFire Core
SkyFire 5.4.8 server core API documentation
Loading...
Searching...
No Matches
zone_undercity.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/* ScriptData
7SDName: Undercity
8SD%Complete: 95
9SDComment: Quest support: 6628, 9180(post-event).
10SDCategory: Undercity
11EndScriptData */
12
13/* ContentData
14npc_lady_sylvanas_windrunner
15npc_highborne_lamenter
16npc_parqual_fintallas
17EndContentData */
18
19#include "ScriptMgr.h"
20#include "ScriptedCreature.h"
21#include "ScriptedGossip.h"
22#include "Player.h"
23
24/*######
25## npc_lady_sylvanas_windrunner
26######*/
27
29{
33
34 SOUND_CREDIT = 10896,
37
40 SPELL_RIBBON_OF_SOULS = 34432, // the real one to use might be 37099
41
42 // Combat spells
44 SPELL_FADE = 20672,
47 SPELL_SHOT = 59710,
49};
50
51float HighborneLoc[4][3]=
52{
53 {1285.41f, 312.47f, 0.51f},
54 {1286.96f, 310.40f, 1.00f},
55 {1289.66f, 309.66f, 1.52f},
56 {1292.51f, 310.50f, 1.99f},
57};
58
59#define HIGHBORNE_LOC_Y -61.00f
60#define HIGHBORNE_LOC_Y_NEW -55.50f
61
63{
64public:
65 npc_lady_sylvanas_windrunner() : CreatureScript("npc_lady_sylvanas_windrunner") { }
66
67 bool OnQuestReward(Player* /*player*/, Creature* creature, const Quest *_Quest, uint32 /*slot*/) OVERRIDE
68 {
69 if (_Quest->GetQuestId() == QUEST_JOURNEY_TO_UNDERCITY)
70 {
72 CAST_AI(npc_lady_sylvanas_windrunner::npc_lady_sylvanas_windrunnerAI, creature->AI())->DoPlaySoundToSet(creature, SOUND_CREDIT);
73 creature->CastSpell(creature, SPELL_SYLVANAS_CAST, false);
74
75 for (uint8 i = 0; i < 4; ++i)
77 }
78
79 return true;
80 }
81
83 {
84 return new npc_lady_sylvanas_windrunnerAI(creature);
85 }
86
88 {
90
94
100
102 {
103 LamentEventTimer = 5000;
104 LamentEvent = false;
105 targetGUID = 0;
106
107 FadeTimer = 30000;
108 SummonSkeletonTimer = 20000;
109 BlackArrowTimer = 15000;
110 ShotTimer = 8000;
111 MultiShotTimer = 10000;
112 }
113
114 void EnterCombat(Unit* /*who*/) OVERRIDE { }
115
117 {
118 if (summoned->GetEntry() == ENTRY_HIGHBORNE_BUNNY)
119 {
120 if (Creature* target = Unit::GetCreature(*summoned, targetGUID))
121 {
122 target->MonsterMoveWithSpeed(target->GetPositionX(), target->GetPositionY(), me->GetPositionZ()+15.0f, 0);
123 target->SetPosition(target->GetPositionX(), target->GetPositionY(), me->GetPositionZ()+15.0f, 0.0f);
124 summoned->CastSpell(target, SPELL_RIBBON_OF_SOULS, false);
125 }
126
127 summoned->SetDisableGravity(true);
128 targetGUID = summoned->GetGUID();
129 }
130 }
131
133 {
134 if (LamentEvent)
135 {
136 if (LamentEventTimer <= diff)
137 {
139
140 LamentEventTimer = 2000;
141 if (!me->HasAura(SPELL_SYLVANAS_CAST))
142 {
145 LamentEvent = false;
146 }
147 } else LamentEventTimer -= diff;
148 }
149
150 if (!UpdateVictim())
151 return;
152
153 // Combat spells
154
155 if (FadeTimer <= diff)
156 {
158 // add a blink to simulate a stealthed movement and reappearing elsewhere
160 FadeTimer = 30000 + rand()%5000;
161 // if the victim is out of melee range she cast multi shot
162 if (Unit* victim = me->GetVictim())
163 if (me->GetDistance(victim) > 10.0f)
164 DoCast(victim, SPELL_MULTI_SHOT);
165 } else FadeTimer -= diff;
166
167 if (SummonSkeletonTimer <= diff)
168 {
170 SummonSkeletonTimer = 20000 + rand()%10000;
171 } else SummonSkeletonTimer -= diff;
172
173 if (BlackArrowTimer <= diff)
174 {
175 if (Unit* victim = me->GetVictim())
176 {
177 DoCast(victim, SPELL_BLACK_ARROW);
178 BlackArrowTimer = 15000 + rand()%5000;
179 }
180 } else BlackArrowTimer -= diff;
181
182 if (ShotTimer <= diff)
183 {
184 if (Unit* victim = me->GetVictim())
185 {
186 DoCast(victim, SPELL_SHOT);
187 ShotTimer = 8000 + rand()%2000;
188 }
189 } else ShotTimer -= diff;
190
191 if (MultiShotTimer <= diff)
192 {
193 if (Unit* victim = me->GetVictim())
194 {
195 DoCast(victim, SPELL_MULTI_SHOT);
196 MultiShotTimer = 10000 + rand()%3000;
197 }
198 } else MultiShotTimer -= diff;
199
201 }
202 };
203};
204
205/*######
206## npc_highborne_lamenter
207######*/
208
210{
211public:
212 npc_highborne_lamenter() : CreatureScript("npc_highborne_lamenter") { }
213
215 {
216 return new npc_highborne_lamenterAI(creature);
217 }
218
220 {
222
227
229 {
230 EventMoveTimer = 10000;
231 EventCastTimer = 17500;
232 EventMove = true;
233 EventCast = true;
234 }
235
236 void EnterCombat(Unit* /*who*/) OVERRIDE { }
237
239 {
240 if (EventMove)
241 {
242 if (EventMoveTimer <= diff)
243 {
244 me->SetDisableGravity(true);
245 me->MonsterMoveWithSpeed(me->GetPositionX(), me->GetPositionY(), HIGHBORNE_LOC_Y_NEW, me->GetDistance(me->GetPositionX(), me->GetPositionY(), HIGHBORNE_LOC_Y_NEW) / (5000 * 0.001f));
246 me->SetPosition(me->GetPositionX(), me->GetPositionY(), HIGHBORNE_LOC_Y_NEW, me->GetOrientation());
247 EventMove = false;
248 } else EventMoveTimer -= diff;
249 }
250 if (EventCast)
251 {
252 if (EventCastTimer <= diff)
253 {
255 EventCast = false;
256 } else EventCastTimer -= diff;
257 }
258 }
259 };
260};
261
262/*######
263## npc_parqual_fintallas
264######*/
265
270
271#define GOSSIP_HPF1 "Gul'dan"
272#define GOSSIP_HPF2 "Kel'Thuzad"
273#define GOSSIP_HPF3 "Ner'zhul"
274
276{
277public:
278 npc_parqual_fintallas() : CreatureScript("npc_parqual_fintallas") { }
279
280 bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) OVERRIDE
281 {
282 player->PlayerTalkClass->ClearMenus();
283 if (action == GOSSIP_ACTION_INFO_DEF+1)
284 {
285 player->CLOSE_GOSSIP_MENU();
286 creature->CastSpell(player, SPELL_MARK_OF_SHAME, false);
287 }
288 if (action == GOSSIP_ACTION_INFO_DEF+2)
289 {
290 player->CLOSE_GOSSIP_MENU();
291 player->AreaExploredOrEventHappens(6628);
292 }
293 return true;
294 }
295
296 bool OnGossipHello(Player* player, Creature* creature) OVERRIDE
297 {
298 if (creature->IsQuestGiver())
299 player->PrepareQuestMenu(creature->GetGUID());
300
301 if (player->GetQuestStatus(6628) == QUEST_STATUS_INCOMPLETE && !player->HasAura(SPELL_MARK_OF_SHAME))
302 {
306 player->SEND_GOSSIP_MENU(5822, creature->GetGUID());
307 }
308 else
309 player->SEND_GOSSIP_MENU(5821, creature->GetGUID());
310
311 return true;
312 }
313};
314
315/*######
316## AddSC
317######*/
318
std::uint8_t uint8
Definition Define.h:79
std::uint32_t uint32
Definition Define.h:77
#define OVERRIDE
Definition Define.h:60
std::uint64_t uint64
Definition Define.h:76
@ GOSSIP_ICON_CHAT
Definition GossipDef.h:46
@ TEMPSUMMON_TIMED_DESPAWN
Definition Object.h:70
@ QUEST_STATUS_INCOMPLETE
Definition QuestDef.h:89
#define CAST_AI(a, b)
@ GOSSIP_SENDER_MAIN
@ GOSSIP_ACTION_INFO_DEF
@ SPELL_SUMMON_SKELETON
Creature * DoSummon(uint32 entry, Position const &pos, uint32 despawnTime=30000, TempSummonType summonType=TempSummonType::TEMPSUMMON_CORPSE_TIMED_DESPAWN)
void Talk(uint8 id, WorldObject const *whisperTarget=NULL)
bool UpdateVictim()
CreatureScript(const char *name)
void DoMeleeAttackIfReady()
Definition UnitAI.cpp:28
void DoCast(uint32 spellId)
Definition UnitAI.cpp:110
Definition Unit.h:1367
static Creature * GetCreature(WorldObject &object, uint64 guid)
Definition Unit.cpp:4905
CreatureAI * GetAI(Creature *creature) const OVERRIDE
CreatureAI * GetAI(Creature *creature) const OVERRIDE
bool OnQuestReward(Player *, Creature *creature, const Quest *_Quest, uint32) OVERRIDE
bool OnGossipSelect(Player *player, Creature *creature, uint32, uint32 action) OVERRIDE
bool OnGossipHello(Player *player, Creature *creature) OVERRIDE
Creature * me
ScriptedAI(Creature *creature)
void UpdateAI(uint32 diff) OVERRIDE
== Triggered Actions Requested ==================
void UpdateAI(uint32 diff) OVERRIDE
== Triggered Actions Requested ==================
#define GOSSIP_HPF3
@ SPELL_HIGHBORNE_AURA
@ SPELL_FADE
@ SAY_LAMENT_END
@ SOUND_CREDIT
@ SPELL_BLACK_ARROW
@ QUEST_JOURNEY_TO_UNDERCITY
@ SPELL_FADE_BLINK
@ ENTRY_HIGHBORNE_LAMENTER
@ SPELL_SYLVANAS_CAST
@ ENTRY_HIGHBORNE_BUNNY
@ SPELL_SHOT
@ SPELL_MULTI_SHOT
@ EMOTE_LAMENT_END
@ SPELL_RIBBON_OF_SOULS
@ SPELL_SUMMON_SKELETON
#define GOSSIP_HPF2
#define HIGHBORNE_LOC_Y_NEW
#define HIGHBORNE_LOC_Y
float HighborneLoc[4][3]
#define GOSSIP_HPF1
ParqualFintallas
@ SPELL_MARK_OF_SHAME
void AddSC_undercity()