viewing paste topic/7023- dispbottomcolor.diff | Diff

Posted on the
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
 src/map/script.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
 
diff --git a/src/map/script.c b/src/map/script.c
index 2c89321..2b478d2 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -18735,10 +18735,28 @@ bool script_hp_add(char *name, char *args, bool (*func)(struct script_state *st)
    return script->add_builtin(&buildin, true);
 }
 
+BUILDIN(dispbottomcolor) {
+   TBL_PC *sd = script->rid2sd(st);
+   if ( sd ) {
+       const char *message = script_getstr(st,2);
+       unsigned short msg_len = strlen( message ) +1;
+       int color = script_getnum(st,3);
+       int colorcode = (color & 0x0000FF) << 16 | (color & 0x00FF00) | (color & 0xFF0000) >> 16;
+       WFIFOHEAD( sd->fd, msg_len + 12 );
+       WFIFOW( sd->fd, 0 ) = 0x2C1;
+       WFIFOW( sd->fd, 2 ) = msg_len + 12;
+       WFIFOL( sd->fd, 4 ) = 0;
+       WFIFOL( sd->fd, 8 ) = colorcode;
+       safestrncpy( (char*)WFIFOP( sd->fd,12 ), message, msg_len );
+       WFIFOSET( sd->fd, msg_len + 12 );
+   }
+   return true;
+}
+
 #define BUILDIN_DEF(x,args) { buildin_ ## x , #x , args }
 #define BUILDIN_DEF2(x,x2,args) { buildin_ ## x , x2 , args }
 void script_parse_builtin(void) {
    struct script_function BUILDIN[] = {
+       BUILDIN_DEF(dispbottomcolor,"si"),
        // NPC interaction
        BUILDIN_DEF(mes,"s*"),
        BUILDIN_DEF(next,""),
 
Viewed 1320 times, submitted by AnnieRuru.