From d17edc2fb98f6c2e177a6252bade155ee88f5979 Mon Sep 17 00:00:00 2001 From: mekolat Date: Thu, 12 May 2016 14:18:48 -0400 Subject: allow to use npctalk on non-script npcs --- src/map/script-fun.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/map/script-fun.cpp b/src/map/script-fun.cpp index 98c07ed..8ec0d4a 100644 --- a/src/map/script-fun.cpp +++ b/src/map/script-fun.cpp @@ -4252,9 +4252,9 @@ void builtin_npctalk(ScriptState *st) dumb_ptr nd; RString str = conv_str(st, &AARG(1)); - dumb_ptr nd_ = npc_name2id(stringish(ZString(conv_str(st, &AARG(0))))); - assert (nd_ && nd_->npc_subtype == NpcSubtype::SCRIPT); - nd = nd_->is_script(); + nd = npc_name2id(stringish(ZString(conv_str(st, &AARG(0))))); + if (nd == nullptr) + return; if(HARG(2)){ -- cgit v1.2.3-60-g2f50 From a41bf92b1b9f604a8a8527a18d7077dad985b1a8 Mon Sep 17 00:00:00 2001 From: mekolat Date: Thu, 12 May 2016 14:34:33 -0400 Subject: don't send hidden part of npc names with npctalk => [fate] --- src/map/battle.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/map/battle.cpp b/src/map/battle.cpp index 031b79d..df01a5c 100644 --- a/src/map/battle.cpp +++ b/src/map/battle.cpp @@ -197,7 +197,12 @@ VString<23> battle_get_name(dumb_ptr bl) name = bl->is_player()->status_key.name.to__actual(); break; case BL::NPC: - name = bl->is_npc()->name; + { + name = bl->is_npc()->name; + // [fate] elim hashed out/invisible names for the client + auto it = std::find(name.begin(), name.end(), '#'); + name = name.xislice_h(it); + } break; case BL::MOB: name = bl->is_mob()->name; -- cgit v1.2.3-60-g2f50 From 6707cc577dcd2ec06d6936036b93d75cda71c6b3 Mon Sep 17 00:00:00 2001 From: mekolat Date: Thu, 12 May 2016 14:43:23 -0400 Subject: don't send name in 0x8d if shorter than 4 char long --- src/map/clif.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/map/clif.cpp b/src/map/clif.cpp index bd7f4ef..894f2e7 100644 --- a/src/map/clif.cpp +++ b/src/map/clif.cpp @@ -3806,7 +3806,8 @@ static void clif_message_sub(Buffer& buf, dumb_ptr bl, AString msg) { VString<23> name = battle_get_name(bl); - msg = STRPRINTF("%s : %s"_fmt, name, msg); + if (name.size() >= 4) // client limitation + msg = STRPRINTF("%s : %s"_fmt, name, msg); size_t msg_len = msg.size() + 1; if (msg_len + 16 > 512) return; -- cgit v1.2.3-60-g2f50