mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-13 01:08:35 +00:00
feat(Scripts/Commands): Add command ".npc do" for calling DoAction() (#24281)
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
--
|
||||
DELETE FROM `acore_string` WHERE `entry` = 603;
|
||||
INSERT INTO `acore_string` (`entry`, `content_default`) VALUES
|
||||
(603, 'Do Action performed on [GUID: {}, entry: {}, name: {}] Action: {}');
|
||||
|
||||
DELETE FROM `command` WHERE `name` = 'npc do';
|
||||
INSERT INTO `command` (`name`, `security`, `help`) VALUES
|
||||
('npc do', 3, 'Syntax: .npc do $action\nRequests the NPC to perform DoAction with the specified ActionID. Used for testing scripts.');
|
||||
@@ -671,6 +671,8 @@ enum AcoreStrings
|
||||
|
||||
LANG_REWARDED = 602,
|
||||
|
||||
LANG_NPC_DO_ACTION = 603,
|
||||
|
||||
// 603-704 - free
|
||||
|
||||
LANG_WAIT_BEFORE_SPEAKING = 705,
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user