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
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
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 summoned->SetDisableGravity(true);
157
158 if (Creature* target = ObjectAccessor::GetCreature(*summoned, targetGUID))
159 {
160 target->GetMotionMaster()->MovePoint(0, target->GetPositionX(), target->GetPositionY(), me->GetPositionZ() + 15.0f, false);
161 target->UpdatePosition(target->GetPositionX(), target->GetPositionY(), me->GetPositionZ()+15.0f, 0.0f);
162 summoned->CastSpell(target, SPELL_RIBBON_OF_SOULS, false);
163 }
164
165 targetGUID = summoned->GetGUID();
166 }
167 }
168
169 void UpdateAI(uint32 diff) override
170 {
171 if (!UpdateVictim() && !LamentEvent)
172 return;
173
174 _events.Update(diff);
175
177 return;
178
179 while (uint32 eventId = _events.ExecuteEvent())
180 {
181 switch (eventId)
182 {
183 case EVENT_FADE:
185 // add a blink to simulate a stealthed movement and reappearing elsewhere
187 // if the victim is out of melee range she cast multi shot
188 if (Unit* victim = me->GetVictim())
189 if (me->GetDistance(victim) > 10.0f)
190 DoCast(victim, SPELL_MULTI_SHOT);
192 break;
196 break;
198 if (Unit* victim = me->GetVictim())
199 DoCast(victim, SPELL_BLACK_ARROW);
201 break;
202 case EVENT_SHOOT:
203 if (Unit* victim = me->GetVictim())
204 DoCast(victim, SPELL_SHOT);
206 break;
207 case EVENT_MULTI_SHOT:
208 if (Unit* victim = me->GetVictim())
209 DoCast(victim, SPELL_MULTI_SHOT);
211 break;
214 {
217 LamentEvent = false;
219 Reset();
220 }
221 else
222 {
225 }
226 break;
228 if (Creature* ambassador = me->FindNearestCreature(NPC_AMBASSADOR_SUNSORROW, 20.0f))
230 ambassador->AI()->Talk(SAY_SUNSORROW_WHISPER, player);
231 break;
232 default:
233 break;
234 }
235 }
236 }
237
238 void OnQuestReward(Player* player, Quest const* quest, LootItemType /*type*/, uint32 /*opt*/) override
239 {
242 }
243
244 private:
249 };
250
251 CreatureAI* GetAI(Creature* creature) const override
252 {
253 return new npc_lady_sylvanas_windrunnerAI(creature);
254 }
255};
256
257/*######
258## npc_highborne_lamenter
259######*/
260
262{
263public:
264 npc_highborne_lamenter() : CreatureScript("npc_highborne_lamenter") { }
265
266 CreatureAI* GetAI(Creature* creature) const override
267 {
268 return new npc_highborne_lamenterAI(creature);
269 }
270
272 {
274 {
275 Initialize();
276 }
277
279 {
280 EventMoveTimer = 10000;
281 EventCastTimer = 17500;
282 EventMove = true;
283 EventCast = true;
284 }
285
290
291 void Reset() override
292 {
293 Initialize();
294 }
295
296 void JustEngagedWith(Unit* /*who*/) override { }
297
298 void UpdateAI(uint32 diff) override
299 {
300 if (EventMove)
301 {
302 if (EventMoveTimer <= diff)
303 {
304 me->SetDisableGravity(true);
307 EventMove = false;
308 } else EventMoveTimer -= diff;
309 }
310 if (EventCast)
311 {
312 if (EventCastTimer <= diff)
313 {
315 EventCast = false;
316 } else EventCastTimer -= diff;
317 }
318 }
319 };
320};
321
322/*######
323## Quest 1846: Dragonmaw Shinbones
324######*/
325
331
332// 8856 - Bending Shinbone
350
351/*######
352## AddSC
353######*/
354
uint8_t uint8
Definition Define.h:156
int32_t int32
Definition Define.h:150
uint32_t uint32
Definition Define.h:154
LootItemType
@ TEMPSUMMON_TIMED_DESPAWN
bool roll_chance(T chance)
Definition Random.h:55
#define RegisterSpellScript(spell_script)
Definition ScriptMgr.h:1383
SpellEffIndex
@ EFFECT_0
@ EMOTE_ONESHOT_KNEEL
@ SPELL_EFFECT_SCRIPT_EFFECT
#define SpellEffectFn(F, I, N)
@ UNIT_STATE_CASTING
Definition Unit.h:276
Sounds
ObjectGuid const & GetGUID() const
Definition BaseEntity.h:163
bool UpdateVictim()
Creature *const me
Definition CreatureAI.h:63
Creature * DoSummon(uint32 entry, Position const &pos, Milliseconds despawnTime=30s, TempSummonType summonType=TEMPSUMMON_CORPSE_TIMED_DESPAWN)
uint32 ExecuteEvent()
Definition EventMap.cpp:77
void Update(uint32 time)
Definition EventMap.h:61
void ScheduleEvent(uint32 eventId, Milliseconds time, uint32 group=0, uint8 phase=0)
Definition EventMap.cpp:40
void Reset()
Definition EventMap.cpp:25
void Clear()
Definition ObjectGuid.h:329
uint32 GetEntry() const
Definition Object.h:89
uint32 GetQuestId() const
Definition QuestDef.h:637
static bool ValidateSpellInfo(std::initializer_list< uint32 > spellIds)
Unit * GetCaster() const
HookList< EffectHandler > OnEffectHit
Spell * GetSpell() const
SpellCastResult DoCast(uint32 spellId)
Definition UnitAI.cpp:89
Definition Unit.h:635
bool SetDisableGravity(bool disable, bool updateAnimTier=true)
Definition Unit.cpp:13361
virtual bool UpdatePosition(float x, float y, float z, float ang, bool teleport=false)
Definition Unit.cpp:13027
Unit * GetVictim() const
Definition Unit.h:726
bool HasUnitState(const uint32 f) const
Definition Unit.h:743
bool HasAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint32 reqEffMask=0) const
Definition Unit.cpp:4804
void HandleEmoteCommand(Emote emoteId, Player *target=nullptr, Trinity::IteratorPair< int32 const * > spellVisualKitIds={}, int32 sequenceVariation=0)
Definition Unit.cpp:1657
void MonsterMoveWithSpeed(float x, float y, float z, float speed, bool generatePath=false, bool forceDestination=false)
Definition Unit.cpp:533
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition Object.cpp:2217
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:1398
Creature * FindNearestCreature(uint32 entry, float range, bool alive=true) const
Definition Object.cpp:1517
float GetDistance(WorldObject const *obj) const
Definition Object.cpp:432
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:87
constexpr float GetPositionY() const
Definition Position.h:88
constexpr float GetOrientation() const
Definition Position.h:90
constexpr float GetPositionZ() const
Definition Position.h:89
void DoPlaySoundToSet(WorldObject *source, uint32 soundId)
void SetGUID(ObjectGuid const &guid, int32 id) override
void OnQuestReward(Player *player, Quest const *quest, LootItemType, 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()