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:
139 break;
140
141 case EVENT_PROGRESS_1:
142 {
144
146
147 std::vector<Creature*> elites;
149 for (Creature* elite : elites)
150 elite->SetImmuneToNPC(false);
151 me->SetImmuneToNPC(false);
153 break;
154 }
155 case EVENT_PROGRESS_2:
158 break;
159
160 case EVENT_PROGRESS_3:
163 break;
164 case EVENT_PROGRESS_4:
167 break;
168 case EVENT_PROGRESS_5:
171 break;
172 case EVENT_PROGRESS_6:
173 {
175
176 std::vector<Creature*> elites;
178 for (Creature* elite : elites)
179 elite->SetEmoteState(EMOTE_STATE_READY1H);
181 break;
182 }
183
184 case EVENT_OUTRO_1:
187 break;
188 case EVENT_OUTRO_2:
189 {
191
192 std::vector<Creature*> elites;
194 for (Creature* elite : elites)
195 elite->DespawnOrUnsummon();
197 break;
198 }
199 default:
200 break;
201 }
202 }
203 }
204
205 if (!UpdateVictim())
206 return;
207
208 _combatEvents.Update(diff);
209
211 return;
212
213 while (uint32 eventId = _combatEvents.ExecuteEvent())
214 {
215 switch (eventId)
216 {
217 case EVENT_STRIKE:
219 _combatEvents.Repeat(10s, 15s);
220 break;
221 case EVENT_BASH:
223 _combatEvents.Repeat(20s, 25s);
224 break;
227 _combatEvents.Repeat(30s, 50s);
228 break;
229 default:
230 break;
231 }
232
234 return;
235 }
236
238 }
239
240 bool OnGossipHello(Player* player) override
241 {
243 {
244 case NOT_STARTED:
246 player->SendPreparedGossip(me);
247 return true;
248 case SPECIAL:
249 case IN_PROGRESS:
251 player->SendPreparedGossip(me);
252 return true;
253 case DONE:
255 player->SendPreparedGossip(me);
256 return true;
257 default:
258 break;
259 }
260 return false;
261 }
262
263 bool OnGossipSelect(Player* player, uint32 menuId, uint32 /*gossipListId*/) override
264 {
265 if (menuId == GOSSIP_MENU_NOT_STARTED)
266 {
270 {
271 CloseGossipMenuFor(player);
273 }
274 }
275 return false;
276 }
277
278private:
282};
283
285{
288
289// 25185 - Itch
291{
293
294 bool Validate(SpellInfo const* /*spellInfo*/) override
295 {
297 }
298
299 void AfterRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
300 {
301 if (GetTargetApplication()->GetRemoveMode() != AURA_REMOVE_BY_EXPIRE)
302 return;
303
304 if (Unit* caster = GetCaster())
305 caster->CastSpell(GetTarget(), SPELL_HIVEZARA_CATALYST, true);
306 }
307
312};
313
int32_t int32
Definition Define.h:129
uint32_t uint32
Definition Define.h:133
@ IN_PROGRESS
@ DONE
@ SPECIAL
@ NOT_STARTED
#define RegisterSpellScript(spell_script)
Definition ScriptMgr.h:1128
void GetCreatureListWithEntryInGrid(Container &container, WorldObject *source, uint32 entry, float maxSearchRange)
void CloseGossipMenuFor(Player *player)
@ EFFECT_0
@ EMOTE_STATE_READY1H
@ AURA_REMOVE_BY_EXPIRE
AuraEffectHandleModes
@ AURA_EFFECT_HANDLE_REAL
@ SPELL_AURA_DUMMY
#define AuraEffectRemoveFn(F, I, N, M)
@ UNIT_NPC_FLAG_VENDOR
@ UNIT_STATE_CASTING
Definition Unit.h:235
AuraApplication const * GetTargetApplication() const
HookList< EffectApplyHandler > AfterEffectRemove
Unit * GetCaster() const
Unit * GetTarget() const
bool UpdateVictim()
Creature *const me
Definition CreatureAI.h:82
void DespawnOrUnsummon(Milliseconds timeToDespawn=0s, Seconds forceRespawnTime=0s)
void SetImmuneToNPC(bool apply) override
Definition Creature.h:132
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
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
SpellCastResult DoCastVictim(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.cpp:166
Definition Unit.h:769
MotionMaster * GetMotionMaster()
Definition Unit.h:1667
bool IsAlive() const
Definition Unit.h:1234
void RemoveNpcFlag(NPCFlags flags)
Definition Unit.h:1098
void SetEmoteState(Emote emote)
Definition Unit.h:967
void SetNpcFlag(NPCFlags flags)
Definition Unit.h:1097
bool HasUnitState(const uint32 f) const
Definition Unit.h:876
bool IsInCombat() const
Definition Unit.h:1144
virtual uint32 GetData(uint32) const
Definition ZoneScript.h:55
virtual void SetData(uint32, uint32)
Definition ZoneScript.h:56
static bool ValidateSpellInfo(std::initializer_list< uint32 > spellIds)
void AfterRemove(AuraEffect const *, AuraEffectHandleModes)
bool Validate(SpellInfo const *) override
PrepareAuraScript(spell_ruins_of_ahnqiraj_itch)
@ 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
bool OnGossipHello(Player *player) override
void WaypointPathEnded(uint32, uint32 pathId) override
InstanceScript * _instance
void JustAppeared() override
npc_andorov(Creature *creature)
void UpdateAI(uint32 diff) override