summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/map/battle.cpp7
-rw-r--r--src/map/clif.cpp63
-rw-r--r--src/map/npc.cpp3
-rw-r--r--src/map/script-fun.cpp6
4 files changed, 45 insertions, 34 deletions
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<block_list> 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;
diff --git a/src/map/clif.cpp b/src/map/clif.cpp
index bd7f4ef..0bc6b8a 100644
--- a/src/map/clif.cpp
+++ b/src/map/clif.cpp
@@ -305,16 +305,19 @@ int clif_send(const Buffer& buf, dumb_ptr<block_list> bl, SendWho type, ClientVe
}
break;
case SendWho::ALL_SAMEMAP: // 同じマップの全クライアントに送信
- for (io::FD i : iter_fds())
+ if (bl->bl_m != borrow(undefined_gat))
{
- Session *s = get_session(i);
- if (!s)
- continue;
- dumb_ptr<map_session_data> sd = dumb_ptr<map_session_data>(static_cast<map_session_data *>(s->session_data.get()));
- if (sd && sd->state.auth && !sd->state.connect_new && sd->bl_m == bl->bl_m)
+ for (io::FD i : iter_fds())
{
+ Session *s = get_session(i);
+ if (!s)
+ continue;
+ dumb_ptr<map_session_data> sd = dumb_ptr<map_session_data>(static_cast<map_session_data *>(s->session_data.get()));
+ if (sd && sd->state.auth && !sd->state.connect_new && sd->bl_m == bl->bl_m)
{
- send_buffer(s, buf);
+ {
+ send_buffer(s, buf);
+ }
}
}
}
@@ -3806,7 +3809,8 @@ static
void clif_message_sub(Buffer& buf, dumb_ptr<block_list> 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;
@@ -5792,37 +5796,36 @@ void clif_parse(Session *s)
// dispatches to actual function
// if error, close socket
- dumb_ptr<map_session_data> sd = dumb_ptr<map_session_data>(static_cast<map_session_data *>(s->session_data.get()));
+ uint16_t packet_id;
+ RecvResult rv = RecvResult::Complete;
+ dumb_ptr<map_session_data> sd;
- if (!sd || (sd && !sd->state.auth))
+ while (rv == RecvResult::Complete && packet_peek_id(s, &packet_id))
{
- uint16_t packet_id;
- if (!packet_peek_id(s, &packet_id))
- return;
+ sd = dumb_ptr<map_session_data>(static_cast<map_session_data *>(s->session_data.get()));
+
+ if (!sd || (sd && !sd->state.auth))
+ {
+ if (packet_id != 0x0072 && packet_id != 0x7530)
+ {
+ // first packet must be auth or finger
+ s->set_eof();
+ return;
+ }
+ }
- if (packet_id != 0x0072 && packet_id != 0x7530)
+ if (!chrif_isconnect())
{
- // first packet must be auth or finger
s->set_eof();
return;
}
- }
- if (!chrif_isconnect())
- {
- s->set_eof();
- return;
- }
- if (sd && sd->state.auth == 1 && sd->state.waitingdisconnect == 1)
- {
- packet_discard(s, packet_avail(s));
- return;
- }
+ if (sd && sd->state.auth == 1 && sd->state.waitingdisconnect == 1)
+ {
+ packet_discard(s, packet_avail(s));
+ return;
+ }
- uint16_t packet_id;
- RecvResult rv = RecvResult::Complete;
- while (rv == RecvResult::Complete && packet_peek_id(s, &packet_id))
- {
switch (packet_id)
{
case 0x7530:
diff --git a/src/map/npc.cpp b/src/map/npc.cpp
index 3eb13b3..2600117 100644
--- a/src/map/npc.cpp
+++ b/src/map/npc.cpp
@@ -1052,6 +1052,9 @@ void npc_free_internal(dumb_ptr<npc_data> nd_)
static
void npc_propagate_update(dumb_ptr<npc_data> nd)
{
+ if (nd->bl_m == borrow(undefined_gat))
+ return;
+
int xs = 0, ys = 0;
if (dumb_ptr<npc_data_script> nd_ = nd->is_script())
{
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<npc_data> nd;
RString str = conv_str(st, &AARG(1));
- dumb_ptr<npc_data> nd_ = npc_name2id(stringish<NpcName>(ZString(conv_str(st, &AARG(0)))));
- assert (nd_ && nd_->npc_subtype == NpcSubtype::SCRIPT);
- nd = nd_->is_script();
+ nd = npc_name2id(stringish<NpcName>(ZString(conv_str(st, &AARG(0)))));
+ if (nd == nullptr)
+ return;
if(HARG(2)){