summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorHaru <haru@dotalux.com>2019-04-07 23:45:51 +0200
committerGitHub <noreply@github.com>2019-04-07 23:45:51 +0200
commita3a1e366f479a80d983a0c476c4cdc6ad3643a03 (patch)
treec0e5ba9127f858449bae19846f518df9ad9658d0 /src
parentf89a6da63a50cefa8251d1a84f40d85cf109bd4e (diff)
parentf61b8dac943cf2c0e3a67659134c424d57064617 (diff)
downloadhercules-a3a1e366f479a80d983a0c476c4cdc6ad3643a03.tar.gz
hercules-a3a1e366f479a80d983a0c476c4cdc6ad3643a03.tar.bz2
hercules-a3a1e366f479a80d983a0c476c4cdc6ad3643a03.tar.xz
hercules-a3a1e366f479a80d983a0c476c4cdc6ad3643a03.zip
Merge pull request #2415 from AnnieRuru/76-showscript
Add optional parameter for *showscript to send target to SELF only
Diffstat (limited to 'src')
-rw-r--r--src/map/clif.c4
-rw-r--r--src/map/clif.h2
-rw-r--r--src/map/script.c14
-rw-r--r--src/plugins/HPMHooking/HPMHooking.Defs.inc4
-rw-r--r--src/plugins/HPMHooking/HPMHooking_map.Hooks.inc12
5 files changed, 18 insertions, 18 deletions
diff --git a/src/map/clif.c b/src/map/clif.c
index 109f78553..cd3131181 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -19374,7 +19374,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];
@@ -19395,7 +19395,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 367e28449..6c9058cba 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 bfb7e9d37..fe8638ac3 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -24430,7 +24430,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);
@@ -24442,14 +24442,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;
}
@@ -25875,7 +25875,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??"),
diff --git a/src/plugins/HPMHooking/HPMHooking.Defs.inc b/src/plugins/HPMHooking/HPMHooking.Defs.inc
index 26bc9a642..c1016d19b 100644
--- a/src/plugins/HPMHooking/HPMHooking.Defs.inc
+++ b/src/plugins/HPMHooking/HPMHooking.Defs.inc
@@ -1618,8 +1618,8 @@ typedef void (*HPMHOOK_pre_clif_wisall) (struct map_session_data **sd, int *type
typedef void (*HPMHOOK_post_clif_wisall) (struct map_session_data *sd, int type, int flag);
typedef void (*HPMHOOK_pre_clif_PMIgnoreList) (struct map_session_data **sd);
typedef void (*HPMHOOK_post_clif_PMIgnoreList) (struct map_session_data *sd);
-typedef void (*HPMHOOK_pre_clif_ShowScript) (struct block_list **bl, const char **message);
-typedef void (*HPMHOOK_post_clif_ShowScript) (struct block_list *bl, const char *message);
+typedef void (*HPMHOOK_pre_clif_ShowScript) (struct block_list **bl, const char **message, enum send_target *target);
+typedef void (*HPMHOOK_post_clif_ShowScript) (struct block_list *bl, const char *message, enum send_target target);
typedef void (*HPMHOOK_pre_clif_traderequest) (struct map_session_data **sd, const char **name);
typedef void (*HPMHOOK_post_clif_traderequest) (struct map_session_data *sd, const char *name);
typedef void (*HPMHOOK_pre_clif_tradestart) (struct map_session_data **sd, uint8 *type);
diff --git a/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc b/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc
index f5d45658e..26cf8ef00 100644
--- a/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc
+++ b/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc
@@ -15758,14 +15758,14 @@ void HP_clif_PMIgnoreList(struct map_session_data *sd) {
}
return;
}
-void HP_clif_ShowScript(struct block_list *bl, const char *message) {
+void HP_clif_ShowScript(struct block_list *bl, const char *message, enum send_target target) {
int hIndex = 0;
if (HPMHooks.count.HP_clif_ShowScript_pre > 0) {
- void (*preHookFunc) (struct block_list **bl, const char **message);
+ void (*preHookFunc) (struct block_list **bl, const char **message, enum send_target *target);
*HPMforce_return = false;
for (hIndex = 0; hIndex < HPMHooks.count.HP_clif_ShowScript_pre; hIndex++) {
preHookFunc = HPMHooks.list.HP_clif_ShowScript_pre[hIndex].func;
- preHookFunc(&bl, &message);
+ preHookFunc(&bl, &message, &target);
}
if (*HPMforce_return) {
*HPMforce_return = false;
@@ -15773,13 +15773,13 @@ void HP_clif_ShowScript(struct block_list *bl, const char *message) {
}
}
{
- HPMHooks.source.clif.ShowScript(bl, message);
+ HPMHooks.source.clif.ShowScript(bl, message, target);
}
if (HPMHooks.count.HP_clif_ShowScript_post > 0) {
- void (*postHookFunc) (struct block_list *bl, const char *message);
+ void (*postHookFunc) (struct block_list *bl, const char *message, enum send_target target);
for (hIndex = 0; hIndex < HPMHooks.count.HP_clif_ShowScript_post; hIndex++) {
postHookFunc = HPMHooks.list.HP_clif_ShowScript_post[hIndex].func;
- postHookFunc(bl, message);
+ postHookFunc(bl, message, target);
}
}
return;