mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-24 14:16:31 +00:00
Merge branch 'azerothcore:master' into Playerbot
This commit is contained in:
@@ -280,11 +280,23 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool HandleServerShutDownCommand(ChatHandler* /*handler*/, int32 time, Optional<int32> exitCode, Tail reason)
|
||||
static bool HandleServerShutDownCommand(ChatHandler* handler, std::string time, Optional<int32> exitCode, Tail reason)
|
||||
{
|
||||
std::wstring wReason = std::wstring();
|
||||
std::string strReason = std::string();
|
||||
|
||||
if (time.empty())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (Acore::StringTo<int32>(time).value_or(0) < 0)
|
||||
{
|
||||
handler->SendSysMessage(LANG_BAD_VALUE);
|
||||
handler->SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!reason.empty())
|
||||
{
|
||||
if (!Utf8toWStr(reason, wReason))
|
||||
@@ -298,23 +310,48 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
int32 delay = TimeStringToSecs(time);
|
||||
if (delay <= 0)
|
||||
{
|
||||
delay = Acore::StringTo<int32>(time).value_or(0);
|
||||
}
|
||||
|
||||
if (delay <= 0)
|
||||
{
|
||||
handler->SendSysMessage(LANG_BAD_VALUE);
|
||||
handler->SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (exitCode && *exitCode >= 0 && *exitCode <= 125)
|
||||
{
|
||||
sWorld->ShutdownServ(time, 0, *exitCode);
|
||||
sWorld->ShutdownServ(delay, 0, *exitCode);
|
||||
}
|
||||
else
|
||||
{
|
||||
sWorld->ShutdownServ(time, 0, SHUTDOWN_EXIT_CODE, strReason);
|
||||
sWorld->ShutdownServ(delay, 0, SHUTDOWN_EXIT_CODE, strReason);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool HandleServerRestartCommand(ChatHandler* /*handler*/, int32 time, Optional<int32> exitCode, Tail reason)
|
||||
static bool HandleServerRestartCommand(ChatHandler* handler, std::string time, Optional<int32> exitCode, Tail reason)
|
||||
{
|
||||
std::wstring wReason = std::wstring();
|
||||
std::string strReason = std::string();
|
||||
|
||||
if (time.empty())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (Acore::StringTo<int32>(time).value_or(0) < 0)
|
||||
{
|
||||
handler->SendSysMessage(LANG_BAD_VALUE);
|
||||
handler->SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!reason.empty())
|
||||
{
|
||||
if (!Utf8toWStr(reason, wReason))
|
||||
@@ -328,23 +365,48 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
int32 delay = TimeStringToSecs(time);
|
||||
if (delay <= 0)
|
||||
{
|
||||
delay = Acore::StringTo<int32>(time).value_or(0);
|
||||
}
|
||||
|
||||
if (delay <= 0)
|
||||
{
|
||||
handler->SendSysMessage(LANG_BAD_VALUE);
|
||||
handler->SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (exitCode && *exitCode >= 0 && *exitCode <= 125)
|
||||
{
|
||||
sWorld->ShutdownServ(time, SHUTDOWN_MASK_RESTART, *exitCode);
|
||||
sWorld->ShutdownServ(delay, SHUTDOWN_MASK_RESTART, *exitCode);
|
||||
}
|
||||
else
|
||||
{
|
||||
sWorld->ShutdownServ(time, SHUTDOWN_MASK_RESTART, RESTART_EXIT_CODE, strReason);
|
||||
sWorld->ShutdownServ(delay, SHUTDOWN_MASK_RESTART, RESTART_EXIT_CODE, strReason);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool HandleServerIdleRestartCommand(ChatHandler* /*handler*/, int32 time, Optional<int32> exitCode, Tail reason)
|
||||
static bool HandleServerIdleRestartCommand(ChatHandler* handler, std::string time, Optional<int32> exitCode, Tail reason)
|
||||
{
|
||||
std::wstring wReason = std::wstring();
|
||||
std::string strReason = std::string();
|
||||
|
||||
if (time.empty())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (Acore::StringTo<int32>(time).value_or(0) < 0)
|
||||
{
|
||||
handler->SendSysMessage(LANG_BAD_VALUE);
|
||||
handler->SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!reason.empty())
|
||||
{
|
||||
if (!Utf8toWStr(reason, wReason))
|
||||
@@ -358,23 +420,48 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
int32 delay = TimeStringToSecs(time);
|
||||
if (delay <= 0)
|
||||
{
|
||||
delay = Acore::StringTo<int32>(time).value_or(0);
|
||||
}
|
||||
|
||||
if (delay <= 0)
|
||||
{
|
||||
handler->SendSysMessage(LANG_BAD_VALUE);
|
||||
handler->SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (exitCode && *exitCode >= 0 && *exitCode <= 125)
|
||||
{
|
||||
sWorld->ShutdownServ(time, SHUTDOWN_MASK_RESTART | SHUTDOWN_MASK_IDLE, *exitCode);
|
||||
sWorld->ShutdownServ(delay, SHUTDOWN_MASK_RESTART | SHUTDOWN_MASK_IDLE, *exitCode);
|
||||
}
|
||||
else
|
||||
{
|
||||
sWorld->ShutdownServ(time, SHUTDOWN_MASK_RESTART | SHUTDOWN_MASK_IDLE, RESTART_EXIT_CODE, strReason);
|
||||
sWorld->ShutdownServ(delay, SHUTDOWN_MASK_RESTART | SHUTDOWN_MASK_IDLE, RESTART_EXIT_CODE, strReason);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool HandleServerIdleShutDownCommand(ChatHandler* /*handler*/, int32 time, Optional<int32> exitCode, Tail reason)
|
||||
static bool HandleServerIdleShutDownCommand(ChatHandler* handler, std::string time, Optional<int32> exitCode, Tail reason)
|
||||
{
|
||||
std::wstring wReason = std::wstring();
|
||||
std::string strReason = std::string();
|
||||
|
||||
if (time.empty())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (Acore::StringTo<int32>(time).value_or(0) < 0)
|
||||
{
|
||||
handler->SendSysMessage(LANG_BAD_VALUE);
|
||||
handler->SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!reason.empty())
|
||||
{
|
||||
if (!Utf8toWStr(reason, wReason))
|
||||
@@ -388,13 +475,26 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
int32 delay = TimeStringToSecs(time);
|
||||
if (delay <= 0)
|
||||
{
|
||||
delay = Acore::StringTo<int32>(time).value_or(0);
|
||||
}
|
||||
|
||||
if (delay <= 0)
|
||||
{
|
||||
handler->SendSysMessage(LANG_BAD_VALUE);
|
||||
handler->SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (exitCode && *exitCode >= 0 && *exitCode <= 125)
|
||||
{
|
||||
sWorld->ShutdownServ(time, SHUTDOWN_MASK_IDLE, *exitCode);
|
||||
sWorld->ShutdownServ(delay, SHUTDOWN_MASK_IDLE, *exitCode);
|
||||
}
|
||||
else
|
||||
{
|
||||
sWorld->ShutdownServ(time, SHUTDOWN_MASK_IDLE, SHUTDOWN_EXIT_CODE, strReason);
|
||||
sWorld->ShutdownServ(delay, SHUTDOWN_MASK_IDLE, SHUTDOWN_EXIT_CODE, strReason);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user