summaryrefslogtreecommitdiff
path: root/src/echar/char.c
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-08-10 01:03:32 +0300
committerAndrei Karas <akaras@inbox.ru>2016-08-10 01:03:32 +0300
commitcb10231838c918dbf380899a947599331818a4bc (patch)
tree7f92446dd65643a81d7ddf0419ff1c4c60be73be /src/echar/char.c
parent725fb53014ab7d48d43d69f0c1ca21354ef8619c (diff)
downloadevol-hercules-cb10231838c918dbf380899a947599331818a4bc.tar.gz
evol-hercules-cb10231838c918dbf380899a947599331818a4bc.tar.bz2
evol-hercules-cb10231838c918dbf380899a947599331818a4bc.tar.xz
evol-hercules-cb10231838c918dbf380899a947599331818a4bc.zip
Add gm command for send restart events to all servers.
For now it support only one char and one map server. For support this actions need use hercules wrapper.
Diffstat (limited to 'src/echar/char.c')
-rw-r--r--src/echar/char.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/echar/char.c b/src/echar/char.c
index e5649ad..26e6c61 100644
--- a/src/echar/char.c
+++ b/src/echar/char.c
@@ -14,6 +14,7 @@
#include "common/socket.h"
#include "common/strlib.h"
#include "common/sql.h"
+#include "common/utils.h"
#include "common/timer.h"
#include "char/char.h"
#include "char/inter.h"
@@ -320,3 +321,30 @@ void echar_parse_frommap_request_stats_report_pre(int *fdPtr)
RFIFOFLUSH(fd);
hookStop();
}
+
+void echar_parse_map_serverexit(int mapFd)
+{
+ const int code = RFIFOW(mapFd, 2);
+ switch (code)
+ {
+ case 100: // all exit
+ case 101: // all restart
+ case 102: // restart char and map server
+ echat_send_login_serverexit(code);
+ HSleep(1);
+ core->shutdown_callback();
+ break;
+ case 103: // restart map server
+ break;
+ default:
+ ShowWarning("Unknown termination code: %d\n", code);
+ }
+}
+
+void echat_send_login_serverexit(const int code)
+{
+ WFIFOHEAD(chr->login_fd, 4);
+ WFIFOW(chr->login_fd, 0) = 0x5003;
+ WFIFOW(chr->login_fd, 2) = code;
+ WFIFOSET(chr->login_fd, 4);
+}