mirror of
https://github.com/HikikoMarmy/Champions-Reborn-Server.git
synced 2026-04-04 16:49:47 -03:00
Reorganized and cleaned up the solution.
This commit is contained in:
50
Include/Game/RealmCharacterMetaKV.hpp
Normal file
50
Include/Game/RealmCharacterMetaKV.hpp
Normal file
@@ -0,0 +1,50 @@
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <utility>
|
||||
|
||||
#include "Common/ByteStream.hpp"
|
||||
|
||||
using CharacterAttributeKV = std::pair<std::wstring, std::wstring>;
|
||||
|
||||
class CharacterSlotData {
|
||||
private:
|
||||
std::vector<CharacterAttributeKV> m_metaData;
|
||||
|
||||
public:
|
||||
CharacterSlotData() = default;
|
||||
CharacterSlotData( const std::vector< uint8_t > &data );
|
||||
|
||||
void Deserialize( const std::vector< uint8_t > &data );
|
||||
void Deserialize( const sptr_byte_stream stream );
|
||||
|
||||
std::vector<uint8_t> Serialize() const;
|
||||
|
||||
bool empty() const
|
||||
{
|
||||
return m_metaData.empty();
|
||||
}
|
||||
|
||||
const std::vector<CharacterAttributeKV> &GetMetaData() const
|
||||
{
|
||||
return m_metaData;
|
||||
}
|
||||
|
||||
void SetMetaData( const std::vector<CharacterAttributeKV> &metaData )
|
||||
{
|
||||
m_metaData = metaData;
|
||||
}
|
||||
|
||||
std::wstring GetValue( std::wstring key )
|
||||
{
|
||||
for( const auto &kv : m_metaData )
|
||||
{
|
||||
if( kv.first == key )
|
||||
{
|
||||
return kv.second;
|
||||
}
|
||||
}
|
||||
return L"";
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user