TrinityCore
Loading...
Searching...
No Matches
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 "ScriptedCreature.h"
34#include "ScriptedEscortAI.h"
35#include "SpellInfo.h"
36#include "SpellScript.h"
37
38/*####
39# npc_ruul_snowhoof
40####*/
41
53
55{
56 { 3449.218018f, -587.825073f, 174.978867f, 4.714445f },
57 { 3446.384521f, -587.830872f, 175.186279f, 4.714445f },
58 { 3444.218994f, -587.835327f, 175.380600f, 4.714445f },
59 { 3508.344482f, -492.024261f, 186.929031f, 4.145029f },
60 { 3506.265625f, -490.531006f, 186.740128f, 4.239277f },
61 { 3503.682373f, -489.393799f, 186.629684f, 4.349232f }
62};
63
65{
66public:
67 npc_ruul_snowhoof() : CreatureScript("npc_ruul_snowhoof") { }
68
70 {
71 npc_ruul_snowhoofAI(Creature* creature) : EscortAI(creature) { }
72
73 void Reset() override
74 {
76 Cage->SetGoState(GO_STATE_READY);
77 }
78
79 void JustEngagedWith(Unit* /*who*/) override { }
80
81 void JustSummoned(Creature* summoned) override
82 {
83 summoned->AI()->AttackStart(me);
84 }
85
86 void OnQuestAccept(Player* player, Quest const* quest) override
87 {
88 if (quest->GetQuestId() == QUEST_FREEDOM_TO_RUUL)
89 {
92 EscortAI::Start(true, player->GetGUID());
93 }
94 }
95
127
128 void UpdateAI(uint32 diff) override
129 {
130 EscortAI::UpdateAI(diff);
131 }
132
133 void EnterEvadeMode(EvadeReason why) override
134 {
138 }
139 };
140
141 CreatureAI* GetAI(Creature* creature) const override
142 {
143 return new npc_ruul_snowhoofAI(creature);
144 }
145};
146
177
179{
180 { 3603.504150f, 1122.631104f, 1.635f, 0.0f }, // rider
181 { 3589.293945f, 1148.664063f, 5.565f, 0.0f }, // sorceress
182 { 3609.925537f, 1168.759521f, -1.168f, 0.0f } // razortail
183};
184
186{
187 { 3609.925537f, 1168.759521f, -1.168f, 0.0f }, // witch
188 { 3645.652100f, 1139.425415f, 1.322f, 0.0f }, // priest
189 { 3583.602051f, 1128.405762f, 2.347f, 0.0f } // myrmidon
190};
191
192Position const VorshaCoord = {3633.056885f, 1172.924072f, -5.388f, 0.0f};
193
195{
196public:
197 npc_muglash() : CreatureScript("npc_muglash") { }
198
199 struct npc_muglashAI : public EscortAI
200 {
201 npc_muglashAI(Creature* creature) : EscortAI(creature)
202 {
203 Initialize();
204 }
205
207 {
208 eventTimer = 10000;
209 waveId = 0;
211 }
212
213 void Reset() override
214 {
215 Initialize();
216 }
217
218 void JustEngagedWith(Unit* /*who*/) override
219 {
220 if (Player* player = GetPlayerForEscort())
222 {
223 if (urand(0, 1))
224 Talk(SAY_MUG_ON_GUARD, player);
225 return;
226 }
227 }
228
229 void JustDied(Unit* /*killer*/) override
230 {
232 if (Player* player = GetPlayerForEscort())
233 player->FailQuest(QUEST_VORSHA);
234 }
235
236 void JustSummoned(Creature* summoned) override
237 {
238 summoned->AI()->AttackStart(me);
239 }
240
241 void OnQuestAccept(Player* player, Quest const* quest) override
242 {
243 if (quest->GetQuestId() == QUEST_VORSHA)
244 {
248 EscortAI::Start(true, player->GetGUID());
249 }
250 }
251
252 void WaypointReached(uint32 waypointId, uint32 /*pathId*/) override
253 {
254 if (Player* player = GetPlayerForEscort())
255 {
256 switch (waypointId)
257 {
258 case 0:
259 Talk(SAY_MUG_START2, player);
260 break;
261 case 24:
262 Talk(SAY_MUG_BRAZIER, player);
263
265 {
266 go->RemoveFlag(GO_FLAG_NOT_SELECTABLE);
267 SetEscortPaused(true);
268 }
269 break;
270 case 25:
272 player->GroupEventHappens(QUEST_VORSHA, me);
273 break;
274 case 26:
276 break;
277 case 27:
279 break;
280 }
281 }
282 }
283
307
308 void UpdateAI(uint32 diff) override
309 {
310 EscortAI::UpdateAI(diff);
311
312 if (!me->GetVictim())
313 {
315 {
316 if (eventTimer < diff)
317 {
318 ++waveId;
319 DoWaveSummon();
320 eventTimer = 10000;
321 }
322 else
323 eventTimer -= diff;
324 }
325 return;
326 }
328 }
329
330 private:
333 public:
335
336 };
337
338 CreatureAI* GetAI(Creature* creature) const override
339 {
340 return new npc_muglashAI(creature);
341 }
342};
343
345{
346 public:
347 go_naga_brazier() : GameObjectScript("go_naga_brazier") { }
348
350 {
352
353 bool OnGossipHello(Player* /*player*/) override
354 {
356 {
357 if (npc_muglash::npc_muglashAI* pEscortAI = CAST_AI(npc_muglash::npc_muglashAI, creature->AI()))
358 {
359 creature->AI()->Talk(SAY_MUG_BRAZIER_WAIT);
360
361 pEscortAI->_isBrazierExtinguished = true;
362 return false;
363 }
364 }
365
366 return true;
367 }
368 };
369
370 GameObjectAI* GetAI(GameObject* go) const override
371 {
372 return new go_naga_brazierAI(go);
373 }
374};
375
377{
378 GO_BANNER = 178205
380
381// 20783 - Destroy Karang's Banner
383{
384 public:
385 spell_destroy_karangs_banner() : SpellScriptLoader("spell_destroy_karangs_banner") { }
386
388 {
390
392 {
393 if (GameObject* banner = GetCaster()->FindNearestGameObject(GO_BANNER, GetSpellInfo()->GetMaxRange(true)))
394 banner->Delete();
395 }
396
401 };
402
403 SpellScript* GetSpellScript() const override
404 {
406 }
407};
408
410{
411 new npc_ruul_snowhoof();
412 new npc_muglash();
413 new go_naga_brazier();
415}
uint8_t uint8
Definition Define.h:135
uint32_t uint32
Definition Define.h:133
@ TEMPSUMMON_DEAD_DESPAWN
@ TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT
#define INTERACTION_DISTANCE
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)
#define CAST_AI(a, b)
Definition UnitAI.h:27
@ UNIT_STAND_STATE_STAND
Definition UnitDefines.h:34
Creature *const me
Definition CreatureAI.h:82
virtual void EnterEvadeMode(EvadeReason why=EVADE_REASON_OTHER)
CreatureTemplate const * GetCreatureTemplate() const
Definition Creature.h:186
CreatureAI * AI() const
Definition Creature.h:154
GameObject *const me
static ObjectGuid GetGUID(Object const *o)
Definition Object.h:78
void GroupEventHappens(uint32 questId, WorldObject const *pEventObject)
Definition Player.cpp:16032
uint32 GetQuestId() const
Definition QuestDef.h:229
HookList< CastHandler > AfterCast
Unit * GetCaster() const
SpellInfo const * GetSpellInfo() const
void DoMeleeAttackIfReady()
Definition UnitAI.cpp:54
virtual void AttackStart(Unit *)
Definition UnitAI.cpp:30
Definition Unit.h:769
void SetFaction(uint32 faction) override
Definition Unit.h:974
Aura * AddAura(uint32 spellId, Unit *target)
Definition Unit.cpp:11964
bool HasAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint8 reqEffMask=0) const
Definition Unit.cpp:4535
void RemoveAurasDueToSpell(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint8 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition Unit.cpp:3784
Unit * GetVictim() const
Definition Unit.h:859
void SetStandState(UnitStandStateType state)
Definition Unit.cpp:10363
GameObject * FindNearestGameObject(uint32 entry, float range, bool spawnedOnly=true) const
Definition Object.cpp:2121
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:1992
GameObjectAI * GetAI(GameObject *go) const override
CreatureAI * GetAI(Creature *creature) const override
CreatureAI * GetAI(Creature *creature) const override
PrepareSpellScript(spell_destroy_karangs_banner_SpellScript)
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 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