mirror of
https://github.com/liyunfan1223/azerothcore-wotlk.git
synced 2026-08-05 06:17:56 +00:00
feat(Core/Commands): add ".server set security" to set realm security level (#26649)
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -76,6 +76,7 @@ public:
|
||||
{ "loglevel", HandleServerSetLogLevelCommand, rbac::RBAC_PERM_COMMAND_SERVER_SET_LOGLEVEL, Console::Yes },
|
||||
{ "motd", HandleServerSetMotdCommand, rbac::RBAC_PERM_COMMAND_SERVER_SET_MOTD, Console::Yes },
|
||||
{ "closed", HandleServerSetClosedCommand, rbac::RBAC_PERM_COMMAND_SERVER_SET_CLOSED, Console::Yes },
|
||||
{ "security", HandleServerSetSecurityCommand, rbac::RBAC_PERM_COMMAND_SERVER_SET_SECURITY, Console::Yes },
|
||||
};
|
||||
|
||||
static ChatCommandTable serverCommandTable =
|
||||
@@ -270,6 +271,7 @@ public:
|
||||
handler->PSendSysMessage("Connected players: {}. Characters in world: {}. Queue: {}.", activeSessionCount, playerCount, queuedSessionCount);
|
||||
|
||||
handler->PSendSysMessage("Connection peak: {}.", connPeak);
|
||||
handler->PSendSysMessage(LANG_COMMAND_SERVER_INFO_SECURITY, uint32(sWorld->GetPlayerSecurityLimit()));
|
||||
handler->PSendSysMessage(LANG_UPTIME, secsToTimeString(GameTime::GetUptime().count()));
|
||||
handler->PSendSysMessage("Update time diff: {}ms. Last {} diffs summary:", sWorldUpdateTime.GetLastUpdateTime(), sWorldUpdateTime.GetDatasetSize());
|
||||
handler->PSendSysMessage("|- Mean: {}ms", sWorldUpdateTime.GetAverageUpdateTime());
|
||||
@@ -600,6 +602,27 @@ public:
|
||||
return false;
|
||||
}
|
||||
|
||||
// Set the minimum security level allowed to log into this realm (realmlist.allowedSecurityLevel)
|
||||
static bool HandleServerSetSecurityCommand(ChatHandler* handler, uint8 level)
|
||||
{
|
||||
if (level > SEC_ADMINISTRATOR)
|
||||
{
|
||||
handler->SendErrorMessage(LANG_COMMAND_SERVER_SET_SECURITY_ERROR, SEC_PLAYER, SEC_ADMINISTRATOR);
|
||||
return false;
|
||||
}
|
||||
|
||||
LoginDatabasePreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_UPD_REALMLIST_SECURITY_LEVEL);
|
||||
stmt->SetData(0, level);
|
||||
stmt->SetData(1, realm.Id.Realm);
|
||||
LoginDatabase.Execute(stmt);
|
||||
|
||||
// Apply live; raising the limit kicks any now-disallowed sessions.
|
||||
sWorld->SetPlayerSecurityLimit(AccountTypes(level));
|
||||
|
||||
handler->PSendSysMessage(LANG_COMMAND_SERVER_SET_SECURITY, level);
|
||||
return true;
|
||||
}
|
||||
|
||||
// Set the level of logging
|
||||
static bool HandleServerSetLogLevelCommand(ChatHandler* /*handler*/, bool isLogger, std::string const& name, int32 level)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user