diff options
author | Asheraf <acheraf1998@gmail.com> | 2018-05-26 23:42:02 +0000 |
---|---|---|
committer | Asheraf <acheraf1998@gmail.com> | 2018-06-30 00:43:06 +0100 |
commit | dff7e258eb1e4eefc5d455212a912fe454b7d3d3 (patch) | |
tree | 23b057fee0bb2b53bc688f7adefa91ef35a297cc /src/map/script.c | |
parent | 8ea98a7ff92e0f34f323342b1d69da42d92f39ae (diff) | |
download | hercules-dff7e258eb1e4eefc5d455212a912fe454b7d3d3.tar.gz hercules-dff7e258eb1e4eefc5d455212a912fe454b7d3d3.tar.bz2 hercules-dff7e258eb1e4eefc5d455212a912fe454b7d3d3.tar.xz hercules-dff7e258eb1e4eefc5d455212a912fe454b7d3d3.zip |
add support for send target in unittalk
Diffstat (limited to 'src/map/script.c')
-rw-r--r-- | src/map/script.c | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/src/map/script.c b/src/map/script.c index 94a991d06..e1d26e731 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -15594,7 +15594,7 @@ BUILDIN(npctalk) } else { safesnprintf(message, sizeof(message), "%s", str); } - clif->disp_overhead(&nd->bl, message); + clif->disp_overhead(&nd->bl, message, AREA_CHAT_WOC, NULL); } return true; @@ -20117,12 +20117,13 @@ BUILDIN(unitstop) { /// Makes the unit say the message /// -/// unittalk(<unit_id>,"<message>"{, show_name}); +/// unittalk(<unit_id>,"<message>"{, show_name{, <send_target>{, <target_id>}}}); BUILDIN(unittalk) { int unit_id; const char* message; - struct block_list* bl; + struct block_list *bl, *target_bl = NULL; bool show_name = true; + enum send_target target = AREA_CHAT_WOC; unit_id = script_getnum(st,2); message = script_getstr(st, 3); @@ -20131,6 +20132,14 @@ BUILDIN(unittalk) { show_name = (script_getnum(st, 4) != 0) ? true : false; } + if (script_hasdata(st, 5)) { + target = script_getnum(st, 5); + } + + if (script_hasdata(st, 6)) { + target_bl = map->id2bl(script_getnum(st, 6)); + } + bl = map->id2bl(unit_id); if( bl != NULL ) { struct StringBuf sbuf; @@ -20144,7 +20153,12 @@ BUILDIN(unittalk) { } else { StrBuf->Printf(&sbuf, "%s", message); } - clif->disp_overhead(bl, StrBuf->Value(&sbuf)); + + if (bl->type == BL_PC && target == SELF && (target_bl == NULL || bl == target_bl)) { + clif->notify_playerchat(bl, StrBuf->Value(&sbuf)); + } else { + clif->disp_overhead(bl, StrBuf->Value(&sbuf), target, target_bl); + } StrBuf->Destroy(&sbuf); } @@ -24789,7 +24803,7 @@ void script_parse_builtin(void) { BUILDIN_DEF(unitwarp,"isii"), BUILDIN_DEF(unitattack,"iv?"), BUILDIN_DEF(unitstop,"i"), - BUILDIN_DEF(unittalk,"is?"), + BUILDIN_DEF(unittalk,"is???"), BUILDIN_DEF(unitemote,"ii"), BUILDIN_DEF(unitskilluseid,"ivi?"), // originally by Qamera [Celest] BUILDIN_DEF(unitskillusepos,"iviii"), // [Celest] |