summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnnieRuru <jeankof@ymail.com>2015-12-21 09:01:59 +0800
committerHaru <haru@dotalux.com>2015-12-22 01:54:41 +0100
commit19d83e65e83887a9f15353e626eaab57d7f86a74 (patch)
treea62a3fc6bcf210bd494b0b75b02b8700f1b44a83
parent91c12a9358fe4a30d7b21862efa82e7466e2ab47 (diff)
downloadhercules-19d83e65e83887a9f15353e626eaab57d7f86a74.tar.gz
hercules-19d83e65e83887a9f15353e626eaab57d7f86a74.tar.bz2
hercules-19d83e65e83887a9f15353e626eaab57d7f86a74.tar.xz
hercules-19d83e65e83887a9f15353e626eaab57d7f86a74.zip
Update *dispbottom script command to allow 0xRRGGBB color
Closes #858 as merged Signed-off-by: Haru <haru@dotalux.com>
-rw-r--r--doc/script_commands.txt7
-rw-r--r--src/map/script.c30
2 files changed, 25 insertions, 12 deletions
diff --git a/doc/script_commands.txt b/doc/script_commands.txt
index 7a9481b46..ef4816889 100644
--- a/doc/script_commands.txt
+++ b/doc/script_commands.txt
@@ -4100,10 +4100,11 @@ of that character. It will not be seen by anyone else.
---------------------------------------
-*dispbottom "<message>";
+*dispbottom "<message>"{,<color>};
-This command will send the given message into the invoking character's
-chat window.
+This command will send the given message into the invoking character's
+chat window. The color format is in RGB (0xRRGGBB), and default to green
+if <color> field is left out.
---------------------------------------
diff --git a/src/map/script.c b/src/map/script.c
index c5bb418d5..7a5292159 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -13610,16 +13610,28 @@ BUILDIN(atcommand) {
return ret;
}
-/*==========================================
- * Displays a message for the player only (like system messages like "you got an apple" )
- *------------------------------------------*/
+/**
+ * Displays a message for the player only (like system messages like "you got an apple")
+ *
+ * @code
+ * dispbottom "<message>"{,<color>};
+ * @endcode
+ */
BUILDIN(dispbottom)
{
- TBL_PC *sd=script->rid2sd(st);
- const char *message;
- message=script_getstr(st,2);
- if(sd)
- clif_disp_onlyself(sd,message,(int)strlen(message));
+ TBL_PC *sd = script->rid2sd(st);
+ const char *message = script_getstr(st,2);
+
+ if (sd == NULL)
+ return true;
+
+ if (script_hasdata(st,3)) {
+ int color = script_getnum(st,3);
+ clif->messagecolor_self(sd->fd, color, message);
+ } else {
+ clif_disp_onlyself(sd, message, (int)strlen(message));
+ }
+
return true;
}
@@ -20396,7 +20408,7 @@ void script_parse_builtin(void) {
BUILDIN_DEF(deletepset,"i"), // Delete a pattern set [MouseJstr]
BUILDIN_DEF(pcre_match,"ss"),
#endif
- BUILDIN_DEF(dispbottom,"s"), //added from jA [Lupus]
+ BUILDIN_DEF(dispbottom,"s?"), //added from jA [Lupus]
BUILDIN_DEF(getusersname,""),
BUILDIN_DEF(recovery,""),
BUILDIN_DEF(getpetinfo,"i"),