feat(Scripts/Commands): Add command ".npc do" for calling DoAction() (#24281)

This commit is contained in:
Gultask
2026-01-01 05:42:12 -03:00
committed by GitHub
parent a3a7435ac3
commit 4a33c8f11e
3 changed files with 25 additions and 0 deletions

View File

@@ -671,6 +671,8 @@ enum AcoreStrings
LANG_REWARDED = 602,
LANG_NPC_DO_ACTION = 603,
// 603-704 - free
LANG_WAIT_BEFORE_SPEAKING = 705,

View File

@@ -188,6 +188,7 @@ public:
{ "whisper", HandleNpcWhisperCommand, SEC_GAMEMASTER, Console::No },
{ "yell", HandleNpcYellCommand, SEC_GAMEMASTER, Console::No },
{ "tame", HandleNpcTameCommand, SEC_GAMEMASTER, Console::No },
{ "do", HandleNpcDoActionCommand, SEC_GAMEMASTER, Console::No },
{ "add", npcAddCommandTable },
{ "delete", npcDeleteCommandTable },
{ "follow", npcFollowCommandTable },
@@ -1212,6 +1213,20 @@ public:
return true;
}
static bool HandleNpcDoActionCommand(ChatHandler* handler, uint32 actionId)
{
Creature* creature = handler->getSelectedCreature();
if (!creature)
{
handler->SendErrorMessage(LANG_SELECT_CREATURE);
return false;
}
creature->AI()->DoAction(actionId);
handler->PSendSysMessage(LANG_NPC_DO_ACTION, creature->GetGUID().ToString(), creature->GetEntry(), creature->GetName(), actionId);
return true;
}
static bool HandleNpcAddFormationCommand(ChatHandler* handler, ObjectGuid::LowType leaderGUID)
{
Creature* creature = handler->getSelectedCreature();