commit
07c0c263b5
@ -505,4 +505,26 @@ namespace demonware
|
|||||||
buffer->read_uint32(&this->m_maxPlayers);
|
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);
|
||||||
|
}
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
#include <std_include.hpp>
|
#include <std_include.hpp>
|
||||||
#include "../services.hpp"
|
#include "../services.hpp"
|
||||||
|
#include "steam/steam.hpp"
|
||||||
|
#include <utils/io.hpp>
|
||||||
|
|
||||||
namespace demonware
|
namespace demonware
|
||||||
{
|
{
|
||||||
@ -15,16 +17,36 @@ namespace demonware
|
|||||||
this->register_task(8, &bdProfiles::setPublicInfoByUserID);
|
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
|
||||||
|
{
|
||||||
|
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))
|
||||||
{
|
{
|
||||||
// TODO:
|
|
||||||
auto reply = server->create_reply(this->task_id());
|
auto reply = server->create_reply(this->task_id());
|
||||||
|
reply->add(result);
|
||||||
reply->send();
|
reply->send();
|
||||||
}
|
}
|
||||||
|
else
|
||||||
void bdProfiles::setPublicInfo(service_server* server, byte_buffer* /*buffer*/) const
|
|
||||||
{
|
{
|
||||||
// TODO:
|
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
|
||||||
|
{
|
||||||
|
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());
|
auto reply = server->create_reply(this->task_id());
|
||||||
reply->send();
|
reply->send();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user