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

@@ -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();
}
}