Project SkyFire Core
SkyFire 5.4.8 server core API documentation
Loading...
Searching...
No Matches
zone_ashenvale.cpp
Go to the documentation of this file.
1/*
2* This file is part of Project SkyFire https://www.projectskyfire.org.
3* See LICENSE.md file for Copyright information
4*/
5
6/* ScriptData
7SDName: Ashenvale
8SD%Complete: 70
9SDComment: Quest support: 6544, 6482
10SDCategory: Ashenvale Forest
11EndScriptData */
12
13/* ContentData
14npc_torek
15npc_ruul_snowhoof
16EndContentData */
17
18#include "ScriptMgr.h"
19#include "ScriptedCreature.h"
20#include "ScriptedEscortAI.h"
21#include "Player.h"
22
23/*####
24# npc_torek
25####*/
26
35
37{
38 SPELL_REND = 11977,
40};
41
51
53{
54 public:
55 npc_torek() : CreatureScript("npc_torek") { }
56
57 struct npc_torekAI : public npc_escortAI
58 {
59 npc_torekAI(Creature* creature) : npc_escortAI(creature) { }
60
64
66 {
67 if (Player* player = GetPlayerForEscort())
68 {
69 switch (waypointId)
70 {
71 case 1:
72 Talk(SAY_MOVE, player);
73 break;
74 case 8:
75 Talk(SAY_PREPARE, player);
76 break;
77 case 19:
79 me->SummonCreature(ENTRY_DURIEL, 1776.73f, -2049.06f, 109.83f, 1.54f, TempSummonType::TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000);
80 me->SummonCreature(ENTRY_SILVERWING_SENTINEL, 1774.64f, -2049.41f, 109.83f, 1.40f, TempSummonType::TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000);
81 me->SummonCreature(ENTRY_SILVERWING_WARRIOR, 1778.73f, -2049.50f, 109.83f, 1.67f, TempSummonType::TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000);
82 break;
83 case 20:
84 Talk(SAY_WIN, player);
85 Completed = true;
86 player->GroupEventHappens(QUEST_TOREK_ASSULT, me);
87 break;
88 case 21:
89 Talk(SAY_END, player);
90 break;
91 }
92 }
93 }
94
96 {
97 Rend_Timer = 5000;
98 Thunderclap_Timer = 8000;
99 Completed = false;
100 }
101
102 void EnterCombat(Unit* /*who*/) OVERRIDE
103 {
104 }
105
107 {
108 summoned->AI()->AttackStart(me);
109 }
110
112 {
114
115 if (!UpdateVictim())
116 return;
117
118 if (Rend_Timer <= diff)
119 {
121 Rend_Timer = 20000;
122 } else Rend_Timer -= diff;
123
124 if (Thunderclap_Timer <= diff)
125 {
127 Thunderclap_Timer = 30000;
128 } else Thunderclap_Timer -= diff;
129 }
130 };
131
133 {
134 return new npc_torekAI(creature);
135 }
136
137 bool OnQuestAccept(Player* player, Creature* creature, Quest const* quest) OVERRIDE
138 {
139 if (quest->GetQuestId() == QUEST_TOREK_ASSULT)
140 {
142 creature->AI()->Talk(SAY_READY, player);
143 creature->setFaction(113);
144
145 if (npc_escortAI* pEscortAI = CAST_AI(npc_torekAI, creature->AI()))
146 pEscortAI->Start(true, true, player->GetGUID());
147 }
148
149 return true;
150 }
151};
152
153/*####
154# npc_ruul_snowhoof
155####*/
156
167
169{
170 {3449.218018f, -587.825073f, 174.978867f, 4.714445f},
171 {3446.384521f, -587.830872f, 175.186279f, 4.714445f},
172 {3444.218994f, -587.835327f, 175.380600f, 4.714445f},
173 {3508.344482f, -492.024261f, 186.929031f, 4.145029f},
174 {3506.265625f, -490.531006f, 186.740128f, 4.239277f},
175 {3503.682373f, -489.393799f, 186.629684f, 4.349232f}
176};
177
179{
180 public:
181 npc_ruul_snowhoof() : CreatureScript("npc_ruul_snowhoof") { }
182
184 {
185 npc_ruul_snowhoofAI(Creature* creature) : npc_escortAI(creature) { }
186
188 {
189 Player* player = GetPlayerForEscort();
190 if (!player)
191 return;
192
193 switch (waypointId)
194 {
195 case 0:
196 me->SetUInt32Value(UNIT_FIELD_ANIM_TIER, 0);
197 if (GameObject* Cage = me->FindNearestGameObject(GO_CAGE, 20))
198 Cage->SetGoState(GOState::GO_STATE_ACTIVE);
199 break;
200 case 13:
204 break;
205 case 19:
209 break;
210 case 21:
212 break;
213 }
214 }
215
216 void EnterCombat(Unit* /*who*/) OVERRIDE { }
217
219 {
220 if (GameObject* Cage = me->FindNearestGameObject(GO_CAGE, 20))
221 Cage->SetGoState(GOState::GO_STATE_READY);
222 }
223
225 {
226 summoned->AI()->AttackStart(me);
227 }
228
230 {
232 }
233 };
234
236 {
237 return new npc_ruul_snowhoofAI(creature);
238 }
239
240 bool OnQuestAccept(Player* player, Creature* creature, Quest const* quest) OVERRIDE
241 {
242 if (quest->GetQuestId() == QUEST_FREEDOM_TO_RUUL)
243 {
244 creature->setFaction(113);
245
246 if (npc_escortAI* pEscortAI = CAST_AI(npc_ruul_snowhoofAI, (creature->AI())))
247 pEscortAI->Start(true, false, player->GetGUID());
248 }
249
250 return true;
251 }
252};
253
282
284{
285 {3603.504150f, 1122.631104f, 1.635f, 0.0f}, // rider
286 {3589.293945f, 1148.664063f, 5.565f, 0.0f}, // sorceress
287 {3609.925537f, 1168.759521f, -1.168f, 0.0f} // razortail
288};
289
291{
292 {3609.925537f, 1168.759521f, -1.168f, 0.0f}, // witch
293 {3645.652100f, 1139.425415f, 1.322f, 0.0f}, // priest
294 {3583.602051f, 1128.405762f, 2.347f, 0.0f} // myrmidon
295};
296
297Position const VorshaCoord = {3633.056885f, 1172.924072f, -5.388f, 0.0f};
298
300{
301 public:
302 npc_muglash() : CreatureScript("npc_muglash") { }
303
305 {
306 npc_muglashAI(Creature* creature) : npc_escortAI(creature) { }
307
311
313 {
314 summoned->AI()->AttackStart(me);
315 }
316
318 {
319 if (Player* player = GetPlayerForEscort())
320 {
321 switch (waypointId)
322 {
323 case 0:
324 Talk(SAY_MUG_START2, player);
325 break;
326 case 24:
327 Talk(SAY_MUG_BRAZIER, player);
328
330 {
332 SetEscortPaused(true);
333 }
334 break;
335 case 25:
337 player->GroupEventHappens(QUEST_VORSHA, me);
338 break;
339 case 26:
341 break;
342 case 27:
344 break;
345 }
346 }
347 }
348
349 void EnterCombat(Unit* /*who*/) OVERRIDE
350 {
351 if (Player* player = GetPlayerForEscort())
353 {
354 if (std::rand() % 1)
355 Talk(SAY_MUG_ON_GUARD, player);
356 return;
357 }
358 }
359
361 {
362 EventTimer = 10000;
363 WaveId = 0;
364 IsBrazierExtinguished = false;
365 }
366
367 void JustDied(Unit* /*killer*/) OVERRIDE
368 {
370 if (Player* player = GetPlayerForEscort())
371 player->FailQuest(QUEST_VORSHA);
372 }
373
397
399 {
401
402 if (!me->GetVictim())
403 {
405 {
406 if (EventTimer < uiDiff)
407 {
408 ++WaveId;
409 DoWaveSummon();
410 EventTimer = 10000;
411 }
412 else
413 EventTimer -= uiDiff;
414 }
415 return;
416 }
418 }
419 };
420
422 {
423 return new npc_muglashAI(creature);
424 }
425
426 bool OnQuestAccept(Player* player, Creature* creature, Quest const* quest) OVERRIDE
427 {
428 if (quest->GetQuestId() == QUEST_VORSHA)
429 {
430 if (npc_muglashAI* pEscortAI = CAST_AI(npc_muglashAI, creature->AI()))
431 {
432 creature->AI()->Talk(SAY_MUG_START1);
433 creature->setFaction(113);
434
435 pEscortAI->Start(true, false, player->GetGUID());
436 }
437 }
438 return true;
439 }
440};
441
443{
444 public:
445 go_naga_brazier() : GameObjectScript("go_naga_brazier") { }
446
448 {
450 {
451 if (npc_muglash::npc_muglashAI* pEscortAI = CAST_AI(npc_muglash::npc_muglashAI, creature->AI()))
452 {
453 creature->AI()->Talk(SAY_MUG_BRAZIER_WAIT);
454
455 pEscortAI->IsBrazierExtinguished = true;
456 return false;
457 }
458 }
459
460 return true;
461 }
462};
463
465{
466 new npc_torek();
467 new npc_ruul_snowhoof();
468 new npc_muglash();
469 new go_naga_brazier();
470}
std::uint8_t uint8
Definition Define.h:79
std::uint32_t uint32
Definition Define.h:77
#define OVERRIDE
Definition Define.h:60
@ GO_STATE_ACTIVE
Definition GameObject.h:576
@ GO_STATE_READY
Definition GameObject.h:577
@ TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT
Definition Object.h:71
@ TEMPSUMMON_DEAD_DESPAWN
Definition Object.h:74
#define INTERACTION_DISTANCE
Definition Object.h:21
Creature * GetClosestCreatureWithEntry(WorldObject *source, uint32 entry, float maxSearchRange, bool alive)
GameObject * GetClosestGameObjectWithEntry(WorldObject *source, uint32 entry, float maxSearchRange)
#define CAST_AI(a, b)
@ STATE_ESCORT_PAUSED
@ STATE_ESCORT_ESCORTING
@ GO_FLAG_NOT_SELECTABLE
@ UNIT_FIELD_ANIM_TIER
@ GAMEOBJECT_FIELD_FLAGS
@ SPELL_REND
@ SPELL_THUNDERCLAP
void Talk(uint8 id, WorldObject const *whisperTarget=NULL)
bool UpdateVictim()
CreatureScript(const char *name)
GameObjectScript(const char *name)
void GroupEventHappens(uint32 questId, WorldObject const *pEventObject)
void DoMeleeAttackIfReady()
Definition UnitAI.cpp:28
void DoCast(uint32 spellId)
Definition UnitAI.cpp:110
void DoCastVictim(uint32 spellId, bool triggered=false)
Definition UnitAI.cpp:168
Definition Unit.h:1367
bool OnGossipHello(Player *, GameObject *go) OVERRIDE
bool OnQuestAccept(Player *player, Creature *creature, Quest const *quest) OVERRIDE
CreatureAI * GetAI(Creature *creature) const OVERRIDE
CreatureAI * GetAI(Creature *creature) const OVERRIDE
bool OnQuestAccept(Player *player, Creature *creature, Quest const *quest) OVERRIDE
bool OnQuestAccept(Player *player, Creature *creature, Quest const *quest) OVERRIDE
CreatureAI * GetAI(Creature *creature) const OVERRIDE
#define SAY_READY
Definition karazhan.cpp:54
@ SAY_END
Creature * me
void UpdateAI(uint32 diff) OVERRIDE
== Triggered Actions Requested ==================
Player * GetPlayerForEscort()
bool HasEscortState(uint32 escortState) const
npc_escortAI(Creature *creature)
void SetEscortPaused(bool on)
void UpdateAI(uint32 uiDiff) OVERRIDE
== Triggered Actions Requested ==================
void JustSummoned(Creature *summoned) OVERRIDE
void JustDied(Unit *) OVERRIDE
void WaypointReached(uint32 waypointId) OVERRIDE
npc_muglashAI(Creature *creature)
void EnterCombat(Unit *) OVERRIDE
void UpdateAI(uint32 diff) OVERRIDE
== Triggered Actions Requested ==================
void WaypointReached(uint32 waypointId) OVERRIDE
void JustSummoned(Creature *summoned) OVERRIDE
npc_torekAI(Creature *creature)
void EnterCombat(Unit *) OVERRIDE
void JustSummoned(Creature *summoned) OVERRIDE
void WaypointReached(uint32 waypointId) OVERRIDE
void UpdateAI(uint32 diff) OVERRIDE
== Triggered Actions Requested ==================
@ SAY_WIN
Position const SecondNagaCoord[3]
TorekMisc
@ ENTRY_SILVERWING_WARRIOR
@ QUEST_TOREK_ASSULT
@ ENTRY_DURIEL
@ ENTRY_SPLINTERTREE_RAIDER
@ ENTRY_SILVERWING_SENTINEL
Position const FirstNagaCoord[3]
Position const RuulSnowhoofSummonsCoord[6]
void AddSC_ashenvale()
TorekSpells
@ SPELL_THUNDERCLAP
@ SPELL_REND
@ GO_NAGA_BRAZIER
@ NPC_WRATH_SEAWITCH
@ NPC_WRATH_SORCERESS
@ SAY_MUG_RETURN
@ SAY_MUG_PATROL
@ NPC_WRATH_RIDER
@ SAY_MUG_START1
@ NPC_WRATH_RAZORTAIL
@ SAY_MUG_START2
@ SAY_MUG_BRAZIER
@ SAY_MUG_GRATITUDE
@ QUEST_VORSHA
@ NPC_VORSHA
@ NPC_WRATH_MYRMIDON
@ SAY_MUG_REST
@ SAY_MUG_ON_GUARD
@ NPC_WRATH_PRIESTESS
@ SAY_MUG_DONE
@ NPC_MUGLASH
@ SAY_MUG_BRAZIER_WAIT
RuulSnowhoof
@ NPC_THISTLEFUR_PATHFINDER
@ NPC_THISTLEFUR_TOTEMIC
@ QUEST_FREEDOM_TO_RUUL
@ GO_CAGE
@ NPC_THISTLEFUR_URSA
Position const VorshaCoord
TorekSays
@ SAY_WIN
@ SAY_END
@ SAY_READY
@ SAY_PREPARE
@ SAY_MOVE
@ GO_CAGE