mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2025-11-29 17:38:24 +08:00
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:
@@ -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]');
|
||||||
@@ -1195,6 +1195,9 @@ enum AcoreStrings
|
|||||||
|
|
||||||
LANG_GM_SILENCE = 6616, // "Silence is ON for %s" - Spell 1852
|
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_CLOSED = 7523,
|
||||||
LANG_WORLD_OPENED = 7524,
|
LANG_WORLD_OPENED = 7524,
|
||||||
|
|
||||||
|
|||||||
@@ -113,7 +113,8 @@ public:
|
|||||||
{ "unbindsight", SEC_ADMINISTRATOR, false, HandleUnbindSightCommand, "" },
|
{ "unbindsight", SEC_ADMINISTRATOR, false, HandleUnbindSightCommand, "" },
|
||||||
{ "playall", SEC_GAMEMASTER, false, HandlePlayAllCommand, "" },
|
{ "playall", SEC_GAMEMASTER, false, HandlePlayAllCommand, "" },
|
||||||
{ "skirmish", SEC_ADMINISTRATOR, false, HandleSkirmishCommand, "" },
|
{ "skirmish", SEC_ADMINISTRATOR, false, HandleSkirmishCommand, "" },
|
||||||
{ "mailbox", SEC_MODERATOR, false, &HandleMailBoxCommand, "" }
|
{ "mailbox", SEC_MODERATOR, false, &HandleMailBoxCommand, "" },
|
||||||
|
{ "string", SEC_GAMEMASTER, false, &HandleStringCommand, "" }
|
||||||
};
|
};
|
||||||
return commandTable;
|
return commandTable;
|
||||||
}
|
}
|
||||||
@@ -3344,6 +3345,42 @@ public:
|
|||||||
handler->GetSession()->SendShowMailBox(player->GetGUID());
|
handler->GetSession()->SendShowMailBox(player->GetGUID());
|
||||||
return true;
|
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()
|
void AddSC_misc_commandscript()
|
||||||
|
|||||||
Reference in New Issue
Block a user