From aee3e1084cc732c913eefabe0d5a3176372143f6 Mon Sep 17 00:00:00 2001 From: hg <4683435+hgtw@users.noreply.github.com> Date: Sun, 24 May 2020 14:55:27 -0400 Subject: [PATCH] Fix missing invite failure messages --- zone/expedition.cpp | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/zone/expedition.cpp b/zone/expedition.cpp index cedca641b..7ba767386 100644 --- a/zone/expedition.cpp +++ b/zone/expedition.cpp @@ -883,19 +883,27 @@ void Expedition::DzAddPlayer( return; } + bool invite_failed = false; + if (add_char_name.empty()) { requester->MessageString(Chat::Red, DZADD_NOT_ONLINE, add_char_name.c_str()); - return; + invite_failed = true; + } + else + { + // we can avoid checking online status in world if we trust member status accuracy + auto member_data = GetMemberData(add_char_name); + if (member_data.char_id != 0 && member_data.status != ExpeditionMemberStatus::Offline) + { + requester->MessageString(Chat::Red, DZADD_ALREADY_PART, add_char_name.c_str()); + invite_failed = true; + } } - // live prioritizes the "not online" message before the "already a member" - // message but we can avoid checking world if we trust member status accuracy - // live sanitizes input except for "sending invite" and "not online" msgs - auto member_data = GetMemberData(add_char_name); - if (member_data.char_id != 0 && member_data.status != ExpeditionMemberStatus::Offline) + if (invite_failed) { - requester->MessageString(Chat::Red, DZADD_ALREADY_PART, add_char_name.c_str()); + requester->MessageString(Chat::Red, DZADD_INVITE_FAIL, FormatName(add_char_name).c_str()); return; } @@ -1679,6 +1687,7 @@ void Expedition::HandleWorldMessage(ServerPacket* pack) if (leader) { leader->MessageString(Chat::Red, DZADD_NOT_ONLINE, FormatName(buf->target_name).c_str()); + leader->MessageString(Chat::Red, DZADD_INVITE_FAIL, FormatName(buf->target_name).c_str()); } } break;