summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2018-11-27 05:40:22 +0300
committerAndrei Karas <akaras@inbox.ru>2018-12-12 21:18:06 +0300
commiteaeebdc9ddaa62488a58885c6a20b43d67e43d4a (patch)
tree7cf6150c1685d087d9fcfdbccd75de477264bf46
parent5c29241d2d4bc43184faeedd7c1ffe3af8753fc9 (diff)
downloadhercules-eaeebdc9ddaa62488a58885c6a20b43d67e43d4a.tar.gz
hercules-eaeebdc9ddaa62488a58885c6a20b43d67e43d4a.tar.bz2
hercules-eaeebdc9ddaa62488a58885c6a20b43d67e43d4a.tar.xz
hercules-eaeebdc9ddaa62488a58885c6a20b43d67e43d4a.zip
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.
-rw-r--r--doc/script_commands.txt10
-rw-r--r--src/map/script.c24
2 files changed, 34 insertions, 0 deletions
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("<message>", <color>{, <account_id>})
+*servicemessage("<message>", <color>{, <player_name>})
+
+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("<message>"{, "<npc name>"{, <show_name>}});
@@ -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"),