diff options
-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); |