summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormekolat <mekolat@users.noreply.github.com>2016-04-15 11:12:56 -0400
committermekolat <mekolat@users.noreply.github.com>2016-04-15 11:12:56 -0400
commitd3c96421dd371db34119de1437fe7f25a05dc4bc (patch)
treeb54e989cae9eaee8f3e7695300bd7e75d90b0d6b /src
parentd5e9d1ecbee0f7540acbe4343bd68e6482e8394a (diff)
downloadtmwa-d3c96421dd371db34119de1437fe7f25a05dc4bc.tar.gz
tmwa-d3c96421dd371db34119de1437fe7f25a05dc4bc.tar.bz2
tmwa-d3c96421dd371db34119de1437fe7f25a05dc4bc.tar.xz
tmwa-d3c96421dd371db34119de1437fe7f25a05dc4bc.zip
implement SMSG_PLAYER_CLIENT_COMMAND
Diffstat (limited to 'src')
-rw-r--r--src/map/clif.cpp14
-rw-r--r--src/map/clif.hpp1
-rw-r--r--src/map/script-fun.cpp19
3 files changed, 32 insertions, 2 deletions
diff --git a/src/map/clif.cpp b/src/map/clif.cpp
index bf20b57..df21a88 100644
--- a/src/map/clif.cpp
+++ b/src/map/clif.cpp
@@ -3906,6 +3906,20 @@ void clif_server_message(dumb_ptr<map_session_data> sd, uint8_t type, XString ms
clif_send(buf, sd, SendWho::SELF, wrap<ClientVersion>(5), altbuf);
}
+void clif_remote_command(dumb_ptr<map_session_data> sd, XString cmd)
+{
+ nullpo_retv(sd);
+
+ size_t msg_len = cmd.size() + 4;
+ if (msg_len > 512)
+ return;
+
+ Packet_Head<0x0230> head_230;
+ Buffer buf = create_vpacket<0x0230, 4, 1>(head_230, cmd);
+
+ clif_send(buf, sd, SendWho::SELF, wrap<ClientVersion>(6));
+}
+
void clif_change_music(dumb_ptr<map_session_data> sd, XString music)
{
nullpo_retv(sd);
diff --git a/src/map/clif.hpp b/src/map/clif.hpp
index c339cfd..4783290 100644
--- a/src/map/clif.hpp
+++ b/src/map/clif.hpp
@@ -106,6 +106,7 @@ 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);
void clif_server_message(dumb_ptr<map_session_data>, uint8_t, XString msg);
+void clif_remote_command(dumb_ptr<map_session_data>, XString);
void clif_change_music(dumb_ptr<map_session_data> sd, XString music);
void clif_npc_action(dumb_ptr<map_session_data>, BlockId, short, int, short, short);
void clif_send_mask(dumb_ptr<map_session_data>, int);
diff --git a/src/map/script-fun.cpp b/src/map/script-fun.cpp
index 0d211a7..07076d5 100644
--- a/src/map/script-fun.cpp
+++ b/src/map/script-fun.cpp
@@ -2957,8 +2957,6 @@ void builtin_smsg(ScriptState *st)
{
CharName player = stringish<CharName>(ZString(conv_str(st, &AARG(2))));
sd = map_nick2sd(player);
- if (sd == nullptr)
- return;
}
int type = HARG(1) ? conv_num(st, &AARG(0)) : 0;
@@ -2972,6 +2970,22 @@ void builtin_smsg(ScriptState *st)
}
static
+void builtin_remotecmd(ScriptState *st)
+{
+ dumb_ptr<map_session_data> sd = script_rid2sd(st);
+ if (HARG(1))
+ {
+ CharName player = stringish<CharName>(ZString(conv_str(st, &AARG(1))));
+ sd = map_nick2sd(player);
+ }
+
+ ZString msg = ZString(conv_str(st, &AARG(0)));
+ if (sd == nullptr)
+ return;
+ clif_remote_command(sd, msg);
+}
+
+static
void builtin_music(ScriptState *st)
{
dumb_ptr<map_session_data> sd = script_rid2sd(st);
@@ -3513,6 +3527,7 @@ BuiltinFunction builtin_functions[] =
BUILTIN(npctalk, "ss?"_s, '\0'),
BUILTIN(title, "s"_s, '\0'),
BUILTIN(smsg, "e??"_s, '\0'),
+ BUILTIN(remotecmd, "s?"_s, '\0'),
BUILTIN(music, "s"_s, '\0'),
BUILTIN(mapmask, "i?"_s, '\0'),
BUILTIN(getmask, ""_s, 'i'),