Project SkyFire Core
SkyFire 5.4.8 server core API documentation
Loading...
Searching...
No Matches
forge_of_souls.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#include "ScriptMgr.h"
7#include "ScriptedCreature.h"
8#include "ScriptedGossip.h"
9#include "forge_of_souls.h"
10#include "Player.h"
11
26
27/****************************************SYLVANAS************************************/
28#define GOSSIP_SYLVANAS_ITEM "What would you have of me, Banshee Queen?"
29#define GOSSIP_JAINA_ITEM "What would you have of me, my lady?"
30
49
55
61
63{
64public:
65 npc_sylvanas_fos() : CreatureScript("npc_sylvanas_fos") { }
66
68 {
69 npc_sylvanas_fosAI(Creature* creature) : ScriptedAI(creature)
70 {
71 instance = me->GetInstanceScript();
73 }
74
76
79
81 {
82 events.Reset();
84 }
85
86 void DoAction(int32 actionId) OVERRIDE
87 {
88 switch (actionId)
89 {
90 case ACTION_INTRO:
91 {
94 events.Reset();
95 events.ScheduleEvent(EVENT_INTRO_1, 1000);
96 }
97 }
98 }
99
101 {
102 if (phase == PHASE_INTRO)
103 {
104 if (!instance)
105 return;
106
107 events.Update(diff);
108 switch (events.ExecuteEvent())
109 {
110 case EVENT_INTRO_1:
112 events.ScheduleEvent(EVENT_INTRO_2, 11500);
113 break;
114
115 case EVENT_INTRO_2:
117 events.ScheduleEvent(EVENT_INTRO_3, 10500);
118 break;
119
120 case EVENT_INTRO_3:
122 events.ScheduleEvent(EVENT_INTRO_4, 9500);
123 break;
124
125 case EVENT_INTRO_4:
127 events.ScheduleEvent(EVENT_INTRO_5, 10500);
128 break;
129
130 case EVENT_INTRO_5:
132 events.ScheduleEvent(EVENT_INTRO_6, 9500);
133 break;
134
135 case EVENT_INTRO_6:
137 // End of Intro
139 break;
140 }
141 }
142
143 //Return since we have no target
144 if (!UpdateVictim())
145 return;
146
147 events.Update(diff);
149 }
150 };
151
152 bool OnGossipHello(Player* player, Creature* creature) OVERRIDE
153 {
154 if (creature->IsQuestGiver())
155 player->PrepareQuestMenu(creature->GetGUID());
156
157 if (creature->GetEntry() == NPC_JAINA_PART1)
159 else
161
162 player->SEND_GOSSIP_MENU(DEFAULT_GOSSIP_MESSAGE, creature->GetGUID());
163 return true;
164 }
165
166 bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) OVERRIDE
167 {
168 player->PlayerTalkClass->ClearMenus();
169 switch (action)
170 {
172 player->CLOSE_GOSSIP_MENU();
173
174 if (creature->AI())
175 creature->AI()->DoAction(ACTION_INTRO);
176 break;
177 }
178
179 return true;
180 }
181
183 {
184 return new npc_sylvanas_fosAI(creature);
185 }
186};
187
189{
190public:
191 npc_jaina_fos() : CreatureScript("npc_jaina_fos") { }
192
194 {
195 npc_jaina_fosAI(Creature* creature) : ScriptedAI(creature)
196 {
197 instance = me->GetInstanceScript();
199 }
200
202
205
207 {
208 events.Reset();
210 }
211
212 void DoAction(int32 actionId) OVERRIDE
213 {
214 switch (actionId)
215 {
216 case ACTION_INTRO:
217 {
220 events.Reset();
221 events.ScheduleEvent(EVENT_INTRO_1, 1000);
222 }
223 }
224 }
225
227 {
228 if (phase == PHASE_INTRO)
229 {
230 if (!instance)
231 return;
232
233 events.Update(diff);
234 switch (events.ExecuteEvent())
235 {
236 case EVENT_INTRO_1:
238 events.ScheduleEvent(EVENT_INTRO_2, 8000);
239 break;
240
241 case EVENT_INTRO_2:
243 events.ScheduleEvent(EVENT_INTRO_3, 8500);
244 break;
245
246 case EVENT_INTRO_3:
248 events.ScheduleEvent(EVENT_INTRO_4, 8000);
249 break;
250
251 case EVENT_INTRO_4:
253 events.ScheduleEvent(EVENT_INTRO_5, 10000);
254 break;
255
256 case EVENT_INTRO_5:
258 events.ScheduleEvent(EVENT_INTRO_6, 8000);
259 break;
260
261 case EVENT_INTRO_6:
263 events.ScheduleEvent(EVENT_INTRO_7, 12000);
264 break;
265
266 case EVENT_INTRO_7:
268 events.ScheduleEvent(EVENT_INTRO_8, 8000);
269 break;
270
271 case EVENT_INTRO_8:
273 // End of Intro
275 break;
276 }
277 }
278
279 //Return since we have no target
280 if (!UpdateVictim())
281 return;
282
283 events.Update(diff);
284
286 }
287 };
288
289 bool OnGossipHello(Player* player, Creature* creature) OVERRIDE
290 {
291 if (creature->IsQuestGiver())
292 player->PrepareQuestMenu(creature->GetGUID());
293
294 if (creature->GetEntry() == NPC_JAINA_PART1)
296 else
298
299 player->SEND_GOSSIP_MENU(DEFAULT_GOSSIP_MESSAGE, creature->GetGUID());
300 return true;
301 }
302
303 bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) OVERRIDE
304 {
305 player->PlayerTalkClass->ClearMenus();
306 switch (action)
307 {
309 player->CLOSE_GOSSIP_MENU();
310
311 if (creature->AI())
312 creature->AI()->DoAction(ACTION_INTRO);
313 break;
314 }
315
316 return true;
317 }
318
320 {
321 return new npc_jaina_fosAI(creature);
322 }
323};
324
326{
327 new npc_sylvanas_fos();
328 new npc_jaina_fos();
329}
std::int32_t int32
Definition Define.h:73
std::uint32_t uint32
Definition Define.h:77
#define OVERRIDE
Definition Define.h:60
#define DEFAULT_GOSSIP_MESSAGE
Definition GossipDef.h:16
@ GOSSIP_ICON_CHAT
Definition GossipDef.h:46
@ GOSSIP_SENDER_MAIN
@ GOSSIP_ACTION_INFO_DEF
@ UNIT_NPC_FLAG_GOSSIP
Definition Unit.h:687
@ UNIT_FIELD_NPC_FLAGS
@ ACTION_INTRO
@ PHASE_INTRO
@ EVENT_NONE
@ PHASE_NORMAL
@ EVENT_INTRO_4
@ EVENT_INTRO_1
@ EVENT_INTRO_2
@ EVENT_INTRO_5
@ EVENT_INTRO_3
void Talk(uint8 id, WorldObject const *whisperTarget=NULL)
bool UpdateVictim()
CreatureScript(const char *name)
void DoMeleeAttackIfReady()
Definition UnitAI.cpp:28
bool OnGossipHello(Player *player, Creature *creature) OVERRIDE
bool OnGossipSelect(Player *player, Creature *creature, uint32, uint32 action) 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
#define GOSSIP_SYLVANAS_ITEM
@ GOSSIP_SPEECHINTRO
@ ACTION_INTRO
@ SAY_JAINA_INTRO_4
@ SAY_SYLVANAS_INTRO_3
@ SAY_JAINA_INTRO_5
@ SAY_SYLVANAS_INTRO_4
@ SAY_JAINA_INTRO_6
@ SAY_JAINA_INTRO_2
@ SAY_JAINA_INTRO_1
@ SAY_JAINA_INTRO_8
@ SAY_SYLVANAS_INTRO_5
@ SAY_SYLVANAS_INTRO_2
@ SAY_SYLVANAS_INTRO_6
@ SAY_JAINA_INTRO_7
@ SAY_JAINA_INTRO_3
@ SAY_SYLVANAS_INTRO_1
void AddSC_forge_of_souls()
#define GOSSIP_JAINA_ITEM
@ PHASE_INTRO
@ PHASE_NORMAL
@ EVENT_INTRO_4
@ EVENT_INTRO_1
@ EVENT_INTRO_2
@ EVENT_INTRO_5
@ EVENT_INTRO_8
@ EVENT_INTRO_6
@ EVENT_INTRO_7
@ EVENT_INTRO_3
@ NPC_JAINA_PART1
Creature * me
ScriptedAI(Creature *creature)
void DoAction(int32 actionId) OVERRIDE
void UpdateAI(uint32 diff) OVERRIDE
== Triggered Actions Requested ==================
npc_jaina_fosAI(Creature *creature)
void UpdateAI(uint32 diff) OVERRIDE
== Triggered Actions Requested ==================
void DoAction(int32 actionId) OVERRIDE