fix(Scripts/RuinsOfAhnQiraj): Implement Rajaxx waves gear check (#12552)

* fix(Scripts/RuinsOfAhnQiraj): Implement Rajaxx waves gear check

* Cancel timer on wipe

* Update rev_1658867303864464100.sql

* Update instance_ruins_of_ahnqiraj.cpp

* set it to 2 mins
This commit is contained in:
Skjalf
2022-08-06 15:23:00 -03:00
committed by GitHub
parent 134568158c
commit 440865e365
2 changed files with 112 additions and 7 deletions

View File

@@ -37,14 +37,17 @@ ObjectData const creatureData[] =
{ NPC_ZERRAN, DATA_ZERRAN },
};
enum RajaxxText
enum RajaxxWaveEvent
{
SAY_WAVE3 = 0,
SAY_WAVE4 = 1,
SAY_WAVE5 = 2,
SAY_WAVE6 = 3,
SAY_WAVE7 = 4,
SAY_ENGAGE = 5
SAY_ENGAGE = 5,
DATA_RAJAXX_WAVE_ENGAGED = 1,
GROUP_RAJAXX_WAVE_TIMER = 1
};
std::array<uint32, 8> RajaxxWavesData[] =
@@ -128,6 +131,20 @@ public:
}
}
void SetData(uint32 type, uint32 /*data*/) override
{
if (type == DATA_RAJAXX_WAVE_ENGAGED)
{
_scheduler.CancelGroup(GROUP_RAJAXX_WAVE_TIMER);
_scheduler.Schedule(2min, [this](TaskContext context)
{
CallNextRajaxxLeader();
context.SetGroup(GROUP_RAJAXX_WAVE_TIMER);
context.Repeat();
});
}
}
void OnUnitDeath(Unit* unit) override
{
if (Creature* creature = unit->ToCreature())
@@ -149,7 +166,7 @@ public:
_scheduler.Schedule(1s, [this, formation](TaskContext /*context*/) {
if (!formation->IsAnyMemberAlive())
{
CallNextRajaxxLeader();
CallNextRajaxxLeader(true);
}
});
break;
@@ -236,17 +253,20 @@ public:
OUT_LOAD_INST_DATA_COMPLETE;
}
void CallNextRajaxxLeader()
void CallNextRajaxxLeader(bool announce = false)
{
++_rajaxWaveCounter;
if (Creature* nextLeader = GetCreature(RajaxxWavesData[_rajaxWaveCounter].at(0)))
{
if (_rajaxWaveCounter >= 2)
if (announce)
{
if (Creature* rajaxx = GetCreature(DATA_RAJAXX))
if (_rajaxWaveCounter >= 2)
{
rajaxx->AI()->Talk(RajaxxWavesData[_rajaxWaveCounter].at(1));
if (Creature* rajaxx = GetCreature(DATA_RAJAXX))
{
rajaxx->AI()->Talk(RajaxxWavesData[_rajaxWaveCounter].at(1));
}
}
}
@@ -264,6 +284,7 @@ public:
void ResetRajaxxWaves()
{
_rajaxWaveCounter = 0;
_scheduler.CancelAll();
for (auto const& data : RajaxxWavesData)
{
if (Creature* creature = GetCreature(data.at(0)))