diff options
author | Andrei Karas <akaras@inbox.ru> | 2015-03-07 16:08:07 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2015-03-07 16:08:07 +0300 |
commit | 6e565a64b6a89e943c95e5b001aadd38727abe01 (patch) | |
tree | d75167bd37fb30336d1145203b0d040f7c7d215f | |
parent | 20e70d1846ba39599255887bef5098583a7586c9 (diff) | |
download | plugin-6e565a64b6a89e943c95e5b001aadd38727abe01.tar.gz plugin-6e565a64b6a89e943c95e5b001aadd38727abe01.tar.bz2 plugin-6e565a64b6a89e943c95e5b001aadd38727abe01.tar.xz plugin-6e565a64b6a89e943c95e5b001aadd38727abe01.zip |
map: translate server to client text messages.
-rw-r--r-- | src/Makefile.am | 4 | ||||
-rw-r--r-- | src/map/atcommand.c | 35 | ||||
-rw-r--r-- | src/map/atcommand.h | 10 | ||||
-rw-r--r-- | src/map/init.c | 3 |
4 files changed, 51 insertions, 1 deletions
diff --git a/src/Makefile.am b/src/Makefile.am index 4996c78..83923cb 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -32,7 +32,9 @@ LOGIN_SRC = login/config.c \ common/ip.c \ common/ip.h -MAP_SRC = map/clif.c \ +MAP_SRC = map/atcommand.c \ + map/atcommand.h \ + map/clif.c \ map/clif.h \ map/init.c \ map/itemdb.c \ diff --git a/src/map/atcommand.c b/src/map/atcommand.c new file mode 100644 index 0000000..00ffb44 --- /dev/null +++ b/src/map/atcommand.c @@ -0,0 +1,35 @@ +// 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 "../../../common/timer.h" +#include "../../../map/atcommand.h" +#include "../../../map/map.h" +#include "map/atcommand.h" +#include "map/lang.h" + +const char* eatcommand_msgsd(struct map_session_data *sd, int *msgPtr) +{ + const int msg_number = *msgPtr; + if (!(msg_number >= 0 && msg_number < MAX_MSG)) + return "??"; + return lang_pctrans(atcommand->msg_table[0][msg_number], sd); +} + +const char* eatcommand_msgfd(int *fdPtr, int *msgPtr) +{ + const int msg_number = *msgPtr; + const int fd = *fdPtr; + struct map_session_data *sd = session_isValid(fd) ? session[fd]->session_data : NULL; + if (!(msg_number >= 0 && msg_number < MAX_MSG)) + return "??"; + return lang_pctrans(atcommand->msg_table[0][msg_number], sd); +} diff --git a/src/map/atcommand.h b/src/map/atcommand.h new file mode 100644 index 0000000..bc3243a --- /dev/null +++ b/src/map/atcommand.h @@ -0,0 +1,10 @@ +// Copyright (c) Copyright (c) Hercules Dev Team, licensed under GNU GPL. +// Copyright (c) 2014 Evol developers + +#ifndef EVOL_MAP_ATCOMMAND +#define EVOL_MAP_ATCOMMAND + +const char* eatcommand_msgsd(struct map_session_data *sd, int *msgPtr); +const char* eatcommand_msgfd(int *fdPtr, int *msgPtr); + +#endif // EVOL_MAP_ATCOMMAND diff --git a/src/map/init.c b/src/map/init.c index 7635e67..e2834ca 100644 --- a/src/map/init.c +++ b/src/map/init.c @@ -36,6 +36,7 @@ #include "common/config.h" #include "common/init.h" +#include "map/atcommand.h" #include "map/clif.h" #include "map/itemdb.h" #include "map/lang.h" @@ -119,6 +120,8 @@ HPExport void plugin_init (void) addPacket(0xb14, 3, map_parse_homun_emote, hpClif_Parse); addPacket(0xb15, 9, map_parse_homun_dir, hpClif_Parse); + addHookPre("atcommand->msgfd", eatcommand_msgfd); + addHookPre("atcommand->msgsd", eatcommand_msgsd); addHookPre("pc->readparam", epc_readparam_pre); addHookPre("pc->setregistry", epc_setregistry); addHookPre("pc->equipitem_pos", epc_equipitem_pos); |