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

@@ -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()