TrinityCore
Loading...
Searching...
No Matches
ruins_of_ahnqiraj.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 "ruins_of_ahnqiraj.h"
23#include "ScriptedCreature.h"
24#include "ScriptedGossip.h"
25#include "SpellAuras.h"
26#include "SpellScript.h"
27
28/*
29 * Some quick facts about the event:
30 *
31 * Event can be completed with or without Andorov, waves will be engaged one after one
32 * Looks like waves aren't linked in some order, for example engaging and killing all waves at once will engage Rajaxx
33 without any issues. Engaging and killing several waves at once will engage next wave. It is unclear what happens if
34 random waves are engaged and killed, probably linked to them waves will be engaged. As well it is unclear what happens
35 if waves are engaged and killed in reverse order
36 * There is a bug on retail when all waves respawn. It is unclear how exactly waves should respawn, NYI
37 * According to patch notes, Andorov should respawn after 15 min if killed, NYI
38 * It is unclear if next wave should be started after specific amount of time even if previous is not yet defeated
39 * Entire event requires additional research since some things may be missing or implemented wrongly
40 */
41
51
58
77
89
90// 15471 - Lieutenant General Andorov
91struct npc_andorov : public ScriptedAI
92{
93 npc_andorov(Creature* creature) : ScriptedAI(creature), _instance(creature->GetInstanceScript()) { }
94
95 void JustAppeared() override
96 {
98 }
99
100 void Reset() override
101 {
103 }
104
105 void JustEngagedWith(Unit* /*who*/) override
106 {
110 }
111
112 void WaypointPathEnded(uint32 /*waypointId*/, uint32 pathId) override
113 {
114 if (pathId == PATH_EVENT)
116 }
117
118 void DoAction(int32 action) override
119 {
122 if (action == ACTION_RAJAXX_DEFEATED && me->IsAlive())
124 }
125
126 void UpdateAI(uint32 diff) override
127 {
128 if (!me->IsInCombat())
129 {
130 _events.Update(diff);
131
132 while (uint32 eventId = _events.ExecuteEvent())
133 {
134 switch (eventId)
135 {
136 case EVENT_INTRO_1:
140 break;
141
142 case EVENT_PROGRESS_1:
143 {
146
148
149 std::vector<Creature*> elites;
151 for (Creature* elite : elites)
152 elite->SetImmuneToNPC(false);
153 me->SetImmuneToNPC(false);
155 break;
156 }
157 case EVENT_PROGRESS_2:
160 break;
161
162 case EVENT_PROGRESS_3:
165 break;
166 case EVENT_PROGRESS_4:
169 break;
170 case EVENT_PROGRESS_5:
173 break;
174 case EVENT_PROGRESS_6:
175 {
177
178 std::vector<Creature*> elites;
180 for (Creature* elite : elites)
181 elite->SetEmoteState(EMOTE_STATE_READY1H);
183 break;
184 }
185
186 case EVENT_OUTRO_1:
190 break;
191 case EVENT_OUTRO_2:
192 {
194
195 std::vector<Creature*> elites;
197 for (Creature* elite : elites)
198 elite->DespawnOrUnsummon();
200 break;
201 }
202 default:
203 break;
204 }
205 }
206 }
207
208 if (!UpdateVictim())
209 return;
210
211 _combatEvents.Update(diff);
212
214 return;
215
216 while (uint32 eventId = _combatEvents.ExecuteEvent())
217 {
218 switch (eventId)
219 {
220 case EVENT_STRIKE:
222 _combatEvents.Repeat(10s, 15s);
223 break;
224 case EVENT_BASH:
226 _combatEvents.Repeat(20s, 25s);
227 break;
230 _combatEvents.Repeat(30s, 50s);
231 break;
232 default:
233 break;
234 }
235
237 return;
238 }
239 }
240
241 bool OnGossipSelect(Player* player, uint32 menuId, uint32 /*gossipListId*/) override
242 {
243 if (menuId == GOSSIP_MENU_NOT_STARTED)
244 {
248 {
249 CloseGossipMenuFor(player);
251 }
252 }
253 return false;
254 }
255
256private:
260};
261
263{
266
267// 25185 - Itch
269{
270 bool Validate(SpellInfo const* /*spellInfo*/) override
271 {
273 }
274
275 void AfterRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
276 {
277 if (GetTargetApplication()->GetRemoveMode() != AURA_REMOVE_BY_EXPIRE)
278 return;
279
280 if (Unit* caster = GetCaster())
281 caster->CastSpell(GetTarget(), SPELL_HIVEZARA_CATALYST, true);
282 }
283
288};
289
int32_t int32
Definition Define.h:150
uint32_t uint32
Definition Define.h:154
@ IN_PROGRESS
@ DONE
@ SPECIAL
#define RegisterSpellScript(spell_script)
Definition ScriptMgr.h:1383
void GetCreatureListWithEntryInGrid(Container &container, WorldObject *source, uint32 entry, float maxSearchRange)
void CloseGossipMenuFor(Player *player)
@ EFFECT_0
@ EMOTE_STATE_READY1H
AuraEffectHandleModes
@ AURA_EFFECT_HANDLE_REAL
@ AURA_REMOVE_BY_EXPIRE
@ SPELL_AURA_DUMMY
#define AuraEffectRemoveFn(F, I, N, M)
@ UNIT_NPC_FLAG_VENDOR
@ UNIT_STATE_CASTING
Definition Unit.h:290
AuraApplication const * GetTargetApplication() const
HookList< EffectApplyHandler > AfterEffectRemove
Unit * GetCaster() const
Unit * GetTarget() const
bool UpdateVictim()
Creature *const me
Definition CreatureAI.h:63
void SetVendor(NPCFlags flags, bool apply)
void DespawnOrUnsummon(Milliseconds timeToDespawn=0s, Seconds forceRespawnTime=0s)
void SetImmuneToNPC(bool apply) override
Definition Creature.h:193
void SetGossipMenuId(uint32 gossipMenuId)
void Update(uint32 time)
Definition EventMap.h:77
void Repeat(Milliseconds time)
Definition EventMap.cpp:67
EventId ExecuteEvent()
Definition EventMap.cpp:77
void ScheduleEvent(EventId eventId, Milliseconds time, GroupIndex group=0u, PhaseIndex phase=0u)
Definition EventMap.cpp:40
void Reset()
Definition EventMap.cpp:25
EncounterState GetBossState(uint32 id) const
void MovePath(uint32 pathId, bool repeatable, Optional< Milliseconds > duration={}, Optional< float > speed={}, MovementWalkRunSpeedSelectionMode speedSelectionMode=MovementWalkRunSpeedSelectionMode::Default, Optional< std::pair< Milliseconds, Milliseconds > > waitTimeRangeAtPathEnd={}, Optional< float > wanderDistanceAtPathEnds={}, Optional< bool > followPathBackwardsFromEndToStart={}, Optional< bool > exactSplinePath={}, bool generatePath=true, Optional< MovementFadeObject > fadeObject={}, Scripting::v2::ActionResultSetter< MovementStopReason > &&scriptResult={})
static bool ValidateSpellInfo(std::initializer_list< uint32 > spellIds)
SpellCastResult DoCastSelf(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.h:160
SpellCastResult DoCastVictim(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.cpp:172
Definition Unit.h:647
MotionMaster * GetMotionMaster()
Definition Unit.h:1750
bool IsAlive() const
Definition Unit.h:1205
void SetEmoteState(Emote emote)
Definition Unit.h:880
bool HasUnitState(const uint32 f) const
Definition Unit.h:755
bool IsInCombat() const
Definition Unit.h:1073
virtual void SetData(uint32, uint32)
Definition ZoneScript.h:100
void AfterRemove(AuraEffect const *, AuraEffectHandleModes)
bool Validate(SpellInfo const *) override
@ SPELL_HIVEZARA_CATALYST
@ SAY_PROGRESS_3
@ SAY_PROGRESS_6
@ SAY_PROGRESS_4
@ SAY_PROGRESS_2
@ SAY_PROGRESS_1
@ SAY_PROGRESS_5
@ SPELL_STRIKE
@ SPELL_BASH
@ SPELL_AURA_OF_COMMAND
@ EVENT_PROGRESS_5
@ EVENT_AURA_OF_COMMAND
@ EVENT_OUTRO_2
@ EVENT_INTRO_1
@ EVENT_PROGRESS_6
@ EVENT_BASH
@ EVENT_PROGRESS_1
@ EVENT_PROGRESS_2
@ EVENT_PROGRESS_4
@ EVENT_OUTRO_1
@ EVENT_STRIKE
@ EVENT_PROGRESS_3
void AddSC_ruins_of_ahnqiraj()
@ GOSSIP_MENU_NOT_STARTED
@ NPC_KALDOREI_ELITE
@ GOSSIP_MENU_IN_PROGRESS
@ PATH_EVENT
@ PATH_SPAWN
@ GOSSIP_MENU_FINISHED
@ ACTION_RAJAXX_DEFEATED
#define RegisterAQ20CreatureAI(ai_name)
@ DATA_RAJAXX
@ DATA_ANDOROV_EVENT_STATE
bool OnGossipSelect(Player *player, uint32 menuId, uint32) override
void JustEngagedWith(Unit *) override
void DoAction(int32 action) override
void Reset() override
void WaypointPathEnded(uint32, uint32 pathId) override
InstanceScript * _instance
void JustAppeared() override
npc_andorov(Creature *creature)
void UpdateAI(uint32 diff) override