bdProfiles service

fixes profile customization lockout(calling card and emblem only?)

Not tested on public games but clearly others players still wont see real info since your dw server is emulated locally and does not provide connectivity between players.

in case you want to adopt it with your system basically  one way might be somehow merging it with any of ddl's shared with dedicated servers; not so familiar with how it works.
This commit is contained in:
project-bo4 2023-03-13 06:37:51 -07:00 committed by GitHub
parent 5090723010
commit 069749f915
2 changed files with 50 additions and 6 deletions

View File

@ -505,4 +505,26 @@ namespace demonware
buffer->read_uint32(&this->m_maxPlayers);
}
};
class bdPublicProfileInfo final : public bdTaskResult
{
public:
uint64_t m_entityID;
int32_t m_VERSION;
std::string m_ddl;
void serialize(byte_buffer* buffer) override
{
buffer->write_uint64(this->m_entityID);
buffer->write_int32(this->m_VERSION);
buffer->write_blob(this->m_ddl);
}
void deserialize(byte_buffer* buffer) override
{
buffer->read_uint64(&this->m_entityID);
buffer->read_int32(&this->m_VERSION);
buffer->read_blob(&this->m_ddl);
}
};
}

View File

@ -1,5 +1,7 @@
#include <std_include.hpp>
#include "../services.hpp"
#include "steam/steam.hpp"
#include <utils/io.hpp>
namespace demonware
{
@ -15,16 +17,36 @@ namespace demonware
this->register_task(8, &bdProfiles::setPublicInfoByUserID);
}
void bdProfiles::getPublicInfos(service_server* server, byte_buffer* /*buffer*/) const
void bdProfiles::getPublicInfos(service_server* server, byte_buffer* buffer) const
{
// TODO:
auto reply = server->create_reply(this->task_id());
reply->send();
uint64_t entity_id;
buffer->read_uint64(&entity_id);
auto* result = new bdPublicProfileInfo;
result->m_entityID = entity_id;
result->m_VERSION = 4;
if (utils::io::read_file(std::format("players/user/profileInfo_{}", entity_id), &result->m_ddl))
{
auto reply = server->create_reply(this->task_id());
reply->add(result);
reply->send();
}
else
{
auto reply = server->create_reply(this->task_id(), game::BD_NO_PROFILE_INFO_EXISTS);
reply->send();
}
}
void bdProfiles::setPublicInfo(service_server* server, byte_buffer* /*buffer*/) const
void bdProfiles::setPublicInfo(service_server* server, byte_buffer* buffer) const
{
// TODO:
int32_t version; std::string ddl;
buffer->read_int32(&version);
buffer->read_blob(&ddl);
utils::io::write_file(std::format("players/user/profileInfo_{}", steam::SteamUser()->GetSteamID().bits), ddl);
auto reply = server->create_reply(this->task_id());
reply->send();
}