feat(Core/SAI): Implement delay option to SMART_ACTION_TALK (#22918)

This commit is contained in:
Andrew
2025-09-15 04:44:49 -03:00
committed by GitHub
parent fc30b784ae
commit 94c2f38ecc
3 changed files with 7 additions and 3 deletions

View File

@@ -53,9 +53,11 @@ void CreatureAI::Talk(uint8 id, WorldObject const* target /*= nullptr*/, Millise
{
if (delay > Seconds::zero())
{
me->m_Events.AddEventAtOffset([this, id, target]()
ObjectGuid targetGuid = target->GetGUID();
me->m_Events.AddEventAtOffset([this, id, targetGuid]()
{
sCreatureTextMgr->SendChat(me, id, target);
if (Unit* textTarget = ObjectAccessor::GetUnit(*me, targetGuid))
sCreatureTextMgr->SendChat(me, id, textTarget);
}, delay);
}
else