feat(Core/Commands): GM command to display strings (#6268)

- Implements a new GM command to display strings from the acore_string table
- Syntax: .string #id [#locale]
- Closes https://github.com/azerothcore/azerothcore-wotlk/issues/1052
This commit is contained in:
buddiman
2021-06-18 17:09:52 +02:00
committed by GitHub
parent 848bb0891b
commit 8e9643c3b0
3 changed files with 48 additions and 1 deletions

View File

@@ -0,0 +1,7 @@
INSERT INTO `version_db_world` (`sql_rev`) VALUES ('1623112710636791400');
DELETE FROM `acore_string` WHERE `entry` = 6617;
INSERT INTO `acore_string` VALUES (6617, 'No acore_string for id: %i found.', null, null, 'Es wurde kein acore_string mit der id: %i gefunden.', null, null, null, null, null);
DELETE FROM `command` WHERE `name` = 'string';
INSERT INTO `command` VALUES ('string', 2, 'Syntax: .string #id [#locale]');

View File

@@ -1195,6 +1195,9 @@ enum AcoreStrings
LANG_GM_SILENCE = 6616, // "Silence is ON for %s" - Spell 1852
// Used for .string command
LANG_NO_ACORE_STRING_FOUND = 6617,
LANG_WORLD_CLOSED = 7523,
LANG_WORLD_OPENED = 7524,

View File

@@ -113,7 +113,8 @@ public:
{ "unbindsight", SEC_ADMINISTRATOR, false, HandleUnbindSightCommand, "" },
{ "playall", SEC_GAMEMASTER, false, HandlePlayAllCommand, "" },
{ "skirmish", SEC_ADMINISTRATOR, false, HandleSkirmishCommand, "" },
{ "mailbox", SEC_MODERATOR, false, &HandleMailBoxCommand, "" }
{ "mailbox", SEC_MODERATOR, false, &HandleMailBoxCommand, "" },
{ "string", SEC_GAMEMASTER, false, &HandleStringCommand, "" }
};
return commandTable;
}
@@ -3344,6 +3345,42 @@ public:
handler->GetSession()->SendShowMailBox(player->GetGUID());
return true;
}
static bool HandleStringCommand(ChatHandler *handler, char const *args)
{
if (!*args)
{
handler->SendSysMessage(LANG_CMD_SYNTAX);
return false;
}
uint32 id = atoi(strtok((char*)args, " "));
if (id == 0)
{
handler->SendSysMessage(LANG_CMD_SYNTAX);
return false;
}
uint32 locale = 0;
char* localeString = strtok(nullptr, " ");
if (localeString != nullptr)
{
locale = atoi(localeString);
}
const char* str = sObjectMgr->GetAcoreString(id, static_cast<LocaleConstant>(locale));
if (strcmp(str, "<error>") == 0)
{
handler->PSendSysMessage(LANG_NO_ACORE_STRING_FOUND, id);
return true;
}
else
{
handler->SendSysMessage(str);
return true;
}
}
};
void AddSC_misc_commandscript()