diff options
-rwxr-xr-x | configure | 2 | ||||
-rw-r--r-- | doc/script_commands.txt | 15 | ||||
-rw-r--r-- | src/map/script.c | 40 |
3 files changed, 56 insertions, 1 deletions
@@ -1,5 +1,5 @@ #! /bin/sh -# From configure.ac b60eb4b69. +# From configure.ac dfd6225e6. # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.69. # diff --git a/doc/script_commands.txt b/doc/script_commands.txt index 10b4e5653..414a72924 100644 --- a/doc/script_commands.txt +++ b/doc/script_commands.txt @@ -10136,3 +10136,18 @@ the available flags are: Opens the styling shop on client --------------------------------------- + +*msgtable(<message_id>{, <color>}) + +Show in client message by <message_id> from msg string table +with optional <color>. + +--------------------------------------- + +*msgtable2(<message_id>, <param>{, <color>}) + +Show in client message by <message_id> from msg string table. +<param> is parameter for this message. Can be string or int. +Optional <color> can be used for set color for whole message. + +--------------------------------------- diff --git a/src/map/script.c b/src/map/script.c index 846075c0e..61059b811 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -24655,6 +24655,44 @@ static BUILDIN(openstylist) return true; } +static BUILDIN(msgtable) +{ + struct map_session_data *sd = script_rid2sd(st); + if (sd == NULL) + return false; + + const enum clif_messages msgId = script_getnum(st, 2); + if (script_hasdata(st, 3)) { + clif->msgtable_color(sd, msgId, script_getnum(st, 3)); + } else { + clif->msgtable(sd, msgId); + } + + return true; +} + +static BUILDIN(msgtable2) +{ + struct map_session_data *sd = script_rid2sd(st); + if (sd == NULL) + return false; + + const enum clif_messages msgId = script_getnum(st, 2); + if (script_isstringtype(st, 3)) { + const char *value = script_getstr(st, 3); + if (script_hasdata(st, 4)) { + clif->msgtable_str_color(sd, msgId, value, script_getnum(st, 4)); + } else { + clif->msgtable_str(sd, msgId, value); + } + } else { + const int value = script_getnum(st, 3); + clif->msgtable_num(sd, msgId, value); + } + + return true; +} + /** * Adds a built-in script function. * @@ -25231,6 +25269,8 @@ static void script_parse_builtin(void) BUILDIN_DEF(buyingstore,"i"), BUILDIN_DEF(searchstores,"ii"), BUILDIN_DEF(showdigit,"i?"), + BUILDIN_DEF(msgtable, "i?"), + BUILDIN_DEF(msgtable2, "iv?"), // WoE SE BUILDIN_DEF(agitstart2,""), BUILDIN_DEF(agitend2,""), |