mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-03-15 05:25:08 +00:00
feat(Core/SAI): Implement delay option to SMART_ACTION_TALK (#22918)
This commit is contained in:
@@ -53,9 +53,11 @@ void CreatureAI::Talk(uint8 id, WorldObject const* target /*= nullptr*/, Millise
|
|||||||
{
|
{
|
||||||
if (delay > Seconds::zero())
|
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);
|
}, delay);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -238,7 +238,8 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
|
|||||||
mLastTextID = e.action.talk.textGroupID;
|
mLastTextID = e.action.talk.textGroupID;
|
||||||
mTextTimer = e.action.talk.duration;
|
mTextTimer = e.action.talk.duration;
|
||||||
mUseTextTimer = true;
|
mUseTextTimer = true;
|
||||||
sCreatureTextMgr->SendChat(talker, uint8(e.action.talk.textGroupID), talkTarget);
|
|
||||||
|
talker->AI()->Talk(e.action.talk.textGroupID, talkTarget, Milliseconds(e.action.talk.delay));
|
||||||
LOG_DEBUG("sql.sql", "SmartScript::ProcessAction: SMART_ACTION_TALK: talker: {} ({}), textId: {}", talker->GetName(), talker->GetGUID().ToString(), mLastTextID);
|
LOG_DEBUG("sql.sql", "SmartScript::ProcessAction: SMART_ACTION_TALK: talker: {} ({}), textId: {}", talker->GetName(), talker->GetGUID().ToString(), mLastTextID);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -765,6 +765,7 @@ struct SmartAction
|
|||||||
uint32 textGroupID;
|
uint32 textGroupID;
|
||||||
uint32 duration;
|
uint32 duration;
|
||||||
SAIBool useTalkTarget;
|
SAIBool useTalkTarget;
|
||||||
|
uint32 delay;
|
||||||
} talk;
|
} talk;
|
||||||
|
|
||||||
struct
|
struct
|
||||||
|
|||||||
Reference in New Issue
Block a user