From 6c0348dc296f9c038a0ca5d6e600c1d802981dc4 Mon Sep 17 00:00:00 2001 From: mekolat Date: Wed, 22 Apr 2015 20:29:11 -0400 Subject: make emotion send to a single rid --- src/map/clif.cpp | 6 ------ src/map/clif.hpp | 1 + src/map/script-fun.cpp | 19 +++++++++++++++---- 3 files changed, 16 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/map/clif.cpp b/src/map/clif.cpp index 577d7be..339adda 100644 --- a/src/map/clif.cpp +++ b/src/map/clif.cpp @@ -198,11 +198,6 @@ int is_deaf(dumb_ptr bl) return sd->special_state.deaf; } -static -void clif_emotion_towards(dumb_ptr bl, - dumb_ptr target, int type); - - enum class ChatType { Party, @@ -3113,7 +3108,6 @@ void clif_emotion(dumb_ptr bl, int type) clif_send(buf, bl, SendWho::AREA); } -static void clif_emotion_towards(dumb_ptr bl, dumb_ptr target, int type) { diff --git a/src/map/clif.hpp b/src/map/clif.hpp index 153cc7c..e9f0452 100644 --- a/src/map/clif.hpp +++ b/src/map/clif.hpp @@ -96,6 +96,7 @@ int clif_changeoption(dumb_ptr); // area int clif_useitemack(dumb_ptr, IOff0, int, int); // self void clif_emotion(dumb_ptr bl, int type); +void clif_emotion_towards(dumb_ptr bl, dumb_ptr target, int type); void clif_sitting(Session *, dumb_ptr sd); // trade 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 pl_sd = nullptr; + int type = conv_num(st, &AARG(0)); + if (HARG(1)) { + str = ZString(conv_str(st, &AARG(1))); + CharName player = stringish(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'), -- cgit v1.2.3-60-g2f50