Project SkyFire Core
SkyFire 5.4.8 server core API documentation
Loading...
Searching...
No Matches
zone_teldrassil.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: Teldrassil
8SD%Complete: 100
9SDComment: Quest support: 938
10SDCategory: Teldrassil
11EndScriptData */
12
13/* ContentData
14npc_mist
15EndContentData */
16
17#include "ScriptMgr.h"
18#include "ScriptedCreature.h"
19#include "ScriptedFollowerAI.h"
20#include "Player.h"
21
22/*####
23# npc_tarindrella
24####*/
25
42
43#define TARINDRELLA_TEXT_ON_COMPLETE "This totem has been corrupting the eggs! It seems a greater threat looms. The Gnarlpine remain tainted by something most foul."
44#define TARINDRELLA_TEXT_SPAWN "You've come to help, $c? Let us stay together for a while."
45#define TARINDRELLA_TEXT_ON_KILL "My dear friends... I'm so sorry..."
46
48{
49public:
50 npc_tarindrella() : CreatureScript("npc_tarindrella") { }
51
52 bool OnQuestReward(Player * player, Creature * creature, Quest const* quest, uint32 /*opt*/) OVERRIDE
53 {
54 if (player->GetQuestStatus(QUEST_SIGNS_OF_THINGS_TO_COME) == QUEST_STATUS_REWARDED)
55 creature->DespawnOrUnsummon();
56 return true;
57 }
59 {
60 npc_tarindrellaAI(Creature* creature) : FollowerAI(creature) { }
61
66
68 {
70 }
71
72 void KilledUnit(Unit* victim) OVERRIDE
73 {
74 if ((victim->GetEntry() == NPC_GITHYISS)) { }
75 else
76 {
77 me->MonsterSay(TARINDRELLA_TEXT_ON_KILL, Language::LANG_UNIVERSAL, me->GetOwner());
78 }
79 }
80
82 {
83 events.ScheduleEvent(EVENT_ENTANGLING_ROOTS, 2000);
84 events.ScheduleEvent(EVENT_SUMMON_NATURES_BITE, 6000);
85 events.ScheduleEvent(EVENT_CLEANSE_SPIRIT, 10000);
86 }
87
89 {
90 if (!UpdateVictim())
91 return;
92
93 events.Update(diff);
94
95 while (uint32 eventId = events.ExecuteEvent())
96 {
97 switch (eventId)
98 {
100 {
101 DoCast(me->GetVictim(), SPELL_ENTANGLING_ROOTS);
102 events.ScheduleEvent(EVENT_ENTANGLING_ROOTS, 10000);
103 break;
104 }
106 {
107 if (me->HasAura(6751) || me->HasAura(11918))
108 {
110 events.ScheduleEvent(EVENT_CLEANSE_SPIRIT, 10000);
111 }
112 else if (me->GetOwner()->HasAura(6751) || me->GetOwner()->HasAura(11918))
113 {
114 DoCast(me->GetOwner(), SPELL_CLEANSE_SPIRIT);
115 events.ScheduleEvent(EVENT_CLEANSE_SPIRIT, 10000);
116 }
117 else
118 {
119 events.ScheduleEvent(EVENT_CLEANSE_SPIRIT, 5000);
120 }
121 break;
122 }
124 {
125 DoCast(me->GetVictim(), SPELL_SUMMON_NATURES_BITE);
126 events.ScheduleEvent(EVENT_SUMMON_NATURES_BITE, 10000);
127 break;
128 }
129 default:
130 break;
131 }
132 }
134 }
136 };
137
139 {
140 return new npc_tarindrellaAI(creature);
141 }
142};
143
144/*####
145# npc_githyiss
146####*/
148{
149public:
150 npc_githyiss() : CreatureScript("npc_githyiss") { }
151
153 {
154 npc_githyissAI(Creature* creature) : CreatureAI(creature) { }
155
157
159 {
160 PoisonTimer = 1000;
161 }
162
163 void JustDied(Unit* killer) OVERRIDE
164 {
165 if (Creature* pDryad = me->FindNearestCreature(49480, 15.0f, true))
166 {
167 pDryad->MonsterSay(TARINDRELLA_TEXT_ON_COMPLETE, Language::LANG_UNIVERSAL, killer);
168 }
169 }
171 {
172 if (!UpdateVictim())
173 return;
174
175 if (PoisonTimer <= diff)
176 {
177 DoCast(me->GetVictim(), SPELL_POISON);
178 PoisonTimer = 15000; //Todo: Get retail timer from combat log
179 }
180 else
181 PoisonTimer -= diff;
182
184 }
185 };
186
188 {
189 return new npc_githyissAI(creature);
190 }
191};
192
193/*####
194# npc_mist
195####*/
196
205
207{
208public:
209 npc_mist() : CreatureScript("npc_mist") { }
210
211 bool OnQuestAccept(Player* player, Creature* creature, Quest const* quest) OVERRIDE
212 {
213 if (quest->GetQuestId() == QUEST_MIST)
214 if (npc_mistAI* pMistAI = CAST_AI(npc_mist::npc_mistAI, creature->AI()))
215 pMistAI->StartFollow(player, FACTION_DARNASSUS, quest);
216
217 return true;
218 }
219
221 {
222 return new npc_mistAI(creature);
223 }
224
225 struct npc_mistAI : public FollowerAI
226 {
227 npc_mistAI(Creature* creature) : FollowerAI(creature) { }
228
229 void Reset() OVERRIDE { }
230
232
233 {
235
236 if (!me->GetVictim() && !HasFollowState(STATE_FOLLOW_COMPLETE) && who->GetEntry() == NPC_ARYNIA)
237 {
238 if (me->IsWithinDistInMap(who, 10.0f))
239 {
240 Talk(SAY_AT_HOME, who);
241 DoComplete();
242 }
243 }
244 }
245
247 {
249
250 Player* player = GetLeaderForFollower();
251 if (player && player->GetQuestStatus(QUEST_MIST) == QUEST_STATUS_INCOMPLETE)
253
254 //The follow is over (and for later development, run off to the woods before really end)
256 }
257
258 //call not needed here, no known abilities
259 /*void UpdateFollowerAI(const uint32 Diff) OVERRIDE
260 {
261 if (!UpdateVictim())
262 return;
263
264 DoMeleeAttackIfReady();
265 }*/
266 };
267};
268
270{
271 new npc_githyiss();
272 new npc_tarindrella();
273 new npc_mist();
274}
std::uint32_t uint32
Definition Define.h:77
#define OVERRIDE
Definition Define.h:60
@ QUEST_STATUS_REWARDED
Definition QuestDef.h:92
@ QUEST_STATUS_INCOMPLETE
Definition QuestDef.h:89
#define CAST_AI(a, b)
@ STATE_FOLLOW_COMPLETE
CreatureAI(Creature *creature)
Definition CreatureAI.h:69
void Talk(uint8 id, WorldObject const *whisperTarget=NULL)
bool UpdateVictim()
Creature *const me
Definition CreatureAI.h:56
CreatureScript(const char *name)
void MoveInLineOfSight(Unit *) OVERRIDE
Player * GetLeaderForFollower()
void SetFollowComplete(bool bWithEndEvent=false)
FollowerAI(Creature *creature)
bool HasFollowState(uint32 uiFollowState) const
void GroupEventHappens(uint32 questId, WorldObject const *pEventObject)
QuestStatus GetQuestStatus(uint32 quest_id) const
void DoMeleeAttackIfReady()
Definition UnitAI.cpp:28
void DoCast(uint32 spellId)
Definition UnitAI.cpp:110
Definition Unit.h:1367
CreatureAI * GetAI(Creature *creature) const OVERRIDE
bool OnQuestAccept(Player *player, Creature *creature, Quest const *quest) OVERRIDE
CreatureAI * GetAI(Creature *creature) const OVERRIDE
CreatureAI * GetAI(Creature *creature) const OVERRIDE
bool OnQuestReward(Player *player, Creature *creature, Quest const *quest, uint32) OVERRIDE
Creature * me
void UpdateAI(uint32 diff) OVERRIDE
== Triggered Actions Requested ==================
void JustDied(Unit *killer) OVERRIDE
npc_githyissAI(Creature *creature)
npc_mistAI(Creature *creature)
void MoveInLineOfSight(Unit *who) OVERRIDE
void IsSummonedBy(Unit *unit) OVERRIDE
void MoveInLineOfSight(Unit *who) OVERRIDE
void KilledUnit(Unit *victim) OVERRIDE
void UpdateFollowerAI(const uint32 diff) OVERRIDE
@ SAY_AT_HOME
@ NPC_ARYNIA
@ FACTION_DARNASSUS
@ EMOTE_AT_HOME
@ QUEST_MIST
void AddSC_teldrassil()
#define TARINDRELLA_TEXT_SPAWN
#define TARINDRELLA_TEXT_ON_COMPLETE
@ SPELL_SUMMON_NATURES_BITE
@ SPELL_ENTANGLING_ROOTS
@ QUEST_VILE_TOUCH
@ SPELL_CLEANSE_SPIRIT
@ SPELL_POISON
@ EVENT_SUMMON_NATURES_BITE
@ EVENT_CLEANSE_SPIRIT
@ QUEST_SIGNS_OF_THINGS_TO_COME
@ NPC_GITHYISS
@ EVENT_ENTANGLING_ROOTS
#define TARINDRELLA_TEXT_ON_KILL