diff options
author | wushin <pasekei@gmail.com> | 2016-03-04 15:15:23 -0600 |
---|---|---|
committer | wushin <pasekei@gmail.com> | 2016-04-01 09:40:50 -0500 |
commit | 2ba1812b8315b5df8291f68144b0c380a6cd749d (patch) | |
tree | de35b9d8d0a7c1f73f6d4ccb72d9cc43b299ef8c /src/map/clif.cpp | |
parent | 14a87196ed27b1abab6b5357a9938e834699bc59 (diff) | |
download | tmwa-2ba1812b8315b5df8291f68144b0c380a6cd749d.tar.gz tmwa-2ba1812b8315b5df8291f68144b0c380a6cd749d.tar.bz2 tmwa-2ba1812b8315b5df8291f68144b0c380a6cd749d.tar.xz tmwa-2ba1812b8315b5df8291f68144b0c380a6cd749d.zip |
add player nicks back to messages
closes #194
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))) |