Project SkyFire Core
SkyFire 5.4.8 server core API documentation
Loading...
Searching...
No Matches
zone_hellfire_peninsula.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: Hellfire_Peninsula
8SD%Complete: 100
9SDComment: Quest support: 9375, 9410, 9418, 10129, 10146, 10162, 10163, 10340, 10346, 10347, 10382 (Special flight paths)
10SDCategory: Hellfire Peninsula
11EndScriptData */
12
13/* ContentData
14npc_aeranas
15npc_ancestral_wolf
16go_haaleshi_altar
17npc_naladu
18npc_tracy_proudwell
19npc_trollbane
20npc_wounded_blood_elf
21EndContentData */
22
23#include "ScriptMgr.h"
24#include "ScriptedCreature.h"
25#include "ScriptedGossip.h"
26#include "ScriptedEscortAI.h"
27#include "Player.h"
28#include "WorldSession.h"
29
30/*######
31## npc_aeranas
32######*/
33
45
47{
48public:
49 npc_aeranas() : CreatureScript("npc_aeranas") { }
50
52 {
53 return new npc_aeranasAI(creature);
54 }
55
56 struct npc_aeranasAI : public ScriptedAI
57 {
58 npc_aeranasAI(Creature* creature) : ScriptedAI(creature) { }
59
63
65 {
66 Faction_Timer = 8000;
68 Shock_Timer = 5000;
69
71 me->setFaction(FACTION_FRIENDLY);
72
74 }
75
77 {
78 if (Faction_Timer)
79 {
80 if (Faction_Timer <= diff)
81 {
82 me->setFaction(FACTION_HOSTILE);
83 Faction_Timer = 0;
84 } else Faction_Timer -= diff;
85 }
86
87 if (!UpdateVictim())
88 return;
89
90 if (HealthBelowPct(30))
91 {
92 me->setFaction(FACTION_FRIENDLY);
94 me->RemoveAllAuras();
95 me->DeleteThreatList();
96 me->CombatStop(true);
98 return;
99 }
100
101 if (Shock_Timer <= diff)
102 {
104 Shock_Timer = 10000;
105 } else Shock_Timer -= diff;
106
107 if (EnvelopingWinds_Timer <= diff)
108 {
110 EnvelopingWinds_Timer = 25000;
111 } else EnvelopingWinds_Timer -= diff;
112
114 }
115 };
116};
117
118/*######
119## npc_ancestral_wolf
120######*/
121
132
134{
135public:
136 npc_ancestral_wolf() : CreatureScript("npc_ancestral_wolf") { }
137
139 {
140 return new npc_ancestral_wolfAI(creature);
141 }
142
144 {
146 {
147 if (creature->GetOwner() && creature->GetOwner()->GetTypeId() == TypeID::TYPEID_PLAYER)
148 Start(false, false, creature->GetOwner()->GetGUID());
149 else
150 SF_LOG_ERROR("scripts", "SKYFIRE: npc_ancestral_wolf can not obtain owner or owner is not a player.");
151
152 creature->SetSpeed(MOVE_WALK, 1.5f);
153 Reset();
154 }
155
157
159 {
160 pRyga = NULL;
162 }
163
165
166 {
167 if (!pRyga && who->GetEntry() == NPC_RYGA && me->IsWithinDistInMap(who, 15.0f))
168 if (Creature* temp = who->ToCreature())
169 pRyga = temp;
170
172 }
173
175 {
176 switch (waypointId)
177 {
178 case 0:
180 break;
181 case 2:
183 break;
184 case 50:
185 if (pRyga && pRyga->IsAlive() && !pRyga->IsInCombat())
186 pRyga->AI()->Talk(SAY_WOLF_WELCOME);
187 break;
188 }
189 }
190 };
191};
192
193/*######
194## npc_naladu
195######*/
196
197#define GOSSIP_NALADU_ITEM1 "Why don't you escape?"
198
200{
202};
203
205{
206public:
207 npc_naladu() : CreatureScript("npc_naladu") { }
208
209 bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) OVERRIDE
210 {
211 player->PlayerTalkClass->ClearMenus();
212 if (action == GOSSIP_ACTION_INFO_DEF+1)
213 player->SEND_GOSSIP_MENU(GOSSIP_TEXTID_NALADU1, creature->GetGUID());
214
215 return true;
216 }
217
218 bool OnGossipHello(Player* player, Creature* creature) OVERRIDE
219 {
220 if (creature->IsQuestGiver())
221 player->PrepareQuestMenu(creature->GetGUID());
222
224 player->SEND_GOSSIP_MENU(player->GetGossipTextId(creature), creature->GetGUID());
225 return true;
226 }
227};
228
229/*######
230## npc_tracy_proudwell
231######*/
232
233#define GOSSIP_TEXT_REDEEM_MARKS "I have marks to redeem!"
234#define GOSSIP_TRACY_PROUDWELL_ITEM1 "I heard that your dog Fei Fei took Klatu's prayer beads..."
235#define GOSSIP_TRACY_PROUDWELL_ITEM2 "<back>"
236
242
244{
245public:
246 npc_tracy_proudwell() : CreatureScript("npc_tracy_proudwell") { }
247
248 bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) OVERRIDE
249 {
250 player->PlayerTalkClass->ClearMenus();
251 switch (action)
252 {
255 player->SEND_GOSSIP_MENU(GOSSIP_TEXTID_TRACY_PROUDWELL1, creature->GetGUID());
256 break;
258 player->SEND_GOSSIP_MENU(player->GetGossipTextId(creature), creature->GetGUID());
259 break;
261 player->GetSession()->SendListInventory(creature->GetGUID());
262 break;
263 }
264
265 return true;
266 }
267
268 bool OnGossipHello(Player* player, Creature* creature) OVERRIDE
269 {
270 if (creature->IsQuestGiver())
271 player->PrepareQuestMenu(creature->GetGUID());
272
273 if (creature->IsVendor())
275
276 if (player->GetQuestStatus(QUEST_DIGGING_FOR_PRAYER_BEADS) == QUEST_STATUS_INCOMPLETE)
278
279 player->SEND_GOSSIP_MENU(player->GetGossipTextId(creature), creature->GetGUID());
280 return true;
281 }
282};
283
284/*######
285## npc_trollbane
286######*/
287
288#define GOSSIP_TROLLBANE_ITEM1 "Tell me of the Sons of Lothar."
289#define GOSSIP_TROLLBANE_ITEM2 "<more>"
290#define GOSSIP_TROLLBANE_ITEM3 "Tell me of your homeland."
291
298
300{
301public:
302 npc_trollbane() : CreatureScript("npc_trollbane") { }
303
304 bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) OVERRIDE
305 {
306 player->PlayerTalkClass->ClearMenus();
307 switch (action)
308 {
311 player->SEND_GOSSIP_MENU(GOSSIP_TEXTID_TROLLBANE1, creature->GetGUID());
312 break;
314 player->SEND_GOSSIP_MENU(GOSSIP_TEXTID_TROLLBANE2, creature->GetGUID());
315 break;
317 player->SEND_GOSSIP_MENU(GOSSIP_TEXTID_TROLLBANE3, creature->GetGUID());
318 break;
319 }
320
321 return true;
322 }
323
324 bool OnGossipHello(Player* player, Creature* creature) OVERRIDE
325 {
326 if (creature->IsQuestGiver())
327 player->PrepareQuestMenu(creature->GetGUID());
328
331 player->SEND_GOSSIP_MENU(player->GetGossipTextId(creature), creature->GetGUID());
332 return true;
333 }
334};
335
336/*######
337## npc_wounded_blood_elf
338######*/
339
351
353{
354public:
355 npc_wounded_blood_elf() : CreatureScript("npc_wounded_blood_elf") { }
356
357 bool OnQuestAccept(Player* player, Creature* creature, Quest const* quest) OVERRIDE
358 {
359 if (quest->GetQuestId() == QUEST_ROAD_TO_FALCON_WATCH)
360 {
362 pEscortAI->Start(true, false, player->GetGUID());
363
364 // Change faction so mobs attack
365 creature->setFaction(775);
366 }
367
368 return true;
369 }
370
372 {
373 return new npc_wounded_blood_elfAI(creature);
374 }
375
377 {
379
381 {
382 Player* player = GetPlayerForEscort();
383 if (!player)
384 return;
385
386 switch (waypointId)
387 {
388 case 0:
389 Talk(SAY_ELF_START, player);
390 break;
391 case 9:
392 Talk(SAY_ELF_SUMMON1, player);
393 // Spawn two Haal'eshi Talonguard
396 break;
397 case 13:
398 Talk(SAY_ELF_RESTING, player);
399 break;
400 case 14:
401 Talk(SAY_ELF_SUMMON2, player);
402 // Spawn two Haal'eshi Windwalker
405 break;
406 case 27:
407 Talk(SAY_ELF_COMPLETE, player);
408 // Award quest credit
410 break;
411 }
412 }
413
414 void Reset() OVERRIDE { }
415
421
423 {
424 summoned->AI()->AttackStart(me);
425 }
426 };
427};
428
429/*######
430## npc_fel_guard_hound
431######*/
432
434{
436
438};
439
441{
442public:
443 npc_fel_guard_hound() : CreatureScript("npc_fel_guard_hound") { }
444
446 {
447 return new npc_fel_guard_houndAI(creature);
448 }
449
451 {
452 npc_fel_guard_houndAI(Creature* creature) : ScriptedAI(creature) { }
453
456
458 {
459 uiCheckTimer = 5000; //check for creature every 5 sec
460 uiHelboarGUID = 0;
461 }
462
464 {
465 if (uiType != POINT_MOTION_TYPE || uiId != 1)
466 return;
467
468 if (Creature* pHelboar = me->GetCreature(*me, uiHelboarGUID))
469 {
470 pHelboar->RemoveCorpse();
472
473 if (Player* owner = me->GetCharmerOrOwnerPlayerOrPlayerItself())
474 me->GetMotionMaster()->MoveFollow(owner, 0.0f, 0.0f);
475 }
476 }
477
479 {
480 if (uiCheckTimer <= uiDiff)
481 {
482 if (Creature* pHelboar = me->FindNearestCreature(NPC_DERANGED_HELBOAR, 10.0f, false))
483 {
484 if (pHelboar->GetGUID() != uiHelboarGUID && me->GetMotionMaster()->GetCurrentMovementGeneratorType() != POINT_MOTION_TYPE && !me->FindCurrentSpellBySpellId(SPELL_SUMMON_POO))
485 {
486 uiHelboarGUID = pHelboar->GetGUID();
487 me->GetMotionMaster()->MovePoint(1, pHelboar->GetPositionX(), pHelboar->GetPositionY(), pHelboar->GetPositionZ());
488 }
489 }
490 uiCheckTimer = 5000;
491 }else uiCheckTimer -= uiDiff;
492
493 if (!UpdateVictim())
494 return;
495
497 }
498 };
499};
500
502{
503 new npc_aeranas();
504 new npc_ancestral_wolf();
505 new npc_naladu();
507 new npc_trollbane();
510}
std::uint32_t uint32
Definition Define.h:77
#define OVERRIDE
Definition Define.h:60
std::uint64_t uint64
Definition Define.h:76
@ GOSSIP_ICON_CHAT
Definition GossipDef.h:46
@ GOSSIP_ICON_VENDOR
Definition GossipDef.h:47
#define SF_LOG_ERROR(filterType__,...)
Definition Log.h:143
@ POINT_MOTION_TYPE
@ TYPEID_PLAYER
Definition Object.h:55
@ TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT
Definition Object.h:71
@ QUEST_STATUS_INCOMPLETE
Definition QuestDef.h:89
#define CAST_AI(a, b)
@ STATE_ESCORT_ESCORTING
@ GOSSIP_SENDER_MAIN
@ GOSSIP_ACTION_TRADE
@ GOSSIP_ACTION_INFO_DEF
@ UNIT_NPC_FLAG_QUESTGIVER
Definition Unit.h:688
@ MOVE_WALK
Definition Unit.h:555
@ UNIT_FIELD_NPC_FLAGS
@ FACTION_HOSTILE
@ SPELL_SHOCK
void Talk(uint8 id, WorldObject const *whisperTarget=NULL)
bool UpdateVictim()
CreatureScript(const char *name)
uint64 GetGUID() const
Definition Object.h:119
TypeID GetTypeId() const
Definition Object.h:131
Creature * ToCreature()
Definition Object.h:207
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
Unit * GetOwner() const
Definition Unit.cpp:2339
void SetSpeed(UnitMoveType mtype, float rate, bool forced=false)
Definition Unit.cpp:4318
CreatureAI * GetAI(Creature *creature) const OVERRIDE
CreatureAI * GetAI(Creature *creature) const OVERRIDE
CreatureAI * GetAI(Creature *creature) const OVERRIDE
bool OnGossipHello(Player *player, Creature *creature) OVERRIDE
bool OnGossipSelect(Player *player, Creature *creature, uint32, uint32 action) OVERRIDE
bool OnGossipHello(Player *player, Creature *creature) OVERRIDE
bool OnGossipSelect(Player *player, Creature *creature, uint32, uint32 action) OVERRIDE
bool OnGossipSelect(Player *player, Creature *creature, uint32, uint32 action) OVERRIDE
bool OnGossipHello(Player *player, Creature *creature) OVERRIDE
bool OnQuestAccept(Player *player, Creature *creature, Quest const *quest) OVERRIDE
CreatureAI * GetAI(Creature *creature) const OVERRIDE
Creature * me
bool HealthBelowPct(uint32 pct) const
Creature * DoSpawnCreature(uint32 entry, float offsetX, float offsetY, float offsetZ, float angle, TempSummonType type, uint32 despawntime)
ScriptedAI(Creature *creature)
void UpdateAI(uint32 diff) OVERRIDE
== Triggered Actions Requested ==================
void WaypointReached(uint32 waypointId) OVERRIDE
Player * GetPlayerForEscort()
bool HasEscortState(uint32 escortState) const
npc_escortAI(Creature *creature)
void Start(bool isActiveAttacker=true, bool run=false, uint64 playerGUID=0, Quest const *quest=NULL, bool instantRespawn=false, bool canLoopPath=false, bool resetWaypoints=true)
void MoveInLineOfSight(Unit *who) OVERRIDE
void UpdateAI(uint32 uiDiff) OVERRIDE
== Triggered Actions Requested ==================
void MovementInform(uint32 uiType, uint32 uiId) OVERRIDE
@ GOSSIP_TEXTID_TROLLBANE2
@ GOSSIP_TEXTID_TROLLBANE3
@ GOSSIP_TEXTID_TROLLBANE1
@ QUEST_ROAD_TO_FALCON_WATCH
@ SPELL_ENVELOPING_WINDS
#define GOSSIP_TRACY_PROUDWELL_ITEM1
#define GOSSIP_TRACY_PROUDWELL_ITEM2
#define GOSSIP_TROLLBANE_ITEM1
#define GOSSIP_TEXT_REDEEM_MARKS
@ QUEST_DIGGING_FOR_PRAYER_BEADS
@ GOSSIP_TEXTID_TRACY_PROUDWELL1
#define GOSSIP_TROLLBANE_ITEM2
#define GOSSIP_TROLLBANE_ITEM3
@ SPELL_ANCESTRAL_WOLF_BUFF
#define GOSSIP_NALADU_ITEM1
void AddSC_hellfire_peninsula()
@ FACTION_FRIENDLY