Project SkyFire Core
SkyFire 5.4.8 server core API documentation
Loading...
Searching...
No Matches
zone_eversong_woods.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: Eversong_Woods
8SD%Complete: 100
9SDComment: Quest support: 8488, 8490
10SDCategory: Eversong Woods
11EndScriptData */
12
13/* ContentData
14npc_apprentice_mirveda
15npc_infused_crystal
16EndContentData */
17
18#include "ScriptMgr.h"
19#include "ScriptedCreature.h"
20#include "ScriptedGossip.h"
21#include "ScriptedEscortAI.h"
22#include "Player.h"
23
25{
26 // Quest
28
29 // Creatures
30 NPC_GHARZUL = 15958,
32};
33
35{
36public:
37 npc_apprentice_mirveda() : CreatureScript("npc_apprentice_mirveda") { }
38
39 bool OnQuestAccept(Player* player, Creature* creature, Quest const* quest) OVERRIDE
40 {
41 if (quest->GetQuestId() == QUEST_UNEXPECTED_RESULT)
42 {
43 CAST_AI(npc_apprentice_mirveda::npc_apprentice_mirvedaAI, creature->AI())->Summon = true;
44 CAST_AI(npc_apprentice_mirveda::npc_apprentice_mirvedaAI, creature->AI())->PlayerGUID = player->GetGUID();
45 }
46 return true;
47 }
48
50 {
51 return new npc_apprentice_mirvedaAI(creature);
52 }
53
55 {
57
60 bool Summon;
62
64 {
65 KillCount = 0;
66 PlayerGUID = 0;
67 Summons.DespawnAll();
68 Summon = false;
69 }
70
71 void EnterCombat(Unit* /*who*/)OVERRIDE { }
72
74 {
75 summoned->AI()->AttackStart(me);
76 Summons.Summon(summoned);
77 }
78
80 {
81 Summons.Despawn(summoned);
82 ++KillCount;
83 }
84
85 void JustDied(Unit* /*killer*/) OVERRIDE
86 {
87 if (PlayerGUID)
89 player->FailQuest(QUEST_UNEXPECTED_RESULT);
90 }
91
92 void UpdateAI(uint32 /*diff*/) OVERRIDE
93 {
94 if (KillCount >= 3 && PlayerGUID)
96 player->CompleteQuest(QUEST_UNEXPECTED_RESULT);
97
98 if (Summon)
99 {
100 me->SummonCreature(NPC_GHARZUL, 8745, -7134.32f, 35.22f, 0, TempSummonType::TEMPSUMMON_CORPSE_DESPAWN, 4000);
101 me->SummonCreature(NPC_ANGERSHADE, 8745, -7134.32f, 35.22f, 0, TempSummonType::TEMPSUMMON_CORPSE_DESPAWN, 4000);
102 me->SummonCreature(NPC_ANGERSHADE, 8745, -7134.32f, 35.22f, 0, TempSummonType::TEMPSUMMON_CORPSE_DESPAWN, 4000);
103 Summon = false;
104 }
105 }
106 };
107};
108
109/*######
110## npc_infused_crystal
111######*/
112
114{
115 // Quest
117
118 // Says
119 EMOTE = 0,
120
121 // Creatures
123};
124
125struct Location
126{
127 float x, y, z;
128};
129
131{
132 {8270.68f, -7188.53f, 139.619f},
133 {8284.27f, -7187.78f, 139.603f},
134 {8297.43f, -7193.53f, 139.603f},
135 {8303.5f, -7201.96f, 139.577f},
136 {8273.22f, -7241.82f, 139.382f},
137 {8254.89f, -7222.12f, 139.603f},
138 {8278.51f, -7242.13f, 139.162f},
139 {8267.97f, -7239.17f, 139.517f}
140};
141
143{
144public:
145 npc_infused_crystal() : CreatureScript("npc_infused_crystal") { }
146
148 {
149 return new npc_infused_crystalAI(creature);
150 }
151
153 {
155 {
156 SetCombatMovement(false);
157 }
158
164
166 {
167 EndTimer = 0;
168 Completed = false;
169 Progress = false;
170 PlayerGUID = 0;
171 WaveTimer = 0;
172 }
173
175
176 {
177 if (!Progress && who->GetTypeId() == TypeID::TYPEID_PLAYER && me->IsWithinDistInMap(who, 10.0f))
178 {
179 if (who->ToPlayer()->GetQuestStatus(QUEST_POWERING_OUR_DEFENSES) == QUEST_STATUS_INCOMPLETE)
180 {
181 PlayerGUID = who->GetGUID();
182 WaveTimer = 1000;
183 EndTimer = 60000;
184 Progress = true;
185 }
186 }
187 }
188
190 {
191 summoned->AI()->AttackStart(me);
192 }
193
194 void JustDied(Unit* /*killer*/) OVERRIDE
195 {
196 if (PlayerGUID && !Completed)
198 player->FailQuest(QUEST_POWERING_OUR_DEFENSES);
199 }
200
202 {
203 if (EndTimer < diff && Progress)
204 {
205 Talk(EMOTE);
206 Completed = true;
207 if (PlayerGUID)
209 player->CompleteQuest(QUEST_POWERING_OUR_DEFENSES);
210
211 me->DealDamage(me, me->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false);
212 me->RemoveCorpse();
213 } else EndTimer -= diff;
214
215 if (WaveTimer < diff && !Completed && Progress)
216 {
217 uint32 ran1 = rand()%8;
218 uint32 ran2 = rand()%8;
219 uint32 ran3 = rand()%8;
223 WaveTimer = 30000;
224 } else WaveTimer -= diff;
225 }
226 };
227};
228
std::uint32_t uint32
Definition Define.h:77
#define OVERRIDE
Definition Define.h:60
std::uint64_t uint64
Definition Define.h:76
@ TYPEID_PLAYER
Definition Object.h:55
@ TEMPSUMMON_CORPSE_DESPAWN
Definition Object.h:72
@ TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN
Definition Object.h:69
@ QUEST_STATUS_INCOMPLETE
Definition QuestDef.h:89
#define CAST_AI(a, b)
@ SPELL_SCHOOL_MASK_NORMAL
@ DIRECT_DAMAGE
Definition Unit.h:614
void Talk(uint8 id, WorldObject const *whisperTarget=NULL)
CreatureScript(const char *name)
static Player * GetPlayer(WorldObject const &, uint64 guid)
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
float y
Definition chapter5.cpp:210
float z
Definition chapter5.cpp:210
float x
Definition chapter5.cpp:210
void SetCombatMovement(bool allowMovement)
Creature * me
ScriptedAI(Creature *creature)
void UpdateAI(uint32) OVERRIDE
== Triggered Actions Requested ==================
void SummonedCreatureDespawn(Creature *summoned) OVERRIDE
void JustSummoned(Creature *summoned) OVERRIDE
void UpdateAI(uint32 diff) OVERRIDE
== Triggered Actions Requested ==================
static Location SpawnLocations[]
void AddSC_eversong_woods()
@ QUEST_POWERING_OUR_DEFENSES
@ NPC_ENRAGED_WRAITH
@ NPC_ANGERSHADE
@ QUEST_UNEXPECTED_RESULT