diff --git a/common/servertalk.h b/common/servertalk.h index 4370d6be0..40be635ad 100644 --- a/common/servertalk.h +++ b/common/servertalk.h @@ -2110,9 +2110,9 @@ struct ServerDzCommand_Struct { struct ServerDzCommandMakeLeader_Struct { uint32 expedition_id; + uint32 requester_id; uint8 is_online; // set by world, 0: new leader name offline, 1: online uint8 is_success; // set by world, 0: makeleader failed, 1: success (is online member) - char requester_name[64]; char new_leader_name[64]; }; diff --git a/world/expedition_message.cpp b/world/expedition_message.cpp index 8501c0e7a..646e2272e 100644 --- a/world/expedition_message.cpp +++ b/world/expedition_message.cpp @@ -156,7 +156,7 @@ void ExpeditionMessage::MakeLeader(ServerPacket* pack) } // if old and new leader are in the same zone only send one message - ClientListEntry* requester_cle = client_list.FindCharacter(buf->requester_name); + ClientListEntry* requester_cle = client_list.FindCLEByCharacterID(buf->requester_id); if (requester_cle && requester_cle->Server() && requester_cle->Server() != new_leader_zs) { requester_cle->Server()->SendPacket(pack); diff --git a/zone/command.cpp b/zone/command.cpp index e1662f3ef..39e6c98d5 100755 --- a/zone/command.cpp +++ b/zone/command.cpp @@ -6986,7 +6986,7 @@ void command_dz(Client* c, const Seperator* sep) { auto char_name = FormatName(sep->arg[3]); c->Message(Chat::White, fmt::format("Setting expedition [{}] leader to [{}]", expedition_id, char_name).c_str()); - expedition->SendWorldMakeLeaderRequest(c->GetName(), char_name); + expedition->SendWorldMakeLeaderRequest(c->CharacterID(), char_name); } else { diff --git a/zone/expedition.cpp b/zone/expedition.cpp index 77dd25b0a..8e3465b7d 100644 --- a/zone/expedition.cpp +++ b/zone/expedition.cpp @@ -1022,7 +1022,7 @@ void Expedition::DzMakeLeader(Client* requester, std::string new_leader_name) } // leader can only be changed by world - SendWorldMakeLeaderRequest(requester->GetName(), FormatName(new_leader_name)); + SendWorldMakeLeaderRequest(requester->CharacterID(), FormatName(new_leader_name)); } void Expedition::DzRemovePlayer(Client* requester, std::string char_name) @@ -1584,14 +1584,13 @@ void Expedition::SendWorldLockoutUpdate( worldserver.SendPacket(pack.get()); } -void Expedition::SendWorldMakeLeaderRequest( - const std::string& requester_name, const std::string& new_leader_name) +void Expedition::SendWorldMakeLeaderRequest(uint32_t requester_id, const std::string& new_leader_name) { uint32_t pack_size = sizeof(ServerDzCommandMakeLeader_Struct); auto pack = std::unique_ptr(new ServerPacket(ServerOP_ExpeditionDzMakeLeader, pack_size)); auto buf = reinterpret_cast(pack->pBuffer); buf->expedition_id = GetID(); - strn0cpy(buf->requester_name, requester_name.c_str(), sizeof(buf->requester_name)); + buf->requester_id = requester_id; strn0cpy(buf->new_leader_name, new_leader_name.c_str(), sizeof(buf->new_leader_name)); worldserver.SendPacket(pack.get()); } @@ -1993,7 +1992,7 @@ void Expedition::HandleWorldMessage(ServerPacket* pack) auto expedition = Expedition::FindCachedExpeditionByID(buf->expedition_id); if (expedition) { - auto old_leader_client = entity_list.GetClientByName(buf->requester_name); + auto old_leader_client = entity_list.GetClientByCharID(buf->requester_id); auto new_leader_client = entity_list.GetClientByName(buf->new_leader_name); expedition->ProcessMakeLeader(old_leader_client, new_leader_client, buf->new_leader_name, buf->is_success, buf->is_online); diff --git a/zone/expedition.h b/zone/expedition.h index 7f264b723..5a0d6da56 100644 --- a/zone/expedition.h +++ b/zone/expedition.h @@ -145,7 +145,7 @@ public: void SetLootEventBySpawnID(uint32_t spawn_id, const std::string& event_name); void SendClientExpeditionInfo(Client* client); - void SendWorldMakeLeaderRequest(const std::string& requester_name, const std::string& new_leader_name); + void SendWorldMakeLeaderRequest(uint32_t requester_id, const std::string& new_leader_name); void SendWorldPendingInvite(const ExpeditionInvite& invite, const std::string& add_name); void DzAddPlayer(Client* requester, const std::string& add_char_name, const std::string& swap_remove_name = {});