From eaeebdc9ddaa62488a58885c6a20b43d67e43d4a Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Tue, 27 Nov 2018 05:40:22 +0300 Subject: Add script command servicemessage. This command will show colored message in chat. This message will be not logged to file and will be not visible over head. --- doc/script_commands.txt | 10 ++++++++++ src/map/script.c | 24 ++++++++++++++++++++++++ 2 files changed, 34 insertions(+) diff --git a/doc/script_commands.txt b/doc/script_commands.txt index b88ff8809..0096cedfd 100644 --- a/doc/script_commands.txt +++ b/doc/script_commands.txt @@ -10248,3 +10248,13 @@ returns true if all parameters correct false in other case. Works for 20160831 main, 20151118 RE, any zero version --------------------------------------- + +*servicemessage("", {, }) +*servicemessage("", {, }) + +That command will send a service message to the chat window of the character +specified by account ID or name, or to connected to npc player. +It will not be seen by anyone else. + +Works fro 20170830 RE and main and for any zero clients +--------------------------------------- diff --git a/src/map/script.c b/src/map/script.c index 4760fd4a0..52c0cf75c 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -15678,6 +15678,29 @@ static BUILDIN(message) return true; } +static BUILDIN(servicemessage) +{ + struct map_session_data *sd = NULL; + + if (script_hasdata(st, 4)) { + if (script_isstringtype(st, 4)) + sd = script->nick2sd(st, script_getstr(st, 4)); + else + sd = script->id2sd(st, script_getnum(st, 4)); + } else { + sd = script->rid2sd(st); + } + + if (sd == NULL) + return true; + + const char *message = script_getstr(st, 2); + const int color = script_getnum(st, 3); + clif->serviceMessageColor(sd, color, message); + + return true; +} + /*========================================== * npctalk (sends message to surrounding area) * usage: npctalk(""{, ""{, }}); @@ -25244,6 +25267,7 @@ static void script_parse_builtin(void) BUILDIN_DEF2(atcommand,"charcommand","s"), // [MouseJstr] BUILDIN_DEF(movenpc,"sii?"), // [MouseJstr] BUILDIN_DEF(message,"vs"), // [MouseJstr] + BUILDIN_DEF(servicemessage, "si?"), BUILDIN_DEF(npctalk,"s??"), // [Valaris][Murilo BiO] BUILDIN_DEF(mobcount,"ss"), BUILDIN_DEF(getlook,"i"), -- cgit v1.2.3-70-g09d2