TrinityCore
Loading...
Searching...
No Matches
zone_azshara.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 "ObjectAccessor.h"
20#include "MotionMaster.h"
21#include "PassiveAI.h"
22#include "Player.h"
23#include "ScriptedCreature.h"
24#include "ScriptedGossip.h"
25#include "SpellInfo.h"
26
27/*####
28# npc_rizzle_sprysprocket
29####*/
30
54
56{
57 npc_rizzle_sprysprocket(Creature* creature) : ScriptedAI(creature) { }
58
59 void Reset() override
60 {
63 }
64
65 void IsSummonedBy(WorldObject* summoner) override
66 {
67 if (Player* player = summoner->ToPlayer())
68 {
69 _playerGUID = player->GetGUID();
71 DoCast(player, SPELL_RIZZLE_BLACKJACK, true);
72 _scheduler.Schedule(1s, [this](TaskContext teleportContext)
73 {
75 Talk(MSG_ESCAPE_NOTICE, player);
77 teleportContext.Schedule(1ms, [this](TaskContext/* startPathContext*/)
78 {
79 me->SetSpeedRate(MOVE_SWIM, 0.85f);
82 });
83 });
84 }
85 }
86
87 void WaypointStarted(uint32 waypointId, uint32 pathId) override
88 {
89 if (pathId != PATH_RIZZLE || waypointId != 1)
90 return;
91
92 _scheduler.Schedule(1s, [this](TaskContext checkDistanceContext)
93 {
95 if (!player)
96 {
98 return;
99 }
100 if (me->IsWithinDist(player, 5.0f))
101 {
102 checkDistanceContext.CancelAll();
107 }
108 else
109 checkDistanceContext.Repeat(1s);
110 }).Schedule(20s, [this](TaskContext granadeContext)
111 {
113 {
114 Talk(SAY_RIZZLE_GRENADE, player);
115 DoCast(player, SPELL_RIZZLE_FROST_GRENADE, true);
116 }
117 granadeContext.Repeat(20s, 30s);
118 });
119 }
120
121 void WaypointPathEnded(uint32/* waypointId*/, uint32 pathId) override
122 {
123 if (pathId != PATH_RIZZLE)
124 return;
125
127 }
128
129 void UpdateAI(uint32 diff) override
130 {
131 _scheduler.Update(diff);
132 }
133
144
145 bool OnGossipSelect(Player* player, uint32 /*menuId*/, uint32 /*gossipListId*/) override
146 {
147 CloseGossipMenuFor(player);
151 return true;
152 }
153
154private:
157};
158
159/*####
160# npc_depth_charge
161####*/
162
164{
165 npc_depth_charge(Creature * creature) : NullCreatureAI(creature) { }
166
167 void Reset() override
168 {
170 me->SetFacingTo(me->GetOrientation() + float(M_PI));
171 }
172
173 void MoveInLineOfSight(Unit* who) override
174 {
175 if (!who)
176 return;
177
178 if (who->GetTypeId() == TYPEID_PLAYER && me->IsWithinDistInMap(who, 5.f))
179 {
182 }
183 }
184};
185
#define M_PI
Definition Common.h:72
uint32_t uint32
Definition Define.h:133
@ TYPEID_PLAYER
Definition ObjectGuid.h:39
@ QUEST_STATUS_INCOMPLETE
Definition QuestDef.h:107
#define RegisterCreatureAI(ai_name)
Definition ScriptMgr.h:1139
void SendGossipMenuFor(Player *player, uint32 npcTextID, ObjectGuid const &guid)
void AddGossipItemFor(Player *player, GossipOptionIcon icon, std::string const &text, uint32 sender, uint32 action)
void InitGossipMenuFor(Player *player, uint32 menuId)
void CloseGossipMenuFor(Player *player)
@ GOSSIP_SENDER_MAIN
@ GOSSIP_ACTION_INFO_DEF
@ UNIT_NPC_FLAG_GOSSIP
@ MOVE_SWIM
@ UNIT_FLAG_UNINTERACTIBLE
Creature *const me
Definition CreatureAI.h:82
void DespawnOrUnsummon(Milliseconds timeToDespawn=0s, Seconds forceRespawnTime=0s)
void MovePath(uint32 pathId, bool repeatable)
void Clear()
Definition ObjectGuid.h:150
TypeID GetTypeId() const
Definition Object.h:93
static ObjectGuid GetGUID(Object const *o)
Definition Object.h:78
static Player * ToPlayer(Object *o)
Definition Object.h:180
QuestStatus GetQuestStatus(uint32 quest_id) const
Definition Player.cpp:15642
uint32 GetGossipTextId(uint32 menuId, WorldObject *source)
Definition Player.cpp:14233
TaskContext & Repeat(std::chrono::duration< _Rep, _Period > const &duration)
TaskContext & CancelAll()
Cancels all tasks from within the context.
TaskContext & Schedule(std::chrono::duration< _Rep, _Period > const &time, TaskScheduler::task_handler_t const &task)
TaskScheduler & Schedule(std::chrono::duration< _Rep, _Period > const &time, task_handler_t const &task)
TaskScheduler & Update(success_t const &callback=EmptyCallback)
SpellCastResult DoCastSelf(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.h:241
SpellCastResult DoCast(uint32 spellId)
Definition UnitAI.cpp:106
Definition Unit.h:769
MotionMaster * GetMotionMaster()
Definition Unit.h:1667
void RemoveNpcFlag(NPCFlags flags)
Definition Unit.h:1098
void SetNpcFlag(NPCFlags flags)
Definition Unit.h:1097
void RemoveAurasDueToSpell(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint8 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition Unit.cpp:3784
void SetSpeedRate(UnitMoveType mtype, float rate)
Definition Unit.cpp:8678
void SetFacingTo(float ori, bool force=true, uint32 movementId=EVENT_FACE)
Definition Unit.cpp:13250
void SetUnitFlag(UnitFlags flags)
Definition Unit.h:954
bool IsWithinDistInMap(WorldObject const *obj, float dist2compare, bool is3D=true, bool incOwnRadius=true, bool incTargetRadius=true) const
Definition Object.cpp:1192
bool IsWithinDist(WorldObject const *obj, float dist2compare, bool is3D=true) const
Definition Object.cpp:1187
TC_GAME_API Player * GetPlayer(Map const *, ObjectGuid const &guid)
float GetOrientation() const
Definition Position.h:82
void MoveInLineOfSight(Unit *who) override
npc_depth_charge(Creature *creature)
void Reset() override
void IsSummonedBy(WorldObject *summoner) override
bool OnGossipSelect(Player *player, uint32, uint32) override
npc_rizzle_sprysprocket(Creature *creature)
void UpdateAI(uint32 diff) override
void WaypointPathEnded(uint32, uint32 pathId) override
bool OnGossipHello(Player *player) override
void WaypointStarted(uint32 waypointId, uint32 pathId) override
== Waypoints system =============================
RizzleSprysprocketData
@ SPELL_GIVE_SOUTHFURY_MOONSTONE
@ SPELL_RIZZLE_ESCAPE
@ SAY_RIZZLE_FINAL
@ SPELL_RIZZLE_FROST_GRENADE
@ SAY_RIZZLE_START
@ SPELL_PERIODIC_DEPTH_CHARGE
@ QUEST_CHASING_THE_MOONSTONE
@ NPC_DEPTH_CHARGE
@ SAY_RIZZLE_GRENADE
@ GOSSIP_MENU_GET_MOONSTONE
@ SPELL_DEPTH_CHARGE_TRAP
@ SPELL_RIZZLE_BLACKJACK
@ MSG_ESCAPE_NOTICE
@ GOSSIP_OPTION_GET_MOONSTONE
@ PATH_RIZZLE
void AddSC_azshara()