TrinityCore
Loading...
Searching...
No Matches
zone_abyssal_depths.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#include "ScriptMgr.h"
19#include "Creature.h"
20#include "MotionMaster.h"
21#include "Player.h"
22#include "ScriptedCreature.h"
23#include "SpellInfo.h"
24
26{
27namespace Spells
28{
30 static constexpr uint32 RideVehicleHardcoded = 46598;
31 static constexpr uint32 TeleportUnderWhirlpool = 82903;
32}
33
34namespace Creatures
35{
36 static constexpr uint32 WorldTrigger = 22515;
37}
38
39namespace Paths
40{
41 static constexpr uint32 PathUnderWhirlpool = 4437300;
42}
43
44// 6200 - Abyssal Depths Whirlpool Entrance
46{
47public:
48 at_abyssal_depths_whirlpool_entrance() : AreaTriggerScript("at_abyssal_depths_whirlpool_entrance") { }
49
50 bool OnTrigger(Player* player, AreaTriggerEntry const* /*areaTrigger*/) override
51 {
52 // cast from nearby worldtrigger
53 if (Creature* worldTrigger = player->FindNearestCreature(Creatures::WorldTrigger, 100.0f))
54 worldTrigger->CastSpell(player, Spells::SummonVashjirWhirlpoolVehicleTrigger);
55
56 return true;
57 }
58};
59
60// 44373 - Whirlpool Vehicle
62{
63 explicit npc_abyssal_depths_whirlpool_vehicle(Creature* creature) : ScriptedAI(creature) { }
64
65 void JustAppeared() override
66 {
67 if (Unit* owner = me->GetOwner())
68 {
69 owner->CastSpell(me, Spells::RideVehicleHardcoded);
70
71 _scheduler.Schedule(3s + 500ms, [this](TaskContext const& /*task*/)
72 {
73 me->SetAIAnimKitId(822);
76 });
77 me->GetMotionMaster()->MovePath(Paths::PathUnderWhirlpool, false);
78 });
79 }
80 }
81
82 void OnSpellCast(SpellInfo const* spellInfo) override
83 {
84 if (spellInfo->Id == Spells::TeleportUnderWhirlpool)
86 }
87
88 void UpdateAI(uint32 diff) override
89 {
90 _scheduler.Update(diff);
91 }
92
93private:
95};
96
97}
98
uint32_t uint32
Definition Define.h:154
Spells
Definition PlayerAI.cpp:32
#define RegisterCreatureAI(ai_name)
Definition ScriptMgr.h:1392
@ TRIGGERED_IGNORE_SET_FACING
Will not adjust facing to target (if any)
Creatures
Creature *const me
Definition CreatureAI.h:63
void DespawnOrUnsummon(Milliseconds timeToDespawn=0s, Seconds forceRespawnTime=0s)
bool OnTrigger(Player *player, AreaTriggerEntry const *) override
uint32 const Id
Definition SpellInfo.h:328
TaskScheduler & Schedule(duration_t time, task_handler_t task)
TaskScheduler & Update()
Update the scheduler to the current time.
Definition Unit.h:635
MotionMaster * GetMotionMaster()
Definition Unit.h:1723
void SetAIAnimKitId(uint16 animKitId)
Definition Unit.cpp:11174
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition Object.cpp:2217
Unit * GetOwner() const
Definition Object.cpp:1598
Creature * FindNearestCreature(uint32 entry, float range, bool alive=true) const
Definition Object.cpp:1517
TriggerCastFlags TriggerFlags
void AddSC_abyssal_depths()