TrinityCore
Loading...
Searching...
No Matches
vashjir_chapter_1_defense_of_the_briny_cutter.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 "CreatureAI.h"
19#include "CreatureAIImpl.h"
20#include "MotionMaster.h"
21#include "ObjectAccessor.h"
22#include "Player.h"
23#include "ScriptMgr.h"
24#include "ScriptedCreature.h"
25#include "SpellAuras.h"
26#include "SpellScript.h"
27#include "TemporarySummon.h"
28
30{
31namespace Creatures
32{
33 static constexpr uint32 DrowningSoldierAlliance = 39663;
34}
35namespace Spells
36{
37 static constexpr uint32 BlowBubble = 74151;
38 static constexpr uint32 BubbleSelf = 74416;
39}
40namespace Events
41{
42 namespace PayItForward
43 {
44 static constexpr uint32 BubbleSelf = 1;
45 static constexpr uint32 MoveToNear = 2;
46 static constexpr uint32 MoveToShip = 3;
47 static constexpr uint32 EnterShip = 4;
48 static constexpr uint32 ShipFinish = 5;
49 }
50}
51namespace Points
52{
53 static constexpr uint32 PointShipFar = 1;
54 static constexpr uint32 PointShipNear = 2;
55 static constexpr uint32 PointShipEnter = 3;
56 static constexpr uint32 PointShipFinish = 4;
57}
58
59// 39663 - Drowning Soldier
61{
63
64 void SpellHit(WorldObject* caster, SpellInfo const* spellInfo) override
65 {
66 if (spellInfo->Id == Spells::BlowBubble)
67 {
69 if (Player* player = caster->ToPlayer())
70 player->KilledMonsterCredit(Creatures::DrowningSoldierAlliance);
71 }
72 else if (spellInfo->Id == Spells::BubbleSelf)
74 }
75
76 void MovementInform(uint32 type, uint32 id) override
77 {
78 if (type != POINT_MOTION_TYPE)
79 return;
80
81 switch (id)
82 {
85 break;
88 break;
91 break;
94 break;
95 default:
96 break;
97 }
98 }
99
100 void UpdateAI(uint32 diff) override
101 {
102 _events.Update(diff);
103
104 while (uint32 eventId = _events.ExecuteEvent())
105 {
106 switch (eventId)
107 {
109 if (Creature* stalker = me->FindNearestCreatureWithOptions(100.0f, { .StringId = "ShipFar" }))
110 me->GetMotionMaster()->MovePoint(Points::PointShipFar, stalker->GetPosition(), true);
111 break;
113 if (Creature* stalker = me->FindNearestCreatureWithOptions(100.0f, { .StringId = "ShipNear" }))
114 me->GetMotionMaster()->MovePoint(Points::PointShipNear, stalker->GetPosition(), true);
115 break;
117 if (Creature* stalker = me->FindNearestCreatureWithOptions(100.0f, { .StringId = "ShipEnter" }))
118 me->GetMotionMaster()->MovePoint(Points::PointShipEnter, stalker->GetPosition(), true);
119 break;
121 if (Creature* stalker = me->FindNearestCreatureWithOptions(100.0f, { .StringId = "ShipFinish" }))
122 me->GetMotionMaster()->MovePoint(Points::PointShipFinish, stalker->GetPosition(), true);
123 break;
126 break;
127 default:
128 break;
129 }
130 }
131 }
132
133private:
135};
136}
137
uint32_t uint32
Definition Define.h:154
@ POINT_MOTION_TYPE
Spells
Definition PlayerAI.cpp:32
#define RegisterCreatureAI(ai_name)
Definition ScriptMgr.h:1392
Creatures
Creature *const me
Definition CreatureAI.h:63
void DespawnOrUnsummon(Milliseconds timeToDespawn=0s, Seconds forceRespawnTime=0s)
void Update(uint32 time)
Definition EventMap.h:77
EventId ExecuteEvent()
Definition EventMap.cpp:77
void ScheduleEvent(EventId eventId, Milliseconds time, GroupIndex group=0u, PhaseIndex phase=0u)
Definition EventMap.cpp:40
void MovePoint(uint32 id, Position const &pos, bool generatePath=true, Optional< float > finalOrient={}, Optional< float > speed={}, MovementWalkRunSpeedSelectionMode speedSelectionMode=MovementWalkRunSpeedSelectionMode::Default, Optional< float > closeEnoughDistance={}, Optional< MovementFadeObject > fadeObject={}, Scripting::v2::ActionResultSetter< MovementStopReason > &&scriptResult={})
Player * ToPlayer()
Definition Object.h:126
uint32 const Id
Definition SpellInfo.h:328
SpellCastResult DoCastSelf(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.h:160
MotionMaster * GetMotionMaster()
Definition Unit.h:1750
Creature * FindNearestCreatureWithOptions(float range, FindCreatureOptions const &options) const
Definition Object.cpp:1531