From fba078bbe9a9280796cef6dc9b20da231fc926eb Mon Sep 17 00:00:00 2001 From: hg <4683435+hgtw@users.noreply.github.com> Date: Sun, 12 Jul 2020 11:21:47 -0400 Subject: [PATCH] Format name in expedition invite message Live uses the original unformatted user input in invite messages, but this doesn't seem necessary to emulate --- zone/expedition.cpp | 14 +++++++------- zone/expedition.h | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/zone/expedition.cpp b/zone/expedition.cpp index e4f56d749..8ebc5b4e6 100644 --- a/zone/expedition.cpp +++ b/zone/expedition.cpp @@ -897,8 +897,8 @@ bool Expedition::ConfirmLeaderCommand(Client* requester) } void Expedition::TryAddClient( - Client* add_client, const std::string& inviter_name, const std::string& orig_add_name, - const std::string& swap_remove_name, Client* leader_client) + Client* add_client, const std::string& inviter_name, const std::string& swap_remove_name, + Client* leader_client) { if (!add_client) { @@ -907,7 +907,7 @@ void Expedition::TryAddClient( LogExpeditionsModerate( "Add player request for expedition [{}] by inviter [{}] add name [{}] swap name [{}]", - m_id, inviter_name, orig_add_name, swap_remove_name + m_id, inviter_name, add_client->GetName(), swap_remove_name ); // null leader client handled by ProcessAddConflicts/SendLeaderMessage fallbacks @@ -921,7 +921,7 @@ void Expedition::TryAddClient( { // live uses the original unsanitized input string in invite messages uint32_t string_id = swap_remove_name.empty() ? DZADD_INVITE : DZSWAP_INVITE; - SendLeaderMessage(leader_client, Chat::Yellow, string_id, { orig_add_name.c_str() }); + SendLeaderMessage(leader_client, Chat::Yellow, string_id, { add_client->GetName() }); SendClientExpeditionInvite(add_client, inviter_name.c_str(), swap_remove_name); } else if (swap_remove_name.empty()) // swap command doesn't result in this message @@ -971,12 +971,12 @@ void Expedition::DzAddPlayer( if (add_client) { // client is online in this zone - TryAddClient(add_client, requester->GetName(), add_char_name, swap_remove_name, requester); + TryAddClient(add_client, requester->GetName(), swap_remove_name, requester); } else { // forward to world to check if client is online and perform cross-zone invite - SendWorldAddPlayerInvite(requester->GetName(), swap_remove_name, add_char_name); + SendWorldAddPlayerInvite(requester->GetName(), swap_remove_name, FormatName(add_char_name)); } } @@ -987,7 +987,7 @@ void Expedition::DzAddPlayerContinue( Client* add_client = entity_list.GetClientByName(add_name.c_str()); if (add_client) { - TryAddClient(add_client, inviter_name, add_name, swap_remove_name); + TryAddClient(add_client, inviter_name, swap_remove_name); } } diff --git a/zone/expedition.h b/zone/expedition.h index 94dde9627..611ad6c0c 100644 --- a/zone/expedition.h +++ b/zone/expedition.h @@ -182,7 +182,7 @@ private: void SendWorldMemberSwapped(const std::string& remove_char_name, uint32_t remove_char_id, const std::string& add_char_name, uint32_t add_char_id); void SendWorldSettingChanged(uint16_t server_opcode, bool setting_value); - void TryAddClient(Client* add_client, const std::string& inviter_name, const std::string& orig_add_name, + void TryAddClient(Client* add_client, const std::string& inviter_name, const std::string& swap_remove_name, Client* leader_client = nullptr); void UpdateMemberStatus(uint32_t update_character_id, ExpeditionMemberStatus status);