TrinityCore
zone_redridge_mountains.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/* Script Data Start
19SDName: Redridge Mountains
20SD%Complete: 0
21SDComment:
22Script Data End */
23
24#include "ScriptMgr.h"
25#include "ScriptedCreature.h"
26#include "MotionMaster.h"
27#include "ObjectAccessor.h"
28
30{
31 NPC_BIGEARL = 43248,
32
33 SPELL_APPLY_QUEST_INVIS_ZONE_3 = 80815, // Used by npc's in Lakeshire Inn
34 SPELL_APPLY_QUEST_INVIS_ZONE_4 = 80816 // Used by npc's in Lakeshire Inn
35};
36
37/*######
38# npc_dumpy_and_keeshan "Used by entries 43249 and 43184"
39######*/
40
42{
43public:
44 npc_dumpy_and_keeshan() : CreatureScript("npc_dumpy_and_keeshan") { }
45
47 {
48 npc_dumpy_and_keeshanAI(Creature* creature) : ScriptedAI(creature) { }
49
50 void Reset() override
51 {
52 _scheduler.Schedule(Seconds(1), [this](TaskContext targetSearch)
53 {
54 std::list<Creature*> bigEarlList;
56
57 for (Creature* bigEarl : bigEarlList)
60 AttackStart(bigEarl);
61
62 if (!me->IsInCombat())
63 targetSearch.Repeat();
64 });
65 }
66
67 void DamageTaken(Unit* who, uint32& damage, DamageEffectType /*damageType*/, SpellInfo const* /*spellInfo = nullptr*/) override
68 {
69 if ((!who || who->GetTypeId() == TYPEID_UNIT) && me->HealthBelowPctDamaged(82, damage))
70 damage = 0;
71 }
72
73 void UpdateAI(uint32 diff) override
74 {
75 _scheduler.Update(diff);
76 }
77
78 private:
80 };
81
82 CreatureAI* GetAI(Creature* creature) const override
83 {
84 return new npc_dumpy_and_keeshanAI(creature);
85 }
86};
87
88/*######
89# npc_big_earl "Used by entry 43248"
90######*/
91
93{
94public:
95 npc_big_earl() : CreatureScript("npc_big_earl") { }
96
97 struct npc_big_earlAI : public ScriptedAI
98 {
99 npc_big_earlAI(Creature* creature) : ScriptedAI(creature) { }
100
101 void DamageTaken(Unit* who, uint32& damage, DamageEffectType /*damageType*/, SpellInfo const* /*spellInfo = nullptr*/) override
102 {
103 if ((!who || who->GetTypeId() == TYPEID_UNIT) && me->HealthBelowPctDamaged(82, damage))
104 damage = 0;
105 }
106 };
107
108 CreatureAI* GetAI(Creature* creature) const override
109 {
110 return new npc_big_earlAI(creature);
111 }
112};
113
114/*######
115# npc_bridge_worker_alex "Used by entry 653" "Script not fully complete. Needs scripting added for move rock will be updated in future."
116######*/
117
119{
126
130 NPC_JESS = 650,
133
143
145{
146public:
147 npc_bridge_worker_alex() : CreatureScript("npc_bridge_worker_alex") { }
148
150 {
152
153 void Reset() override
154 {
155 _events.Reset();
165 }
166
167 void UpdateAI(uint32 diff) override
168 {
169 _events.Update(diff);
170
171 if (!UpdateVictim())
172 {
173 while (uint32 eventId = _events.ExecuteEvent())
174 {
175 switch (eventId)
176 {
178 if (Creature* oslow = me->FindNearestCreature(NPC_OSLOW, 5.0f, true))
179 _oslowGUID = oslow->GetGUID();
180 if (Creature* trent = me->FindNearestCreature(NPC_TRENT, 5.0f, true))
181 _trentGUID = trent->GetGUID();
182 if (Creature* dimitri = me->FindNearestCreature(NPC_DIMITRI, 5.0f, true))
183 _dimitriGUID = dimitri->GetGUID();
184 if (Creature* jess = me->FindNearestCreature(NPC_JESS, 5.0f, true))
185 _jessGUID = jess->GetGUID();
186 if (Creature* daniel = me->FindNearestCreature(NPC_DANIEL, 5.0f, true))
187 _danielGUID = daniel->GetGUID();
188 if (Creature* matthew = me->FindNearestCreature(NPC_MATTHEW, 5.0f, true))
189 _matthewGUID = matthew->GetGUID();
190 break;
191 case EVENT_OSLOW_SAY:
193 oslow->AI()->Talk(SAY_OSLOW);
194 _events.Repeat(Seconds(40), Seconds(50));
195 break;
196 case EVENT_ALEX_SAY:
197 switch (urand(0, 3))
198 {
199 case 0:
201 break;
202 case 1:
205 break;
206 case 2:
209 break;
210 case 3:
212 break;
213 }
214 _events.Repeat(Seconds(22), Seconds(30));
215 break;
218 trent->AI()->Talk(SAY_WORKERS_HO);
220 dimitri->AI()->Talk(SAY_WORKERS_HO);
222 jess->AI()->Talk(SAY_WORKERS_HO);
224 daniel->AI()->Talk(SAY_WORKERS_HO);
226 matthew->AI()->Talk(SAY_WORKERS_HO);
227 break;
231 break;
234 matthew->AI()->Talk(SAY_MATTHEW_IM_PUSHING);
235 break;
236 default:
237 break;
238 }
239 }
240 }
241 }
242
243 private:
251 };
252
253 CreatureAI* GetAI(Creature* creature) const override
254 {
255 return new npc_bridge_worker_alexAI(creature);
256 }
257};
258
259/*######
260# npc_redridge_citizen "Used by entries 43222 and 43247"
261######*/
262
264{
265 EVENT_DETERMINE_EVENT = 7, // Determine where npc is located by aura
266 EVENT_PLAYEMOTE = 8, // Used by npc's in Lakeshire Inn
267 EVENT_SAY_TEXT = 9, // Used by npc's in Lakeshire Townhall
268 EVENT_LEAVE_TOWNHALL = 10, // Used by npc's in Lakeshire Townhall
269
270 SAY_IN_TOWNHALL = 0, // Used by npc's in Lakeshire Townhall
271 SAY_LEAVE_TOWNHALL = 1, // Used by npc's in Lakeshire Townhall
272
273 SPELL_APPLY_QUEST_INVIS_ZONE_19 = 82099 // Used by npc's in Lakeshire Townhall
275
276const Emote EmoteID[6] =
277{
284};
285
286uint32 const pathSize = 8;
288{
289 { -9221.39f, -2198.45f, 66.34846f },
290 { -9221.39f, -2198.45f, 66.34846f },
291 { -9226.39f, -2196.45f, 66.34846f },
292 { -9231.64f, -2196.45f, 65.34846f },
293 { -9231.39f, -2205.45f, 66.34846f },
294 { -9231.64f, -2210.45f, 66.34846f },
295 { -9244.14f, -2211.20f, 66.34846f },
296 { -9255.31f, -2211.62f, 63.93340f }
297};
298
300{
301public:
302 npc_redridge_citizen() : CreatureScript("npc_redridge_citizen") { }
303
305 {
306 npc_redridge_citizenAI(Creature* creature) : ScriptedAI(creature) { }
307
308 void Reset() override
309 {
310 _events.Reset();
312 }
313
314 void UpdateAI(uint32 diff) override
315 {
316 _events.Update(diff);
317
318 if (!UpdateVictim())
319 {
320 while (uint32 eventId = _events.ExecuteEvent())
321 {
322 switch (eventId)
323 {
324 case EVENT_DETERMINE_EVENT: // Determine where npc is located
327 else if (me->HasAura(SPELL_APPLY_QUEST_INVIS_ZONE_19)) // Lakeshire Townhall
329 break;
330 case EVENT_PLAYEMOTE:
333 break;
334 case EVENT_SAY_TEXT:
335 if (roll_chance_i(3))
336 {
339 break;
340 }
341 if (roll_chance_i(30))
343 _events.Repeat(Seconds(30), Seconds(60));
344 break;
348 break;
349 default:
350 break;
351 }
352 }
353 }
354 }
355 private:
357 };
358
359 CreatureAI* GetAI(Creature* creature) const override
360 {
361 return new npc_redridge_citizenAI(creature);
362 }
363};
364
366{
367 new npc_big_earl();
371}
uint32_t uint32
Definition: Define.h:142
std::chrono::seconds Seconds
Seconds shorthand typedef.
Definition: Duration.h:32
@ TYPEID_UNIT
Definition: ObjectGuid.h:40
uint32 urand(uint32 min, uint32 max)
Definition: Random.cpp:42
bool roll_chance_i(int chance)
Definition: Random.h:59
Emote
@ EMOTE_ONESHOT_NO
@ EMOTE_ONESHOT_POINT
@ EMOTE_ONESHOT_BATTLE_ROAR
@ EMOTE_ONESHOT_CHEER
@ EMOTE_ONESHOT_ROAR
@ EMOTE_ONESHOT_SHOUT
DamageEffectType
Definition: UnitDefines.h:131
void Talk(uint8 id, WorldObject const *whisperTarget=nullptr)
Definition: CreatureAI.cpp:56
bool UpdateVictim()
Definition: CreatureAI.cpp:245
Creature *const me
Definition: CreatureAI.h:61
void DespawnOrUnsummon(Milliseconds timeToDespawn=0s, Seconds forceRespawnTime=0s)
Definition: Creature.cpp:2415
uint32 ExecuteEvent()
Definition: EventMap.cpp:73
void Update(uint32 time)
Definition: EventMap.h:56
void Repeat(Milliseconds time)
Definition: EventMap.cpp:63
void ScheduleEvent(uint32 eventId, Milliseconds time, uint32 group=0, uint8 phase=0)
Definition: EventMap.cpp:36
void Reset()
Definition: EventMap.cpp:21
void MoveSmoothPath(uint32 pointId, Position const *pathPoints, size_t pathSize, bool walk=false, bool fly=false)
void Clear()
Definition: ObjectGuid.h:286
TypeID GetTypeId() const
Definition: Object.h:173
TaskContext & Repeat(std::chrono::duration< Rep, Period > duration)
TaskScheduler & Schedule(std::chrono::duration< Rep, Period > time, task_handler_t task)
TaskScheduler & Update(success_t const &callback=nullptr)
Definition: Unit.h:627
MotionMaster * GetMotionMaster()
Definition: Unit.h:1652
bool HasAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint32 reqEffMask=0) const
Definition: Unit.cpp:4664
void HandleEmoteCommand(Emote emoteId, Player *target=nullptr, Trinity::IteratorPair< int32 const * > spellVisualKitIds={}, int32 sequenceVariation=0)
Definition: Unit.cpp:1598
bool HealthBelowPctDamaged(int32 pct, uint32 damage) const
Definition: Unit.h:781
bool IsInCombat() const
Definition: Unit.h:1043
void GetCreatureListWithEntryInGrid(Container &creatureContainer, uint32 entry, float maxSearchRange=250.0f) const
Definition: Object.cpp:3312
Creature * FindNearestCreature(uint32 entry, float range, bool alive=true) const
Definition: Object.cpp:2148
CreatureAI * GetAI(Creature *creature) const override
CreatureAI * GetAI(Creature *creature) const override
CreatureAI * GetAI(Creature *creature) const override
CreatureAI * GetAI(Creature *creature) const override
TC_GAME_API Creature * GetCreature(WorldObject const &u, ObjectGuid const &guid)
void AttackStart(Unit *) override
== Triggered Actions Requested ==================
void DamageTaken(Unit *who, uint32 &damage, DamageEffectType, SpellInfo const *) override
void DamageTaken(Unit *who, uint32 &damage, DamageEffectType, SpellInfo const *) override
const Emote EmoteID[6]
void AddSC_redridge_mountains()
@ EVENT_LEAVE_TOWNHALL
@ EVENT_DETERMINE_EVENT
@ SPELL_APPLY_QUEST_INVIS_ZONE_19
uint32 const pathSize
Position const TownhallPath[pathSize]
@ SPELL_APPLY_QUEST_INVIS_ZONE_3
@ SPELL_APPLY_QUEST_INVIS_ZONE_4
@ SAY_MATTHEW_IM_PUSHING