TrinityCore
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
28EndContentData */
29
30#include "ScriptMgr.h"
31#include "MotionMaster.h"
32#include "ObjectAccessor.h"
33#include "Player.h"
34#include "ScriptedCreature.h"
35#include "SpellScript.h"
36
37/*######
38## npc_lady_sylvanas_windrunner
39######*/
40
42{
44
48
49 // Ambassador Sunsorrow
51
52 SOUND_CREDIT = 10896,
53
57
60 //SPELL_RIBBON_OF_SOULS = 34432, the real one to use might be 37099
62
63 // Combat spells
65 SPELL_FADE = 20672,
68 SPELL_SHOT = 59710,
70
71 // Events
79
81};
82
84{
85 SOUND_AGGRO = 5886
86};
87
88float HighborneLoc[4][3]=
89{
90 {1285.41f, 312.47f, 0.51f},
91 {1286.96f, 310.40f, 1.00f},
92 {1289.66f, 309.66f, 1.52f},
93 {1292.51f, 310.50f, 1.99f},
94};
95
96#define HIGHBORNE_LOC_Y -61.00f
97#define HIGHBORNE_LOC_Y_NEW -55.50f
98
100{
101public:
102 npc_lady_sylvanas_windrunner() : CreatureScript("npc_lady_sylvanas_windrunner") { }
103
105 {
107 {
108 Initialize();
109 }
110
112 {
113 LamentEvent = false;
116 }
117
118 void Reset() override
119 {
120 Initialize();
121 _events.Reset();
122 }
123
124 void JustEngagedWith(Unit* /*who*/) override
125 {
132 }
133
134 void SetGUID(ObjectGuid const& guid, int32 id) override
135 {
136 if (id == GUID_EVENT_INVOKER)
137 {
141 playerGUID = guid;
142 LamentEvent = true;
143
144 for (uint8 i = 0; i < 4; ++i)
146
149 }
150 }
151
152 void JustSummoned(Creature* summoned) override
153 {
154 if (summoned->GetEntry() == NPC_HIGHBORNE_BUNNY)
155 {
156 if (Creature* target = ObjectAccessor::GetCreature(*summoned, targetGUID))
157 {
158 target->GetMotionMaster()->MoveJump(target->GetPositionX(), target->GetPositionY(), me->GetPositionZ() + 15.0f, me->GetOrientation(), 0);
159 target->UpdatePosition(target->GetPositionX(), target->GetPositionY(), me->GetPositionZ()+15.0f, 0.0f);
160 summoned->CastSpell(target, SPELL_RIBBON_OF_SOULS, false);
161 }
162
163 summoned->SetDisableGravity(true);
164 targetGUID = summoned->GetGUID();
165 }
166 }
167
168 void UpdateAI(uint32 diff) override
169 {
170 if (!UpdateVictim() && !LamentEvent)
171 return;
172
173 _events.Update(diff);
174
176 return;
177
178 while (uint32 eventId = _events.ExecuteEvent())
179 {
180 switch (eventId)
181 {
182 case EVENT_FADE:
184 // add a blink to simulate a stealthed movement and reappearing elsewhere
186 // if the victim is out of melee range she cast multi shot
187 if (Unit* victim = me->GetVictim())
188 if (me->GetDistance(victim) > 10.0f)
189 DoCast(victim, SPELL_MULTI_SHOT);
191 break;
195 break;
197 if (Unit* victim = me->GetVictim())
198 DoCast(victim, SPELL_BLACK_ARROW);
200 break;
201 case EVENT_SHOOT:
202 if (Unit* victim = me->GetVictim())
203 DoCast(victim, SPELL_SHOT);
205 break;
206 case EVENT_MULTI_SHOT:
207 if (Unit* victim = me->GetVictim())
208 DoCast(victim, SPELL_MULTI_SHOT);
210 break;
213 {
216 LamentEvent = false;
218 Reset();
219 }
220 else
221 {
224 }
225 break;
227 if (Creature* ambassador = me->FindNearestCreature(NPC_AMBASSADOR_SUNSORROW, 20.0f))
229 ambassador->AI()->Talk(SAY_SUNSORROW_WHISPER, player);
230 break;
231 default:
232 break;
233 }
234 }
235 }
236
237 void OnQuestReward(Player* player, Quest const* quest, LootItemType /*type*/, uint32 /*opt*/) override
238 {
241 }
242
243 private:
248 };
249
250 CreatureAI* GetAI(Creature* creature) const override
251 {
252 return new npc_lady_sylvanas_windrunnerAI(creature);
253 }
254};
255
256/*######
257## npc_highborne_lamenter
258######*/
259
261{
262public:
263 npc_highborne_lamenter() : CreatureScript("npc_highborne_lamenter") { }
264
265 CreatureAI* GetAI(Creature* creature) const override
266 {
267 return new npc_highborne_lamenterAI(creature);
268 }
269
271 {
273 {
274 Initialize();
275 }
276
278 {
279 EventMoveTimer = 10000;
280 EventCastTimer = 17500;
281 EventMove = true;
282 EventCast = true;
283 }
284
289
290 void Reset() override
291 {
292 Initialize();
293 }
294
295 void JustEngagedWith(Unit* /*who*/) override { }
296
297 void UpdateAI(uint32 diff) override
298 {
299 if (EventMove)
300 {
301 if (EventMoveTimer <= diff)
302 {
303 me->SetDisableGravity(true);
306 EventMove = false;
307 } else EventMoveTimer -= diff;
308 }
309 if (EventCast)
310 {
311 if (EventCastTimer <= diff)
312 {
314 EventCast = false;
315 } else EventCastTimer -= diff;
316 }
317 }
318 };
319};
320
321/*######
322## Quest 1846: Dragonmaw Shinbones
323######*/
324
326{
330
331// 8856 - Bending Shinbone
333{
334 bool Validate(SpellInfo const* /*spellInfo*/) override
335 {
337 }
338
339 void HandleScript(SpellEffIndex /*effIndex*/)
340 {
342 }
343
344 void Register() override
345 {
347 }
348};
349
350/*######
351## AddSC
352######*/
353
355{
359}
uint8_t uint8
Definition: Define.h:144
int32_t int32
Definition: Define.h:138
uint32_t uint32
Definition: Define.h:142
LootItemType
Definition: LootItemType.h:24
@ TEMPSUMMON_TIMED_DESPAWN
Definition: ObjectDefines.h:65
bool roll_chance_i(int chance)
Definition: Random.h:59
#define RegisterSpellScript(spell_script)
Definition: ScriptMgr.h:1369
SpellEffIndex
Definition: SharedDefines.h:29
@ EFFECT_0
Definition: SharedDefines.h:30
@ EMOTE_ONESHOT_KNEEL
@ SPELL_EFFECT_SCRIPT_EFFECT
#define SpellEffectFn(F, I, N)
Definition: SpellScript.h:842
@ UNIT_STATE_CASTING
Definition: Unit.h:270
Sounds
Definition: boss_beauty.cpp:23
void Talk(uint8 id, WorldObject const *whisperTarget=nullptr)
Definition: CreatureAI.cpp:56
bool UpdateVictim()
Definition: CreatureAI.cpp:245
Creature *const me
Definition: CreatureAI.h:61
Creature * DoSummon(uint32 entry, Position const &pos, Milliseconds despawnTime=30s, TempSummonType summonType=TEMPSUMMON_CORPSE_TIMED_DESPAWN)
Definition: CreatureAI.cpp:464
uint32 ExecuteEvent()
Definition: EventMap.cpp:73
void Update(uint32 time)
Definition: EventMap.h:56
void ScheduleEvent(uint32 eventId, Milliseconds time, uint32 group=0, uint8 phase=0)
Definition: EventMap.cpp:36
void Reset()
Definition: EventMap.cpp:21
void Clear()
Definition: ObjectGuid.h:286
uint32 GetEntry() const
Definition: Object.h:161
static ObjectGuid GetGUID(Object const *o)
Definition: Object.h:159
uint32 GetQuestId() const
Definition: QuestDef.h:587
static bool ValidateSpellInfo(std::initializer_list< uint32 > spellIds)
Definition: SpellScript.h:162
Unit * GetCaster() const
HookList< EffectHandler > OnEffectHit
Definition: SpellScript.h:839
Spell * GetSpell() const
Definition: SpellScript.h:987
SpellCastResult DoCast(uint32 spellId)
Definition: UnitAI.cpp:89
Definition: Unit.h:627
bool SetDisableGravity(bool disable, bool updateAnimTier=true)
Definition: Unit.cpp:12725
virtual bool UpdatePosition(float x, float y, float z, float ang, bool teleport=false)
Definition: Unit.cpp:12392
Unit * GetVictim() const
Definition: Unit.h:715
bool HasUnitState(const uint32 f) const
Definition: Unit.h:732
bool HasAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint32 reqEffMask=0) const
Definition: Unit.cpp:4664
void HandleEmoteCommand(Emote emoteId, Player *target=nullptr, Trinity::IteratorPair< int32 const * > spellVisualKitIds={}, int32 sequenceVariation=0)
Definition: Unit.cpp:1598
void MonsterMoveWithSpeed(float x, float y, float z, float speed, bool generatePath=false, bool forceDestination=false)
Definition: Unit.cpp:506
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition: Object.cpp:2896
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:2025
Creature * FindNearestCreature(uint32 entry, float range, bool alive=true) const
Definition: Object.cpp:2148
float GetDistance(WorldObject const *obj) const
Definition: Object.cpp:1078
CreatureAI * GetAI(Creature *creature) const override
CreatureAI * GetAI(Creature *creature) const override
bool Validate(SpellInfo const *) override
TC_GAME_API Player * GetPlayer(Map const *, ObjectGuid const &guid)
TC_GAME_API Creature * GetCreature(WorldObject const &u, ObjectGuid const &guid)
constexpr float GetPositionX() const
Definition: Position.h:76
constexpr float GetPositionY() const
Definition: Position.h:77
constexpr float GetOrientation() const
Definition: Position.h:79
constexpr float GetPositionZ() const
Definition: Position.h:78
void DoPlaySoundToSet(WorldObject *source, uint32 soundId)
void SetGUID(ObjectGuid const &guid, int32 id) override
void OnQuestReward(Player *player, Quest const *quest, LootItemType, uint32) override
Sylvanas
@ 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()