Scripts/Nexus: Use std::chrono::duration overloads of EventMap (#25033)

Contributes to #25012

(cherry picked from commit 2f538258d9e2e1162766efaee8cb61eeae4f921e)
This commit is contained in:
Peter Keresztes Schmidt
2022-01-23 15:49:27 +01:00
committed by Shauren
parent ef5f874cea
commit b7d5a1653d
7 changed files with 39 additions and 39 deletions
@@ -466,7 +466,7 @@ public:
me->GetMotionMaster()->MoveLand(POINT_LAND_P_ONE, pos); me->GetMotionMaster()->MoveLand(POINT_LAND_P_ONE, pos);
me->SetImmuneToAll(false); me->SetImmuneToAll(false);
DoZoneInCombat(); DoZoneInCombat();
events.ScheduleEvent(EVENT_LAND_START_ENCOUNTER, 7*IN_MILLISECONDS, 1, PHASE_NOT_STARTED); events.ScheduleEvent(EVENT_LAND_START_ENCOUNTER, 7s, 1, PHASE_NOT_STARTED);
} }
break; break;
case ACTION_EXECUTE_VORTEX: case ACTION_EXECUTE_VORTEX:
@@ -502,11 +502,11 @@ public:
me->GetMotionMaster()->Clear(); me->GetMotionMaster()->Clear();
me->StopMoving(); me->StopMoving();
if (me->GetPositionZ() > 300.0f) if (me->GetPositionZ() > 300.0f)
events.ScheduleEvent(EVENT_DELAY_MOVE_TO_DESTROY_P, 5*IN_MILLISECONDS, 0, PHASE_TWO); events.ScheduleEvent(EVENT_DELAY_MOVE_TO_DESTROY_P, 5s, 0, PHASE_TWO);
else else
me->GetMotionMaster()->MovePoint(POINT_DESTROY_PLATFORM_P_TWO, MalygosPositions[0]); me->GetMotionMaster()->MovePoint(POINT_DESTROY_PLATFORM_P_TWO, MalygosPositions[0]);
events.ScheduleEvent(EVENT_LIGHT_DIMENSION_CHANGE, 1*IN_MILLISECONDS, 0, PHASE_TWO); events.ScheduleEvent(EVENT_LIGHT_DIMENSION_CHANGE, 1s, 0, PHASE_TWO);
break; break;
case ACTION_HANDLE_RESPAWN: case ACTION_HANDLE_RESPAWN:
// Teleport to spawn position, we can't use normal relocate // Teleport to spawn position, we can't use normal relocate
@@ -537,8 +537,8 @@ public:
switch (_phase) switch (_phase)
{ {
case PHASE_NOT_STARTED: case PHASE_NOT_STARTED:
events.ScheduleEvent(EVENT_SAY_INTRO, 1*IN_MILLISECONDS, 1, _phase); events.ScheduleEvent(EVENT_SAY_INTRO, 1s, 1, _phase);
events.ScheduleEvent(EVENT_START_FIRST_RANDOM_PORTAL, 2*IN_MILLISECONDS, 1, _phase); events.ScheduleEvent(EVENT_START_FIRST_RANDOM_PORTAL, 2s, 1, _phase);
break; break;
case PHASE_ONE: case PHASE_ONE:
events.ScheduleEvent(EVENT_ARCANE_BREATH, 8s, 10s, 0, _phase); events.ScheduleEvent(EVENT_ARCANE_BREATH, 8s, 10s, 0, _phase);
@@ -547,12 +547,12 @@ public:
events.ScheduleEvent(EVENT_POWER_SPARKS, 20s, 30s, 0, _phase); events.ScheduleEvent(EVENT_POWER_SPARKS, 20s, 30s, 0, _phase);
break; break;
case PHASE_TWO: case PHASE_TWO:
events.ScheduleEvent(EVENT_MOVE_TO_POINT_SURGE_P_TWO, 60*IN_MILLISECONDS, 0, _phase); events.ScheduleEvent(EVENT_MOVE_TO_POINT_SURGE_P_TWO, 60s, 0, _phase);
DoAction(ACTION_LIFT_IN_AIR); DoAction(ACTION_LIFT_IN_AIR);
break; break;
case PHASE_THREE: case PHASE_THREE:
events.ScheduleEvent(EVENT_ARCANE_PULSE, 7*IN_MILLISECONDS, 0, _phase); events.ScheduleEvent(EVENT_ARCANE_PULSE, 7s, 0, _phase);
events.ScheduleEvent(EVENT_ARCANE_STORM, 10*IN_MILLISECONDS, 0, _phase); events.ScheduleEvent(EVENT_ARCANE_STORM, 10s, 0, _phase);
events.ScheduleEvent(EVENT_SURGE_OF_POWER_P_THREE, 4s, 6s, 0, _phase); events.ScheduleEvent(EVENT_SURGE_OF_POWER_P_THREE, 4s, 6s, 0, _phase);
events.ScheduleEvent(EVENT_STATIC_FIELD, 20s, 30s, 0, _phase); events.ScheduleEvent(EVENT_STATIC_FIELD, 20s, 30s, 0, _phase);
break; break;
@@ -610,17 +610,17 @@ public:
{ {
case PHASE_ONE: case PHASE_ONE:
Talk(SAY_KILLED_PLAYER_P_ONE); Talk(SAY_KILLED_PLAYER_P_ONE);
events.ScheduleEvent(EVENT_PREVENT_SAY_SPAM_ON_KILL, 5*IN_MILLISECONDS, 0, _phase); events.ScheduleEvent(EVENT_PREVENT_SAY_SPAM_ON_KILL, 5s, 0, _phase);
_killSpamFilter = true; _killSpamFilter = true;
break; break;
case PHASE_TWO: case PHASE_TWO:
Talk(SAY_KILLED_PLAYER_P_TWO); Talk(SAY_KILLED_PLAYER_P_TWO);
events.ScheduleEvent(EVENT_PREVENT_SAY_SPAM_ON_KILL, 5*IN_MILLISECONDS, 0, _phase); events.ScheduleEvent(EVENT_PREVENT_SAY_SPAM_ON_KILL, 5s, 0, _phase);
_killSpamFilter = true; _killSpamFilter = true;
break; break;
case PHASE_THREE: case PHASE_THREE:
Talk(SAY_KILLED_PLAYER_P_THREE); Talk(SAY_KILLED_PLAYER_P_THREE);
events.ScheduleEvent(EVENT_PREVENT_SAY_SPAM_ON_KILL, 5*IN_MILLISECONDS, 0, _phase); events.ScheduleEvent(EVENT_PREVENT_SAY_SPAM_ON_KILL, 5s, 0, _phase);
_killSpamFilter = true; _killSpamFilter = true;
break; break;
} }
@@ -661,8 +661,8 @@ public:
case POINT_NEAR_RANDOM_PORTAL_P_NONE: case POINT_NEAR_RANDOM_PORTAL_P_NONE:
if (Creature* portal = me->FindNearestCreature(NPC_PORTAL_TRIGGER, 31.0f, true)) if (Creature* portal = me->FindNearestCreature(NPC_PORTAL_TRIGGER, 31.0f, true))
{ {
events.ScheduleEvent(EVENT_STOP_PORTAL_BEAM, 10*IN_MILLISECONDS, 1, PHASE_NOT_STARTED); events.ScheduleEvent(EVENT_STOP_PORTAL_BEAM, 10s, 1, PHASE_NOT_STARTED);
events.ScheduleEvent(EVENT_RANDOM_PORTAL, 14*IN_MILLISECONDS, 1, PHASE_NOT_STARTED); events.ScheduleEvent(EVENT_RANDOM_PORTAL, 14s, 1, PHASE_NOT_STARTED);
DoCast(portal, SPELL_PORTAL_BEAM); DoCast(portal, SPELL_PORTAL_BEAM);
} }
break; break;
@@ -680,7 +680,7 @@ public:
break; break;
case POINT_LIFT_IN_AIR_P_ONE: case POINT_LIFT_IN_AIR_P_ONE:
me->SetDisableGravity(true); me->SetDisableGravity(true);
events.ScheduleEvent(EVENT_MOVE_TO_VORTEX_POINT, 1, 0, PHASE_ONE); events.ScheduleEvent(EVENT_MOVE_TO_VORTEX_POINT, 1ms, 0, PHASE_ONE);
break; break;
case POINT_FLY_OUT_OF_PLATFORM_P_TWO: case POINT_FLY_OUT_OF_PLATFORM_P_TWO:
if (!_firstCyclicMovementStarted) if (!_firstCyclicMovementStarted)
@@ -689,35 +689,35 @@ public:
me->AddUnitFlag(UNIT_FLAG_NOT_SELECTABLE); me->AddUnitFlag(UNIT_FLAG_NOT_SELECTABLE);
if (Creature* alexstraszaBunny = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_ALEXSTRASZA_BUNNY_GUID))) if (Creature* alexstraszaBunny = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_ALEXSTRASZA_BUNNY_GUID)))
me->SetFacingToObject(alexstraszaBunny); me->SetFacingToObject(alexstraszaBunny);
events.ScheduleEvent(EVENT_SUMMON_ARCANE_BOMB, 1*IN_MILLISECONDS, 0, PHASE_TWO); events.ScheduleEvent(EVENT_SUMMON_ARCANE_BOMB, 1s, 0, PHASE_TWO);
} }
_flyingOutOfPlatform = false; _flyingOutOfPlatform = false;
_performingSurgeOfPower = false; _performingSurgeOfPower = false;
events.ScheduleEvent(EVENT_PATHING_AROUND_PLATFORM, 1*IN_MILLISECONDS, 0, PHASE_TWO); events.ScheduleEvent(EVENT_PATHING_AROUND_PLATFORM, 1s, 0, PHASE_TWO);
break; break;
case POINT_PHASE_ONE_TO_TWO_TRANSITION: case POINT_PHASE_ONE_TO_TWO_TRANSITION:
me->SetDisableGravity(true); me->SetDisableGravity(true);
if (Creature* alexstraszaBunny = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_ALEXSTRASZA_BUNNY_GUID))) if (Creature* alexstraszaBunny = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_ALEXSTRASZA_BUNNY_GUID)))
me->SetFacingToObject(alexstraszaBunny); me->SetFacingToObject(alexstraszaBunny);
me->GetMap()->SetZoneOverrideLight(AREA_EYE_OF_ETERNITY, LIGHT_DEFAULT, LIGHT_ARCANE_RUNES, 5 * IN_MILLISECONDS); me->GetMap()->SetZoneOverrideLight(AREA_EYE_OF_ETERNITY, LIGHT_DEFAULT, LIGHT_ARCANE_RUNES, 5 * IN_MILLISECONDS);
events.ScheduleEvent(EVENT_FLY_OUT_OF_PLATFORM, 18 * IN_MILLISECONDS, 0, PHASE_TWO); events.ScheduleEvent(EVENT_FLY_OUT_OF_PLATFORM, 18s, 0, PHASE_TWO);
break; break;
case POINT_SURGE_OF_POWER_P_TWO: case POINT_SURGE_OF_POWER_P_TWO:
if (!_performingDestroyPlatform) if (!_performingDestroyPlatform)
{ {
Talk(EMOTE_SURGE_OF_POWER_WARNING_P2); Talk(EMOTE_SURGE_OF_POWER_WARNING_P2);
DoCastAOE(SPELL_SURGE_OF_POWER_P_II, true); DoCastAOE(SPELL_SURGE_OF_POWER_P_II, true);
events.ScheduleEvent(EVENT_FLY_OUT_OF_PLATFORM, 7*IN_MILLISECONDS, 0, PHASE_TWO); events.ScheduleEvent(EVENT_FLY_OUT_OF_PLATFORM, 7s, 0, PHASE_TWO);
} }
break; break;
case POINT_DESTROY_PLATFORM_P_TWO: case POINT_DESTROY_PLATFORM_P_TWO:
me->GetMap()->SetZoneOverrideLight(AREA_EYE_OF_ETERNITY, LIGHT_DEFAULT, LIGHT_OBSCURE_SPACE, 1 * IN_MILLISECONDS); me->GetMap()->SetZoneOverrideLight(AREA_EYE_OF_ETERNITY, LIGHT_DEFAULT, LIGHT_OBSCURE_SPACE, 1 * IN_MILLISECONDS);
DoCast(me, SPELL_DESTROY_PLATFORM_CHANNEL); DoCast(me, SPELL_DESTROY_PLATFORM_CHANNEL);
events.ScheduleEvent(EVENT_MOVE_TO_P_THREE_POINT, 11*IN_MILLISECONDS, 0, PHASE_TWO); events.ScheduleEvent(EVENT_MOVE_TO_P_THREE_POINT, 11s, 0, PHASE_TWO);
break; break;
case POINT_IDLE_P_THREE: case POINT_IDLE_P_THREE:
me->SetControlled(true, UNIT_STATE_ROOT); me->SetControlled(true, UNIT_STATE_ROOT);
events.ScheduleEvent(EVENT_START_P_THREE, 5*IN_MILLISECONDS, 0, PHASE_TWO); events.ScheduleEvent(EVENT_START_P_THREE, 5s, 0, PHASE_TWO);
break; break;
} }
} }
@@ -789,24 +789,24 @@ public:
case EVENT_ARCANE_BREATH: case EVENT_ARCANE_BREATH:
if (_executingVortex) if (_executingVortex)
{ {
events.ScheduleEvent(EVENT_ARCANE_BREATH, 20*IN_MILLISECONDS, 0, PHASE_ONE); events.ScheduleEvent(EVENT_ARCANE_BREATH, 20s, 0, PHASE_ONE);
break; break;
} }
me->CastSpell(me->GetVictim(), SPELL_ARCANE_BREATH); me->CastSpell(me->GetVictim(), SPELL_ARCANE_BREATH);
events.ScheduleEvent(EVENT_ARCANE_BREATH, 20*IN_MILLISECONDS, 0, PHASE_ONE); events.ScheduleEvent(EVENT_ARCANE_BREATH, 20s, 0, PHASE_ONE);
break; break;
case EVENT_ARCANE_STORM: case EVENT_ARCANE_STORM:
if (_phase == PHASE_ONE) if (_phase == PHASE_ONE)
{ {
if (_executingVortex) if (_executingVortex)
{ {
events.ScheduleEvent(EVENT_ARCANE_STORM, 10*IN_MILLISECONDS, 0, PHASE_ONE); events.ScheduleEvent(EVENT_ARCANE_STORM, 10s, 0, PHASE_ONE);
break; break;
} }
DoCastAOE(SPELL_ARCANE_STORM_P_I, true); DoCastAOE(SPELL_ARCANE_STORM_P_I, true);
events.ScheduleEvent(EVENT_ARCANE_STORM, 10*IN_MILLISECONDS, 0, PHASE_ONE); events.ScheduleEvent(EVENT_ARCANE_STORM, 10s, 0, PHASE_ONE);
} }
else if (_phase == PHASE_THREE) else if (_phase == PHASE_THREE)
{ {
@@ -847,7 +847,7 @@ public:
_arcaneReinforcements = false; _arcaneReinforcements = false;
if (GetDifficulty() == DIFFICULTY_25_N) if (GetDifficulty() == DIFFICULTY_25_N)
events.ScheduleEvent(EVENT_DELAYED_REINFORCEMENTS, 1*IN_MILLISECONDS, 0, PHASE_TWO); events.ScheduleEvent(EVENT_DELAYED_REINFORCEMENTS, 1s, 0, PHASE_TWO);
} }
break; break;
case EVENT_DELAYED_REINFORCEMENTS: case EVENT_DELAYED_REINFORCEMENTS:
@@ -875,14 +875,14 @@ public:
_performingSurgeOfPower = true; _performingSurgeOfPower = true;
Talk(SAY_DEEP_BREATH); Talk(SAY_DEEP_BREATH);
me->GetMotionMaster()->MovePoint(POINT_SURGE_OF_POWER_P_TWO, MalygosPositions[3]); me->GetMotionMaster()->MovePoint(POINT_SURGE_OF_POWER_P_TWO, MalygosPositions[3]);
events.ScheduleEvent(EVENT_MOVE_TO_POINT_SURGE_P_TWO, 60*IN_MILLISECONDS, 2, PHASE_TWO); events.ScheduleEvent(EVENT_MOVE_TO_POINT_SURGE_P_TWO, 60s, 2, PHASE_TWO);
} }
break; break;
case EVENT_SUMMON_ARCANE_BOMB: case EVENT_SUMMON_ARCANE_BOMB:
if (!_performingSurgeOfPower && !_performingDestroyPlatform) if (!_performingSurgeOfPower && !_performingDestroyPlatform)
{ {
me->StopMoving(); me->StopMoving();
events.ScheduleEvent(EVENT_PATHING_AROUND_PLATFORM, 3*IN_MILLISECONDS, 0, PHASE_TWO); events.ScheduleEvent(EVENT_PATHING_AROUND_PLATFORM, 3s, 0, PHASE_TWO);
} }
if (!_flyingOutOfPlatform) if (!_flyingOutOfPlatform)
@@ -897,13 +897,13 @@ public:
if (_preparingPulsesChecker < 2) if (_preparingPulsesChecker < 2)
{ {
DoCastAOE(SPELL_ARCANE_PULSE, true); DoCastAOE(SPELL_ARCANE_PULSE, true);
events.ScheduleEvent(EVENT_ARCANE_PULSE, 7*IN_MILLISECONDS, 0, PHASE_THREE); events.ScheduleEvent(EVENT_ARCANE_PULSE, 7s, 0, PHASE_THREE);
_preparingPulsesChecker++; _preparingPulsesChecker++;
} }
else else
{ {
DoCastAOE(SPELL_ARCANE_PULSE, true); DoCastAOE(SPELL_ARCANE_PULSE, true);
events.ScheduleEvent(EVENT_ARCANE_PULSE, 2*IN_MILLISECONDS, 0, PHASE_THREE); events.ScheduleEvent(EVENT_ARCANE_PULSE, 2s, 0, PHASE_THREE);
} }
break; break;
case EVENT_LIGHT_DIMENSION_CHANGE: case EVENT_LIGHT_DIMENSION_CHANGE:
@@ -1217,7 +1217,7 @@ public:
if (_wpCount < 3) if (_wpCount < 3)
{ {
_events.ScheduleEvent(id + 1, 1); _events.ScheduleEvent(id + 1, 1ms);
++_wpCount; ++_wpCount;
} }
else if (Vehicle* hoverDisk = me->GetVehicleKit()) else if (Vehicle* hoverDisk = me->GetVehicleKit())
@@ -1324,7 +1324,7 @@ class npc_nexus_lord : public CreatureScript
void DoAction(int32 /*action*/) override void DoAction(int32 /*action*/) override
{ {
_events.ScheduleEvent(EVENT_NUKE_DUMMY, 1); _events.ScheduleEvent(EVENT_NUKE_DUMMY, 1ms);
_events.ScheduleEvent(EVENT_ARCANE_SHOCK, 2s); _events.ScheduleEvent(EVENT_ARCANE_SHOCK, 2s);
_events.ScheduleEvent(EVENT_HASTE_BUFF, 12s); _events.ScheduleEvent(EVENT_HASTE_BUFF, 12s);
} }
@@ -98,7 +98,7 @@ class boss_keristrasza : public CreatureScript
BossAI::JustEngagedWith(who); BossAI::JustEngagedWith(who);
events.ScheduleEvent(EVENT_CRYSTAL_FIRE_BREATH, 14s); events.ScheduleEvent(EVENT_CRYSTAL_FIRE_BREATH, 14s);
events.ScheduleEvent(EVENT_CRYSTAL_CHAINS_CRYSTALLIZE, DUNGEON_MODE(30000, 11000)); events.ScheduleEvent(EVENT_CRYSTAL_CHAINS_CRYSTALLIZE, DUNGEON_MODE(30s, 11s));
events.ScheduleEvent(EVENT_TAIL_SWEEP, 5s); events.ScheduleEvent(EVENT_TAIL_SWEEP, 5s);
} }
@@ -189,7 +189,7 @@ class boss_keristrasza : public CreatureScript
DoCast(me, SPELL_CRYSTALLIZE); DoCast(me, SPELL_CRYSTALLIZE);
else if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 100.0f, true)) else if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 100.0f, true))
DoCast(target, SPELL_CRYSTAL_CHAINS); DoCast(target, SPELL_CRYSTAL_CHAINS);
events.ScheduleEvent(EVENT_TAIL_SWEEP, DUNGEON_MODE(30000, 11000)); events.ScheduleEvent(EVENT_TAIL_SWEEP, DUNGEON_MODE(30s, 11s));
break; break;
default: default:
break; break;
@@ -74,7 +74,7 @@ class boss_nexus_commanders : public CreatureScript
break; break;
case EVENT_WHIRLWIND: case EVENT_WHIRLWIND:
DoCast(me, SPELL_WHIRLWIND); DoCast(me, SPELL_WHIRLWIND);
events.ScheduleEvent(EVENT_WHIRLWIND, urand(19500, 25000)); events.ScheduleEvent(EVENT_WHIRLWIND, 19500ms, 25s);
break; break;
case EVENT_FRIGHTENING_SHOUT: case EVENT_FRIGHTENING_SHOUT:
DoCastAOE(SPELL_FRIGHTENING_SHOUT); DoCastAOE(SPELL_FRIGHTENING_SHOUT);
@@ -73,7 +73,7 @@ class boss_drakos : public CreatureScript
{ {
_Reset(); _Reset();
events.ScheduleEvent(EVENT_MAGIC_PULL, 15000); events.ScheduleEvent(EVENT_MAGIC_PULL, 15s);
events.ScheduleEvent(EVENT_STOMP, 15s); events.ScheduleEvent(EVENT_STOMP, 15s);
events.ScheduleEvent(EVENT_BOMB_SUMMON, 2s); events.ScheduleEvent(EVENT_BOMB_SUMMON, 2s);
@@ -113,7 +113,7 @@ class boss_drakos : public CreatureScript
case EVENT_MAGIC_PULL: case EVENT_MAGIC_PULL:
DoCast(SPELL_MAGIC_PULL); DoCast(SPELL_MAGIC_PULL);
postPull = true; postPull = true;
events.ScheduleEvent(EVENT_MAGIC_PULL, 15000); events.ScheduleEvent(EVENT_MAGIC_PULL, 15s);
break; break;
case EVENT_STOMP: case EVENT_STOMP:
Talk(SAY_STOMP); Talk(SAY_STOMP);
@@ -252,7 +252,7 @@ class boss_urom : public CreatureScript
Talk(EMOTE_ARCANE_EXPLOSION); Talk(EMOTE_ARCANE_EXPLOSION);
Talk(SAY_ARCANE_EXPLOSION); Talk(SAY_ARCANE_EXPLOSION);
DoCastAOE(SPELL_EMPOWERED_ARCANE_EXPLOSION); DoCastAOE(SPELL_EMPOWERED_ARCANE_EXPLOSION);
events.ScheduleEvent(EVENT_TELEPORT_BACK, DUNGEON_MODE<uint32>(10000, 8000)); events.ScheduleEvent(EVENT_TELEPORT_BACK, DUNGEON_MODE(10s, 8s));
break; break;
case EVENT_TELEPORT_BACK: case EVENT_TELEPORT_BACK:
me->SetReactState(REACT_AGGRESSIVE); me->SetReactState(REACT_AGGRESSIVE);
@@ -190,7 +190,7 @@ class instance_oculus : public InstanceMapScript
FreeDragons(); FreeDragons();
if (Creature* varos = instance->GetCreature(VarosGUID)) if (Creature* varos = instance->GetCreature(VarosGUID))
PhasingHandler::RemovePhase(varos, 170, true); PhasingHandler::RemovePhase(varos, 170, true);
events.ScheduleEvent(EVENT_VAROS_INTRO, 15000); events.ScheduleEvent(EVENT_VAROS_INTRO, 15s);
} }
break; break;
case DATA_VAROS: case DATA_VAROS:
@@ -343,7 +343,7 @@ class npc_ruby_emerald_amber_drake : public CreatureScript
if (_healthWarning) if (_healthWarning)
{ {
if (me->GetHealthPct() <= 40.0f) if (me->GetHealthPct() <= 40.0f)
_events.ScheduleEvent(EVENT_LOW_HEALTH, 0); _events.ScheduleEvent(EVENT_LOW_HEALTH, 0ms);
} }
_events.Update(diff); _events.Update(diff);