feat(Core/Instance): Add TaskScheduler to the InstanceScript class (#17284)

feat(Core/Instance): Add TaskScheduler to the instancescript class
This commit is contained in:
Skjalf
2023-09-17 10:56:02 -03:00
committed by GitHub
parent 655f2bb15b
commit 0bf559f975
4 changed files with 14 additions and 18 deletions

View File

@@ -154,8 +154,8 @@ public:
switch (type)
{
case DATA_RAJAXX_WAVE_ENGAGED:
_scheduler.CancelGroup(GROUP_RAJAXX_WAVE_TIMER);
_scheduler.Schedule(2min, [this](TaskContext context)
scheduler.CancelGroup(GROUP_RAJAXX_WAVE_TIMER);
scheduler.Schedule(2min, [this](TaskContext context)
{
CallNextRajaxxLeader();
context.SetGroup(GROUP_RAJAXX_WAVE_TIMER);
@@ -195,8 +195,8 @@ public:
case NPC_YEGGETH:
case NPC_PAKKON:
case NPC_ZERRAN:
_scheduler.CancelAll();
_scheduler.Schedule(1s, [this, formation](TaskContext /*context*/)
scheduler.CancelAll();
scheduler.Schedule(1s, [this, formation](TaskContext /*context*/)
{
if (!formation->IsAnyMemberAlive())
{
@@ -212,11 +212,6 @@ public:
}
}
void Update(uint32 diff) override
{
_scheduler.Update(diff);
}
void SetGuidData(uint32 type, ObjectGuid data) override
{
if (type == DATA_PARALYZED)
@@ -285,7 +280,7 @@ public:
void ResetRajaxxWaves()
{
_rajaxWaveCounter = 0;
_scheduler.CancelAll();
scheduler.CancelAll();
for (auto const& data : RajaxxWavesData)
{
if (Creature* creature = GetCreature(data.at(0)))
@@ -308,7 +303,6 @@ public:
ObjectGuid _andorovGUID;
uint32 _rajaxWaveCounter;
uint8 _buruPhase;
TaskScheduler _scheduler;
};
InstanceScript* GetInstanceScript(InstanceMap* map) const override

View File

@@ -210,15 +210,9 @@ public:
return true;
}
void Update(uint32 diff) override
{
scheduler.Update(diff);
}
private:
GuidVector CThunGraspGUIDs;
uint32 BugTrioDeathCount;
TaskScheduler scheduler;
};
};