From ef9eb6bde90ec1d9d175b6481935cb3bd67d6c6c Mon Sep 17 00:00:00 2001 From: mekolat Date: Sat, 23 May 2015 10:17:10 -0400 Subject: add clif_message_towards --- src/map/clif.cpp | 31 +++++++++++++++++++++++++------ 1 file changed, 25 insertions(+), 6 deletions(-) (limited to 'src/map/clif.cpp') diff --git a/src/map/clif.cpp b/src/map/clif.cpp index 73315d8..db5ecd2 100644 --- a/src/map/clif.cpp +++ b/src/map/clif.cpp @@ -3809,19 +3809,16 @@ RecvResult clif_parse_GlobalMessage(Session *s, dumb_ptr sd) return rv; } -void clif_message(dumb_ptr bl, XString msg) +static +void clif_message_sub(Buffer& buf, dumb_ptr bl, XString msg) { size_t msg_len = msg.size() + 1; if (msg_len + 16 > 512) return; - nullpo_retv(bl); - Packet_Head<0x008d> head_8d; head_8d.block_id = bl->bl_id; - Buffer buf = create_vpacket<0x008d, 8, 1>(head_8d, msg); - - clif_send(buf, bl, SendWho::AREA, MIN_CLIENT_VERSION); + buf = create_vpacket<0x008d, 8, 1>(head_8d, msg); } void clif_npc_send_title(Session *s, BlockId npcid, XString msg) @@ -3854,6 +3851,28 @@ void clif_change_music(dumb_ptr sd, XString music) send_buffer(sd->sess, buf); } +void clif_message_towards(dumb_ptr sd, dumb_ptr bl, XString msg) +{ + nullpo_retv(bl); + nullpo_retv(sd); + + if(!sd) + return; + + Buffer buf; + clif_message_sub(buf, bl, msg); + clif_send(buf, sd, SendWho::SELF, MIN_CLIENT_VERSION); +} + +void clif_message(dumb_ptr bl, XString msg) +{ + nullpo_retv(bl); + + Buffer buf; + clif_message_sub(buf, bl, msg); + clif_send(buf, bl, SendWho::AREA, MIN_CLIENT_VERSION); +} + /*========================================== * *------------------------------------------ -- cgit v1.2.3-60-g2f50