TrinityCore
zone_ashenvale.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/* ScriptData
19SDName: Ashenvale
20SD%Complete: 70
21SDComment: Quest support: 6544, 6482
22SDCategory: Ashenvale Forest
23EndScriptData */
24
25/* ContentData
26npc_ruul_snowhoof
27EndContentData */
28
29#include "ScriptMgr.h"
30#include "GameObject.h"
31#include "GameObjectAI.h"
32#include "Player.h"
33#include "ScriptedEscortAI.h"
34#include "SpellInfo.h"
35#include "SpellScript.h"
36
37/*####
38# npc_ruul_snowhoof
39####*/
40
42{
47 GO_CAGE = 178147,
51};
52
54{
55 { 3449.218018f, -587.825073f, 174.978867f, 4.714445f },
56 { 3446.384521f, -587.830872f, 175.186279f, 4.714445f },
57 { 3444.218994f, -587.835327f, 175.380600f, 4.714445f },
58 { 3508.344482f, -492.024261f, 186.929031f, 4.145029f },
59 { 3506.265625f, -490.531006f, 186.740128f, 4.239277f },
60 { 3503.682373f, -489.393799f, 186.629684f, 4.349232f }
61};
62
64{
65public:
66 npc_ruul_snowhoof() : CreatureScript("npc_ruul_snowhoof") { }
67
69 {
70 npc_ruul_snowhoofAI(Creature* creature) : EscortAI(creature) { }
71
72 void Reset() override
73 {
75 Cage->SetGoState(GO_STATE_READY);
76 }
77
78 void JustEngagedWith(Unit* /*who*/) override { }
79
80 void JustSummoned(Creature* summoned) override
81 {
82 summoned->AI()->AttackStart(me);
83 }
84
85 void OnQuestAccept(Player* player, Quest const* quest) override
86 {
87 if (quest->GetQuestId() == QUEST_FREEDOM_TO_RUUL)
88 {
91 EscortAI::Start(true, player->GetGUID());
92 }
93 }
94
95 void WaypointReached(uint32 waypointId, uint32 /*pathId*/) override
96 {
97 Player* player = GetPlayerForEscort();
98 if (!player)
99 return;
100
101 switch (waypointId)
102 {
103 case 0:
105 if (GameObject* Cage = me->FindNearestGameObject(GO_CAGE, 20))
106 Cage->SetGoState(GO_STATE_ACTIVE);
107 break;
108 case 13:
112 break;
113 case 19:
117 break;
118 case 27:
121 Talk(SAY_FINISH, player);
123 break;
124 }
125 }
126
127 void UpdateAI(uint32 diff) override
128 {
129 EscortAI::UpdateAI(diff);
130 }
131
132 void EnterEvadeMode(EvadeReason why) override
133 {
137 }
138 };
139
140 CreatureAI* GetAI(Creature* creature) const override
141 {
142 return new npc_ruul_snowhoofAI(creature);
143 }
144};
145
147{
158
160
162
166
170
171 NPC_VORSHA = 12940,
172 NPC_MUGLASH = 12717,
173
175};
176
178{
179 { 3603.504150f, 1122.631104f, 1.635f, 0.0f }, // rider
180 { 3589.293945f, 1148.664063f, 5.565f, 0.0f }, // sorceress
181 { 3609.925537f, 1168.759521f, -1.168f, 0.0f } // razortail
182};
183
185{
186 { 3609.925537f, 1168.759521f, -1.168f, 0.0f }, // witch
187 { 3645.652100f, 1139.425415f, 1.322f, 0.0f }, // priest
188 { 3583.602051f, 1128.405762f, 2.347f, 0.0f } // myrmidon
189};
190
191Position const VorshaCoord = {3633.056885f, 1172.924072f, -5.388f, 0.0f};
192
194{
195public:
196 npc_muglash() : CreatureScript("npc_muglash") { }
197
198 struct npc_muglashAI : public EscortAI
199 {
200 npc_muglashAI(Creature* creature) : EscortAI(creature)
201 {
202 Initialize();
203 }
204
206 {
207 eventTimer = 10000;
208 waveId = 0;
210 }
211
212 void Reset() override
213 {
214 Initialize();
215 }
216
217 void JustEngagedWith(Unit* /*who*/) override
218 {
219 if (Player* player = GetPlayerForEscort())
221 {
222 if (urand(0, 1))
223 Talk(SAY_MUG_ON_GUARD, player);
224 return;
225 }
226 }
227
228 void JustDied(Unit* /*killer*/) override
229 {
231 if (Player* player = GetPlayerForEscort())
232 player->FailQuest(QUEST_VORSHA);
233 }
234
235 void JustSummoned(Creature* summoned) override
236 {
237 summoned->AI()->AttackStart(me);
238 }
239
240 void OnQuestAccept(Player* player, Quest const* quest) override
241 {
242 if (quest->GetQuestId() == QUEST_VORSHA)
243 {
247 EscortAI::Start(true, player->GetGUID());
248 }
249 }
250
251 void WaypointReached(uint32 waypointId, uint32 /*pathId*/) override
252 {
253 if (Player* player = GetPlayerForEscort())
254 {
255 switch (waypointId)
256 {
257 case 0:
258 Talk(SAY_MUG_START2, player);
259 break;
260 case 24:
261 Talk(SAY_MUG_BRAZIER, player);
262
264 {
265 go->RemoveFlag(GO_FLAG_NOT_SELECTABLE);
266 SetEscortPaused(true);
267 }
268 break;
269 case 25:
271 player->GroupEventHappens(QUEST_VORSHA, me);
272 break;
273 case 26:
275 break;
276 case 27:
278 break;
279 }
280 }
281 }
282
284 {
285 switch (waveId)
286 {
287 case 1:
291 break;
292 case 2:
296 break;
297 case 3:
299 break;
300 case 4:
301 SetEscortPaused(false);
303 break;
304 }
305 }
306
307 void UpdateAI(uint32 diff) override
308 {
309 EscortAI::UpdateAI(diff);
310
311 if (!me->GetVictim())
312 {
314 {
315 if (eventTimer < diff)
316 {
317 ++waveId;
318 DoWaveSummon();
319 eventTimer = 10000;
320 }
321 else
322 eventTimer -= diff;
323 }
324 return;
325 }
326 }
327
328 private:
331 public:
333
334 };
335
336 CreatureAI* GetAI(Creature* creature) const override
337 {
338 return new npc_muglashAI(creature);
339 }
340};
341
343{
344 public:
345 go_naga_brazier() : GameObjectScript("go_naga_brazier") { }
346
348 {
350
351 bool OnGossipHello(Player* /*player*/) override
352 {
354 {
355 if (npc_muglash::npc_muglashAI* pEscortAI = CAST_AI(npc_muglash::npc_muglashAI, creature->AI()))
356 {
357 creature->AI()->Talk(SAY_MUG_BRAZIER_WAIT);
358
359 pEscortAI->_isBrazierExtinguished = true;
360 return false;
361 }
362 }
363
364 return true;
365 }
366 };
367
368 GameObjectAI* GetAI(GameObject* go) const override
369 {
370 return new go_naga_brazierAI(go);
371 }
372};
373
375{
376 GO_BANNER = 178205
378
379// 20783 - Destroy Karang's Banner
381{
382 public:
383 spell_destroy_karangs_banner() : SpellScriptLoader("spell_destroy_karangs_banner") { }
384
386 {
388 {
389 if (GameObject* banner = GetCaster()->FindNearestGameObject(GO_BANNER, GetSpellInfo()->GetMaxRange(true)))
390 banner->Delete();
391 }
392
393 void Register() override
394 {
396 }
397 };
398
399 SpellScript* GetSpellScript() const override
400 {
402 }
403};
404
406{
407 new npc_ruul_snowhoof();
408 new npc_muglash();
409 new go_naga_brazier();
411}
uint8_t uint8
Definition: Define.h:144
uint32_t uint32
Definition: Define.h:142
@ TEMPSUMMON_DEAD_DESPAWN
Definition: ObjectDefines.h:69
@ TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT
Definition: ObjectDefines.h:66
#define INTERACTION_DISTANCE
Definition: ObjectDefines.h:24
uint32 urand(uint32 min, uint32 max)
Definition: Random.cpp:42
GameObject * GetClosestGameObjectWithEntry(WorldObject *source, uint32 entry, float maxSearchRange, bool spawnedOnly=true)
Creature * GetClosestCreatureWithEntry(WorldObject *source, uint32 entry, float maxSearchRange, bool alive=true)
@ STATE_ESCORT_PAUSED
@ STATE_ESCORT_ESCORTING
@ GO_FLAG_NOT_SELECTABLE
@ FACTION_ESCORTEE_N_NEUTRAL_PASSIVE
@ GO_STATE_READY
@ GO_STATE_ACTIVE
#define SpellCastFn(F)
Definition: SpellScript.h:825
EvadeReason
Definition: UnitAICommon.h:30
#define CAST_AI(a, b)
Definition: UnitAI.h:28
@ UNIT_STAND_STATE_STAND
Definition: UnitDefines.h:42
virtual void EnterEvadeMode(EvadeReason why=EvadeReason::Other)
Definition: CreatureAI.cpp:219
void Talk(uint8 id, WorldObject const *whisperTarget=nullptr)
Definition: CreatureAI.cpp:56
void AttackStart(Unit *victim) override
== Triggered Actions Requested ==================
Definition: CreatureAI.cpp:328
Creature *const me
Definition: CreatureAI.h:61
CreatureTemplate const * GetCreatureTemplate() const
Definition: Creature.h:250
CreatureAI * AI() const
Definition: Creature.h:214
GameObject *const me
Definition: GameObjectAI.h:50
static ObjectGuid GetGUID(Object const *o)
Definition: Object.h:159
void GroupEventHappens(uint32 questId, WorldObject const *pEventObject)
Definition: Player.cpp:16598
uint32 GetQuestId() const
Definition: QuestDef.h:587
HookList< CastHandler > AfterCast
Definition: SpellScript.h:824
Unit * GetCaster() const
SpellInfo const * GetSpellInfo() const
Definition: Unit.h:627
void SetStandState(UnitStandStateType state, uint32 animKitID=0)
Definition: Unit.cpp:10100
void SetFaction(uint32 faction) override
Definition: Unit.h:859
Aura * AddAura(uint32 spellId, Unit *target)
Definition: Unit.cpp:11618
Unit * GetVictim() const
Definition: Unit.h:715
bool HasAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint32 reqEffMask=0) const
Definition: Unit.cpp:4664
void RemoveAurasDueToSpell(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint32 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition: Unit.cpp:3831
GameObject * FindNearestGameObject(uint32 entry, float range, bool spawnedOnly=true) const
Definition: Object.cpp:2170
TempSummon * SummonCreature(uint32 entry, Position const &pos, TempSummonType despawnType=TEMPSUMMON_MANUAL_DESPAWN, Milliseconds despawnTime=0s, uint32 vehId=0, uint32 spellId=0, ObjectGuid privateObjectOwner=ObjectGuid::Empty)
Definition: Object.cpp:2025
GameObjectAI * GetAI(GameObject *go) const override
CreatureAI * GetAI(Creature *creature) const override
CreatureAI * GetAI(Creature *creature) const override
SpellScript * GetSpellScript() const override
void Start(bool isActiveAttacker=true, ObjectGuid playerGUID=ObjectGuid::Empty, Quest const *quest=nullptr, bool instantRespawn=false, bool canLoopPath=false)
bool HasEscortState(uint32 escortState)
void LoadPath(uint32 pathId)
Player * GetPlayerForEscort()
void SetEscortPaused(bool on)
void UpdateAI(uint32 diff) override
bool OnGossipHello(Player *) override
void JustSummoned(Creature *summoned) override
void JustEngagedWith(Unit *) override
void JustDied(Unit *) override
void UpdateAI(uint32 diff) override
void WaypointReached(uint32 waypointId, uint32) override
npc_muglashAI(Creature *creature)
void OnQuestAccept(Player *player, Quest const *quest) override
void UpdateAI(uint32 diff) override
void WaypointReached(uint32 waypointId, uint32) override
void JustSummoned(Creature *summoned) override
void OnQuestAccept(Player *player, Quest const *quest) override
void EnterEvadeMode(EvadeReason why) override
Position const SecondNagaCoord[3]
KingoftheFoulwealdMisc
@ GO_BANNER
Position const FirstNagaCoord[3]
Position const RuulSnowhoofSummonsCoord[6]
void AddSC_ashenvale()
@ GO_NAGA_BRAZIER
@ NPC_WRATH_SEAWITCH
@ NPC_WRATH_SORCERESS
@ PATH_ESCORT_MUGLASH
@ 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
@ SAY_FINISH
@ PATH_ESCORT_RUUL_SNOWHOOF
@ NPC_THISTLEFUR_PATHFINDER
@ RUUL_SHAPECHANGE
@ NPC_THISTLEFUR_TOTEMIC
@ QUEST_FREEDOM_TO_RUUL
@ GO_CAGE
@ NPC_THISTLEFUR_URSA
Position const VorshaCoord