summaryrefslogtreecommitdiff
path: root/src/map/script-fun.cpp
diff options
context:
space:
mode:
authorWushin <pasekei@gmail.com>2015-04-29 22:31:07 -0500
committerWushin <pasekei@gmail.com>2015-04-29 22:31:07 -0500
commita75608ef2f62a07879e7ef6d73c0ebe5b23908b2 (patch)
treea9662a4100c2d2213d954239b7046f7b897a6cbe /src/map/script-fun.cpp
parentff87a3f275966dfcdd5a123b44b8802288ca6b22 (diff)
parent6c0348dc296f9c038a0ca5d6e600c1d802981dc4 (diff)
downloadtmwa-a75608ef2f62a07879e7ef6d73c0ebe5b23908b2.tar.gz
tmwa-a75608ef2f62a07879e7ef6d73c0ebe5b23908b2.tar.bz2
tmwa-a75608ef2f62a07879e7ef6d73c0ebe5b23908b2.tar.xz
tmwa-a75608ef2f62a07879e7ef6d73c0ebe5b23908b2.zip
Merge pull request #66 from mekolat/emotion
make emotion send to a single rid
Diffstat (limited to 'src/map/script-fun.cpp')
-rw-r--r--src/map/script-fun.cpp19
1 files changed, 15 insertions, 4 deletions
diff --git a/src/map/script-fun.cpp b/src/map/script-fun.cpp
index 4cb4448..17fe943 100644
--- a/src/map/script-fun.cpp
+++ b/src/map/script-fun.cpp
@@ -2179,11 +2179,22 @@ void builtin_getpvpflag(ScriptState *st)
static
void builtin_emotion(ScriptState *st)
{
- int type;
- type = conv_num(st, &AARG(0));
+ ZString str;
+ dumb_ptr<map_session_data> pl_sd = nullptr;
+ int type = conv_num(st, &AARG(0));
+ if (HARG(1)) {
+ str = ZString(conv_str(st, &AARG(1)));
+ CharName player = stringish<CharName>(str);
+ pl_sd = map_nick2sd(player);
+ }
if (type < 0 || type > 200)
return;
- clif_emotion(map_id2bl(st->oid), type);
+ if (pl_sd != nullptr)
+ clif_emotion_towards(map_id2bl(st->oid), pl_sd, type);
+ else if (st->rid && str == "self"_s)
+ clif_emotion(map_id2sd(st->rid), type);
+ else
+ clif_emotion(map_id2bl(st->oid), type);
}
static
@@ -3178,7 +3189,7 @@ BuiltinFunction builtin_functions[] =
BUILTIN(pvpoff, "M"_s, '\0'),
BUILTIN(setpvpchannel, "i"_s, '\0'),
BUILTIN(getpvpflag, "i"_s, 'i'),
- BUILTIN(emotion, "i"_s, '\0'),
+ BUILTIN(emotion, "i?"_s, '\0'),
BUILTIN(mapwarp, "MMxy"_s, '\0'),
BUILTIN(mobcount, "ME"_s, 'i'),
BUILTIN(marriage, "P"_s, 'i'),