diff options
Diffstat (limited to 'src/map/clif.cpp')
-rw-r--r-- | src/map/clif.cpp | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/src/map/clif.cpp b/src/map/clif.cpp index 9743e49..349d2e9 100644 --- a/src/map/clif.cpp +++ b/src/map/clif.cpp @@ -3790,6 +3790,20 @@ RecvResult clif_parse_GetCharNameRequest(Session *s, dumb_ptr<map_session_data> return rv; } +static +void clif_message_sub(Buffer& buf, dumb_ptr<block_list> bl, AString msg) +{ + VString<23> name = battle_get_name(bl); + msg = STRPRINTF("%s : %s"_fmt, name, msg); + size_t msg_len = msg.size() + 1; + if (msg_len + 16 > 512) + return; + + Packet_Head<0x008d> head_8d; + head_8d.block_id = bl->bl_id; + buf = create_vpacket<0x008d, 8, 1>(head_8d, msg); +} + /*========================================== * Validate and process transmission of a * global/public message. @@ -3825,10 +3839,8 @@ RecvResult clif_parse_GlobalMessage(Session *s, dumb_ptr<map_session_data> sd) } /* It's not a spell/magic message, so send the message to others. */ - Packet_Head<0x008d> head_8d; - head_8d.block_id = sd->bl_id; - XString repeat_8d = mbuf; - Buffer sendbuf = create_vpacket<0x008d, 8, 1>(head_8d, repeat_8d); + Buffer sendbuf; + clif_message_sub(sendbuf, sd, mbuf); clif_send(sendbuf, sd, SendWho::AREA_CHAT_WOC, MIN_CLIENT_VERSION); } @@ -3839,18 +3851,6 @@ RecvResult clif_parse_GlobalMessage(Session *s, dumb_ptr<map_session_data> sd) return rv; } -static -void clif_message_sub(Buffer& buf, dumb_ptr<block_list> bl, XString msg) -{ - size_t msg_len = msg.size() + 1; - if (msg_len + 16 > 512) - return; - - Packet_Head<0x008d> head_8d; - head_8d.block_id = bl->bl_id; - buf = create_vpacket<0x008d, 8, 1>(head_8d, msg); -} - void clif_npc_send_title(Session *s, BlockId npcid, XString msg) { size_t msg_len = msg.size() + 1; @@ -5688,7 +5688,7 @@ AString clif_validate_chat(dumb_ptr<map_session_data> sd, ChatType type, XString return AString(); } - if (type == ChatType::Global) + if (type == ChatType::Global && sd->client_version < 6) { XString p = pbuf; if (!(p.startswith(sd->status_key.name.to__actual()) && p.xslice_t(name_len).startswith(" : "_s))) |