TrinityCore
Loading...
Searching...
No Matches
zone_undercity.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: Undercity
20SD%Complete: 95
21SDComment: Quest support: 6628, 9180(post-event).
22SDCategory: Undercity
23EndScriptData */
24
25/* ContentData
26npc_lady_sylvanas_windrunner
27npc_highborne_lamenter
28npc_parqual_fintallas
29EndContentData */
30
31#include "ScriptMgr.h"
32#include "MotionMaster.h"
33#include "ObjectAccessor.h"
34#include "Player.h"
35#include "ScriptedCreature.h"
36#include "ScriptedGossip.h"
37#include "SpellScript.h"
38
39/*######
40## npc_lady_sylvanas_windrunner
41######*/
42
44{
46
50
51 // Ambassador Sunsorrow
53
54 SOUND_CREDIT = 10896,
55
59
62 //SPELL_RIBBON_OF_SOULS = 34432, the real one to use might be 37099
64
65 // Combat spells
67 SPELL_FADE = 20672,
70 SPELL_SHOT = 59710,
72
73 // Events
81
83};
84
86{
87 SOUND_AGGRO = 5886
88};
89
90float HighborneLoc[4][3]=
91{
92 {1285.41f, 312.47f, 0.51f},
93 {1286.96f, 310.40f, 1.00f},
94 {1289.66f, 309.66f, 1.52f},
95 {1292.51f, 310.50f, 1.99f},
96};
97
98#define HIGHBORNE_LOC_Y -61.00f
99#define HIGHBORNE_LOC_Y_NEW -55.50f
100
102{
103public:
104 npc_lady_sylvanas_windrunner() : CreatureScript("npc_lady_sylvanas_windrunner") { }
105
107 {
109 {
110 Initialize();
111 }
112
114 {
115 LamentEvent = false;
118 }
119
120 void Reset() override
121 {
122 Initialize();
123 _events.Reset();
124 }
125
135
136 void SetGUID(ObjectGuid const& guid, int32 id) override
137 {
138 if (id == GUID_EVENT_INVOKER)
139 {
143 playerGUID = guid;
144 LamentEvent = true;
145
146 for (uint8 i = 0; i < 4; ++i)
148
151 }
152 }
153
154 void JustSummoned(Creature* summoned) override
155 {
156 if (summoned->GetEntry() == NPC_HIGHBORNE_BUNNY)
157 {
158 summoned->SetDisableGravity(true);
159
160 if (Creature* target = ObjectAccessor::GetCreature(*summoned, targetGUID))
161 {
162 target->GetMotionMaster()->MovePoint(0, target->GetPositionX(), target->GetPositionY(), me->GetPositionZ() + 15.0f, false);
163 target->UpdatePosition(target->GetPositionX(), target->GetPositionY(), me->GetPositionZ()+15.0f, 0.0f);
164 summoned->CastSpell(target, SPELL_RIBBON_OF_SOULS, false);
165 }
166
167 targetGUID = summoned->GetGUID();
168 }
169 }
170
171 void UpdateAI(uint32 diff) override
172 {
173 if (!UpdateVictim() && !LamentEvent)
174 return;
175
176 _events.Update(diff);
177
179 return;
180
181 while (uint32 eventId = _events.ExecuteEvent())
182 {
183 switch (eventId)
184 {
185 case EVENT_FADE:
187 // add a blink to simulate a stealthed movement and reappearing elsewhere
189 // if the victim is out of melee range she cast multi shot
190 if (Unit* victim = me->GetVictim())
191 if (me->GetDistance(victim) > 10.0f)
192 DoCast(victim, SPELL_MULTI_SHOT);
194 break;
198 break;
200 if (Unit* victim = me->GetVictim())
201 DoCast(victim, SPELL_BLACK_ARROW);
203 break;
204 case EVENT_SHOOT:
205 if (Unit* victim = me->GetVictim())
206 DoCast(victim, SPELL_SHOT);
208 break;
209 case EVENT_MULTI_SHOT:
210 if (Unit* victim = me->GetVictim())
211 DoCast(victim, SPELL_MULTI_SHOT);
213 break;
216 {
219 LamentEvent = false;
221 Reset();
222 }
223 else
224 {
227 }
228 break;
230 if (Creature* ambassador = me->FindNearestCreature(NPC_AMBASSADOR_SUNSORROW, 20.0f))
232 ambassador->AI()->Talk(SAY_SUNSORROW_WHISPER, player);
233 break;
234 default:
235 break;
236 }
237 }
238
240 }
241
242 void OnQuestReward(Player* player, Quest const* quest, uint32 /*opt*/) override
243 {
246 }
247
248 private:
253 };
254
255 CreatureAI* GetAI(Creature* creature) const override
256 {
257 return new npc_lady_sylvanas_windrunnerAI(creature);
258 }
259};
260
261/*######
262## npc_highborne_lamenter
263######*/
264
266{
267public:
268 npc_highborne_lamenter() : CreatureScript("npc_highborne_lamenter") { }
269
270 CreatureAI* GetAI(Creature* creature) const override
271 {
272 return new npc_highborne_lamenterAI(creature);
273 }
274
276 {
278 {
279 Initialize();
280 }
281
283 {
284 EventMoveTimer = 10000;
285 EventCastTimer = 17500;
286 EventMove = true;
287 EventCast = true;
288 }
289
294
295 void Reset() override
296 {
297 Initialize();
298 }
299
300 void JustEngagedWith(Unit* /*who*/) override { }
301
302 void UpdateAI(uint32 diff) override
303 {
304 if (EventMove)
305 {
306 if (EventMoveTimer <= diff)
307 {
308 me->SetDisableGravity(true);
311 EventMove = false;
312 } else EventMoveTimer -= diff;
313 }
314 if (EventCast)
315 {
316 if (EventCastTimer <= diff)
317 {
319 EventCast = false;
320 } else EventCastTimer -= diff;
321 }
322 }
323 };
324};
325
326/*######
327## Quest 1846: Dragonmaw Shinbones
328######*/
329
335
336// 8856 - Bending Shinbone
356
357/*######
358## AddSC
359######*/
360
uint8_t uint8
Definition Define.h:135
int32_t int32
Definition Define.h:129
uint32_t uint32
Definition Define.h:133
@ TEMPSUMMON_TIMED_DESPAWN
bool roll_chance_i(int chance)
Definition Random.h:59
#define RegisterSpellScript(spell_script)
Definition ScriptMgr.h:1128
SpellEffIndex
@ EFFECT_0
@ SPELL_EFFECT_SCRIPT_EFFECT
@ EMOTE_ONESHOT_KNEEL
#define SpellEffectFn(F, I, N)
@ UNIT_STATE_CASTING
Definition Unit.h:235
bool UpdateVictim()
Creature *const me
Definition CreatureAI.h:82
Creature * DoSummon(uint32 entry, Position const &pos, Milliseconds despawnTime=30s, TempSummonType summonType=TEMPSUMMON_CORPSE_TIMED_DESPAWN)
void Update(uint32 time)
Definition EventMap.h:67
EventId ExecuteEvent()
Definition EventMap.cpp:73
void ScheduleEvent(EventId eventId, Milliseconds time, GroupIndex group=0u, PhaseIndex phase=0u)
Definition EventMap.cpp:36
void Reset()
Definition EventMap.cpp:21
void Clear()
Definition ObjectGuid.h:150
uint32 GetEntry() const
Definition Object.h:81
static ObjectGuid GetGUID(Object const *o)
Definition Object.h:78
uint32 GetQuestId() const
Definition QuestDef.h:229
Unit * GetCaster() const
HookList< EffectHandler > OnEffectHit
void DoMeleeAttackIfReady()
Definition UnitAI.cpp:54
SpellCastResult DoCast(uint32 spellId)
Definition UnitAI.cpp:106
Definition Unit.h:769
bool HasAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint8 reqEffMask=0) const
Definition Unit.cpp:4535
bool SetDisableGravity(bool disable, bool updateAnimTier=true)
Definition Unit.cpp:13286
virtual bool UpdatePosition(float x, float y, float z, float ang, bool teleport=false)
Definition Unit.cpp:12890
Unit * GetVictim() const
Definition Unit.h:859
bool HasUnitState(const uint32 f) const
Definition Unit.h:876
void HandleEmoteCommand(Emote emoteId)
Definition Unit.cpp:1568
void MonsterMoveWithSpeed(float x, float y, float z, float speed, bool generatePath=false, bool forceDestination=false)
Definition Unit.cpp:518
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition Object.cpp:2832
TempSummon * SummonCreature(uint32 entry, Position const &pos, TempSummonType despawnType=TEMPSUMMON_MANUAL_DESPAWN, Milliseconds despawnTime=0s, uint32 vehId=0, uint32 spellId=0, ObjectGuid privateObjectOwner=ObjectGuid::Empty)
Definition Object.cpp:1992
Creature * FindNearestCreature(uint32 entry, float range, bool alive=true) const
Definition Object.cpp:2099
float GetDistance(WorldObject const *obj) const
Definition Object.cpp:1123
static bool ValidateSpellInfo(std::initializer_list< uint32 > spellIds)
CreatureAI * GetAI(Creature *creature) const override
CreatureAI * GetAI(Creature *creature) const override
bool Validate(SpellInfo const *) override
PrepareSpellScript(spell_undercity_bending_shinbone)
TC_GAME_API Player * GetPlayer(Map const *, ObjectGuid const &guid)
TC_GAME_API Creature * GetCreature(WorldObject const &u, ObjectGuid const &guid)
float GetPositionZ() const
Definition Position.h:81
float GetOrientation() const
Definition Position.h:82
float GetPositionX() const
Definition Position.h:79
float GetPositionY() const
Definition Position.h:80
void DoPlaySoundToSet(WorldObject *source, uint32 soundId)
void SetGUID(ObjectGuid const &guid, int32 id) override
void OnQuestReward(Player *player, Quest const *quest, uint32) override
@ SPELL_HIGHBORNE_AURA
@ SPELL_FADE
@ EMOTE_LAMENT
@ NPC_HIGHBORNE_LAMENTER
@ SAY_LAMENT_END
@ GUID_EVENT_INVOKER
@ SOUND_CREDIT
@ SPELL_BLACK_ARROW
@ EVENT_SHOOT
@ QUEST_JOURNEY_TO_UNDERCITY
@ SAY_SUNSORROW_WHISPER
@ EVENT_BLACK_ARROW
@ SPELL_FADE_BLINK
@ EVENT_FADE
@ EVENT_MULTI_SHOT
@ SPELL_SYLVANAS_CAST
@ EVENT_SUMMON_SKELETON
@ NPC_AMBASSADOR_SUNSORROW
@ EVENT_SUNSORROW_WHISPER
@ SPELL_SHOT
@ SPELL_MULTI_SHOT
@ EMOTE_LAMENT_END
@ EVENT_LAMENT_OF_THE_HIGHBORN
@ SPELL_RIBBON_OF_SOULS
@ SPELL_SUMMON_SKELETON
@ NPC_HIGHBORNE_BUNNY
@ SOUND_AGGRO
#define HIGHBORNE_LOC_Y_NEW
#define HIGHBORNE_LOC_Y
DragonmawShinbones
@ SPELL_BENDING_SHINBONE2
@ SPELL_BENDING_SHINBONE1
float HighborneLoc[4][3]
void AddSC_undercity()