Project SkyFire Core
SkyFire 5.4.8 server core API documentation
Loading...
Searching...
No Matches
shadowfang_keep.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: Shadowfang_Keep
8SD%Complete: 75
9SDComment: npc_shadowfang_prisoner using escortAI for movement to door. Might need additional code in case being attacked. Add proper texts/say().
10SDCategory: Shadowfang Keep
11EndScriptData */
12
13/* ContentData
14npc_shadowfang_prisoner
15EndContentData */
16
17#include "ScriptMgr.h"
18#include "ScriptedCreature.h"
19#include "ScriptedGossip.h"
20#include "SpellScript.h"
21#include "SpellAuraEffects.h"
22#include "ScriptedEscortAI.h"
23#include "shadowfang_keep.h"
24#include "Player.h"
25
26/*######
27## npc_shadowfang_prisoner
28######*/
29
40
42{
44
46};
47
49{
50 NPC_ASH = 3850
51};
52
53#define GOSSIP_ITEM_DOOR "Thanks, I'll follow you to the door."
54
56{
57public:
58 npc_shadowfang_prisoner() : CreatureScript("npc_shadowfang_prisoner") { }
59
61 {
62 return new npc_shadowfang_prisonerAI(creature);
63 }
64
65 bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) OVERRIDE
66 {
67 player->PlayerTalkClass->ClearMenus();
68 if (action == GOSSIP_ACTION_INFO_DEF+1)
69 {
70 player->CLOSE_GOSSIP_MENU();
71
73 pEscortAI->Start(false, false);
74 }
75 return true;
76 }
77
78 bool OnGossipHello(Player* player, Creature* creature) OVERRIDE
79 {
80 InstanceScript* instance = creature->GetInstanceScript();
81
82 if (instance && instance->GetData(TYPE_FREE_NPC) != DONE && instance->GetData(TYPE_RETHILGORE) == DONE)
84
85 player->SEND_GOSSIP_MENU(player->GetGossipTextId(creature), creature->GetGUID());
86
87 return true;
88 }
89
91 {
93 {
94 instance = creature->GetInstanceScript();
95 }
96
98
100 {
101 switch (waypointId)
102 {
103 case 0:
104 if (me->GetEntry() == NPC_ASH)
106 else
108 break;
109 case 10:
110 if (me->GetEntry() == NPC_ASH)
112 else
114 break;
115 case 11:
116 if (me->GetEntry() == NPC_ASH)
118 break;
119 case 12:
120 if (me->GetEntry() == NPC_ASH)
122 else
124
125 if (instance)
126 instance->SetData(TYPE_FREE_NPC, DONE);
127 break;
128 case 13:
129 if (me->GetEntry() != NPC_ASH)
131 break;
132 }
133 }
134
135 void Reset() OVERRIDE { }
136 void EnterCombat(Unit* /*who*/) OVERRIDE { }
137 };
138
139};
140
142{
143public:
144 npc_arugal_voidwalker() : CreatureScript("npc_arugal_voidwalker") { }
145
147 {
148 return new npc_arugal_voidwalkerAI(creature);
149 }
150
152 {
154 {
155 instance = creature->GetInstanceScript();
156 }
157
159
161
163 {
164 uiDarkOffering = urand(200, 1000);
165 }
166
168 {
169 if (!UpdateVictim())
170 return;
171
172 if (uiDarkOffering <= uiDiff)
173 {
174 if (Creature* pFriend = me->FindNearestCreature(me->GetEntry(), 25.0f, true))
175 DoCast(pFriend, SPELL_DARK_OFFERING);
176 else
178 uiDarkOffering = urand(4400, 12500);
179 } else uiDarkOffering -= uiDiff;
180
182 }
183
184 void JustDied(Unit* /*killer*/) OVERRIDE
185 {
186 if (instance)
187 instance->SetData(TYPE_FENRUS, instance->GetData(TYPE_FENRUS) + 1);
188 }
189 };
190
191};
192
231
@ IN_MILLISECONDS
Definition Common.h:125
std::int32_t int32
Definition Define.h:73
std::uint32_t uint32
Definition Define.h:77
#define OVERRIDE
Definition Define.h:60
@ GOSSIP_ICON_CHAT
Definition GossipDef.h:46
@ DONE
#define CAST_AI(a, b)
@ GOSSIP_SENDER_MAIN
@ GOSSIP_ACTION_INFO_DEF
@ EFFECT_0
@ SPELL_AURA_DUMMY
#define AuraEffectPeriodicFn(F, I, N)
#define AuraEffectUpdatePeriodicFn(F, I, N)
#define AuraEffectCalcPeriodicFn(F, I, N)
Creatures
void CalculatePeriodic(Unit *caster, bool resetPeriodicTimer=true, bool load=false)
int32 GetAmount() const
HookList< EffectCalcPeriodicHandler > DoEffectCalcPeriodic
HookList< EffectPeriodicHandler > OnEffectPeriodic
Unit * GetCaster() const
HookList< EffectUpdatePeriodicHandler > OnEffectUpdatePeriodic
Unit * GetTarget() const
void Talk(uint8 id, WorldObject const *whisperTarget=NULL)
bool UpdateVictim()
CreatureScript(const char *name)
SpellScriptLoader(const char *name)
void DoMeleeAttackIfReady()
Definition UnitAI.cpp:28
void DoCast(uint32 spellId)
Definition UnitAI.cpp:110
Definition Unit.h:1367
void CastSpell(SpellCastTargets const &targets, SpellInfo const *spellInfo, CustomSpellValues const *value, TriggerCastFlags triggerFlags=TRIGGERED_NONE, Item *castItem=NULL, AuraEffect const *triggeredByAura=NULL, uint64 originalCaster=0)
InstanceScript * GetInstanceScript()
Definition Object.cpp:1612
virtual uint32 GetData(uint32) const
Definition ZoneScript.h:36
CreatureAI * GetAI(Creature *creature) const OVERRIDE
bool OnGossipSelect(Player *player, Creature *creature, uint32, uint32 action) OVERRIDE
CreatureAI * GetAI(Creature *creature) const OVERRIDE
bool OnGossipHello(Player *player, Creature *creature) OVERRIDE
void CalcPeriodic(AuraEffect const *, bool &isPeriodic, int32 &amplitude)
AuraScript * GetAuraScript() const OVERRIDE
@ NPC_ASH
@ SAY_OPEN_DOOR_AS
@ SAY_OPEN_DOOR_AD
@ SAY_POST1_DOOR_AD
@ SAY_FREE_AD
@ SAY_FREE_AS
@ SAY_POST_DOOR_AS
@ SAY_POST2_DOOR_AD
@ SPELL_DARK_OFFERING
@ SPELL_UNLOCK
void AddSC_shadowfang_keep()
#define GOSSIP_ITEM_DOOR
@ TYPE_FENRUS
@ TYPE_RETHILGORE
@ TYPE_FREE_NPC
Creature * me
ScriptedAI(Creature *creature)
void UpdateAI(uint32 uiDiff) OVERRIDE
== Triggered Actions Requested ==================
npc_escortAI(Creature *creature)