TrinityCore
wailing_caverns.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/* ScriptData
19SDName: Wailing Caverns
20SD%Complete: 95
21SDComment: Need to add skill usage for Disciple of Naralex
22SDCategory: Wailing Caverns
23EndScriptData */
24
25/* ContentData
26EndContentData */
27
28#include "ScriptMgr.h"
29#include "InstanceScript.h"
30#include "MotionMaster.h"
31#include "ObjectAccessor.h"
32#include "Player.h"
33#include "ScriptedEscortAI.h"
34#include "ScriptedGossip.h"
35#include "TemporarySummon.h"
36#include "wailing_caverns.h"
37
38/*######
39## npc_disciple_of_naralex
40######*/
41
43{
62
66
71
77
79};
80
82{
83public:
84 npc_disciple_of_naralex() : CreatureScript("npc_disciple_of_naralex") { }
85
87 {
89 {
90 instance = creature->GetInstanceScript();
91 eventTimer = 0;
92 currentEvent = 0;
93 eventProgress = 0;
94 me->setActive(true);
95 me->SetFarVisible(true);
96 me->SetImmuneToPC(false);
97 }
98
103
104 void WaypointReached(uint32 waypointId, uint32 /*pathId*/) override
105 {
106 switch (waypointId)
107 {
108 case 4:
109 eventProgress = 1;
112 break;
113 case 5:
116 break;
117 case 11:
118 eventProgress = 1;
121 break;
122 case 19:
124 break;
125 case 24:
126 eventProgress = 1;
129 break;
130 }
131 }
132
133 void Reset() override
134 {
135
136 }
137
138 void JustEngagedWith(Unit* who) override
139 {
140 Talk(SAY_ATTACKED, who);
141 }
142
143 void JustDied(Unit* /*killer*/) override
144 {
149 }
150
151 void JustSummoned(Creature* summoned) override
152 {
153 summoned->AI()->AttackStart(me);
154 }
155
156 void UpdateAI(uint32 diff) override
157 {
159 EscortAI::UpdateAI(diff);
160
161 if (eventTimer <= diff)
162 {
163 eventTimer = 0;
165 {
166 switch (currentEvent)
167 {
169 if (eventProgress == 1)
170 {
173 me->SummonCreature(NPC_DEVIATE_RAVAGER, -82.1763f, 227.874f, -93.3233f, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 5s);
174 me->SummonCreature(NPC_DEVIATE_RAVAGER, -72.9506f, 216.645f, -93.6756f, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 5s);
175 }
176 break;
178 if (eventProgress == 1)
179 {
183 //CAST_AI(EscortAI, me->AI())->SetCanDefend(false);
184 eventTimer = 30000;
185 me->SummonCreature(NPC_DEVIATE_VIPER, -61.5261f, 273.676f, -92.8442f, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 5s);
186 me->SummonCreature(NPC_DEVIATE_VIPER, -58.4658f, 280.799f, -92.8393f, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 5s);
187 me->SummonCreature(NPC_DEVIATE_VIPER, -50.002f, 278.578f, -92.8442f, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 5s);
188 }
189 else
190 if (eventProgress == 2)
191 {
192 //CAST_AI(EscortAI, me->AI())->SetCanDefend(true);
197 }
198 break;
200 if (eventProgress == 1)
201 {
203 eventTimer = 4000;
206 }
207 else
208 if (eventProgress == 2)
209 {
211 eventTimer = 15000;
212 //CAST_AI(EscortAI, me->AI())->SetCanDefend(false);
214 DoCast(naralex, SPELL_NARALEXS_AWAKENING, true);
216 }
217 else
218 if (eventProgress == 3)
219 {
221 eventTimer = 15000;
223 naralex->AI()->Talk(EMOTE_TROUBLED_SLEEP);
224 me->SummonCreature(NPC_DEVIATE_MOCCASIN, 135.943f, 199.701f, -103.529f, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 15s);
225 me->SummonCreature(NPC_DEVIATE_MOCCASIN, 151.08f, 221.13f, -103.609f, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 15s);
226 me->SummonCreature(NPC_DEVIATE_MOCCASIN, 128.007f, 227.428f, -97.421f, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 15s);
227 }
228 else
229 if (eventProgress == 4)
230 {
232 eventTimer = 30000;
234 naralex->AI()->Talk(EMOTE_WRITHE_IN_AGONY);
235 me->SummonCreature(NPC_NIGHTMARE_ECTOPLASM, 133.413f, 207.188f, -102.469f, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 15s);
236 me->SummonCreature(NPC_NIGHTMARE_ECTOPLASM, 142.857f, 218.645f, -102.905f, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 15s);
237 me->SummonCreature(NPC_NIGHTMARE_ECTOPLASM, 105.102f, 227.211f, -102.752f, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 15s);
238 me->SummonCreature(NPC_NIGHTMARE_ECTOPLASM, 153.372f, 235.149f, -102.826f, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 15s);
239 me->SummonCreature(NPC_NIGHTMARE_ECTOPLASM, 149.524f, 251.113f, -102.558f, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 15s);
240 me->SummonCreature(NPC_NIGHTMARE_ECTOPLASM, 136.208f, 266.466f, -102.977f, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 15s);
241 me->SummonCreature(NPC_NIGHTMARE_ECTOPLASM, 126.167f, 274.759f, -102.962f, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 15s);
242 }
243 else
244 if (eventProgress == 5)
245 {
248 naralex->AI()->Talk(EMOTE_HORRENDOUS_VISION);
249 if (Creature* mutanus = me->SummonCreature(NPC_MUTANUS_THE_DEVOURER, 150.872f, 262.905f, -103.503f, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 5min))
251
253 }
254 else
256 {
258 eventTimer = 3000;
260 {
263 naralex->SetStandState(UNIT_STAND_STATE_STAND);
264 naralex->AI()->Talk(SAY_I_AM_AWAKE);
265 }
267 }
268 else
269 if (eventProgress == 7)
270 {
272 eventTimer = 6000;
274 naralex->AI()->Talk(SAY_THANK_YOU);
275 }
276 else
277 if (eventProgress == 8)
278 {
280 eventTimer = 8000;
282 {
283 naralex->AI()->Talk(SAY_FAREWELL);
284 naralex->AddAura(SPELL_FLIGHT_FORM, naralex);
285 }
288 }
289 else
290 if (eventProgress == 9)
291 {
293 eventTimer = 1500;
295 naralex->GetMotionMaster()->MovePoint(25, naralex->GetPositionX(), naralex->GetPositionY(), naralex->GetPositionZ());
296 }
297 else
298 if (eventProgress == 10)
299 {
301 eventTimer = 2500;
303 {
304 naralex->GetMotionMaster()->MovePoint(0, 117.095512f, 247.107971f, -96.167870f);
305 naralex->GetMotionMaster()->MovePoint(1, 90.388809f, 276.135406f, -83.389801f);
306 }
307 me->GetMotionMaster()->MovePoint(26, 117.095512f, 247.107971f, -96.167870f);
308 me->GetMotionMaster()->MovePoint(27, 144.375443f, 281.045837f, -82.477135f);
309 }
310 else
311 if (eventProgress == 11)
312 {
314 naralex->SetVisible(false);
315 me->SetVisible(false);
317 }
318 break;
319 }
320 }
321 } else eventTimer -= diff;
322 }
323
324 bool OnGossipSelect(Player* player, uint32 /*menuId*/, uint32 gossipListId) override
325 {
326 uint32 const action = player->PlayerTalkClass->GetGossipOptionAction(gossipListId);
327 ClearGossipMenuFor(player);
328 if (action == GOSSIP_ACTION_INFO_DEF + 1)
329 {
330 CloseGossipMenuFor(player);
331 if (instance)
333
335
337 me->SetImmuneToPC(false);
338
340 Start(false, player->GetGUID());
341 SetDespawnAtFar(false);
342 SetDespawnAtEnd(false);
343 }
344 return true;
345 }
346
347 bool OnGossipHello(Player* player) override
348 {
352 {
356
358 {
361 }
362 }
363 else
364 {
366 }
367 return true;
368 }
369 };
370
371 CreatureAI* GetAI(Creature* creature) const override
372 {
373 return GetWailingCavernsAI<npc_disciple_of_naralexAI>(creature);
374 }
375};
376
378{
380}
uint32_t uint32
Definition: Define.h:142
@ IN_PROGRESS
@ FAIL
@ DONE
@ TEMPSUMMON_CORPSE_TIMED_DESPAWN
Definition: ObjectDefines.h:68
void AddGossipItemFor(Player *player, GossipOptionNpc optionNpc, std::string text, uint32 sender, uint32 action)
void SendGossipMenuFor(Player *player, uint32 npcTextID, ObjectGuid const &guid)
void ClearGossipMenuFor(Player *player)
void InitGossipMenuFor(Player *player, uint32 menuId)
void CloseGossipMenuFor(Player *player)
@ GOSSIP_SENDER_MAIN
@ GOSSIP_ACTION_INFO_DEF
@ FACTION_ESCORTEE_N_NEUTRAL_ACTIVE
@ UNIT_STAND_STATE_KNEEL
Definition: UnitDefines.h:50
@ UNIT_STAND_STATE_STAND
Definition: UnitDefines.h:42
Enums
Definition: boss_aeonus.cpp:31
void Talk(uint8 id, WorldObject const *whisperTarget=nullptr)
Definition: CreatureAI.cpp:56
void AttackStart(Unit *victim) override
== Triggered Actions Requested ==================
Definition: CreatureAI.cpp:328
Creature *const me
Definition: CreatureAI.h:61
void SetImmuneToPC(bool apply) override
Definition: Creature.h:170
CreatureAI * AI() const
Definition: Creature.h:214
virtual ObjectGuid GetGuidData(uint32 type) const override
void MovePoint(uint32 id, Position const &pos, bool generatePath=true, Optional< float > finalOrient={}, Optional< float > speed={}, MovementWalkRunSpeedSelectionMode speedSelectionMode=MovementWalkRunSpeedSelectionMode::Default, Optional< float > closeEnoughDistance={})
static ObjectGuid GetGUID(Object const *o)
Definition: Object.h:159
std::unique_ptr< PlayerMenu > PlayerTalkClass
Definition: Player.h:2380
SpellCastResult DoCast(uint32 spellId)
Definition: UnitAI.cpp:89
Definition: Unit.h:627
void SetVisible(bool x)
Definition: Unit.cpp:8351
void RemoveAura(AuraApplicationMap::iterator &i, AuraRemoveMode mode=AURA_REMOVE_BY_DEFAULT)
Definition: Unit.cpp:3685
void SetStandState(UnitStandStateType state, uint32 animKitID=0)
Definition: Unit.cpp:10100
void SetFaction(uint32 faction) override
Definition: Unit.h:859
MotionMaster * GetMotionMaster()
Definition: Unit.h:1652
Aura * AddAura(uint32 spellId, Unit *target)
Definition: Unit.cpp:11618
bool HasAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint32 reqEffMask=0) const
Definition: Unit.cpp:4664
InstanceScript * GetInstanceScript() const
Definition: Object.cpp:1042
TempSummon * SummonCreature(uint32 entry, Position const &pos, TempSummonType despawnType=TEMPSUMMON_MANUAL_DESPAWN, Milliseconds despawnTime=0s, uint32 vehId=0, uint32 spellId=0, ObjectGuid privateObjectOwner=ObjectGuid::Empty)
Definition: Object.cpp:2025
void setActive(bool isActiveObject)
Definition: Object.cpp:922
void SetFarVisible(bool on)
Definition: Object.cpp:973
virtual uint32 GetData(uint32) const
Definition: ZoneScript.h:91
virtual void SetData(uint32, uint32)
Definition: ZoneScript.h:92
CreatureAI * GetAI(Creature *creature) const override
TC_GAME_API Creature * GetCreature(WorldObject const &u, ObjectGuid const &guid)
void Start(bool isActiveAttacker=true, ObjectGuid playerGUID=ObjectGuid::Empty, Quest const *quest=nullptr, bool instantRespawn=false, bool canLoopPath=false)
void SetDespawnAtFar(bool despawn)
void SetDespawnAtEnd(bool despawn)
void LoadPath(uint32 pathId)
void UpdateAI(uint32 diff) override
void WaypointReached(uint32 waypointId, uint32) override
void JustSummoned(Creature *summoned) override
bool OnGossipSelect(Player *player, uint32, uint32 gossipListId) override
@ EMOTE_TROUBLED_SLEEP
@ SAY_MUST_CONTINUE
@ SAY_BANISH_THE_SPIRITS
@ SAY_ATTACKED
@ SAY_MUTANUS_THE_DEVOURER
@ NPC_NIGHTMARE_ECTOPLASM
@ SAY_TEMPLE_OF_PROMISE
@ PATH_ESCORT_NARALEX_DISCIPLE
@ SPELL_MARK_OF_THE_WILD_RANK_2
@ SAY_FAREWELL
@ SAY_NARALEX_AWAKES
@ EMOTE_HORRENDOUS_VISION
@ SAY_CAVERNS_PURIFIED
@ SAY_MAKE_PREPARATIONS
@ SPELL_NARALEXS_AWAKENING
@ NPC_MUTANUS_THE_DEVOURER
@ GOSSIP_OPTION_LET_EVENT_BEGIN
@ SAY_THANK_YOU
@ SPELL_FLIGHT_FORM
@ SAY_I_AM_AWAKE
@ NPC_DEVIATE_MOCCASIN
@ EMOTE_AWAKENING_RITUAL
@ NPC_TEXT_NARALEX_SLEEPS_AGAIN
@ SPELL_SERPENTINE_CLEANSING
@ SAY_EMERALD_DREAM
@ SAY_BEYOND_THIS_CORRIDOR
@ NPC_DEVIATE_RAVAGER
@ EMOTE_WRITHE_IN_AGONY
@ NPC_DEVIATE_VIPER
@ NPC_TEXT_FANGLORDS_ARE_DEAD
@ SAY_AT_LAST
void AddSC_wailing_caverns()
@ TYPE_LADY_ANACONDRA
@ TYPE_NARALEX_PART1
@ DATA_NARALEX
@ TYPE_NARALEX_EVENT
@ TYPE_LORD_SERPENTIS
@ TYPE_NARALEX_PART2
@ TYPE_NARALEX_PART3
@ TYPE_MUTANUS_THE_DEVOURER
@ TYPE_LORD_COBRAHN
@ TYPE_LORD_PYTHAS
@ TYPE_NARALEX_YELLED