TrinityCore
forge_of_souls.cpp
Go to the documentation of this file.
1/*
2 * This file is part of the TrinityCore Project. See AUTHORS file for Copyright information
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the
6 * Free Software Foundation; either version 2 of the License, or (at your
7 * option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18#include "ScriptMgr.h"
19#include "forge_of_souls.h"
20#include "ScriptedCreature.h"
21#include "ScriptedGossip.h"
22#include "SpellAuras.h"
23#include "SpellScript.h"
24
26{
28
29 // Jaina/Sylvanas Intro
38};
39
41{
50
57};
58
59enum Misc
60{
65};
66
68{
71};
72
74{
75 SPELL_LETHARGY = 69133
76};
77
79{
80 npc_sylvanas_fos(Creature* creature) : ScriptedAI(creature)
81 {
82 Initialize();
85 }
86
88 {
90 }
91
93
96
97 void Reset() override
98 {
99 events.Reset();
100 Initialize();
101 }
102
103 bool OnGossipSelect(Player* player, uint32 menuId, uint32 gossipListId) override
104 {
105 if (menuId == MENU_ID_SYLVANAS && gossipListId == GOSSIP_OPTION_ID)
106 {
107 CloseGossipMenuFor(player);
110 events.Reset();
112 }
113 return false;
114 }
115
116 void UpdateAI(uint32 diff) override
117 {
118 if (phase == PHASE_INTRO)
119 {
120 events.Update(diff);
121 switch (events.ExecuteEvent())
122 {
123 case EVENT_INTRO_1:
126 break;
127
128 case EVENT_INTRO_2:
131 break;
132
133 case EVENT_INTRO_3:
136 break;
137
138 case EVENT_INTRO_4:
141 break;
142
143 case EVENT_INTRO_5:
146 break;
147
148 case EVENT_INTRO_6:
150 // End of Intro
152 break;
153 }
154 }
155
156 //Return since we have no target
157 if (!UpdateVictim())
158 return;
159
160 events.Update(diff);
161 }
162};
163
165{
166 npc_jaina_fos(Creature* creature) : ScriptedAI(creature)
167 {
168 Initialize();
171 }
172
174 {
176 }
177
179
182
183 void Reset() override
184 {
185 events.Reset();
186 Initialize();
187 }
188
189 bool OnGossipSelect(Player* player, uint32 menuId, uint32 gossipListId) override
190 {
191 if (menuId == MENU_ID_JAINA && gossipListId == GOSSIP_OPTION_ID)
192 {
193 CloseGossipMenuFor(player);
196 events.Reset();
198 }
199 return false;
200 }
201
202 void UpdateAI(uint32 diff) override
203 {
204 if (phase == PHASE_INTRO)
205 {
206 events.Update(diff);
207 switch (events.ExecuteEvent())
208 {
209 case EVENT_INTRO_1:
212 break;
213
214 case EVENT_INTRO_2:
217 break;
218
219 case EVENT_INTRO_3:
222 break;
223
224 case EVENT_INTRO_4:
227 break;
228
229 case EVENT_INTRO_5:
232 break;
233
234 case EVENT_INTRO_6:
237 break;
238
239 case EVENT_INTRO_7:
242 break;
243
244 case EVENT_INTRO_8:
246 // End of Intro
248 break;
249 }
250 }
251
252 //Return since we have no target
253 if (!UpdateVictim())
254 return;
255
256 events.Update(diff);
257 }
258};
259
260// 69131 - Soul Sickness
262{
263 bool Validate(SpellInfo const* /*spellInfo*/) override
264 {
266 }
267
268 void HandleStun(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/)
269 {
270 if (GetTargetApplication()->GetRemoveMode() == AURA_REMOVE_BY_EXPIRE)
271 {
272 Unit* target = GetTarget();
273 target->CastSpell(target, SPELL_LETHARGY, aurEff);
274 }
275 }
276
277 void Register() override
278 {
280 }
281};
282
284{
288}
uint32_t uint32
Definition: Define.h:142
#define RegisterSpellScript(spell_script)
Definition: ScriptMgr.h:1369
void CloseGossipMenuFor(Player *player)
@ EFFECT_0
Definition: SharedDefines.h:30
AuraEffectHandleModes
@ AURA_EFFECT_HANDLE_REAL
@ AURA_REMOVE_BY_EXPIRE
@ SPELL_AURA_DUMMY
#define AuraEffectRemoveFn(F, I, N, M)
Definition: SpellScript.h:2040
@ UNIT_NPC_FLAG_GOSSIP
Definition: UnitDefines.h:297
Yells
AuraApplication const * GetTargetApplication() const
HookList< EffectApplyHandler > AfterEffectRemove
Definition: SpellScript.h:2039
Unit * GetTarget() const
void Talk(uint8 id, WorldObject const *whisperTarget=nullptr)
Definition: CreatureAI.cpp:56
bool UpdateVictim()
Definition: CreatureAI.cpp:245
Creature *const me
Definition: CreatureAI.h:61
uint32 ExecuteEvent()
Definition: EventMap.cpp:73
void Update(uint32 time)
Definition: EventMap.h:56
void ScheduleEvent(uint32 eventId, Milliseconds time, uint32 group=0, uint8 phase=0)
Definition: EventMap.cpp:36
void Reset()
Definition: EventMap.cpp:21
static bool ValidateSpellInfo(std::initializer_list< uint32 > spellIds)
Definition: SpellScript.h:162
Definition: Unit.h:627
void RemoveNpcFlag(NPCFlags flags)
Definition: Unit.h:983
void SetNpcFlag(NPCFlags flags)
Definition: Unit.h:982
InstanceScript * GetInstanceScript() const
Definition: Object.cpp:1042
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition: Object.cpp:2896
void HandleStun(AuraEffect const *aurEff, AuraEffectHandleModes)
bool Validate(SpellInfo const *) override
@ GOSSIP_OPTION_ID
@ MENU_ID_JAINA
@ MENU_ID_SYLVANAS
@ 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
ForgeSpells
@ SPELL_LETHARGY
void AddSC_forge_of_souls()
@ 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_NONE
@ EVENT_INTRO_3
#define RegisterForgeOfSoulsCreatureAI(ai_name)
bool OnGossipSelect(Player *player, uint32 menuId, uint32 gossipListId) override
npc_jaina_fos(Creature *creature)
void UpdateAI(uint32 diff) override
InstanceScript * instance
void Reset() override
InstanceScript * instance
npc_sylvanas_fos(Creature *creature)
void UpdateAI(uint32 diff) override
void Reset() override
bool OnGossipSelect(Player *player, uint32 menuId, uint32 gossipListId) override