TrinityCore
Loading...
Searching...
No Matches
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#include "ScriptMgr.h"
19#include "InstanceScript.h"
20#include "MotionMaster.h"
21#include "Player.h"
22#include "ScriptedCreature.h"
23#include "ScriptedGossip.h"
24#include "wailing_caverns.h"
25
26/*
27 * Spawns are supposed to be pooled, NYI
28 * Some spawns attack on spawn, some moves to position, NYI, all attacks on spawn currently
29 * This is based on Cata sniffs and WotLK classic video, timers were changed in Cata and requires to be revisited
30 */
31
55
66
100
110
119
124
125// 3678 - Disciple of Naralex
127{
128 npc_disciple_of_naralex(Creature* creature) : ScriptedAI(creature), _instance(creature->GetInstanceScript()) { }
129
130 void Reset() override
131 {
133 }
134
135 void JustEngagedWith(Unit* who) override
136 {
139
140 if (roll_chance_i(30))
141 Talk(SAY_AGGRO, who);
142 }
143
144 void JustSummoned(Creature* summoned) override
145 {
146 summoned->AI()->AttackStart(me);
147 }
148
149 void DoAction(int32 action) override
150 {
151 if (action == ACTION_ALL_DONE)
153 }
154
155 void WaypointPathEnded(uint32/* waypointId*/, uint32 pathId) override
156 {
157 switch (pathId)
158 {
159 case PATH_PROGRESS_1:
161 break;
162 case PATH_PROGRESS_2:
164 break;
165 case PATH_PROGRESS_3:
167 break;
168 case PATH_PROGRESS_4:
170 break;
171 case PATH_PROGRESS_5:
173 break;
174 default:
175 break;
176 }
177 }
178
179 void UpdateAI(uint32 diff) override
180 {
181 if (!me->IsInCombat())
182 {
183 _events.Update(diff);
184
185 while (uint32 eventId = _events.ExecuteEvent())
186 {
187 switch (eventId)
188 {
189 case EVENT_PROGRESS_1:
193 break;
194 case EVENT_PROGRESS_2:
197 break;
198 case EVENT_PROGRESS_3:
200 break;
201
202 case EVENT_PROGRESS_4:
205 break;
206 case EVENT_PROGRESS_5:
209 break;
210 case EVENT_PROGRESS_6:
211 me->SetFacingTo(5.742133140563964843f);
214 break;
215 case EVENT_PROGRESS_7:
217 break;
218
219 case EVENT_PROGRESS_8:
223 break;
224 case EVENT_PROGRESS_9:
227 break;
231 break;
234 break;
235
239 break;
242 break;
243
247 break;
252 break;
256 break;
259 naralex->AI()->Talk(EMOTE_AWAKENING_1);
261 break;
265 break;
268 naralex->AI()->Talk(EMOTE_AWAKENING_2);
270 break;
273 naralex->AI()->Talk(EMOTE_AWAKENING_3);
276 break;
278 {
280 {
281 naralex->SetStandState(UNIT_STAND_STATE_STAND);
282 naralex->AI()->Talk(SAY_AWAKENING_4);
283 }
285 break;
286 }
291 break;
294 naralex->AI()->Talk(SAY_AWAKENING_5);
296 break;
299 naralex->AI()->Talk(SAY_AWAKENING_6);
301 break;
305 naralex->CastSpell(naralex, SPELL_OWL_FORM);
308 break;
310 {
312 {
313 naralex->SetDisableGravity(true);
314 naralex->GetMotionMaster()->MovePath(PATH_NARALEX, false);
315 }
316 me->SetDisableGravity(true);
318 break;
319 }
320
323 naralex->DespawnOrUnsummon();
325 break;
326 default:
327 break;
328 }
329 }
330 }
331
332 if (!UpdateVictim())
333 return;
334
335 _combatEvents.Update(diff);
336
337 while (uint32 eventId = _combatEvents.ExecuteEvent())
338 {
339 switch (eventId)
340 {
341 case EVENT_SLEEP:
343 DoCast(target, SPELL_SLEEP);
344 _combatEvents.Repeat(20s, 30s);
345 break;
347 if (HealthBelowPct(80))
349 _combatEvents.Repeat(10s, 15s);
350 break;
351 default:
352 break;
353 }
354 }
355
357 }
358
359 bool OnGossipHello(Player* player) override
360 {
362
365 {
366 player->PrepareGossipMenu(me, GOSSIP_MENU_EVENT, true);
367 player->SendPreparedGossip(me);
368 return true;
369 }
370
371 return false;
372 }
373
374 bool OnGossipSelect(Player* player, uint32 /*menuId*/, uint32 /*gossipListId*/) override
375 {
376 CloseGossipMenuFor(player);
378
379 return false;
380 }
381
382private:
386};
387
int32_t int32
Definition Define.h:129
uint32_t uint32
Definition Define.h:133
@ DONE
bool roll_chance_i(int chance)
Definition Random.h:59
void CloseGossipMenuFor(Player *player)
@ FACTION_FRIENDLY
@ FACTION_ESCORTEE_N_NEUTRAL_ACTIVE
@ UNIT_STAND_STATE_STAND
Definition UnitDefines.h:34
@ UNIT_NPC_FLAG_GOSSIP
bool UpdateVictim()
Creature *const me
Definition CreatureAI.h:82
void DespawnOrUnsummon(Milliseconds timeToDespawn=0s, Seconds forceRespawnTime=0s)
CreatureAI * AI() const
Definition Creature.h:154
void Update(uint32 time)
Definition EventMap.h:67
void Repeat(Milliseconds time)
Definition EventMap.cpp:63
EventId ExecuteEvent()
Definition EventMap.cpp:73
void ScheduleEvent(EventId eventId, Milliseconds time, GroupIndex group=0u, PhaseIndex phase=0u)
Definition EventMap.cpp:36
void Reset()
Definition EventMap.cpp:21
Creature * GetCreature(uint32 type)
EncounterState GetBossState(uint32 id) const
void MovePath(uint32 pathId, bool repeatable)
void SendPreparedGossip(WorldObject *source)
Definition Player.cpp:14052
void PrepareGossipMenu(WorldObject *source, uint32 menuId=0, bool showQuests=false)
Definition Player.cpp:13886
void DoMeleeAttackIfReady()
Definition UnitAI.cpp:54
SpellCastResult DoCastSelf(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.h:241
Unit * SelectTarget(SelectTargetMethod targetType, uint32 offset=0, float dist=0.0f, bool playerOnly=false, bool withTank=true, int32 aura=0)
Definition UnitAI.cpp:96
virtual void AttackStart(Unit *)
Definition UnitAI.cpp:30
SpellCastResult DoCast(uint32 spellId)
Definition UnitAI.cpp:106
Definition Unit.h:769
void SetFaction(uint32 faction) override
Definition Unit.h:974
MotionMaster * GetMotionMaster()
Definition Unit.h:1667
void RemoveNpcFlag(NPCFlags flags)
Definition Unit.h:1098
bool SetDisableGravity(bool disable, bool updateAnimTier=true)
Definition Unit.cpp:13286
void RemoveAurasDueToSpell(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint8 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition Unit.cpp:3784
void SetFacingTo(float ori, bool force=true, uint32 movementId=EVENT_FACE)
Definition Unit.cpp:13250
bool IsInCombat() const
Definition Unit.h:1144
void SummonCreatureGroup(uint8 group, std::list< TempSummon * > *list=nullptr)
Definition Object.cpp:2082
bool HealthBelowPct(uint32 pct) const
void JustEngagedWith(Unit *who) override
void WaypointPathEnded(uint32, uint32 pathId) override
void DoAction(int32 action) override
void UpdateAI(uint32 diff) override
npc_disciple_of_naralex(Creature *creature)
bool OnGossipSelect(Player *player, uint32, uint32) override
bool OnGossipHello(Player *player) override
void JustSummoned(Creature *summoned) override
void AddSC_wailing_caverns()
DiscipleSummonGroups
@ SUMMON_GROUP_2
@ SUMMON_GROUP_4
@ SUMMON_GROUP_1
@ SUMMON_GROUP_3
@ SUMMON_GROUP_5
@ GOSSIP_MENU_EVENT
DiscipleTexts
@ SAY_PROGRESS_9
@ SAY_PROGRESS_3
@ SAY_PROGRESS_8
@ EMOTE_AWAKENING_3
@ SAY_PROGRESS_6
@ SAY_AGGRO
@ SAY_AWAKENING_4
@ SAY_PROGRESS_4
@ SAY_PROGRESS_2
@ EMOTE_AWAKENING_1
@ SAY_PROGRESS_7
@ SAY_ALL_DONE
@ SAY_PROGRESS_1
@ SAY_AWAKENING_6
@ EMOTE_AWAKENING_2
@ SAY_AWAKENING_5
@ SAY_PROGRESS_5
DiscipleSpells
@ SPELL_SLEEP
@ SPELL_MARK_OF_THE_WILD
@ SPELL_NARALEXS_AWAKENING
@ SPELL_DRUIDS_POTION
@ SPELL_OWL_FORM
@ SPELL_SERPENTINE_CLEANSING
DisciplePaths
@ PATH_PROGRESS_1
@ PATH_PROGRESS_4
@ PATH_PROGRESS_3
@ PATH_PROGRESS_5
@ PATH_PROGRESS_2
@ PATH_NARALEX
DiscipleEvents
@ EVENT_PROGRESS_12
@ EVENT_PROGRESS_5
@ EVENT_PROGRESS_27
@ EVENT_PROGRESS_22
@ EVENT_PROGRESS_20
@ EVENT_PROGRESS_23
@ EVENT_PROGRESS_21
@ EVENT_PROGRESS_7
@ EVENT_PROGRESS_26
@ EVENT_PROGRESS_6
@ EVENT_PROGRESS_8
@ EVENT_PROGRESS_16
@ EVENT_PROGRESS_25
@ EVENT_PROGRESS_19
@ EVENT_PROGRESS_1
@ EVENT_PROGRESS_2
@ EVENT_PROGRESS_15
@ EVENT_PROGRESS_14
@ EVENT_PROGRESS_24
@ EVENT_PROGRESS_9
@ EVENT_PROGRESS_11
@ EVENT_PROGRESS_18
@ EVENT_PROGRESS_4
@ EVENT_PROGRESS_10
@ EVENT_PROGRESS_17
@ EVENT_DRUIDS_POTION
@ EVENT_SLEEP
@ EVENT_PROGRESS_3
@ EVENT_PROGRESS_13
#define RegisterWailingCavernsCreatureAI(ai_name)
@ DATA_NARALEX
@ DATA_LORD_PYTHAS
@ DATA_LORD_SERPENTIS
@ DATA_LADY_ANACONDRA
@ DATA_LORD_COBRAHN
@ ACTION_ALL_DONE