diff options
-rw-r--r-- | src/map/clif.c | 29 | ||||
-rw-r--r-- | src/map/clif.h | 1 | ||||
-rw-r--r-- | src/map/packets_struct.h | 10 |
3 files changed, 40 insertions, 0 deletions
diff --git a/src/map/clif.c b/src/map/clif.c index 82ced2d24..df7b3839b 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -8971,6 +8971,34 @@ static void clif_messagecolor(struct block_list *bl, uint32 color, const char *m clif->send(buf, WBUFW(buf,2), bl, AREA_CHAT_WOC); } +// Message without owner, not logged in chat +static void clif_serviceMessageColor(struct map_session_data *sd, uint32 color, const char *msg) +{ +#if PACKETVER_MAIN_NUM >= 20170830 || PACKETVER_RE_NUM >= 20170830 || defined(PACKETVER_ZERO) + nullpo_retv(sd); + nullpo_retv(msg); + + int msg_len = (int)strlen(msg) + 1; + + if (msg_len > 512) { + ShowWarning("clif_serviceMessageColor: Truncating too long message '%s' (len=%d).\n", msg, msg_len); + msg_len = 512; + } + + const int len = sizeof(struct PACKET_ZC_SERVICE_MESSAGE_COLOR) + msg_len; + const int fd = sd->fd; + WFIFOHEAD(fd, len); + struct PACKET_ZC_SERVICE_MESSAGE_COLOR *p = WFIFOP(fd, 0); + + p->packetType = HEADER_ZC_SERVICE_MESSAGE_COLOR; + p->packetLength = len; + p->color = RGB2BGR(color); + safestrncpy(p->message, msg, msg_len); + + WFIFOSET(fd, len); +#endif +} + /** * Notifies the client that the storage window is still open * @@ -22592,6 +22620,7 @@ void clif_defaults(void) clif->broadcast2 = clif_broadcast2; clif->messagecolor_self = clif_messagecolor_self; clif->messagecolor = clif_messagecolor; + clif->serviceMessageColor = clif_serviceMessageColor; clif->disp_overhead = clif_disp_overhead; clif->notify_playerchat = clif_notify_playerchat; clif->msgtable_skill = clif_msgtable_skill; diff --git a/src/map/clif.h b/src/map/clif.h index c8db1a0fd..be127a54f 100644 --- a/src/map/clif.h +++ b/src/map/clif.h @@ -972,6 +972,7 @@ struct clif_interface { void (*broadcast2) (struct block_list *bl, const char *mes, int len, unsigned int fontColor, short fontType, short fontSize, short fontAlign, short fontY, enum send_target target); void (*messagecolor_self) (int fd, uint32 color, const char *msg); void (*messagecolor) (struct block_list* bl, uint32 color, const char* msg); + void (*serviceMessageColor) (struct map_session_data *sd, uint32 color, const char *msg); void (*disp_overhead) (struct block_list *bl, const char *mes, enum send_target target, struct block_list *target_bl); void (*notify_playerchat) (struct block_list *bl, const char *mes); void (*msgtable) (struct map_session_data* sd, enum clif_messages msg_id); diff --git a/src/map/packets_struct.h b/src/map/packets_struct.h index 1f4df6fc9..5c9a60465 100644 --- a/src/map/packets_struct.h +++ b/src/map/packets_struct.h @@ -2960,6 +2960,16 @@ struct PACKET_ZC_ENCHANT_EQUIPMENT { DEFINE_PACKET_HEADER(ZC_ENCHANT_EQUIPMENT, 0x0a3f); #endif // PACKETVER_MAIN_NUM >= 20160831 || PACKETVER_RE_NUM >= 20151118 || defined(PACKETVER_ZERO) +#if PACKETVER_MAIN_NUM >= 20170830 || PACKETVER_RE_NUM >= 20170830 || defined(PACKETVER_ZERO) +struct PACKET_ZC_SERVICE_MESSAGE_COLOR { + int16 packetType; + int16 packetLength; + int32 color; + char message[]; +} __attribute__((packed)); +DEFINE_PACKET_HEADER(ZC_SERVICE_MESSAGE_COLOR, 0x0adb); +#endif + #if !defined(sun) && (!defined(__NETBSD__) || __NetBSD_Version__ >= 600000000) // NetBSD 5 and Solaris don't like pragma pack but accept the packed attribute #pragma pack(pop) #endif // not NetBSD < 6 / Solaris |