summaryrefslogtreecommitdiff
path: root/src/map/script-fun.cpp
diff options
context:
space:
mode:
authormekolat <mekolat@users.noreply.github.com>2015-04-22 20:29:11 -0400
committermekolat <mekolat@users.noreply.github.com>2015-04-23 11:58:30 -0400
commit6c0348dc296f9c038a0ca5d6e600c1d802981dc4 (patch)
tree46bed6e7467a7e9ba3feff342780d8c3ae219447 /src/map/script-fun.cpp
parente6ee7b3f99935a594e6462472fdc9d075408da0f (diff)
downloadtmwa-6c0348dc296f9c038a0ca5d6e600c1d802981dc4.tar.gz
tmwa-6c0348dc296f9c038a0ca5d6e600c1d802981dc4.tar.bz2
tmwa-6c0348dc296f9c038a0ca5d6e600c1d802981dc4.tar.xz
tmwa-6c0348dc296f9c038a0ca5d6e600c1d802981dc4.zip
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 3b814aa..c4cf129 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'),