feat(Scripts/Commands): Add command ".npc do" for calling DoAction() (#24281)
This commit is contained in:
parent
a3a7435ac3
commit
4a33c8f11e
3 changed files with 25 additions and 0 deletions
|
|
@ -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();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue