refactor(Core): AddEventAtOffset (#23140)

This commit is contained in:
天鹭
2025-10-17 12:09:57 +08:00
committed by GitHub
parent 762f5a7158
commit 058f7acac6
47 changed files with 141 additions and 139 deletions

View File

@@ -606,7 +606,7 @@ public:
if (Creature* argelmach = instance->GetCreature(ArgelmachGUID))
{
argelmach->HandleEmoteCommand(EMOTE_ONESHOT_SHOUT);
argelmach->m_Events.AddEvent(new RestoreAttack(argelmach), argelmach->m_Events.CalculateTime(3000));
argelmach->m_Events.AddEventAtOffset(new RestoreAttack(argelmach), 3s);
for (ObjectGuid const& argelmachAddGUID : ArgelmachAdds)
{

View File

@@ -157,8 +157,8 @@ public:
orc->AI()->Talk(SAY_BLACKHAND_DOOMED);
}
orc->m_Events.AddEvent(new OrcMoveEvent(orc), me->m_Events.CalculateTime(3 * IN_MILLISECONDS));
orc->m_Events.AddEvent(new OrcDeathEvent(orc), me->m_Events.CalculateTime(9 * IN_MILLISECONDS));
orc->m_Events.AddEventAtOffset(new OrcMoveEvent(orc), 3s);
orc->m_Events.AddEventAtOffset(new OrcDeathEvent(orc), 9s);
}
}
}

View File

@@ -473,7 +473,7 @@ public:
if (battleStarted != ENCOUNTER_STATE_FIGHT)
return;
me->m_Events.AddEvent(new DelayedSummonEvent(me, creature->GetEntry(), *creature), me->m_Events.CalculateTime(3000));
me->m_Events.AddEventAtOffset(new DelayedSummonEvent(me, creature->GetEntry(), *creature), 3s);
if (creature->GetEntry() >= NPC_RAMPAGING_ABOMINATION)
{
--scourgeRemaining;

View File

@@ -319,9 +319,10 @@ struct boss_felmyst : public BossAI
break;
case POINT_LANE:
Talk(EMOTE_BREATH);
me->m_Events.AddEventAtOffset([&] {
me->m_Events.AddEventAtOffset([this]()
{
for (uint8 i = 0; i < 16; ++i)
me->m_Events.AddEvent(new CorruptTriggers(me, _currentLane), me->m_Events.CalculateTime(i*250));
me->m_Events.AddEventAtOffset(new CorruptTriggers(me, _currentLane), Milliseconds(i * 250));
}, 5s);
me->m_Events.AddEventAtOffset([&] {

View File

@@ -554,7 +554,7 @@ struct boss_kiljaeden : public BossAI
summon->SetDisableGravity(true);
summon->CastSpell(summon, SPELL_ARMAGEDDON_VISUAL, true);
summon->SetPosition(summon->GetPositionX(), summon->GetPositionY(), summon->GetPositionZ() + 20.0f, 0.0f);
summon->m_Events.AddEvent(new CastArmageddon(summon), summon->m_Events.CalculateTime(6000));
summon->m_Events.AddEventAtOffset(new CastArmageddon(summon), 6s);
summon->DespawnOrUnsummon(randtime(8s, 10s));
}
}
@@ -787,8 +787,8 @@ struct npc_kalecgos_kj : public NullCreatureAI
case EVENT_SCENE_05:
if (Creature* first = me->SummonCreature(NPC_SHATTERED_SUN_SOLDIER, 1729.48f, 640.49f, 28.06f, 3.49f))
{
first->m_Events.AddEvent(new MoveDelayed(first, 1718.70f, 607.78f, 28.06f, 2.323f), first->m_Events.CalculateTime(5000));
first->m_Events.AddEvent(new FixOrientation(first), first->m_Events.CalculateTime(12000));
first->m_Events.AddEventAtOffset(new MoveDelayed(first, 1718.70f, 607.78f, 28.06f, 2.323f), 5s);
first->m_Events.AddEventAtOffset(new FixOrientation(first), 12s);
for (uint8 i = 0; i < 9; ++i)
if (Creature* follower = me->SummonCreature(NPC_SHATTERED_SUN_SOLDIER, 1729.48f + 5 * cos(i * 2.0f * M_PI / 9), 640.49f + 5 * std::sin(i * 2.0f * M_PI / 9), 28.06f, 3.49f))
follower->GetMotionMaster()->MoveFollow(first, 3.0f, follower->GetAngle(first));
@@ -798,8 +798,8 @@ struct npc_kalecgos_kj : public NullCreatureAI
case EVENT_SCENE_06:
if (Creature* first = me->SummonCreature(NPC_SHATTERED_SUN_SOLDIER, 1729.48f, 640.49f, 28.06f, 3.49f))
{
first->m_Events.AddEvent(new MoveDelayed(first, 1678.69f, 649.27f, 28.06f, 5.46f), first->m_Events.CalculateTime(5000));
first->m_Events.AddEvent(new FixOrientation(first), first->m_Events.CalculateTime(14500));
first->m_Events.AddEventAtOffset(new MoveDelayed(first, 1678.69f, 649.27f, 28.06f, 5.46f), 5s);
first->m_Events.AddEventAtOffset(new FixOrientation(first), 14500ms);
for (uint8 i = 0; i < 9; ++i)
if (Creature* follower = me->SummonCreature(NPC_SHATTERED_SUN_SOLDIER, 1729.48f + 5 * cos(i * 2.0f * M_PI / 9), 640.49f + 5 * std::sin(i * 2.0f * M_PI / 9), 28.06f, 3.49f))
follower->GetMotionMaster()->MoveFollow(first, 3.0f, follower->GetAngle(first));

View File

@@ -199,19 +199,19 @@ struct npc_medivh_bm : public ScriptedAI
events.ScheduleEvent(EVENT_OUTRO_3, 2s);
break;
case EVENT_OUTRO_3:
SummonOrcs(-2046.158f, -3.0f, 37s, 30000, true);
SummonOrcs(-2046.158f, -3.0f, 37s, 30s, true);
events.ScheduleEvent(EVENT_OUTRO_4, 2s);
break;
case EVENT_OUTRO_4:
SummonOrcs(-2055.97f, -2.0f, 33s, 28000, false);
SummonOrcs(-2055.97f, -2.0f, 33s, 28s, false);
events.ScheduleEvent(EVENT_OUTRO_5, 2s);
break;
case EVENT_OUTRO_5:
SummonOrcs(-2064.0f, -1.5f, 29s, 26000, false);
SummonOrcs(-2064.0f, -1.5f, 29s, 26s, false);
events.ScheduleEvent(EVENT_OUTRO_6, 2s);
break;
case EVENT_OUTRO_6:
SummonOrcs(-2074.35f, -0.1f, 26s, 24000, false);
SummonOrcs(-2074.35f, -0.1f, 26s, 24s, false);
events.ScheduleEvent(EVENT_OUTRO_7, 7s);
break;
case EVENT_OUTRO_7:
@@ -228,14 +228,14 @@ struct npc_medivh_bm : public ScriptedAI
}
}
void SummonOrcs(float x, float y, Milliseconds duration, uint32 homeTime, bool first)
void SummonOrcs(float x, float y, Milliseconds duration, Milliseconds homeTime, bool first)
{
for (uint8 i = 0; i < 6; ++i)
{
if (Creature* cr = me->SummonCreature(NPC_SHADOW_COUNCIL_ENFORCER, -2091.731f, 7133.083f - 3.0f * i, 34.589f, 0.0f))
{
cr->GetMotionMaster()->MovePoint(0, (first && i == 3) ? x + 2.0f : x, cr->GetPositionY() + y, cr->GetMapHeight(x, cr->GetPositionY() + y, cr->GetPositionZ(), true));
cr->m_Events.AddEvent(new NpcRunToHome(*cr), cr->m_Events.CalculateTime(homeTime + urand(0, 2000)));
cr->m_Events.AddEventAtOffset(new NpcRunToHome(*cr), homeTime + randtime(0ms, 2s));
cr->DespawnOrUnsummon(duration + randtime(0ms, 2s));
}
}

View File

@@ -1174,7 +1174,7 @@ public:
summons->SetLootRecipient(player);
summons->CastSpell(summons, SPELL_SPAWN_IN, false);
summons->AI()->Talk(SAY_ON_SPAWN_IN, player);
summons->m_Events.AddEvent(new DelayedWindstoneSummonEvent(summons, player->GetGUID()), summons->m_Events.CalculateTime(5200));
summons->m_Events.AddEventAtOffset(new DelayedWindstoneSummonEvent(summons, player->GetGUID()), 5200ms);
_creatureGuid = summons->GetGUID();
}
}

View File

@@ -152,7 +152,7 @@ public:
if (action == ACTION_INTRO_BALTHARUS && !_introDone)
{
_introDone = true;
me->m_Events.AddEvent(new DelayedTalk(me, SAY_BALTHARUS_INTRO), me->m_Events.CalculateTime(6000));
me->m_Events.AddEventAtOffset(new DelayedTalk(me, SAY_BALTHARUS_INTRO), 6s);
}
else if (action == ACTION_CLONE)
{
@@ -204,7 +204,7 @@ public:
summon->SetHealth(me->GetHealth());
summon->CastSpell(summon, SPELL_SPAWN_EFFECT, true);
summon->SetReactState(REACT_PASSIVE);
summon->m_Events.AddEvent(new RestoreFight(summon), summon->m_Events.CalculateTime(2000));
summon->m_Events.AddEventAtOffset(new RestoreFight(summon), 2s);
}
void UpdateAI(uint32 diff) override

View File

@@ -1120,7 +1120,7 @@ class spell_halion_twilight_realm_aura : public AuraScript
target->RemoveAurasDueToSpell(SPELL_FIERY_COMBUSTION, ObjectGuid::Empty, 0, AURA_REMOVE_BY_ENEMY_SPELL);
if (!GetTarget()->IsPlayer())
return;
GetTarget()->m_Events.AddEvent(new SendEncounterUnit(GetTarget()->ToPlayer()), GetTarget()->m_Events.CalculateTime(500));
GetTarget()->m_Events.AddEventAtOffset(new SendEncounterUnit(GetTarget()->ToPlayer()), 500ms);
}
void Register() override
@@ -1153,7 +1153,7 @@ class spell_halion_leave_twilight_realm_aura : public AuraScript
if (!GetTarget()->IsPlayer())
return;
GetTarget()->m_Events.AddEvent(new SendEncounterUnit(GetTarget()->ToPlayer()), GetTarget()->m_Events.CalculateTime(500));
GetTarget()->m_Events.AddEventAtOffset(new SendEncounterUnit(GetTarget()->ToPlayer()), 500ms);
}
void Register() override

View File

@@ -502,7 +502,7 @@ public:
void JustDied(Unit* /*killer*/) override
{
me->CastSpell(me, RAID_MODE(SPELL_TRAITOR_KING_10, SPELL_TRAITOR_KING_25, SPELL_TRAITOR_KING_10, SPELL_TRAITOR_KING_25), true);
me->m_Events.AddEvent(new HideNpcEvent(*me), me->m_Events.CalculateTime(5000));
me->m_Events.AddEventAtOffset(new HideNpcEvent(*me), 5s);
}
bool CanAIAttack(Unit const* target) const override
@@ -710,7 +710,7 @@ public:
void JustDied(Unit* /*killer*/) override
{
me->m_Events.AddEvent(new HideNpcEvent(*me), me->m_Events.CalculateTime(5000));
me->m_Events.AddEventAtOffset(new HideNpcEvent(*me), 5s);
}
bool CanAIAttack(Unit const* target) const override

View File

@@ -38,7 +38,7 @@ public:
_owner.GetMotionMaster()->Clear();
_owner.SetVisible(true);
_owner.NearTeleportTo(5300.53f, 1987.80f, 707.70f, 3.89f);
_owner.m_Events.AddEvent(new UtherBatteredHiltEvent(_owner, 2), _owner.m_Events.CalculateTime(1000));
_owner.m_Events.AddEventAtOffset(new UtherBatteredHiltEvent(_owner, 2), 1s);
break;
case 2:
_owner.AI()->Talk(SAY_BATTERED_HILT_HALT);
@@ -52,12 +52,12 @@ public:
{
quel->AI()->Talk(EMOTE_QUEL_SPAWN);
}
_owner.m_Events.AddEvent(new UtherBatteredHiltEvent(_owner, 4), _owner.m_Events.CalculateTime(3500));
_owner.m_Events.AddEventAtOffset(new UtherBatteredHiltEvent(_owner, 4), 3500ms);
break;
case 4:
_owner.SetWalk(false);
_owner.GetMotionMaster()->MovePoint(0, 5337.53f, 1981.21f, 709.32f);
_owner.m_Events.AddEvent(new UtherBatteredHiltEvent(_owner, 5), _owner.m_Events.CalculateTime(6000));
_owner.m_Events.AddEventAtOffset(new UtherBatteredHiltEvent(_owner, 5), 6s);
break;
case 5:
_owner.SetFacingTo(2.82f);
@@ -66,7 +66,7 @@ public:
case 6:
if (InstanceScript* instance = _owner.GetInstanceScript())
instance->SetData(DATA_BATTERED_HILT, 6);
_owner.m_Events.AddEvent(new UtherBatteredHiltEvent(_owner, 7), _owner.m_Events.CalculateTime(2000));
_owner.m_Events.AddEventAtOffset(new UtherBatteredHiltEvent(_owner, 7), 2s);
break;
case 7:
if (InstanceScript* instance = _owner.GetInstanceScript())
@@ -77,7 +77,7 @@ public:
{
quel->AI()->Talk(EMOTE_QUEL_PREPARE);
}
_owner.m_Events.AddEvent(new UtherBatteredHiltEvent(_owner, 8), _owner.m_Events.CalculateTime(4000));
_owner.m_Events.AddEventAtOffset(new UtherBatteredHiltEvent(_owner, 8), 4s);
break;
case 8:
_owner.SetReactState(REACT_AGGRESSIVE);
@@ -87,23 +87,23 @@ public:
break;
case 9:
_owner.AI()->Talk(SAY_BATTERED_HILT_OUTRO1);
_owner.m_Events.AddEvent(new UtherBatteredHiltEvent(_owner, _eventId + 1), _owner.m_Events.CalculateTime(11000));
_owner.m_Events.AddEventAtOffset(new UtherBatteredHiltEvent(_owner, _eventId + 1), 11s);
break;
case 10:
_owner.AI()->Talk(SAY_BATTERED_HILT_OUTRO2);
_owner.m_Events.AddEvent(new UtherBatteredHiltEvent(_owner, _eventId + 1), _owner.m_Events.CalculateTime(7500));
_owner.m_Events.AddEventAtOffset(new UtherBatteredHiltEvent(_owner, _eventId + 1), 7500ms);
break;
case 11:
_owner.AI()->Talk(SAY_BATTERED_HILT_OUTRO3);
_owner.m_Events.AddEvent(new UtherBatteredHiltEvent(_owner, _eventId + 1), _owner.m_Events.CalculateTime(8000));
_owner.m_Events.AddEventAtOffset(new UtherBatteredHiltEvent(_owner, _eventId + 1), 8s);
break;
case 12:
_owner.AI()->Talk(SAY_BATTERED_HILT_OUTRO4);
_owner.m_Events.AddEvent(new UtherBatteredHiltEvent(_owner, _eventId + 1), _owner.m_Events.CalculateTime(5000));
_owner.m_Events.AddEventAtOffset(new UtherBatteredHiltEvent(_owner, _eventId + 1), 5s);
break;
case 13:
_owner.CastSpell((Unit*)nullptr, 73036, true);
_owner.m_Events.AddEvent(new UtherBatteredHiltEvent(_owner, _eventId + 1), _owner.m_Events.CalculateTime(3000));
_owner.m_Events.AddEventAtOffset(new UtherBatteredHiltEvent(_owner, _eventId + 1), 3s);
break;
case 14:
{
@@ -594,7 +594,7 @@ public:
if (Creature* c = instance->GetCreature(NPC_AltarBunnyGUID))
c->CastSpell(c, 70720, true);
if (Creature* c = instance->GetCreature(NPC_UtherGUID))
c->m_Events.AddEvent(new UtherBatteredHiltEvent(*c, 1), c->m_Events.CalculateTime(3000));
c->m_Events.AddEventAtOffset(new UtherBatteredHiltEvent(*c, 1), 3s);
break;
case 3:
if ((BatteredHiltStatus & BHSF_STARTED) == 0 || (BatteredHiltStatus & BHSF_THROWN))
@@ -602,7 +602,7 @@ public:
BatteredHiltStatus |= BHSF_THROWN;
if (Creature* c = instance->GetCreature(NPC_UtherGUID))
{
c->m_Events.AddEvent(new UtherBatteredHiltEvent(*c, 3), c->m_Events.CalculateTime(5500));
c->m_Events.AddEventAtOffset(new UtherBatteredHiltEvent(*c, 3), 5500ms);
}
break;
case 4:
@@ -614,7 +614,7 @@ public:
break;
case 5:
if (Creature* c = instance->GetCreature(NPC_UtherGUID))
c->m_Events.AddEvent(new UtherBatteredHiltEvent(*c, 6), c->m_Events.CalculateTime(3000));
c->m_Events.AddEventAtOffset(new UtherBatteredHiltEvent(*c, 6), 3s);
break;
case 6:
if (Creature* c = instance->GetCreature(NPC_QuelDelarGUID))
@@ -726,7 +726,7 @@ public:
c->SetStandState(UNIT_STAND_STATE_STAND);
c->SetWalk(false);
c->GetMotionMaster()->MovePoint(0, 5313.92f, 1989.36f, 707.70f);
c->m_Events.AddEvent(new UtherBatteredHiltEvent(*c, 9), c->m_Events.CalculateTime(7000));
c->m_Events.AddEventAtOffset(new UtherBatteredHiltEvent(*c, 9), 7s);
}
}

View File

@@ -1383,7 +1383,7 @@ class spell_pos_slave_trigger_closest : public SpellScript
{
c->DespawnOrUnsummon(7s);
c->AI()->Talk(0, p);
c->m_Events.AddEvent(new SlaveRunEvent(*c), c->m_Events.CalculateTime(3000));
c->m_Events.AddEventAtOffset(new SlaveRunEvent(*c), 3s);
}
}
}

View File

@@ -160,7 +160,7 @@ public:
{
summon->SetRegeneratingHealth(false);
summon->SetReactState(REACT_PASSIVE);
summon->m_Events.AddEvent(new RestoreFight(summon), summon->m_Events.CalculateTime(3000));
summon->m_Events.AddEventAtOffset(new RestoreFight(summon), 3s);
if (!events.HasTimeUntilEvent(EVENT_COLOSSUS_HEALTH_2))
{
summon->SetHealth(summon->GetMaxHealth() / 2);

View File

@@ -375,7 +375,7 @@ public:
me->RemoveUnitFlag2(UNIT_FLAG2_FEIGN_DEATH);
me->SetReactState(REACT_AGGRESSIVE);
me->ForceValuesUpdateAtIndex(UNIT_NPC_FLAGS); // was in sniff. don't ask why
me->m_Events.AddEvent(new StandUpEvent(*me), me->m_Events.CalculateTime(1000));
me->m_Events.AddEventAtOffset(new StandUpEvent(*me), 1s);
DoAction(ACTION_REMOVE_INVOCATION);
me->SetHealth(1);
break;
@@ -645,7 +645,7 @@ public:
me->RemoveUnitFlag2(UNIT_FLAG2_FEIGN_DEATH);
me->SetReactState(REACT_AGGRESSIVE);
me->ForceValuesUpdateAtIndex(UNIT_NPC_FLAGS); // was in sniff. don't ask why
me->m_Events.AddEvent(new StandUpEvent(*me), me->m_Events.CalculateTime(1000));
me->m_Events.AddEventAtOffset(new StandUpEvent(*me), 1s);
DoAction(ACTION_REMOVE_INVOCATION);
me->SetHealth(1);
break;
@@ -889,7 +889,7 @@ public:
summon->CastSpell(summon, SPELL_KINETIC_BOMB, true, nullptr, nullptr, me->GetGUID());
break;
case NPC_SHOCK_VORTEX:
summon->m_Events.AddEvent(new ShockVortexExplodeEvent(*summon), summon->m_Events.CalculateTime(4500));
summon->m_Events.AddEventAtOffset(new ShockVortexExplodeEvent(*summon), 4500ms);
break;
default:
break;
@@ -939,7 +939,7 @@ public:
me->RemoveUnitFlag2(UNIT_FLAG2_FEIGN_DEATH);
me->SetReactState(REACT_AGGRESSIVE);
me->ForceValuesUpdateAtIndex(UNIT_NPC_FLAGS); // was in sniff. don't ask why
me->m_Events.AddEvent(new StandUpEvent(*me), me->m_Events.CalculateTime(1000));
me->m_Events.AddEventAtOffset(new StandUpEvent(*me), 1s);
me->SetHealth(me->GetMaxHealth());
DoAction(ACTION_CAST_INVOCATION);
break;

View File

@@ -373,7 +373,7 @@ class BattleExperienceEvent : public BasicEvent
{
public:
static uint32 const ExperiencedSpells[5];
static uint32 const ExperiencedTimes[5];
static Milliseconds const ExperiencedTimes[5];
BattleExperienceEvent(Creature* creature) : _creature(creature), _level(0) { }
@@ -388,7 +388,8 @@ public:
_creature->CastSpell(_creature, ExperiencedSpells[_level], true);
if (_level < (_creature->GetMap()->IsHeroic() ? 4 : 3))
{
_creature->m_Events.AddEvent(this, timer + ExperiencedTimes[_level]);
Milliseconds nextExperienceEventTime = Milliseconds(timer) + ExperiencedTimes[_level];
_creature->m_Events.AddEventAtOffset(this, nextExperienceEventTime);
return false;
}
@@ -401,7 +402,7 @@ private:
};
uint32 const BattleExperienceEvent::ExperiencedSpells[5] = { 0, SPELL_EXPERIENCED, SPELL_VETERAN, SPELL_ELITE, SPELL_ADDS_BERSERK };
uint32 const BattleExperienceEvent::ExperiencedTimes[5] = { 100000, 70000, 60000, 90000, 0 };
Milliseconds const BattleExperienceEvent::ExperiencedTimes[5] = { 100s, 70s, 60s, 90s, 0ms };
class PassengerController
{
@@ -675,7 +676,7 @@ public:
else
{
uint32 teleportSpellId = _teamIdInInstance == TEAM_HORDE ? SPELL_TELEPORT_PLAYERS_ON_RESET_H : SPELL_TELEPORT_PLAYERS_ON_RESET_A;
me->m_Events.AddEvent(new ResetEncounterEvent(me, teleportSpellId, _instance->GetGuidData(DATA_ENEMY_GUNSHIP)), me->m_Events.CalculateTime(8000));
me->m_Events.AddEventAtOffset(new ResetEncounterEvent(me, teleportSpellId, _instance->GetGuidData(DATA_ENEMY_GUNSHIP)), 8s);
}
}
@@ -1544,7 +1545,7 @@ struct gunship_npc_AI : public ScriptedAI
if (type == POINT_MOTION_TYPE && pointId == EVENT_CHARGE_PREPATH && Slot)
{
me->SetFacingTo(Slot->TargetPosition.GetOrientation());
me->m_Events.AddEvent(new BattleExperienceEvent(me), me->m_Events.CalculateTime(BattleExperienceEvent::ExperiencedTimes[0]));
me->m_Events.AddEventAtOffset(new BattleExperienceEvent(me), BattleExperienceEvent::ExperiencedTimes[0]);
me->CastSpell(me, SPELL_BATTLE_EXPERIENCE, true);
me->SetReactState(REACT_AGGRESSIVE);
}
@@ -1579,7 +1580,7 @@ struct npc_gunship_boarding_addAI : public ScriptedAI
{
SetSlotInfo(data);
me->SetReactState(REACT_PASSIVE);
me->m_Events.AddEvent(new DelayedMovementEvent(me, Slot->TargetPosition), me->m_Events.CalculateTime(3000 * (Index - SLOT_MARINE_1)));
me->m_Events.AddEventAtOffset(new DelayedMovementEvent(me, Slot->TargetPosition), Milliseconds(3000 * (Index - SLOT_MARINE_1)));
}
}
@@ -1608,7 +1609,7 @@ struct npc_gunship_boarding_addAI : public ScriptedAI
if (type == POINT_MOTION_TYPE && pointId == EVENT_CHARGE_PREPATH && Slot)
{
me->SetFacingTo(Slot->TargetPosition.GetOrientation());
me->m_Events.AddEvent(new BattleExperienceEvent(me), me->m_Events.CalculateTime(BattleExperienceEvent::ExperiencedTimes[0]));
me->m_Events.AddEventAtOffset(new BattleExperienceEvent(me), BattleExperienceEvent::ExperiencedTimes[0]);
me->CastSpell(me, SPELL_BATTLE_EXPERIENCE, true);
me->SetReactState(REACT_AGGRESSIVE);

View File

@@ -522,7 +522,7 @@ public:
darnavan->GetMotionMaster()->MoveIdle();
darnavan->StopMoving();
darnavan->SetReactState(REACT_PASSIVE);
darnavan->m_Events.AddEvent(new DaranavanMoveEvent(*darnavan), darnavan->m_Events.CalculateTime(10000));
darnavan->m_Events.AddEventAtOffset(new DaranavanMoveEvent(*darnavan), 10s);
darnavan->AI()->Talk(SAY_DARNAVAN_RESCUED);
if (Player* owner = killer->GetCharmerOrOwnerPlayerOrPlayerItself())
{

View File

@@ -384,7 +384,7 @@ public:
me->SetUnitFlag(UNIT_FLAG_NON_ATTACKABLE);
me->SetSpeed(MOVE_RUN, 4.28571f);
float moveTime = me->GetExactDist(&SindragosaFlyInPos) / (me->GetSpeed(MOVE_RUN) * 0.001f);
me->m_Events.AddEvent(new FrostwyrmLandEvent(*me, SindragosaLandPos), me->m_Events.CalculateTime(uint64(moveTime) + 250));
me->m_Events.AddEventAtOffset(new FrostwyrmLandEvent(*me, SindragosaLandPos), Milliseconds(uint32(moveTime) + 250));
me->GetMotionMaster()->MovePoint(POINT_FROSTWYRM_FLY_IN, SindragosaFlyInPos);
if (!instance->GetData(DATA_SINDRAGOSA_INTRO))
@@ -478,7 +478,7 @@ public:
{
summons.Summon(summon);
if (summon->GetEntry() == NPC_FROST_BOMB)
summon->m_Events.AddEvent(new FrostBombExplosion(summon, me->GetGUID()), summon->m_Events.CalculateTime(5500));
summon->m_Events.AddEventAtOffset(new FrostBombExplosion(summon, me->GetGUID()), 5500ms);
}
void SummonedCreatureDespawn(Creature* summon) override
@@ -1079,7 +1079,7 @@ class spell_sindragosa_ice_tomb_trap_aura : public AuraScript
void AfterApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
if (Unit* c = GetCaster())
GetTarget()->m_Events.AddEvent(new IceTombSummonEvent(GetTarget(), c->GetGUID()), GetTarget()->m_Events.CalculateTime(500));
GetTarget()->m_Events.AddEventAtOffset(new IceTombSummonEvent(GetTarget(), c->GetGUID()), 500ms);
}
void ExtraRemoveEffect(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
@@ -1245,7 +1245,7 @@ public:
me->setActive(true);
me->SetImmuneToPC(true);
float moveTime = me->GetExactDist(&SpinestalkerFlyPos) / (me->GetSpeed(MOVE_RUN) * 0.001f);
me->m_Events.AddEvent(new FrostwyrmLandEvent(*me, SpinestalkerLandPos), me->m_Events.CalculateTime(uint64(moveTime) + 250));
me->m_Events.AddEventAtOffset(new FrostwyrmLandEvent(*me, SpinestalkerLandPos), Milliseconds(uint32(moveTime) + 250));
me->SetDefaultMovementType(IDLE_MOTION_TYPE);
me->GetMotionMaster()->MoveIdle();
me->StopMoving();
@@ -1376,7 +1376,7 @@ public:
me->setActive(true);
me->SetImmuneToPC(true);
float moveTime = me->GetExactDist(&RimefangFlyPos) / (me->GetSpeed(MOVE_RUN) * 0.001f);
me->m_Events.AddEvent(new FrostwyrmLandEvent(*me, RimefangLandPos), me->m_Events.CalculateTime(uint64(moveTime) + 250));
me->m_Events.AddEventAtOffset(new FrostwyrmLandEvent(*me, RimefangLandPos), Milliseconds(uint32(moveTime) + 250));
me->SetDefaultMovementType(IDLE_MOTION_TYPE);
me->GetMotionMaster()->MoveIdle();
me->StopMoving();

View File

@@ -552,7 +552,7 @@ public:
if (--_counter)
{
_owner->m_Events.AddEvent(this, _owner->m_Events.CalculateTime(3000));
_owner->m_Events.AddEventAtOffset(this, 3s);
return false;
}
@@ -830,8 +830,8 @@ public:
if (Creature* terenas = me->FindNearestCreature(NPC_TERENAS_MENETHIL_OUTRO, 50.0f))
terenas->DespawnOrUnsummon(1ms);
me->m_Events.AddEvent(new LichKingDeathEvent(*me), me->m_Events.CalculateTime(2500)); // die after spinning anim is over, so death anim is visible
me->m_Events.AddEvent(new LichKingMovieEvent(*me), me->m_Events.CalculateTime(11500));
me->m_Events.AddEventAtOffset(new LichKingDeathEvent(*me), 2500ms); // die after spinning anim is over, so death anim is visible
me->m_Events.AddEventAtOffset(new LichKingMovieEvent(*me), 11500ms);
}
if (!_bFordringMustFallYell && me->GetHealth() < 500000)
@@ -862,7 +862,7 @@ public:
summon->CastSpell(summon, SPELL_RISEN_WITCH_DOCTOR_SPAWN, true);
summon->SetReactState(REACT_PASSIVE);
summon->HandleEmoteCommand(EMOTE_ONESHOT_EMERGE);
summon->m_Events.AddEvent(new StartMovementEvent(me, summon), summon->m_Events.CalculateTime(5000));
summon->m_Events.AddEventAtOffset(new StartMovementEvent(me, summon), 5s);
break;
case NPC_RAGING_SPIRIT:
summon->SetHomePosition(CenterPosition);
@@ -872,7 +872,7 @@ public:
summon->SetReactState(REACT_PASSIVE);
summon->GetMotionMaster()->MoveRandom(10.0f);
if (_phase == PHASE_THREE)
summon->m_Events.AddEvent(new VileSpiritActivateEvent(summon), summon->m_Events.CalculateTime(15000));
summon->m_Events.AddEventAtOffset(new VileSpiritActivateEvent(summon), 15s);
break;
}
case NPC_STRANGULATE_VEHICLE:
@@ -1189,7 +1189,7 @@ public:
if (summon->GetEntry() == NPC_VILE_SPIRIT)
{
summon->m_Events.KillAllEvents(true);
summon->m_Events.AddEvent(new VileSpiritActivateEvent(summon), summon->m_Events.CalculateTime(55000));
summon->m_Events.AddEventAtOffset(new VileSpiritActivateEvent(summon), 55s);
summon->GetMotionMaster()->Clear(true);
summon->StopMoving();
summon->SetReactState(REACT_PASSIVE);
@@ -1213,7 +1213,7 @@ public:
{
spawner->CastSpell(spawner, SPELL_SUMMON_SPIRIT_BOMB_1, true); // summons bombs randomly
spawner->CastSpell(spawner, SPELL_SUMMON_SPIRIT_BOMB_2, true); // summons bombs on players
spawner->m_Events.AddEvent(new TriggerWickedSpirit(spawner), spawner->m_Events.CalculateTime(3000));
spawner->m_Events.AddEventAtOffset(new TriggerWickedSpirit(spawner), 3s);
terenas->SetImmuneToAll(true); // to avoid being healed by player trinket procs. terenas' health doesn't matter on heroic
}
}

View File

@@ -417,13 +417,13 @@ public:
{
if (summon->GetEntry() == NPC_DREAM_PORTAL_PRE_EFFECT)
{
summon->m_Events.AddEvent(new DelayedCastEvent(summon, SPELL_SUMMON_DREAM_PORTAL, me->GetGUID(), 6s), summon->m_Events.CalculateTime(15000));
summon->m_Events.AddEvent(new AuraRemoveEvent(summon, SPELL_DREAM_PORTAL_VISUAL_PRE), summon->m_Events.CalculateTime(15000));
summon->m_Events.AddEventAtOffset(new DelayedCastEvent(summon, SPELL_SUMMON_DREAM_PORTAL, me->GetGUID(), 6s), 15s);
summon->m_Events.AddEventAtOffset(new AuraRemoveEvent(summon, SPELL_DREAM_PORTAL_VISUAL_PRE), 15s);
}
else if (summon->GetEntry() == NPC_NIGHTMARE_PORTAL_PRE_EFFECT)
{
summon->m_Events.AddEvent(new DelayedCastEvent(summon, SPELL_SUMMON_NIGHTMARE_PORTAL, me->GetGUID(), 6s), summon->m_Events.CalculateTime(15000));
summon->m_Events.AddEvent(new AuraRemoveEvent(summon, SPELL_NIGHTMARE_PORTAL_VISUAL_PRE), summon->m_Events.CalculateTime(15000));
summon->m_Events.AddEventAtOffset(new DelayedCastEvent(summon, SPELL_SUMMON_NIGHTMARE_PORTAL, me->GetGUID(), 6s), 15s);
summon->m_Events.AddEventAtOffset(new AuraRemoveEvent(summon, SPELL_NIGHTMARE_PORTAL_VISUAL_PRE), 15s);
}
}
@@ -579,7 +579,7 @@ public:
void DoAction(int32 action) override
{
if (action == ACTION_DEATH)
me->m_Events.AddEvent(new ValithriaDespawner(me), me->m_Events.CalculateTime(5000));
me->m_Events.AddEventAtOffset(new ValithriaDespawner(me), 5s);
else if (action == ACTION_ENTER_COMBAT)
{
if (!me->IsInCombat())
@@ -750,7 +750,7 @@ public:
void JustSummoned(Creature* summon) override
{
if (summon->GetEntry() == NPC_COLUMN_OF_FROST)
summon->m_Events.AddEvent(new DelayedCastEvent(summon, SPELL_COLUMN_OF_FROST_DAMAGE, ObjectGuid::Empty, 8s), summon->m_Events.CalculateTime(2000));
summon->m_Events.AddEventAtOffset(new DelayedCastEvent(summon, SPELL_COLUMN_OF_FROST_DAMAGE, ObjectGuid::Empty, 8s), 2s);
else if (summon->GetEntry() == NPC_MANA_VOID)
summon->DespawnOrUnsummon(36s);
}

View File

@@ -1017,15 +1017,15 @@ public:
if (Creature* crok = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_CROK_SCOURGEBANE))) // _isEventDone = true, setActive(false)
crok->AI()->DoAction(ACTION_RESET_EVENT);
uint64 delay = 6000;
Milliseconds delay = 6s;
for (uint32 i = 0; i < 4; ++i)
if (Creature* crusader = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_CAPTAIN_ARNATH + i)))
if (crusader->IsAlive())
{
if (crusader->GetEntry() == crusader->GetCreatureData()->id1)
{
crusader->m_Events.AddEvent(new CaptainSurviveTalk(*crusader), crusader->m_Events.CalculateTime(delay));
delay += 6000;
crusader->m_Events.AddEventAtOffset(new CaptainSurviveTalk(*crusader), delay);
delay += 6s;
}
else
Unit::Kill(crusader, crusader);

View File

@@ -513,7 +513,7 @@ public:
spellId = BLOOD_BEAM_VISUAL_LLEG;
else
spellId = BLOOD_BEAM_VISUAL_RLEG;
creature->m_Events.AddEvent(new DelayedCastMincharEvent(creature, spellId), creature->m_Events.CalculateTime(1000));
creature->m_Events.AddEventAtOffset(new DelayedCastMincharEvent(creature, spellId), 1s);
}
break;
case NPC_SKYBREAKER_DECKHAND:
@@ -608,7 +608,7 @@ public:
std::string name2("Kor'kron ");
if (!creature->GetTransport() && creature->GetPositionZ() <= 205.0f && creature->GetExactDist2d(-439.0f, 2210.0f) <= 150.0f && (creature->GetEntry() == 37544 || creature->GetEntry() == 37545 || creature->GetName().compare(0, name1.length(), name1) == 0 || creature->GetName().compare(0, name2.length(), name2) == 0))
if (!creature->GetLootRecipient())
creature->m_Events.AddEvent(new RespawnEvent(*creature), creature->m_Events.CalculateTime(3000));
creature->m_Events.AddEventAtOffset(new RespawnEvent(*creature), 3s);
switch (creature->GetEntry())
{

View File

@@ -727,7 +727,7 @@ public:
{
c->SetFaction(pPlayer->GetFaction());
//pPlayer->CastCustomSpell(60683, SPELLVALUE_BASE_POINT0, 1, c, true);
c->m_Events.AddEvent(new EoEDrakeEnterVehicleEvent(*c, pPlayer->GetGUID()), c->m_Events.CalculateTime(500));
c->m_Events.AddEventAtOffset(new EoEDrakeEnterVehicleEvent(*c, pPlayer->GetGUID()), 500ms);
AttackStart(c);
}
}

View File

@@ -89,7 +89,7 @@ public:
c->SetCanFly(true);
c->SetFaction(pPlayer->GetFaction());
//pPlayer->CastCustomSpell(60683, SPELLVALUE_BASE_POINT0, 1, c, true);
c->m_Events.AddEvent(new EoEDrakeEnterVehicleEvent(*c, pPlayer->GetGUID()), c->m_Events.CalculateTime(500));
c->m_Events.AddEventAtOffset(new EoEDrakeEnterVehicleEvent(*c, pPlayer->GetGUID()), 500ms);
}
}
}

View File

@@ -171,7 +171,7 @@ struct boss_anomalus : public BossAI
me->CastSpell(me, SPELL_CREATE_RIFT, false);
me->CastSpell(me, SPELL_RIFT_SHIELD, true);
me->m_Events.AddEvent(new ChargeRifts(me), me->m_Events.CalculateTime(1000));
me->m_Events.AddEventAtOffset(new ChargeRifts(me), 1s);
events.DelayEvents(46s);
//As we just spawned an empowered spawn a normal one
events.ScheduleEvent(EVENT_ANOMALUS_SPAWN_RIFT, IsHeroic() ? 15s : 25s);

View File

@@ -574,7 +574,7 @@ public:
summon->SetHomePosition(x, y, z, o);
summon->UpdatePosition(x, y, z, o, true);
summon->StopMovingOnCurrentPos();
summon->m_Events.AddEvent(new CosmicSmashDamageEvent(summon), summon->m_Events.CalculateTime(4000));
summon->m_Events.AddEventAtOffset(new CosmicSmashDamageEvent(summon), 4s);
break;
}
case NPC_UNLEASHED_DARK_MATTER:

View File

@@ -418,7 +418,7 @@ public:
if (pInstance)
pInstance->SetData(TYPE_ASSEMBLY, NOT_STARTED);
me->m_Events.AddEvent(new CastRunesEvent(*me), me->m_Events.CalculateTime(8000));
me->m_Events.AddEventAtOffset(new CastRunesEvent(*me), 8s);
}
void JustReachedHome() override

View File

@@ -769,12 +769,12 @@ public:
// so that can't be the issue
// See BoomEvent class
// Schedule 1s delayed
me->m_Events.AddEvent(new BoomEvent(me), me->m_Events.CalculateTime(1 * IN_MILLISECONDS));
me->m_Events.AddEventAtOffset(new BoomEvent(me), 1s);
}
void JustDied(Unit* /*killer*/) override
{
me->m_Events.AddEvent(new BoomEvent(me), me->m_Events.CalculateTime(1 * IN_MILLISECONDS));
me->m_Events.AddEventAtOffset(new BoomEvent(me), 1s);
}
void DamageTaken(Unit*, uint32& damage, DamageEffectType, SpellSchoolMask) override

View File

@@ -1439,7 +1439,7 @@ public:
{
me->SetDisplayId(me->GetNativeDisplayId());
me->CastSpell(me, SPELL_SAC_EMERGE, true);
me->m_Events.AddEvent(new SACActivateEvent(me), me->m_Events.CalculateTime(4000));
me->m_Events.AddEventAtOffset(new SACActivateEvent(me), 4s);
}
void Deactivate()
@@ -1452,7 +1452,7 @@ public:
void JustDied(Unit* /*killer*/) override
{
me->RemoveAurasDueToSpell(SPELL_SAC_GHOUL_AREA_AURA);
me->m_Events.AddEvent(new SACDeactivateEvent(me), me->m_Events.CalculateTime(4000));
me->m_Events.AddEventAtOffset(new SACDeactivateEvent(me), 4s);
}
void JustRespawned() override

View File

@@ -975,7 +975,7 @@ public:
};
if (who->IsPlayer())
who->m_Events.AddEvent(new DelayedTransportPositionOffsets(who), who->m_Events.CalculateTime(500));
who->m_Events.AddEventAtOffset(new DelayedTransportPositionOffsets(who), 500ms);
return;
}

View File

@@ -771,7 +771,7 @@ class spell_illidari_council_deadly_strike_aura : public AuraScript
if (Unit* target = GetUnitOwner()->GetAI()->SelectTarget(SelectTargetMethod::Random, 0, 100.0f, true))
{
GetUnitOwner()->CastSpell(target, GetSpellInfo()->Effects[effect->GetEffIndex()].TriggerSpell, true);
GetUnitOwner()->m_Events.AddEvent(new VerasEnvenom(*GetUnitOwner(), target->GetGUID()), GetUnitOwner()->m_Events.CalculateTime(urand(1500, 3500)));
GetUnitOwner()->m_Events.AddEventAtOffset(new VerasEnvenom(*GetUnitOwner(), target->GetGUID()), randtime(1500ms, 3500ms));
}
}

View File

@@ -284,7 +284,7 @@ public:
if (type != POINT_MOTION_TYPE || id != POINT_GO_BACK)
return;
me->m_Events.AddEvent(new SuckBackEvent(*me, ACTION_ESSENCE_OF_SUFFERING), me->m_Events.CalculateTime(1500));
me->m_Events.AddEventAtOffset(new SuckBackEvent(*me, ACTION_ESSENCE_OF_SUFFERING), 1500ms);
me->SetTarget();
me->SetFacingTo(M_PI / 2.0f);
}
@@ -392,7 +392,7 @@ public:
if (type != POINT_MOTION_TYPE || id != POINT_GO_BACK)
return;
me->m_Events.AddEvent(new SuckBackEvent(*me, ACTION_ESSENCE_OF_DESIRE), me->m_Events.CalculateTime(1500));
me->m_Events.AddEventAtOffset(new SuckBackEvent(*me, ACTION_ESSENCE_OF_DESIRE), 1500ms);
me->SetTarget();
me->SetFacingTo(M_PI / 2.0f);
}

View File

@@ -452,10 +452,10 @@ class spell_alar_flame_quills : public AuraScript
// 24 spells in total
for (uint8 i = 0; i < 21; ++i)
GetUnitOwner()->m_Events.AddEvent(new CastQuill(GetUnitOwner(), SPELL_QUILL_MISSILE_1 + i), GetUnitOwner()->m_Events.CalculateTime(i * 40));
GetUnitOwner()->m_Events.AddEvent(new CastQuill(GetUnitOwner(), SPELL_QUILL_MISSILE_2 + 0), GetUnitOwner()->m_Events.CalculateTime(22 * 40));
GetUnitOwner()->m_Events.AddEvent(new CastQuill(GetUnitOwner(), SPELL_QUILL_MISSILE_2 + 1), GetUnitOwner()->m_Events.CalculateTime(23 * 40));
GetUnitOwner()->m_Events.AddEvent(new CastQuill(GetUnitOwner(), SPELL_QUILL_MISSILE_2 + 2), GetUnitOwner()->m_Events.CalculateTime(24 * 40));
GetUnitOwner()->m_Events.AddEventAtOffset(new CastQuill(GetUnitOwner(), SPELL_QUILL_MISSILE_1 + i), Milliseconds(i * 40));
GetUnitOwner()->m_Events.AddEventAtOffset(new CastQuill(GetUnitOwner(), SPELL_QUILL_MISSILE_2 + 0), Milliseconds(22 * 40));
GetUnitOwner()->m_Events.AddEventAtOffset(new CastQuill(GetUnitOwner(), SPELL_QUILL_MISSILE_2 + 1), Milliseconds(23 * 40));
GetUnitOwner()->m_Events.AddEventAtOffset(new CastQuill(GetUnitOwner(), SPELL_QUILL_MISSILE_2 + 2), Milliseconds(24 * 40));
}
void Register() override

View File

@@ -1032,7 +1032,7 @@ public:
bool Execute(uint64 /*execTime*/, uint32 /*diff*/) override
{
if (_owner->IsBeingTeleportedNear())
_owner->m_Events.AddEvent(new lapseTeleport(_owner), _owner->m_Events.CalculateTime(1));
_owner->m_Events.AddEventAtOffset(new lapseTeleport(_owner), 1ms);
else if (!_owner->IsBeingTeleported())
{
_owner->CastSpell(_owner, SPELL_GRAVITY_LAPSE_KNOCKBACK, true);
@@ -1062,7 +1062,7 @@ class spell_kaelthas_gravity_lapse : public SpellScript
if (Player* target = GetHitPlayer())
{
GetCaster()->CastSpell(target, _currentSpellId++, true);
target->m_Events.AddEvent(new lapseTeleport(target), target->m_Events.CalculateTime(1));
target->m_Events.AddEventAtOffset(new lapseTeleport(target), 1ms);
}
}

View File

@@ -193,7 +193,7 @@ struct npc_pet_gen_argent_pony_bridle : public ScriptedAI
duration = cooldown;
aura = SPELL_AURA_POSTMAN_S + i;
_state = argentPonyService[TEAM_ALLIANCE][i];
me->ToTempSummon()->UnSummon(duration);
me->ToTempSummon()->UnSummon(Milliseconds(duration));
break;
}
}
@@ -204,7 +204,7 @@ struct npc_pet_gen_argent_pony_bridle : public ScriptedAI
duration = cooldown * IN_MILLISECONDS;
aura = SPELL_AURA_BANK_G + i;
_state = argentPonyService[TEAM_HORDE][i];
me->ToTempSummon()->UnSummon(duration);
me->ToTempSummon()->UnSummon(Milliseconds(duration));
break;
}
}

View File

@@ -138,7 +138,7 @@ struct npc_pet_mage_mirror_image : CasterAI
newAura->SetDuration(visAura->GetDuration());
}
me->m_Events.AddEvent(new DeathEvent(*me), me->m_Events.CalculateTime(29500));
me->m_Events.AddEventAtOffset(new DeathEvent(*me), 29500ms);
}
// Do not reload Creature templates on evade mode enter - prevent visual lost

View File

@@ -1669,7 +1669,7 @@ public:
_player->HandleEmoteCommand(RAND(EMOTE_ONESHOT_APPLAUD, EMOTE_ONESHOT_DANCESPECIAL, EMOTE_ONESHOT_LAUGH, EMOTE_ONESHOT_CHEER, EMOTE_ONESHOT_CHICKEN));
}
_player->m_Events.AddEvent(this, RAND(_player->m_Events.CalculateTime(5000), _player->m_Events.CalculateTime(10000), _player->m_Events.CalculateTime(15000)));
_player->m_Events.AddEventAtOffset(this, RAND(5s, 10s, 15s));
return false; // do not delete re-added event in EventProcessor::Update
}
@@ -1690,7 +1690,7 @@ class spell_item_party_time : public AuraScript
return;
}
player->m_Events.AddEvent(new PartyTimeEmoteEvent(player), RAND(player->m_Events.CalculateTime(5000), player->m_Events.CalculateTime(10000), player->m_Events.CalculateTime(15000)));
player->m_Events.AddEventAtOffset(new PartyTimeEmoteEvent(player), RAND(5s, 10s, 15s));
}
void Register() override