diff options
author | AnnieRuru <jeankofannie2@gmail.com> | 2019-03-30 03:00:41 +0800 |
---|---|---|
committer | AnnieRuru <jeankofannie2@gmail.com> | 2019-03-30 03:00:41 +0800 |
commit | c90ec16607f6ff4e422e2a5eca465a88af8b0af3 (patch) | |
tree | 78081ad6df236db7dc3ac48e3e2f0f8e981044d2 | |
parent | e1e951c805916853e55ff5b9ce0531e0cf483ebf (diff) | |
download | hercules-c90ec16607f6ff4e422e2a5eca465a88af8b0af3.tar.gz hercules-c90ec16607f6ff4e422e2a5eca465a88af8b0af3.tar.bz2 hercules-c90ec16607f6ff4e422e2a5eca465a88af8b0af3.tar.xz hercules-c90ec16607f6ff4e422e2a5eca465a88af8b0af3.zip |
Add optional parameter for *showscript to send target to SELF only
- also remove the useless script_pushint
-rw-r--r-- | doc/script_commands.txt | 5 | ||||
-rw-r--r-- | src/map/clif.c | 4 | ||||
-rw-r--r-- | src/map/clif.h | 2 | ||||
-rw-r--r-- | src/map/script.c | 14 |
4 files changed, 14 insertions, 11 deletions
diff --git a/doc/script_commands.txt b/doc/script_commands.txt index 19f189f81..077895e2b 100644 --- a/doc/script_commands.txt +++ b/doc/script_commands.txt @@ -4443,11 +4443,14 @@ if <color> field is left out. --------------------------------------- -*showscript("<message>"{, <GID>}) +*showscript("<message>"{, <GID>{, <send_target>}}) Makes the attached player or GID, display a message similiar to a chat, this will be seen by everyone near the invoking character but will not be displayed in the chat window. +send_target: (optional) + AREA: show the message to everyone within the view range (default) + SELF: show the message to the given unit GID only --------------------------------------- diff --git a/src/map/clif.c b/src/map/clif.c index a037d3436..4c3c746c4 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -19360,7 +19360,7 @@ static void clif_partytickack(struct map_session_data *sd, bool flag) WFIFOSET(sd->fd, packet_len(0x2c9)); } -static void clif_ShowScript(struct block_list *bl, const char *message) +static void clif_ShowScript(struct block_list *bl, const char *message, enum send_target target) { #if PACKETVER >= 20110111 char buf[256]; @@ -19381,7 +19381,7 @@ static void clif_ShowScript(struct block_list *bl, const char *message) WBUFW(buf,2) = len+8; WBUFL(buf,4) = bl->id; safestrncpy(WBUFP(buf,8),message,len); - clif->send(buf,WBUFW(buf,2),bl,AREA); + clif->send(buf, WBUFW(buf,2), bl, target); #endif } diff --git a/src/map/clif.h b/src/map/clif.h index 6b501477c..6e922bdff 100644 --- a/src/map/clif.h +++ b/src/map/clif.h @@ -1009,7 +1009,7 @@ struct clif_interface { void (*wisexin) (struct map_session_data *sd,int type,int flag); void (*wisall) (struct map_session_data *sd,int type,int flag); void (*PMIgnoreList) (struct map_session_data* sd); - void (*ShowScript) (struct block_list* bl, const char* message); + void (*ShowScript) (struct block_list* bl, const char* message, enum send_target target); /* trade handling */ void (*traderequest) (struct map_session_data* sd, const char* name); void (*tradestart) (struct map_session_data* sd, uint8 type); diff --git a/src/map/script.c b/src/map/script.c index bba559df8..ed8f6b8d2 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -24377,7 +24377,7 @@ static BUILDIN(showscript) { struct block_list *bl = NULL; const char *msg = script_getstr(st, 2); - int id = 0; + int id = 0, flag = AREA; if (script_hasdata(st, 3)) { id = script_getnum(st, 3); @@ -24389,14 +24389,14 @@ static BUILDIN(showscript) if (!bl) { ShowError("buildin_showscript: Script not attached. (id=%d, rid=%d, oid=%d)\n", id, st->rid, st->oid); - script_pushint(st, 0); return false; } - clif->ShowScript(bl, msg); - - script_pushint(st, 1); - + if (script_hasdata(st, 4)) + if (script_getnum(st, 4) == SELF) + flag = SELF; + + clif->ShowScript(bl, msg, flag); return true; } @@ -25822,7 +25822,7 @@ static void script_parse_builtin(void) BUILDIN_DEF(channelmes, "ss"), BUILDIN_DEF(addchannelhandler, "ss"), BUILDIN_DEF(removechannelhandler, "ss"), - BUILDIN_DEF(showscript, "s?"), + BUILDIN_DEF(showscript, "s??"), BUILDIN_DEF(mergeitem,""), BUILDIN_DEF(getcalendartime, "ii??"), |