summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/char/char.c27
-rw-r--r--src/char/char.h2
-rw-r--r--src/char/init.c1
3 files changed, 30 insertions, 0 deletions
diff --git a/src/char/char.c b/src/char/char.c
index d68d02b..f971617 100644
--- a/src/char/char.c
+++ b/src/char/char.c
@@ -10,6 +10,7 @@
#include "../../../common/mmo.h"
#include "../../../common/socket.h"
#include "../../../common/strlib.h"
+#include "../../../common/timer.h"
#include "../../../char/char.h"
#include "common/ip.h"
@@ -130,3 +131,29 @@ void echar_creation_failed(int *fdPtr, int *result)
WFIFOSET(fd,3);
hookStop();
}
+
+void echar_parse_char_ping(int *fdPtr)
+{
+ const int fd = *fdPtr;
+ RFIFOSKIP(fd, 6);
+
+ struct char_session_data* sd = (struct char_session_data*)session[fd]->session_data;
+ if (!sd)
+ {
+ hookStop();
+ return;
+ }
+ struct online_char_data* character = (struct online_char_data*)idb_get(chr->online_char_db, sd->account_id);
+ if (!character)
+ {
+ hookStop();
+ return;
+ }
+
+ if (character->waiting_disconnect != INVALID_TIMER)
+ {
+ timer->delete(character->waiting_disconnect, chr->waiting_disconnect);
+ character->waiting_disconnect = timer->add(timer->gettick() + 30000, chr->waiting_disconnect, character->account_id, 0);
+ }
+ hookStop();
+}
diff --git a/src/char/char.h b/src/char/char.h
index 7896a0e..eb90bce 100644
--- a/src/char/char.h
+++ b/src/char/char.h
@@ -10,4 +10,6 @@ void echar_parse_char_create_new_char(int *fdPtr, struct char_session_data* sd);
void echar_creation_failed(int *fdPtr, int *result);
+void echar_parse_char_ping(int *fdPtr);
+
#endif // EVOL_CHAR_CHAR
diff --git a/src/char/init.c b/src/char/init.c
index 87b952b..262a463 100644
--- a/src/char/init.c
+++ b/src/char/init.c
@@ -62,6 +62,7 @@ HPExport void plugin_init (void)
addHookPre("chr->parse_char_login_map_server", echar_parse_char_login_map_server);
addHookPre("chr->parse_char_create_new_char", echar_parse_char_create_new_char);
+ //addHookPre("chr->parse_char_ping", echar_parse_char_ping);
addHookPre("chr->creation_failed", echar_creation_failed);
}