fix(Scripts/AhnQiraj): Implemented General Andorov event. (#12645)

This commit is contained in:
UltraNix
2022-08-21 06:34:34 +02:00
committed by GitHub
parent 39386c2228
commit c65d4bbe56
5 changed files with 326 additions and 7 deletions

View File

@@ -77,8 +77,15 @@ struct boss_kurinnaxx : public BossAI
void JustDied(Unit* killer) override
{
if (killer)
{
killer->GetMap()->LoadGrid(-9502.80f, 2042.65f); // Ossirian grid
if (Player* player = killer->GetCharmerOrOwnerPlayerOrPlayerItself())
{
player->SummonCreature(NPC_ANDOROV, -8538.177f, 1486.0956f, 32.39054f, 3.7638654f, TEMPSUMMON_CORPSE_DESPAWN, 600000000);
}
}
if (Creature* ossirian = instance->GetCreature(DATA_OSSIRIAN))
{
ossirian->setActive(true);

View File

@@ -15,21 +15,22 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "SmartAI.h"
#include "ScriptMgr.h"
#include "ScriptedCreature.h"
#include "ScriptedEscortAI.h"
#include "ScriptedGossip.h"
#include "SpellScript.h"
#include "ruins_of_ahnqiraj.h"
enum Yells
{
SAY_UNK1 = 6,
SAY_UNK2 = 7,
SAY_UNK3 = 8,
// The time of our retribution is at hand! Let darkness reign in the hearts of our enemies! Sound: 8645 Emote: 35
SAY_DEATH = 9,
SAY_CHANGEAGGRO = 10,
SAY_KILLS_ANDOROV = 11,
SAY_COMPLETE_QUEST = 12 // Yell when realm complete quest 8743 for world event
// Warriors, Captains, continue the fight! Sound: 8640
// Warriors, Captains, continue the fight! Sound: 8640
};
enum Spells
@@ -60,6 +61,12 @@ struct boss_rajaxx : public BossAI
{
Talk(SAY_DEATH);
_JustDied();
if (Creature* andorov = instance->instance->GetCreature(instance->GetGuidData(DATA_ANDOROV)))
{
andorov->SetNpcFlag(UNIT_NPC_FLAG_GOSSIP | UNIT_NPC_FLAG_VENDOR);
andorov->ForceValuesUpdateAtIndex(UNIT_NPC_FLAGS);
}
}
void EnterCombat(Unit* /*victim*/) override
@@ -123,8 +130,236 @@ class spell_rajaxx_thundercrash : public SpellScript
}
};
enum AndorovMisc
{
// Factions
FACTION_ANDOROV_ESCORT = 250,
// Spells
SPELL_AURA_OF_COMMAND = 25516,
SPELL_BASH = 25515,
SPELL_STRIKE = 22591,
// Texts
SAY_ANDOROV_INTRO = 0, // Before for the first wave
SAY_ANDOROV_ATTACK = 1, // Beginning the event
// Gossips
GOSSIP_ANDRNOV = 7047,
// Events
EVENT_BASH = 1,
EVENT_COMMAND_AURA,
EVENT_STRIKE
};
struct npc_general_andorov : public npc_escortAI
{
npc_general_andorov(Creature* creature) : npc_escortAI(creature), _summons(me)
{
instance = creature->GetInstanceScript();
SetDespawnAtEnd(false);
SetDespawnAtFar(false);
}
void sGossipSelect(Player* player, uint32 /*uiSender*/, uint32 uiAction) override
{
if (uiAction)
{
CloseGossipMenuFor(player);
me->RemoveNpcFlag(UNIT_NPC_FLAG_GOSSIP);
SetEscortPaused(false);
}
}
void InitializeAI() override
{
me->SetReactState(REACT_PASSIVE);
for (uint8 i = 0; i < 4; ++i)
{
if (Creature* kaldoreielitist = me->SummonCreature(NPC_KALDOREI_ELITE, *me))
{
kaldoreielitist->SetImmuneToNPC(true);
kaldoreielitist->SetUnitFlag(UNIT_FLAG_NON_ATTACKABLE);
kaldoreielitist->SetReactState(REACT_PASSIVE);
kaldoreielitist->SetFaction(FACTION_ESCORT_H_ACTIVE);
CAST_AI(SmartAI, kaldoreielitist->AI())->SetFollow(me, 2.5f, 0.f + i * (M_PI / 2));
}
}
me->SetFaction(FACTION_ANDOROV_ESCORT);
Endwaypoint = false;
_initialAttackTimer = 5 * IN_MILLISECONDS;
_paused = false;
Start(false, true);
me->SetImmuneToNPC(true);
me->SetUnitFlag(UNIT_FLAG_NON_ATTACKABLE);
}
void JustSummoned(Creature* summon) override
{
_summons.Summon(summon);
}
void EnterCombat(Unit* /*who*/) override
{
events.ScheduleEvent(EVENT_BASH, urand(8, 11) * IN_MILLISECONDS);
events.ScheduleEvent(EVENT_COMMAND_AURA, urand(1, 3) * IN_MILLISECONDS);
events.ScheduleEvent(EVENT_STRIKE, urand(2, 5) * IN_MILLISECONDS);
}
void WaypointReached(uint32 waypointId) override
{
switch (waypointId)
{
case 10:
me->HandleEmoteCommand(EMOTE_ONESHOT_CHEER);
SetEscortPaused(true);
me->SetNpcFlag(UNIT_NPC_FLAG_GOSSIP);
_paused = true;
break;
case 14:
SetEscortPaused(true);
if (!Endwaypoint)
{
Endwaypoint = true;
Talk(SAY_ANDOROV_INTRO);
me->SetImmuneToNPC(false);
me->RemoveUnitFlag(UNIT_FLAG_NON_ATTACKABLE);
me->SetReactState(REACT_AGGRESSIVE);
for (ObjectGuid const& guid : _summons)
{
if (Creature* kaldoreielitist = ObjectAccessor::GetCreature(*me, guid))
{
kaldoreielitist->SetImmuneToNPC(false);
kaldoreielitist->RemoveUnitFlag(UNIT_FLAG_NON_ATTACKABLE);
kaldoreielitist->SetReactState(REACT_AGGRESSIVE);
}
}
}
break;
}
}
void JustDied(Unit* /*killer*/) override
{
_summons.DespawnAll();
if (Creature* rajaxx = instance->GetCreature(DATA_RAJAXX))
{
rajaxx->AI()->Talk(SAY_KILLS_ANDOROV);
}
}
void KilledUnit(Unit* victim) override
{
if (victim->GetEntry() == NPC_RAJAXX)
{
Talk(SAY_ANDOROV_ATTACK);
}
}
void MoveInLineOfSight(Unit* who) override
{
// If Rajaxx is in range attack him
if (who->GetEntry() == NPC_RAJAXX && me->IsWithinDistInMap(who, 50.0f))
{
AttackStart(who);
}
ScriptedAI::MoveInLineOfSight(who);
}
uint32 GetData(uint32 type) const override
{
if (type == DATA_ANDOROV)
{
return Endwaypoint;
}
return 0;
}
void UpdateEscortAI(uint32 diff) override
{
if (Endwaypoint && _initialAttackTimer)
{
me->SetFacingTo(2.8772139f);
if (_initialAttackTimer <= diff)
{
_initialAttackTimer = 0;
if (Creature* queez = instance->GetCreature(DATA_QUUEZ))
{
queez->AI()->AttackStart(me);
}
}
else
{
_initialAttackTimer -= diff;
}
}
if (_paused)
{
_paused = false;
me->SetFacingTo(5.63741350f);
}
if (!UpdateVictim())
{
return;
}
events.Update(diff);
if (me->HasUnitState(UNIT_STATE_CASTING))
{
return;
}
while (uint32 eventId = events.ExecuteEvent())
{
switch (eventId)
{
case EVENT_BASH:
DoCastVictim(SPELL_BASH);
events.ScheduleEvent(EVENT_BASH, urand(12, 15) * IN_MILLISECONDS);
break;
case EVENT_COMMAND_AURA:
DoCastSelf(SPELL_AURA_OF_COMMAND, true);
events.ScheduleEvent(EVENT_COMMAND_AURA, urand(10, 20) * IN_MILLISECONDS);
break;
case EVENT_STRIKE:
DoCastVictim(SPELL_STRIKE);
events.ScheduleEvent(EVENT_STRIKE, urand(4, 6) * IN_MILLISECONDS);
break;
default:
break;
}
}
DoMeleeAttackIfReady();
}
private:
InstanceScript* instance;
EventMap events;
SummonList _summons;
uint32 _initialAttackTimer;
bool Endwaypoint;
bool _paused;
};
void AddSC_boss_rajaxx()
{
RegisterRuinsOfAhnQirajCreatureAI(boss_rajaxx);
RegisterSpellScript(spell_rajaxx_thundercrash);
RegisterRuinsOfAhnQirajCreatureAI(npc_general_andorov);
}

View File

@@ -17,6 +17,7 @@
#include "CreatureGroups.h"
#include "InstanceScript.h"
#include "Player.h"
#include "ScriptMgr.h"
#include "TaskScheduler.h"
#include "ruins_of_ahnqiraj.h"
@@ -76,6 +77,17 @@ public:
_rajaxWaveCounter = 0;
}
void OnPlayerEnter(Player* player) override
{
if (GetBossState(DATA_KURINNAXX) == DONE && GetBossState(DATA_RAJAXX) != DONE)
{
if (!_andorovGUID)
{
player->SummonCreature(NPC_ANDOROV, -8538.177f, 1486.0956f, 32.39054f, 3.7638654f, TEMPSUMMON_CORPSE_DESPAWN, 600000000);
}
}
}
void OnCreatureCreate(Creature* creature) override
{
InstanceScript::OnCreatureCreate(creature);
@@ -101,6 +113,9 @@ public:
_sandVortexes.push_back(creature->GetGUID());
creature->SetVisible(false);
break;
case NPC_ANDOROV:
_andorovGUID = creature->GetGUID();
break;
}
}
@@ -167,7 +182,8 @@ public:
case NPC_PAKKON:
case NPC_ZERRAN:
_scheduler.CancelAll();
_scheduler.Schedule(1s, [this, formation](TaskContext /*context*/) {
_scheduler.Schedule(1s, [this, formation](TaskContext /*context*/)
{
if (!formation->IsAnyMemberAlive())
{
CallNextRajaxxLeader(true);
@@ -234,6 +250,8 @@ public:
return _ossirianGUID;
case DATA_PARALYZED:
return _paralyzedGUID;
case DATA_ANDOROV:
return _andorovGUID;
}
return ObjectGuid::Empty;
@@ -301,7 +319,15 @@ public:
if (nextLeader->IsAlive())
{
nextLeader->SetInCombatWithZone();
Creature* generalAndorov = instance->GetCreature(_andorovGUID);
if (generalAndorov && generalAndorov->IsAlive() && generalAndorov->AI()->GetData(DATA_ANDOROV))
{
nextLeader->AI()->AttackStart(generalAndorov);
}
else
{
nextLeader->SetInCombatWithZone();
}
}
else
{
@@ -333,6 +359,7 @@ public:
ObjectGuid _buruGUID;
ObjectGuid _ossirianGUID;
ObjectGuid _paralyzedGUID;
ObjectGuid _andorovGUID;
GuidVector _sandVortexes;
uint32 _rajaxWaveCounter;
TaskScheduler _scheduler;

View File

@@ -41,6 +41,7 @@ enum DataTypes
DATA_YEGGETH = 12,
DATA_PAKKON = 13,
DATA_ZERRAN = 14,
DATA_ANDOROV = 15,
DATA_ENGAGED_FORMATION = 1
};
@@ -68,7 +69,9 @@ enum Creatures
NPC_XURREM = 15390,
NPC_YEGGETH = 15386,
NPC_PAKKON = 15388,
NPC_ZERRAN = 15385
NPC_ZERRAN = 15385,
NPC_ANDOROV = 15471,
NPC_KALDOREI_ELITE = 15473
};
enum GameObjects