diff options
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'), |