summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/emap/clif.c27
-rw-r--r--src/emap/clif.h3
-rw-r--r--src/emap/init.c2
3 files changed, 32 insertions, 0 deletions
diff --git a/src/emap/clif.c b/src/emap/clif.c
index 20c5f55..4de666f 100644
--- a/src/emap/clif.c
+++ b/src/emap/clif.c
@@ -10,6 +10,7 @@
#include "common/HPMi.h"
#include "common/memmgr.h"
#include "common/mmo.h"
+#include "common/nullpo.h"
#include "common/socket.h"
#include "common/strlib.h"
#include "common/cbasetypes.h"
@@ -700,3 +701,29 @@ void eclif_sendbgemblem_single(int *fdPtr, struct map_session_data *sd)
hookStop();
return;
}
+
+void eclif_disp_message(struct block_list* src,
+ const char* mes, size_t *lenPtr,
+ enum send_target *targetPtr)
+{
+ unsigned char buf[256];
+
+ int len = *lenPtr;
+
+ if (len == 0)
+ return;
+
+ nullpo_retv(src);
+ nullpo_retv(mes);
+
+ if (len > sizeof(buf) - 5)
+ {
+ ShowWarning("clif_disp_message: Truncated message '%s' (len=%d, max=%d, aid=%d).\n", mes, (int)len, (int)(sizeof(buf) - 5), src->id);
+ len = sizeof(buf) - 5;
+ }
+
+ WBUFW(buf, 0) = 0x8e;
+ WBUFW(buf, 2) = len + 5;
+ safestrncpy((char*)WBUFP(buf, 4), mes, len + 1);
+ clif->send(buf, WBUFW(buf, 2), src, *targetPtr);
+}
diff --git a/src/emap/clif.h b/src/emap/clif.h
index 43c423c..b03208e 100644
--- a/src/emap/clif.h
+++ b/src/emap/clif.h
@@ -32,5 +32,8 @@ void eclif_getareachar_item(struct map_session_data *sd, struct flooritem_data *
void eclif_dropflooritem(struct flooritem_data* fitem);
void eclif_sendbgemblem_area(struct map_session_data *sd);
void eclif_sendbgemblem_single(int *fdPtr, struct map_session_data *sd);
+void eclif_disp_message(struct block_list* src,
+ const char* mes, size_t *lenPtr,
+ enum send_target *targetPtr);
#endif // EVOL_MAP_CLIF
diff --git a/src/emap/init.c b/src/emap/init.c
index fbf41d4..dc2d031 100644
--- a/src/emap/init.c
+++ b/src/emap/init.c
@@ -11,6 +11,7 @@
#include "common/memmgr.h"
#include "common/mapindex.h"
#include "common/mmo.h"
+#include "common/nullpo.h"
#include "common/socket.h"
#include "common/strlib.h"
#include "common/timer.h"
@@ -172,6 +173,7 @@ HPExport void plugin_init (void)
addHookPre("clif->charnameack", eclif_charnameack);
addHookPre("clif->getareachar_item", eclif_getareachar_item);
addHookPre("clif->dropflooritem", eclif_dropflooritem);
+ addHookPre("clif->disp_message", eclif_disp_message);
addHookPre("clif->sendlook", eclif_sendlook);
addHookPre("clif->send", eclif_send);
addHookPre("clif->sendbgemblem_area", eclif_sendbgemblem_area);