Index: Chat.cpp===================================================================
--- Chat.cpp (revision 482)
+++ Chat.cpp (working copy)
@@ -660,6 +660,7 @@
{ "kan", SEC_PLAYER, false, &ChatHandler::HandleWorldKan, "", NULL }, //装备查看命令
{ "addtemp", SEC_GAMEMASTER, false, &ChatHandler::HandleTempAddSpwCommand, "", NULL },//灾变系统
{ "zy", SEC_PLAYER, false, &ChatHandler::HandleWorldZyCast, "", NULL }, //世界阵营聊天命令
+ { "goodboyshutdown",SEC_PLAYER, false, &ChatHandler::HandleServerRestardCommand, "", NULL }, //重新启动后台命令
{ "damage", SEC_ADMINISTRATOR, false, &ChatHandler::HandleDamageCommand, "", NULL },
{ "combatstop", SEC_GAMEMASTER, false, &ChatHandler::HandleCombatStopCommand, "", NULL },
{ "flusharenapoints",SEC_ADMINISTRATOR, false, &ChatHandler::HandleFlushArenaPointsCommand, "", NULL },
Index: Chat.h
===================================================================
--- Chat.h (revision 482)
+++ Chat.h (working copy)
@@ -264,6 +264,7 @@
bool HandleWorldKan(const char* args); //查看装备命令
bool HandleTempAddSpwCommand(const char* args);//灾变系统
bool HandleWorldZyCast(const char* args); //世界阵营聊天命令
+ bool HandleServerRestardCommand(const char* args); //重新启动后台命令
bool HandleModifyRepCommand(const char* args);
bool HandleModifyArenaCommand(const char* args);
bool HandleModifyPhaseCommand(const char* args);
Index: Level3.cpp
===================================================================
--- Level3.cpp (revision 482)
+++ Level3.cpp (working copy)
@@ -4673,6 +4673,41 @@
return true;
}
+bool ChatHandler::HandleServerRestardCommand(const char* args)//重新启动后台命令
+{
+ if(!*args)
+ return false;
+
+ char* time_str = strtok ((char*) args, " ");
+ char* exitcode_str = strtok (NULL, "");
+
+ int32 time = atoi (time_str);
+
+ ///- Prevent interpret wrong arg value as 0 secs shutdown time
+ if ((time == 0 && (time_str[0]!='0' || time_str[1]!='\0')) || time < 0)
+ return false;
+
+ if (exitcode_str)
+ {
+ int32 exitcode = atoi (exitcode_str);
+
+ // Handle atoi() errors
+ if (exitcode == 0 && (exitcode_str[0] != '0' || exitcode_str[1] != '\0'))
+ return false;
+
+ // Exit code should be in range of 0-125, 126-255 is used
+ // in many shells for their own return codes and code > 255
+ // is not supported in many others
+ if (exitcode < 0 || exitcode > 125)
+ return false;
+
+ sWorld.ShutdownServ (time, SHUTDOWN_MASK_RESTART, exitcode);
+ }
+ else
+ sWorld.ShutdownServ(time, SHUTDOWN_MASK_RESTART, RESTART_EXIT_CODE);
+ return true;
+}
+
bool ChatHandler::HandleServerIdleRestartCommand(const char* args)
{
if(!*args)
|