Finish profile infos
This commit is contained in:
parent
26a56b0602
commit
bee66b1e91
@ -100,6 +100,8 @@ namespace auth
|
||||
std::string serialize_connect_data(const char* data, const int length)
|
||||
{
|
||||
utils::byte_buffer buffer{};
|
||||
profile_infos::get_profile_info().value_or(profile_infos::profile_info{}).serialize(buffer);
|
||||
|
||||
buffer.write_string(data, static_cast<size_t>(length));
|
||||
|
||||
return buffer.move_buffer();
|
||||
@ -128,18 +130,18 @@ namespace auth
|
||||
// TODO: SV running?
|
||||
|
||||
utils::byte_buffer buffer(data);
|
||||
profile_infos::profile_info info(buffer);
|
||||
const profile_infos::profile_info info(buffer);
|
||||
|
||||
const auto connect_data = buffer.read_string();
|
||||
const command::params_sv params(connect_data);
|
||||
|
||||
if (params.size() != 2)
|
||||
if (params.size() < 2)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
const utils::info_string info_string(params[1]);
|
||||
const auto xuid = strtoull(info_string.get("xuid").data(), nullptr, 10);
|
||||
const auto xuid = strtoull(info_string.get("xuid").data(), nullptr, 16);
|
||||
|
||||
profile_infos::add_and_distribute_profile_info(target, xuid, info);
|
||||
|
||||
|
@ -72,6 +72,11 @@ namespace profile_infos
|
||||
|
||||
void distribute_profile_info(const uint64_t user_id, const profile_info& info)
|
||||
{
|
||||
if (user_id == steam::SteamUser()->GetSteamID().bits)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
utils::byte_buffer buffer{};
|
||||
buffer.write(user_id);
|
||||
info.serialize(buffer);
|
||||
@ -132,6 +137,15 @@ namespace profile_infos
|
||||
distribute_profile_info_to_user(addr, entry.first, entry.second);
|
||||
}
|
||||
});
|
||||
|
||||
if (!game::is_server())
|
||||
{
|
||||
const auto info = get_profile_info();
|
||||
if (info)
|
||||
{
|
||||
distribute_profile_info_to_user(addr, steam::SteamUser()->GetSteamID().bits, *info);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void add_and_distribute_profile_info(const game::netadr_t& addr, const uint64_t user_id, const profile_info& info)
|
||||
@ -150,13 +164,18 @@ namespace profile_infos
|
||||
});
|
||||
}
|
||||
|
||||
std::optional<profile_info> get_profile_info()
|
||||
{
|
||||
return load_profile_info();
|
||||
}
|
||||
|
||||
std::optional<profile_info> get_profile_info(const uint64_t user_id)
|
||||
{
|
||||
printf("Requesting profile info: %llX\n", user_id);
|
||||
|
||||
if (user_id == steam::SteamUser()->GetSteamID().bits)
|
||||
{
|
||||
return load_profile_info();
|
||||
return get_profile_info();
|
||||
}
|
||||
|
||||
return profile_mapping.access<std::optional<profile_info>>([user_id](const profile_map& profiles)
|
||||
|
@ -19,6 +19,8 @@ namespace profile_infos
|
||||
void add_and_distribute_profile_info(const game::netadr_t& addr, uint64_t user_id, const profile_info& info);
|
||||
void clear_profile_infos();
|
||||
|
||||
|
||||
std::optional<profile_info> get_profile_info();
|
||||
std::optional<profile_info> get_profile_info(uint64_t user_id);
|
||||
void update_profile_info(const profile_info& info);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user