summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-11-14 13:13:06 +0300
committerAndrei Karas <akaras@inbox.ru>2014-11-14 13:13:06 +0300
commita64d627afaf3c2211de164cc25325323092db3cc (patch)
tree58f4e8d2206b825c42539307cded54b2f9ac6488 /src
parentfd3ff79b70accad28179fdc23049daec0bec9997 (diff)
downloadevol-hercules-a64d627afaf3c2211de164cc25325323092db3cc.tar.gz
evol-hercules-a64d627afaf3c2211de164cc25325323092db3cc.tar.bz2
evol-hercules-a64d627afaf3c2211de164cc25325323092db3cc.tar.xz
evol-hercules-a64d627afaf3c2211de164cc25325323092db3cc.zip
Add internal variable with client version.
New variable: ClientVersion
Diffstat (limited to 'src')
-rw-r--r--src/Makefile.am2
-rw-r--r--src/map/init.c2
-rw-r--r--src/map/parse.h3
-rw-r--r--src/map/pc.c29
-rw-r--r--src/map/pc.h14
5 files changed, 50 insertions, 0 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index 6099737..5c0befa 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -15,6 +15,8 @@ MAP_SRC = map/dummy.c \
map/init.c \
map/parse.c \
map/parse.h \
+ map/pc.c \
+ map/pc.h \
map/script.c \
map/script.h \
map/session.c \
diff --git a/src/map/init.c b/src/map/init.c
index c9536e7..2381de5 100644
--- a/src/map/init.c
+++ b/src/map/init.c
@@ -17,6 +17,7 @@
#include "map/dummy.h"
#include "map/parse.h"
#include "map/script.h"
+#include "map/pc.h"
#include "../../../common/HPMDataCheck.h" /* should always be the last file included! (if you don't make it last, it'll intentionally break compile time) */
@@ -60,6 +61,7 @@ HPExport void plugin_init (void)
addScriptCommand("misceffect2", "i*", dummy);
addPacket(0x7530, 22, map_parse_version, hpClif_Parse);
+ addHookPre("pc->readparam", epc_readparam_pre);
}
HPExport void server_preinit (void)
diff --git a/src/map/parse.h b/src/map/parse.h
index a4413e4..ea45975 100644
--- a/src/map/parse.h
+++ b/src/map/parse.h
@@ -7,4 +7,7 @@
void map_parse_version(int fd);
void sample_packet0f3(int fd);
+int epc_parse_setparam_pre(struct map_session_data *sd, int *type, int *val);
+int epc_parse_readparam_pre(struct map_session_data* sd, int *type);
+
#endif // EVOL_MAP_PARSE
diff --git a/src/map/pc.c b/src/map/pc.c
new file mode 100644
index 0000000..d1ad03c
--- /dev/null
+++ b/src/map/pc.c
@@ -0,0 +1,29 @@
+// Copyright (c) Copyright (c) Hercules Dev Team, licensed under GNU GPL.
+// Copyright (c) 2014 Evol developers
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "../../../common/HPMi.h"
+#include "../../../common/malloc.h"
+#include "../../../common/mmo.h"
+#include "../../../common/socket.h"
+#include "../../../common/strlib.h"
+
+#include "map/pc.h"
+#include "map/session.h"
+#include "map/sessionext.h"
+
+int epc_readparam_pre(struct map_session_data* sd, int *type)
+{
+ if (*type == Const_ClientVersion)
+ {
+ hookStop();
+ struct SessionExt *data = session_get_bysd(sd);
+ if (!data)
+ return 0;
+ return data->clientVersion;
+ }
+ return 0;
+}
diff --git a/src/map/pc.h b/src/map/pc.h
new file mode 100644
index 0000000..d9867ee
--- /dev/null
+++ b/src/map/pc.h
@@ -0,0 +1,14 @@
+// Copyright (c) Copyright (c) Hercules Dev Team, licensed under GNU GPL.
+// Copyright (c) 2014 Evol developers
+
+#ifndef EVOL_MAP_PC
+#define EVOL_MAP_PC
+
+enum VarConst
+{
+ Const_ClientVersion = 10000
+};
+
+int epc_readparam_pre(struct map_session_data* sd, int *type);
+
+#endif // EVOL_MAP_PC