TrinityCore
zone_eversong_woods.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 "GameObject.h"
20#include "MotionMaster.h"
21#include "ScriptedCreature.h"
22
24{
29
30 PATH_FIRST_PATH = 4755520,
31 PATH_LAST_PATH = 4755552,
32};
33
35{
37
38 void JustAppeared() override
39 {
42 }
43
44 void WaypointPathEnded(uint32 /*nodeId*/, uint32 /*pathId*/) override
45 {
46 ++_path;
49
51 }
52
53 void UpdateAI(uint32 diff) override
54 {
55 _events.Update(diff);
56
57 while (uint32 eventId = _events.ExecuteEvent())
58 {
59 switch (eventId)
60 {
61 case EVENT_PATH:
62 me->GetMotionMaster()->MovePath(_path, false);
63 break;
65 {
66 int8 action = urand(1, 5);
67
68 switch (action)
69 {
70 case 1:
73 break;
74 case 2:
77 break;
78 case 3:
81 break;
82 case 4:
83 me->LoadEquipment(urand(1, 2));
86 break;
87 case 5:
90 break;
91 }
92 break;
93 }
95 me->LoadEquipment(0, true);
97 break;
101 break;
102 }
103 }
104
105 if (!UpdateVictim())
106 return;
107 }
108
109private:
112};
113
115{
121
123
126
128{
129 npc_partygoer(Creature* creature) : ScriptedAI(creature), _facing(0.0f) { }
130
131 void JustAppeared() override
132 {
135 }
136
137 void UpdateAI(uint32 diff) override
138 {
139 _events.Update(diff);
140
141 while (uint32 eventId = _events.ExecuteEvent())
142 {
143 switch (eventId)
144 {
146 {
147 int8 action = urand(1, 6);
148
149 switch (action)
150 {
151 case 1:
154 break;
155 case 2:
158 break;
159 case 3:
162 break;
163 case 4:
164 me->LoadEquipment(urand(1, 2));
167 break;
168 case 5:
171 break;
172 case 6:
174 me->SetFacingToObject(launcher);
176 break;
177 }
178 break;
179 }
181 me->LoadEquipment(0, true);
183 break;
187 break;
191 break;
195 break;
196 }
197 }
198
199 if (!UpdateVictim())
200 return;
201 }
202
203private:
205 float _facing;
206};
207
209{
212}
int8_t int8
Definition: Define.h:140
uint32_t uint32
Definition: Define.h:142
uint32 urand(uint32 min, uint32 max)
Definition: Random.cpp:42
#define RegisterCreatureAI(ai_name)
Definition: ScriptMgr.h:1380
@ EMOTE_ONESHOT_EXCLAMATION
@ EMOTE_ONESHOT_LAUGH
@ EMOTE_STATE_DANCE
@ EMOTE_ONESHOT_EAT_NO_SHEATHE
@ EMOTE_ONESHOT_NONE
@ EMOTE_ONESHOT_TALK
bool UpdateVictim()
Definition: CreatureAI.cpp:245
Creature *const me
Definition: CreatureAI.h:61
void LoadEquipment(int8 id=1, bool force=false)
Definition: Creature.cpp:1946
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 MovePath(uint32 pathId, bool repeatable, Optional< Milliseconds > duration={}, Optional< float > speed={}, MovementWalkRunSpeedSelectionMode speedSelectionMode=MovementWalkRunSpeedSelectionMode::Default, Optional< std::pair< Milliseconds, Milliseconds > > waitTimeRangeAtPathEnd={}, Optional< float > wanderDistanceAtPathEnds={}, Optional< bool > followPathBackwardsFromEndToStart={}, bool generatePath=true)
MotionMaster * GetMotionMaster()
Definition: Unit.h:1652
void SetFacingToObject(WorldObject const *object, bool force=true)
Definition: Unit.cpp:12671
void SetEmoteState(Emote emote)
Definition: Unit.h:852
void SetFacingTo(float const ori, bool force=true)
Definition: Unit.cpp:12653
void HandleEmoteCommand(Emote emoteId, Player *target=nullptr, Trinity::IteratorPair< int32 const * > spellVisualKitIds={}, int32 sequenceVariation=0)
Definition: Unit.cpp:1598
GameObject * FindNearestGameObject(uint32 entry, float range, bool spawnedOnly=true) const
Definition: Object.cpp:2170
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition: Object.cpp:2896
constexpr float GetOrientation() const
Definition: Position.h:79
npc_partygoer_pather(Creature *creature)
void UpdateAI(uint32 diff) override
void WaypointPathEnded(uint32, uint32) override
void JustAppeared() override
void UpdateAI(uint32 diff) override
void JustAppeared() override
npc_partygoer(Creature *creature)
@ EVENT_RESET_FACING
@ EVENT_REMOVE_EQUIPMENT
@ GO_FIREWORKS_LAUNCHER
@ SPELL_SMALL_YELLOW_ROCKET
@ EVENT_THROW_FIREWORKS
@ EVENT_STOP_DANCING
@ EVENT_RANDOM_ACTION
Partygoer_Pather
@ EVENT_STOP_DANCING_PATHER
@ PATH_LAST_PATH
@ PATH_FIRST_PATH
@ EVENT_RANDOM_ACTION_PATHER
@ EVENT_REMOVE_EQUIPMENT_PATHER
@ EVENT_PATH
void AddSC_eversong_woods()