diff options
author | Wushin <pasekei@gmail.com> | 2015-06-19 21:53:45 -0500 |
---|---|---|
committer | Wushin <pasekei@gmail.com> | 2015-06-19 21:53:45 -0500 |
commit | 8b4faba9b55ea4a0f3c8f6e5cbcd5fcff3509247 (patch) | |
tree | b80c2b15c93e5c705e1b75e51fdddaeb7b3e94c0 /src/map | |
parent | 6a0c11388cb15cc94bffacaedce8b10f3ac2b6f8 (diff) | |
parent | 9cca1e384248bc6f043248066f5bcca284cc5403 (diff) | |
download | tmwa-8b4faba9b55ea4a0f3c8f6e5cbcd5fcff3509247.tar.gz tmwa-8b4faba9b55ea4a0f3c8f6e5cbcd5fcff3509247.tar.bz2 tmwa-8b4faba9b55ea4a0f3c8f6e5cbcd5fcff3509247.tar.xz tmwa-8b4faba9b55ea4a0f3c8f6e5cbcd5fcff3509247.zip |
Merge pull request #110 from mekolat/title
implement set title packet
Diffstat (limited to 'src/map')
-rw-r--r-- | src/map/clif.cpp | 14 | ||||
-rw-r--r-- | src/map/clif.hpp | 1 | ||||
-rw-r--r-- | src/map/script-fun.cpp | 11 |
3 files changed, 26 insertions, 0 deletions
diff --git a/src/map/clif.cpp b/src/map/clif.cpp index 248f74a..6f55f73 100644 --- a/src/map/clif.cpp +++ b/src/map/clif.cpp @@ -3782,6 +3782,20 @@ void clif_message(dumb_ptr<block_list> bl, XString msg) clif_send(buf, bl, SendWho::AREA); } +void clif_npc_send_title(Session *s, BlockId npcid, XString msg) +{ + size_t msg_len = msg.size() + 1; + if (msg_len > 50) + return; + + Packet_Head<0x0228> head_228; + head_228.npc_id = npcid; + head_228.string_length = msg_len; + Buffer buf = create_vpacket<0x0228, 10, 1>(head_228, msg); + + send_buffer(s, buf); +} + /*========================================== * *------------------------------------------ diff --git a/src/map/clif.hpp b/src/map/clif.hpp index 3cc308c..f067017 100644 --- a/src/map/clif.hpp +++ b/src/map/clif.hpp @@ -102,6 +102,7 @@ void clif_sitnpc(dumb_ptr<npc_data> nd, DamageType dmg); void clif_sitnpc_towards(dumb_ptr<map_session_data> sd, dumb_ptr<npc_data> nd, DamageType dmg); void clif_setnpcdirection(dumb_ptr<npc_data> nd, DIR direction); void clif_setnpcdirection_towards(dumb_ptr<map_session_data> sd, dumb_ptr<npc_data> nd, DIR direction); +void clif_npc_send_title(Session *s, BlockId npcid, XString msg); // trade void clif_traderequest(dumb_ptr<map_session_data> sd, CharName name); diff --git a/src/map/script-fun.cpp b/src/map/script-fun.cpp index 8b797c2..fd8498c 100644 --- a/src/map/script-fun.cpp +++ b/src/map/script-fun.cpp @@ -2660,6 +2660,16 @@ void builtin_message(ScriptState *st) } +static +void builtin_title(ScriptState *st) +{ + dumb_ptr<map_session_data> sd = script_rid2sd(st); + ZString msg = ZString(conv_str(st, &AARG(0))); + if (sd == nullptr) + return; + clif_npc_send_title(sd->sess, st->oid, msg); +} + /*========================================== * npctalk (sends message to surrounding * area) [Valaris] @@ -3130,6 +3140,7 @@ BuiltinFunction builtin_functions[] = BUILTIN(npcareawarp, "xyxyis"_s, '\0'), BUILTIN(message, "Ps"_s, '\0'), BUILTIN(npctalk, "s"_s, '\0'), + BUILTIN(title, "s"_s, '\0'), BUILTIN(getlook, "i"_s, 'i'), BUILTIN(getsavepoint, "i"_s, '.'), BUILTIN(areatimer, "MxyxytE"_s, '\0'), |