refactor: switch to wide string

This commit is contained in:
k0t9i 2023-01-25 19:53:02 +04:00
parent f7198a13ef
commit eb7bfc779b
46 changed files with 284 additions and 293 deletions

View File

@ -9,11 +9,11 @@ DWORD dwWritten;
BOOL fSuccess = FALSE;
DWORD cbRead, cbToWrite, cbWritten, dwMode;
int CreatePipe(std::string name)
int CreatePipe(std::wstring name)
{
while (1)
{
hPipe = CreateFileA(
hPipe = CreateFileW(
name.c_str(), // pipe name
GENERIC_READ | // read and write access
GENERIC_WRITE,
@ -50,9 +50,9 @@ int CreatePipe(std::string name)
return 0;
}
std::string ReadMessage()
std::wstring ReadMessage()
{
char chBuf[10240];
wchar_t chBuf[10240];
do
{
// Read from the pipe.
@ -60,7 +60,7 @@ std::string ReadMessage()
fSuccess = ReadFile(
hPipe, // pipe handle
chBuf, // buffer to receive reply
10240 * sizeof(char), // size of buffer
10240 * sizeof(wchar_t), // size of buffer
&cbRead, // number of bytes read
NULL); // not overlapped
@ -68,27 +68,28 @@ std::string ReadMessage()
break;
} while (!fSuccess);
return std::string(chBuf);
return std::wstring(chBuf);
}
int main()
{
CreatePipe("\\\\.\\pipe\\PipeL2Bot");
CreatePipe(L"\\\\.\\pipe\\PipeL2Bot");
std::cout << "Connected to the connection pipe" << std::endl;
auto name = ReadMessage();
CloseHandle(hPipe);
std::cout << "Received main pipe name: " << name << std::endl;
std::wcout << L"Received main pipe name: " << name << std::endl;
std::cin.get();
CreatePipe(name);
const std::string message = "invalidate";
const std::wstring message = L"invalidate";
DWORD written;
WriteFile(hPipe, message.c_str(), message.size() + 1, &written, NULL);
while (true) {
std::cout << ReadMessage() << std::endl;
const auto msg = ReadMessage();
std::wcout << msg << std::endl;
}
std::cin.get();
}

View File

@ -43,14 +43,14 @@ namespace L2Bot::Domain::Entities
{
std::vector<Serializers::Node> result;
result.push_back({ "skillId", std::to_string(m_SkillId) });
result.push_back({ "level", std::to_string(m_Level) });
result.push_back({ L"skillId", std::to_wstring(m_SkillId) });
result.push_back({ L"level", std::to_wstring(m_Level) });
if (m_IsNewState)
{
result.push_back({ "name", m_Name });
result.push_back({ "iconName", m_IconName });
result.push_back({ "description", m_Description });
result.push_back({ L"name", m_Name });
result.push_back({ L"iconName", m_IconName });
result.push_back({ L"description", m_Description });
}
return result;
@ -59,9 +59,9 @@ namespace L2Bot::Domain::Entities
AbnormalEffect(
const uint32_t skillId,
const uint8_t level,
const std::string& name,
const std::string& description,
const std::string& iconName
const std::wstring& name,
const std::wstring& description,
const std::wstring& iconName
) :
m_SkillId(skillId),
m_Level(level),
@ -87,9 +87,9 @@ namespace L2Bot::Domain::Entities
private:
uint32_t m_SkillId = 0;
uint8_t m_Level = 0;
std::string m_Name = "";
std::string m_Description = "";
std::string m_IconName = "";
std::wstring m_Name = L"";
std::wstring m_Description = L"";
std::wstring m_IconName = L"";
bool m_IsNewState = true;
};
}

View File

@ -60,28 +60,28 @@ namespace L2Bot::Domain::Entities
if (m_PrevState.isNewState)
{
result.push_back({ "armorType", std::to_string(static_cast<uint8_t>(m_ArmorType)) });
result.push_back({ "crystalType", std::to_string(static_cast<int8_t>(m_CrystalType)) });
result.push_back({ "setEffect", m_SetEffect });
result.push_back({ "addSetEffect", m_AddSetEffect });
result.push_back({ "enchantEffect", m_EnchantEffect });
result.push_back({ L"armorType", std::to_wstring(static_cast<uint8_t>(m_ArmorType)) });
result.push_back({ L"crystalType", std::to_wstring(static_cast<int8_t>(m_CrystalType)) });
result.push_back({ L"setEffect", m_SetEffect });
result.push_back({ L"addSetEffect", m_AddSetEffect });
result.push_back({ L"enchantEffect", m_EnchantEffect });
}
if (m_PrevState.isNewState || m_IsEquipped != m_PrevState.isEquipped)
{
result.push_back({ "isEquipped", std::to_string(m_IsEquipped) });
result.push_back({ L"isEquipped", std::to_wstring(m_IsEquipped) });
}
if (m_PrevState.isNewState || m_EnchantLevel != m_PrevState.enchantLevel)
{
result.push_back({ "enchantLevel", std::to_string(m_EnchantLevel) });
result.push_back({ L"enchantLevel", std::to_wstring(m_EnchantLevel) });
}
if (m_PrevState.isNewState || m_PDefense != m_PrevState.pDefense)
{
result.push_back({ "pDefense", std::to_string(m_PDefense) });
result.push_back({ L"pDefense", std::to_wstring(m_PDefense) });
}
if (m_PrevState.isNewState || m_MDefense != m_PrevState.mDefense)
{
result.push_back({ "mDefense", std::to_string(m_MDefense) });
result.push_back({ L"mDefense", std::to_wstring(m_MDefense) });
}
return result;
@ -91,9 +91,9 @@ namespace L2Bot::Domain::Entities
const uint32_t objectId,
const uint32_t itemId,
const int32_t mana,
const std::string& name,
const std::string& iconName,
const std::string& description,
const std::wstring& name,
const std::wstring& iconName,
const std::wstring& description,
const uint16_t weight,
const bool isEquipped,
const uint16_t enchantLevel,
@ -101,9 +101,9 @@ namespace L2Bot::Domain::Entities
const Enums::CrystalTypeEnum crystalType,
const uint32_t pDefense,
const uint32_t mDefense,
const std::string& setEffect,
const std::string& addSetEffect,
const std::string& enchantEffect
const std::wstring& setEffect,
const std::wstring& addSetEffect,
const std::wstring& enchantEffect
) :
BaseItem
(
@ -163,9 +163,9 @@ namespace L2Bot::Domain::Entities
Enums::CrystalTypeEnum m_CrystalType = Enums::CrystalTypeEnum::none;
uint32_t m_PDefense = 0;
uint32_t m_MDefense = 0;
std::string m_SetEffect = "";
std::string m_AddSetEffect = "";
std::string m_EnchantEffect = "";
std::wstring m_SetEffect = L"";
std::wstring m_AddSetEffect = L"";
std::wstring m_EnchantEffect = L"";
GetState m_PrevState = GetState();
};
}

View File

@ -58,24 +58,24 @@ namespace L2Bot::Domain::Entities
{
std::vector<Serializers::Node> result;
result.push_back({ "objectId", std::to_string(m_ObjectId) });
result.push_back({ "itemId", std::to_string(m_ItemId) });
result.push_back({ L"objectId", std::to_wstring(m_ObjectId) });
result.push_back({ L"itemId", std::to_wstring(m_ItemId) });
if (m_PrevState.isNewState)
{
result.push_back({ "type", std::to_string(static_cast<int8_t>(m_Type))});
result.push_back({ "name", m_Name });
result.push_back({ "iconName", m_IconName });
result.push_back({ "description", m_Description });
result.push_back({ L"type", std::to_wstring(static_cast<int8_t>(m_Type))});
result.push_back({ L"name", m_Name });
result.push_back({ L"iconName", m_IconName });
result.push_back({ L"description", m_Description });
}
if (m_PrevState.isNewState || m_Mana != m_PrevState.mana)
{
result.push_back({ "mana", std::to_string(m_Mana) });
result.push_back({ L"mana", std::to_wstring(m_Mana) });
}
if (m_PrevState.isNewState || m_Weight != m_PrevState.weight)
{
result.push_back({ "weight", std::to_string(m_Weight) });
result.push_back({ L"weight", std::to_wstring(m_Weight) });
}
return result;
@ -85,9 +85,9 @@ namespace L2Bot::Domain::Entities
const uint32_t objectId,
const uint32_t itemId,
const int32_t mana,
const std::string& name,
const std::string& iconName,
const std::string& description,
const std::wstring& name,
const std::wstring& iconName,
const std::wstring& description,
const uint16_t weight,
const Enums::ItemTypeEnum type
) :
@ -130,9 +130,9 @@ namespace L2Bot::Domain::Entities
uint32_t m_ObjectId = 0;
uint32_t m_ItemId = 0;
int32_t m_Mana = -1;
std::string m_Name = "";
std::string m_IconName = "";
std::string m_Description = "";
std::wstring m_Name = L"";
std::wstring m_IconName = L"";
std::wstring m_Description = L"";
uint16_t m_Weight = 0;
Enums::ItemTypeEnum m_Type = Enums::ItemTypeEnum::none;
GetState m_PrevState = GetState();

View File

@ -38,10 +38,10 @@ namespace L2Bot::Domain::Entities
if (m_IsNewState)
{
result.push_back({ "itemId", std::to_string(m_ItemId) });
result.push_back({ "amount", std::to_string(m_Amount) });
result.push_back({ "name", m_Name });
result.push_back({ "iconName", m_IconName });
result.push_back({ L"itemId", std::to_wstring(m_ItemId) });
result.push_back({ L"amount", std::to_wstring(m_Amount) });
result.push_back({ L"name", m_Name });
result.push_back({ L"iconName", m_IconName });
}
return result;
@ -52,8 +52,8 @@ namespace L2Bot::Domain::Entities
const ValueObjects::Transform transform,
const uint32_t itemId,
const uint32_t amount,
const std::string& name,
const std::string& iconName
const std::wstring& name,
const std::wstring& iconName
) :
WorldObject(id, transform),
m_ItemId(itemId),
@ -69,8 +69,8 @@ namespace L2Bot::Domain::Entities
private:
uint32_t m_ItemId = 0;
uint32_t m_Amount = 0;
std::string m_Name = "";
std::string m_IconName = "";
std::wstring m_Name = L"";
std::wstring m_IconName = L"";
bool m_IsNewState = true;
};
}

View File

@ -49,16 +49,16 @@ namespace L2Bot::Domain::Entities
if (m_PrevState.isNewState)
{
result.push_back({ "isQuest", std::to_string(m_IsQuest) });
result.push_back({ L"isQuest", std::to_wstring(m_IsQuest) });
}
if (m_PrevState.isNewState || m_Amount != m_PrevState.amount)
{
result.push_back({ "amount", std::to_string(m_Amount) });
result.push_back({ L"amount", std::to_wstring(m_Amount) });
}
if (m_PrevState.isNewState || m_IsAutoused != m_PrevState.isAutoused)
{
result.push_back({ "isAutoused", std::to_string(m_IsAutoused) });
result.push_back({ L"isAutoused", std::to_wstring(m_IsAutoused) });
}
return result;
@ -68,9 +68,9 @@ namespace L2Bot::Domain::Entities
const uint32_t objectId,
const uint32_t itemId,
const int32_t mana,
const std::string& name,
const std::string& iconName,
const std::string& description,
const std::wstring& name,
const std::wstring& iconName,
const std::wstring& description,
const uint16_t weight,
const uint32_t amount,
const bool isQuest

View File

@ -70,43 +70,43 @@ namespace L2Bot::Domain::Entities
if (m_PrevState.isNewState || !m_FullName.IsEqual(&m_PrevState.fullName))
{
result.push_back({ "fullName", m_FullName.BuildSerializationNodes() });
result.push_back({ L"fullName", m_FullName.BuildSerializationNodes() });
}
if (m_PrevState.isNewState || !m_VitalStats.IsEqual(&m_PrevState.vitalStats))
{
result.push_back({ "vitalStats", m_VitalStats.BuildSerializationNodes() });
result.push_back({ L"vitalStats", m_VitalStats.BuildSerializationNodes() });
}
if (m_PrevState.isNewState || !m_Phenotype.IsEqual(&m_PrevState.phenotype))
{
result.push_back({ "phenotype", m_Phenotype.BuildSerializationNodes() });
result.push_back({ L"phenotype", m_Phenotype.BuildSerializationNodes() });
}
if (m_PrevState.isNewState || !m_ExperienceInfo.IsEqual(&m_PrevState.experienceInfo))
{
result.push_back({ "experienceInfo", m_ExperienceInfo.BuildSerializationNodes() });
result.push_back({ L"experienceInfo", m_ExperienceInfo.BuildSerializationNodes() });
}
if (m_PrevState.isNewState || !m_PermanentStats.IsEqual(&m_PrevState.permanentStats))
{
result.push_back({ "permanentStats", m_PermanentStats.BuildSerializationNodes() });
result.push_back({ L"permanentStats", m_PermanentStats.BuildSerializationNodes() });
}
if (m_PrevState.isNewState || !m_VariableStats.IsEqual(&m_PrevState.variableStats))
{
result.push_back({ "variableStats", m_VariableStats.BuildSerializationNodes() });
result.push_back({ L"variableStats", m_VariableStats.BuildSerializationNodes() });
}
if (m_PrevState.isNewState || !m_Reputation.IsEqual(&m_PrevState.reputation))
{
result.push_back({ "reputation", m_Reputation.BuildSerializationNodes() });
result.push_back({ L"reputation", m_Reputation.BuildSerializationNodes() });
}
if (m_PrevState.isNewState || !m_InventoryInfo.IsEqual(&m_PrevState.inventoryInfo))
{
result.push_back({ "inventoryInfo", m_InventoryInfo.BuildSerializationNodes() });
result.push_back({ L"inventoryInfo", m_InventoryInfo.BuildSerializationNodes() });
}
if (m_PrevState.isNewState || m_TargetId != m_PrevState.targetId)
{
result.push_back({ "targetId", std::to_string(m_TargetId) });
result.push_back({ L"targetId", std::to_wstring(m_TargetId) });
}
if (m_PrevState.isNewState || m_IsStanding != m_PrevState.isStanding)
{
result.push_back({ "isStanding", std::to_string(m_IsStanding) });
result.push_back({ L"isStanding", std::to_wstring(m_IsStanding) });
}
return result;

View File

@ -49,20 +49,20 @@ namespace L2Bot::Domain::Entities
if (m_PrevState.isNewState || !m_FullName.IsEqual(&m_PrevState.fullName))
{
result.push_back({ "fullName", m_FullName.BuildSerializationNodes() });
result.push_back({ L"fullName", m_FullName.BuildSerializationNodes() });
}
if (m_PrevState.isNewState)
{
result.push_back({ "isHostile", std::to_string(m_IsHostile) });
result.push_back({ "npcId", std::to_string(m_NpcId) });
result.push_back({ L"isHostile", std::to_wstring(m_IsHostile) });
result.push_back({ L"npcId", std::to_wstring(m_NpcId) });
}
if (m_PrevState.isNewState || m_SpoilState != m_PrevState.spoilState)
{
result.push_back({ "spoilState", std::to_string(static_cast<uint32_t>(m_SpoilState)) });
result.push_back({ L"spoilState", std::to_wstring(static_cast<uint32_t>(m_SpoilState)) });
}
if (m_PrevState.isNewState || !m_VitalStats.IsEqual(&m_PrevState.vitalStats))
{
result.push_back({ "vitalStats", m_VitalStats.BuildSerializationNodes() });
result.push_back({ L"vitalStats", m_VitalStats.BuildSerializationNodes() });
}
return result;

View File

@ -40,11 +40,11 @@ namespace L2Bot::Domain::Entities
if (m_PrevState.isNewState || !m_FullName.IsEqual(&m_PrevState.fullName))
{
result.push_back({ "fullName", m_FullName.BuildSerializationNodes() });
result.push_back({ L"fullName", m_FullName.BuildSerializationNodes() });
}
if (m_PrevState.isNewState || !m_Phenotype.IsEqual(&m_PrevState.phenotype))
{
result.push_back({ "phenotype", m_Phenotype.BuildSerializationNodes() });
result.push_back({ L"phenotype", m_Phenotype.BuildSerializationNodes() });
}
return result;

View File

@ -52,22 +52,22 @@ namespace L2Bot::Domain::Entities
if (m_PrevState.isNewState)
{
result.push_back({ "crystalType", std::to_string(static_cast<int8_t>(m_CrystalType)) });
result.push_back({ "evasion", std::to_string(m_Evasion) });
result.push_back({ "defRate", std::to_string(m_DefRate) });
result.push_back({ L"crystalType", std::to_wstring(static_cast<int8_t>(m_CrystalType)) });
result.push_back({ L"evasion", std::to_wstring(m_Evasion) });
result.push_back({ L"defRate", std::to_wstring(m_DefRate) });
}
if (m_PrevState.isNewState || m_IsEquipped != m_PrevState.isEquipped)
{
result.push_back({ "isEquipped", std::to_string(m_IsEquipped) });
result.push_back({ L"isEquipped", std::to_wstring(m_IsEquipped) });
}
if (m_PrevState.isNewState || m_EnchantLevel != m_PrevState.enchantLevel)
{
result.push_back({ "enchantLevel", std::to_string(m_EnchantLevel) });
result.push_back({ L"enchantLevel", std::to_wstring(m_EnchantLevel) });
}
if (m_PrevState.isNewState || m_PDefense != m_PrevState.pDefense)
{
result.push_back({ "pDefense", std::to_string(m_PDefense) });
result.push_back({ L"pDefense", std::to_wstring(m_PDefense) });
}
return result;
@ -77,9 +77,9 @@ namespace L2Bot::Domain::Entities
const uint32_t objectId,
const uint32_t itemId,
const int32_t mana,
const std::string& name,
const std::string& iconName,
const std::string& description,
const std::wstring& name,
const std::wstring& iconName,
const std::wstring& description,
const uint16_t weight,
const bool isEquipped,
const uint16_t enchantLevel,

View File

@ -90,43 +90,43 @@ namespace L2Bot::Domain::Entities
{
std::vector<Serializers::Node> result;
result.push_back({ "skillId", std::to_string(m_SkillId) });
result.push_back({ "level", std::to_string(m_Level) });
result.push_back({ L"skillId", std::to_wstring(m_SkillId) });
result.push_back({ L"level", std::to_wstring(m_Level) });
if (m_PrevState.isNewState)
{
result.push_back({ "isActive", std::to_string(m_IsActive) });
result.push_back({ "name", m_Name });
result.push_back({ "iconName", m_IconName });
result.push_back({ L"isActive", std::to_wstring(m_IsActive) });
result.push_back({ L"name", m_Name });
result.push_back({ L"iconName", m_IconName });
}
if (m_PrevState.isNewState || m_Description != m_PrevState.description)
{
result.push_back({ "description", m_Description });
result.push_back({ L"description", m_Description });
}
if (m_PrevState.isNewState || m_Cost != m_PrevState.cost)
{
result.push_back({ "cost", std::to_string(m_Cost) });
result.push_back({ L"cost", std::to_wstring(m_Cost) });
}
if (m_PrevState.isNewState || m_Range != m_PrevState.range)
{
result.push_back({ "range", std::to_string(m_Range) });
result.push_back({ L"range", std::to_wstring(m_Range) });
}
if (m_PrevState.isNewState || m_IsToggled != m_PrevState.isToggled)
{
result.push_back({ "isToggled", std::to_string(m_IsToggled) });
result.push_back({ L"isToggled", std::to_wstring(m_IsToggled) });
}
if (m_PrevState.isNewState || m_IsCasting != m_PrevState.isCasting)
{
result.push_back({ "isCasting", std::to_string(m_IsCasting) });
result.push_back({ L"isCasting", std::to_wstring(m_IsCasting) });
}
if (m_PrevState.isNewState || m_IsReloading != m_PrevState.isReloading)
{
result.push_back({ "isReloading", std::to_string(m_IsReloading) });
result.push_back({ L"isReloading", std::to_wstring(m_IsReloading) });
}
if (m_PrevState.isNewState || IsReadyToUse() != m_PrevState.isReadyToUse)
{
result.push_back({ "isReadyToUse", std::to_string(IsReadyToUse()) });
result.push_back({ L"isReadyToUse", std::to_wstring(IsReadyToUse()) });
}
return result;
@ -138,9 +138,9 @@ namespace L2Bot::Domain::Entities
const bool isActive,
const uint8_t cost,
const int16_t range,
const std::string& name,
const std::string& description,
const std::string& iconName,
const std::wstring& name,
const std::wstring& description,
const std::wstring& iconName,
const bool isToggled,
const bool isCasting,
const bool isReloading
@ -183,7 +183,7 @@ namespace L2Bot::Domain::Entities
{
uint8_t cost = 0;
int16_t range = 0;
std::string description = "";
std::wstring description = L"";
bool isToggled = false;
bool isCasting = false;
bool isReloading = false;
@ -198,9 +198,9 @@ namespace L2Bot::Domain::Entities
bool m_IsActive = false;
uint8_t m_Cost = 0;
int16_t m_Range = 0;
std::string m_Name = "";
std::string m_Description = "";
std::string m_IconName = "";
std::wstring m_Name = L"";
std::wstring m_Description = L"";
std::wstring m_IconName = L"";
bool m_IsToggled = false;
bool m_IsCasting = false;
bool m_IsReloading = false;

View File

@ -68,32 +68,32 @@ namespace L2Bot::Domain::Entities
if (m_PrevState.isNewState)
{
result.push_back({ "weaponType", std::to_string(static_cast<uint8_t>(m_WeaponType)) });
result.push_back({ "crystalType", std::to_string(static_cast<int8_t>(m_CrystalType)) });
result.push_back({ "rndDamage", std::to_string(m_RndDamage) });
result.push_back({ "critical", std::to_string(m_Critical) });
result.push_back({ "hitModify", std::to_string(m_HitModify) });
result.push_back({ "attackSpeed", std::to_string(m_AttackSpeed) });
result.push_back({ "mpConsume", std::to_string(m_MpConsume) });
result.push_back({ "soulshotCount", std::to_string(m_SoulshotCount) });
result.push_back({ "spiritshotCount", std::to_string(m_SpiritshotCount) });
result.push_back({ L"weaponType", std::to_wstring(static_cast<uint8_t>(m_WeaponType)) });
result.push_back({ L"crystalType", std::to_wstring(static_cast<int8_t>(m_CrystalType)) });
result.push_back({ L"rndDamage", std::to_wstring(m_RndDamage) });
result.push_back({ L"critical", std::to_wstring(m_Critical) });
result.push_back({ L"hitModify", std::to_wstring(m_HitModify) });
result.push_back({ L"attackSpeed", std::to_wstring(m_AttackSpeed) });
result.push_back({ L"mpConsume", std::to_wstring(m_MpConsume) });
result.push_back({ L"soulshotCount", std::to_wstring(m_SoulshotCount) });
result.push_back({ L"spiritshotCount", std::to_wstring(m_SpiritshotCount) });
}
if (m_PrevState.isNewState || m_IsEquipped != m_PrevState.isEquipped)
{
result.push_back({ "isEquipped", std::to_string(m_IsEquipped) });
result.push_back({ L"isEquipped", std::to_wstring(m_IsEquipped) });
}
if (m_PrevState.isNewState || m_EnchantLevel != m_PrevState.enchantLevel)
{
result.push_back({ "enchantLevel", std::to_string(m_EnchantLevel) });
result.push_back({ L"enchantLevel", std::to_wstring(m_EnchantLevel) });
}
if (m_PrevState.isNewState || m_PAttack != m_PrevState.pAttack)
{
result.push_back({ "pAttack", std::to_string(m_PAttack) });
result.push_back({ L"pAttack", std::to_wstring(m_PAttack) });
}
if (m_PrevState.isNewState || m_MAttack != m_PrevState.mAttack)
{
result.push_back({ "mAttack", std::to_string(m_MAttack) });
result.push_back({ L"mAttack", std::to_wstring(m_MAttack) });
}
return result;
@ -103,9 +103,9 @@ namespace L2Bot::Domain::Entities
const uint32_t objectId,
const uint32_t itemId,
const int32_t mana,
const std::string& name,
const std::string& iconName,
const std::string& description,
const std::wstring& name,
const std::wstring& iconName,
const std::wstring& description,
const uint16_t weight,
const bool isEquipped,
const uint16_t enchantLevel,

View File

@ -34,10 +34,10 @@ namespace L2Bot::Domain::Entities
{
std::vector<Serializers::Node> result;
result.push_back({ "id", std::to_string(GetId()) });
result.push_back({ L"id", std::to_wstring(GetId()) });
if (m_PrevState.isNewState || !m_Transform.IsEqual(&m_PrevState.transform))
{
result.push_back({ "transform", m_Transform.BuildSerializationNodes() });
result.push_back({ L"transform", m_Transform.BuildSerializationNodes() });
}
return result;

View File

@ -7,18 +7,18 @@ namespace L2Bot::Domain::Serializers
{
struct Node
{
const std::string name = "";
const std::string value = "";
const std::wstring name = L"";
const std::wstring value = L"";
const std::vector<Node> children;
const bool isArray = false;
const bool isContainer = false;
Node() = delete;
Node(const std::string& name, const std::string& value) :
Node(const std::wstring& name, const std::wstring& value) :
name(name), value(value)
{
}
Node(const std::string& name, const std::vector<Node> children, const bool isArray = false) :
Node(const std::wstring& name, const std::vector<Node> children, const bool isArray = false) :
name(name), children(children), isArray(isArray), isContainer(true)
{
}

View File

@ -14,21 +14,21 @@ namespace L2Bot::Domain::Serializers
for (const auto& kvp : m_Objects)
{
std::string operationName = "";
std::wstring operationName = L"";
switch (kvp->GetState())
{
case Enums::EntityStateEnum::created:
operationName = "created";
operationName = L"created";
break;
case Enums::EntityStateEnum::updated:
operationName = "updated";
operationName = L"updated";
break;
case Enums::EntityStateEnum::deleted:
operationName = "deleted";
operationName = L"deleted";
break;
}
if (operationName != "")
if (operationName != L"")
{
result.push_back(
{
@ -42,7 +42,7 @@ namespace L2Bot::Domain::Serializers
return result;
}
SerializableStateContainer(const std::vector<std::shared_ptr<DTO::EntityState>> objects, const std::string& containerName) :
SerializableStateContainer(const std::vector<std::shared_ptr<DTO::EntityState>> objects, const std::wstring& containerName) :
m_Objects(objects), m_ContainerName(containerName)
{
@ -51,6 +51,6 @@ namespace L2Bot::Domain::Serializers
virtual ~SerializableStateContainer() = default;
private:
const std::vector<std::shared_ptr<DTO::EntityState>> m_Objects;
const std::string m_ContainerName;
const std::wstring m_ContainerName;
};
}

View File

@ -8,6 +8,6 @@ namespace L2Bot::Domain::Serializers
class SerializerInterface
{
public:
virtual const std::string Serialize(std::vector<Node> nodes, const bool isArray = false) const = 0;
virtual const std::wstring Serialize(std::vector<Node> nodes, const bool isArray = false) const = 0;
};
}

View File

@ -8,7 +8,7 @@ namespace L2Bot::Domain::Transports
public:
virtual const bool Connect() = 0;
virtual const bool IsConnected() const = 0;
virtual const void Send(const std::string& data) = 0;
virtual const std::string Receive() = 0;
virtual const void Send(const std::wstring& data) = 0;
virtual const std::wstring Receive() = 0;
};
}

View File

@ -13,18 +13,18 @@ namespace L2Bot::Domain::ValueObjects
{
return std::vector<Serializers::Node>
{
{ "objectId", std::to_string(m_ObjectId) },
{ "channel", std::to_string(static_cast<uint8_t>(m_Channel)) },
{ "name", m_Name },
{ "text", m_Text }
{ L"objectId", std::to_wstring(m_ObjectId) },
{ L"channel", std::to_wstring(static_cast<uint8_t>(m_Channel)) },
{ L"name", m_Name },
{ L"text", m_Text }
};
}
ChatMessage(
const uint32_t objectId,
const Enums::ChatChannelEnum channel,
const std::string& name,
const std::string& text
const std::wstring& name,
const std::wstring& text
) :
m_ObjectId(objectId),
m_Channel(channel),
@ -39,7 +39,7 @@ namespace L2Bot::Domain::ValueObjects
private:
uint32_t m_ObjectId = 0;
Enums::ChatChannelEnum m_Channel = Enums::ChatChannelEnum::all;
std::string m_Name = "";
std::string m_Text = "";
std::wstring m_Name = L"";
std::wstring m_Text = L"";
};
}

View File

@ -28,9 +28,9 @@ namespace L2Bot::Domain::ValueObjects
{
return std::vector<Serializers::Node>
{
{ "level", std::to_string(m_Level) },
{ "exp", std::to_string(m_Exp) },
{ "sp", std::to_string(m_Sp) }
{ L"level", std::to_wstring(m_Level) },
{ L"exp", std::to_wstring(m_Exp) },
{ L"sp", std::to_wstring(m_Sp) }
};
}

View File

@ -7,11 +7,11 @@ namespace L2Bot::Domain::ValueObjects
class FullName : public Serializers::Serializable
{
public:
const std::string& GetNickname() const
const std::wstring& GetNickname() const
{
return m_Nickname;
}
const std::string& GetTitle() const
const std::wstring& GetTitle() const
{
return m_Title;
}
@ -24,14 +24,14 @@ namespace L2Bot::Domain::ValueObjects
{
return std::vector<Serializers::Node>
{
{ "nickname", m_Nickname },
{ "title", m_Title }
{ L"nickname", m_Nickname },
{ L"title", m_Title }
};
}
FullName(
const std::string& nickname,
const std::string& title
const std::wstring& nickname,
const std::wstring& title
) :
m_Nickname(nickname),
m_Title(title)
@ -41,7 +41,7 @@ namespace L2Bot::Domain::ValueObjects
FullName() = default;
virtual ~FullName() = default;
private:
std::string m_Nickname = "";
std::string m_Title = "";
std::wstring m_Nickname = L"";
std::wstring m_Title = L"";
};
}

View File

@ -34,9 +34,9 @@ namespace L2Bot::Domain::ValueObjects
{
return std::vector<Serializers::Node>
{
{ "maxWeight", std::to_string(m_MaxWeight) },
{ "weight", std::to_string(m_Weight) },
{ "slots", std::to_string(m_Slots) }
{ L"maxWeight", std::to_wstring(m_MaxWeight) },
{ L"weight", std::to_wstring(m_Weight) },
{ L"slots", std::to_wstring(m_Slots) }
};
}

View File

@ -45,12 +45,12 @@ namespace L2Bot::Domain::ValueObjects
{
return std::vector<Serializers::Node>
{
{ "str", std::to_string(m_Str) },
{ "dex", std::to_string(m_Dex) },
{ "con", std::to_string(m_Con) },
{ "int", std::to_string(m_Int) },
{ "men", std::to_string(m_Men) },
{ "wit", std::to_string(m_Wit) }
{ L"str", std::to_wstring(m_Str) },
{ L"dex", std::to_wstring(m_Dex) },
{ L"con", std::to_wstring(m_Con) },
{ L"int", std::to_wstring(m_Int) },
{ L"men", std::to_wstring(m_Men) },
{ L"wit", std::to_wstring(m_Wit) }
};
}

View File

@ -40,10 +40,10 @@ namespace L2Bot::Domain::ValueObjects
{
return std::vector<Serializers::Node>
{
{ "race", std::to_string(static_cast<uint8_t>(m_Race)) },
{ "isMale", std::to_string(m_IsMale) },
{ "class", std::to_string(static_cast<uint8_t>(m_Class)) },
{ "activeClass", std::to_string(static_cast<uint8_t>(m_ActiveClass)) }
{ L"race", std::to_wstring(static_cast<uint8_t>(m_Race)) },
{ L"isMale", std::to_wstring(m_IsMale) },
{ L"class", std::to_wstring(static_cast<uint8_t>(m_Class)) },
{ L"activeClass", std::to_wstring(static_cast<uint8_t>(m_ActiveClass)) }
};
}

View File

@ -44,11 +44,11 @@ namespace L2Bot::Domain::ValueObjects
{
return std::vector<Serializers::Node>
{
{ "karma", std::to_string(m_Karma) },
{ "pkKills", std::to_string(m_PkKills) },
{ "pvpKills", std::to_string(m_PvpKills) },
{ "recRemaining", std::to_string(m_RecRemaining) },
{ "evalScore", std::to_string(m_EvalScore) }
{ L"karma", std::to_wstring(m_Karma) },
{ L"pkKills", std::to_wstring(m_PkKills) },
{ L"pvpKills", std::to_wstring(m_PvpKills) },
{ L"recRemaining", std::to_wstring(m_RecRemaining) },
{ L"evalScore", std::to_wstring(m_EvalScore) }
};
}

View File

@ -43,10 +43,10 @@ namespace L2Bot::Domain::ValueObjects
{
return std::vector<Serializers::Node>
{
{ "position", m_Position.BuildSerializationNodes() },
{ "rotation", m_Rotation.BuildSerializationNodes() },
{ "velocity", m_Velocity.BuildSerializationNodes() },
{ "acceleration", m_Acceleration.BuildSerializationNodes() }
{ L"position", m_Position.BuildSerializationNodes() },
{ L"rotation", m_Rotation.BuildSerializationNodes() },
{ L"velocity", m_Velocity.BuildSerializationNodes() },
{ L"acceleration", m_Acceleration.BuildSerializationNodes() }
};
}

View File

@ -60,15 +60,15 @@ namespace L2Bot::Domain::ValueObjects
{
return std::vector<Serializers::Node>
{
{ "accuracy", std::to_string(m_Accuracy) },
{ "critRate", std::to_string(m_CritRate) },
{ "pAttack", std::to_string(m_PAttack) },
{ "attackSpeed", std::to_string(m_AttackSpeed) },
{ "pDefense", std::to_string(m_PDefense) },
{ "evasion", std::to_string(m_Evasion) },
{ "mAttack", std::to_string(m_MAttack) },
{ "mDefense", std::to_string(m_MDefense) },
{ "castingSpeed", std::to_string(m_CastingSpeed) }
{ L"accuracy", std::to_wstring(m_Accuracy) },
{ L"critRate", std::to_wstring(m_CritRate) },
{ L"pAttack", std::to_wstring(m_PAttack) },
{ L"attackSpeed", std::to_wstring(m_AttackSpeed) },
{ L"pDefense", std::to_wstring(m_PDefense) },
{ L"evasion", std::to_wstring(m_Evasion) },
{ L"mAttack", std::to_wstring(m_MAttack) },
{ L"mDefense", std::to_wstring(m_MDefense) },
{ L"castingSpeed", std::to_wstring(m_CastingSpeed) }
};
}

View File

@ -42,9 +42,9 @@ namespace L2Bot::Domain::ValueObjects
{
return std::vector<Serializers::Node>
{
{ "x", std::to_string(m_X) },
{ "y", std::to_string(m_Y) },
{ "z", std::to_string(m_Z) }
{ L"x", std::to_wstring(m_X) },
{ L"y", std::to_wstring(m_Y) },
{ L"z", std::to_wstring(m_Z) }
};
}

View File

@ -49,12 +49,12 @@ namespace L2Bot::Domain::ValueObjects
{
return std::vector<Serializers::Node>
{
{ "maxHp", std::to_string(m_MaxHp) },
{ "hp", std::to_string(m_Hp) },
{ "maxMp", std::to_string(m_MaxMp) },
{ "mp", std::to_string(m_Mp) },
{ "maxCp", std::to_string(m_MaxCp) },
{ "cp", std::to_string(m_Cp) }
{ L"maxHp", std::to_wstring(m_MaxHp) },
{ L"hp", std::to_wstring(m_Hp) },
{ L"maxMp", std::to_wstring(m_MaxMp) },
{ L"mp", std::to_wstring(m_Mp) },
{ L"maxCp", std::to_wstring(m_MaxCp) },
{ L"cp", std::to_wstring(m_Cp) }
};
}

View File

@ -62,9 +62,9 @@ private:
JsonSerializer m_Serializer;
NamedPipeTransport m_Transport;
static const std::string PIPE_NAME;
static const std::wstring PIPE_NAME;
static const uint16_t RADIUS;
};
const std::string Application::PIPE_NAME = std::string("PipeL2Bot");
const std::wstring Application::PIPE_NAME = std::wstring(L"PipeL2Bot");
const uint16_t Application::RADIUS = 2000;

View File

@ -5,14 +5,7 @@
#include <Rpc.h>
#pragma comment(lib, "Rpcrt4.lib")
std::string ConvertFromWideChar(const wchar_t* str)
{
std::wstring ws(str);
std::string result(ws.begin(), ws.end());
return result;
}
std::string GenerateUUID()
std::wstring GenerateUUID()
{
UUID uuid;
::ZeroMemory(&uuid, sizeof(UUID));
@ -24,7 +17,7 @@ std::string GenerateUUID()
if (wszUuid == NULL)
{
return "";
return L"";
}
std::wstring ws = wszUuid;
@ -32,5 +25,5 @@ std::string GenerateUUID()
::RpcStringFree((RPC_WSTR*)&wszUuid);
wszUuid = NULL;
return std::string(ws.begin(), ws.end());
return ws;
}

View File

@ -3,5 +3,4 @@
#include <string>
#include <cstdint>
std::string ConvertFromWideChar(const wchar_t* str);
std::string GenerateUUID();
std::wstring GenerateUUID();

View File

@ -7,6 +7,6 @@ struct ChatMessage
{
const uint32_t objectId = 0;
const uint8_t channel = 0;
const std::string name = "";
const std::string text = "";
const std::wstring name = L"";
const std::wstring text = L"";
};

View File

@ -8,15 +8,15 @@ using namespace L2Bot::Domain;
class JsonSerializer : public Serializers::SerializerInterface
{
public:
const std::string Serialize(std::vector<Serializers::Node> nodes, const bool isArray = false) const override
const std::wstring Serialize(std::vector<Serializers::Node> nodes, const bool isArray = false) const override
{
std::string result = isArray ? "[" : "{";
std::wstring result = isArray ? L"[" : L"{";
for (auto it = nodes.begin(); it != nodes.end(); ++it)
{
if (!isArray)
{
result += "\"" + it->name + "\":";
result += L"\"" + it->name + L"\":";
}
if (it->isContainer)
{
@ -24,15 +24,15 @@ public:
}
else
{
result += "\"" + it->value + "\"";
result += L"\"" + it->value + L"\"";
}
if (std::next(it) != nodes.end())
{
result += ",";
result += L",";
}
}
result += isArray ? "]" : "}";
result += isArray ? L"]" : L"}";
return result;
}

View File

@ -98,8 +98,8 @@ private:
{
if (m_Transport.IsConnected())
{
const std::string& response = m_Transport.Receive();
if (response == "invalidate")
const std::wstring& response = m_Transport.Receive();
if (response == L"invalidate")
{
Invalidate();
}
@ -124,13 +124,13 @@ private:
{
std::vector<Serializers::SerializableStateContainer> items
{
Serializers::SerializableStateContainer{m_HeroService.GetEntities(), "hero"},
Serializers::SerializableStateContainer{m_DropService.GetEntities(), "drop"},
Serializers::SerializableStateContainer{m_NPCService.GetEntities(), "npc"},
Serializers::SerializableStateContainer{m_PlayerService.GetEntities(), "player"},
Serializers::SerializableStateContainer{m_SkillService.GetEntities(), "skill"},
Serializers::SerializableStateContainer{m_ItemService.GetEntities(), "item"},
Serializers::SerializableStateContainer{m_AbnormalEffectService.GetEntities(), "abnormalEffect"},
Serializers::SerializableStateContainer{m_HeroService.GetEntities(), L"hero"},
Serializers::SerializableStateContainer{m_DropService.GetEntities(), L"drop"},
Serializers::SerializableStateContainer{m_NPCService.GetEntities(), L"npc"},
Serializers::SerializableStateContainer{m_PlayerService.GetEntities(), L"player"},
Serializers::SerializableStateContainer{m_SkillService.GetEntities(), L"skill"},
Serializers::SerializableStateContainer{m_ItemService.GetEntities(), L"item"},
Serializers::SerializableStateContainer{m_AbnormalEffectService.GetEntities(), L"abnormalEffect"},
};
std::vector<Serializers::Node> result;
@ -144,7 +144,7 @@ private:
for (const auto& message : m_ChatMessageService.GetMessages())
{
result.push_back(Serializers::Node{ "chat", message.BuildSerializationNodes() });
result.push_back(Serializers::Node{ L"chat", message.BuildSerializationNodes() });
}
return result;

View File

@ -18,15 +18,15 @@ public:
return true;
}
const void Send(const std::string& data) override
const void Send(const std::wstring& data) override
{
OutputDebugStringA(data.c_str());
OutputDebugStringW(data.c_str());
}
const std::string Receive() override
const std::wstring Receive() override
{
// delay imitation
std::this_thread::sleep_for(std::chrono::milliseconds(50));
return "";
return L"";
}
DebugViewTransport() = default;

View File

@ -10,7 +10,7 @@
class NamedPipe
{
public:
const bool Connect(const std::string& pipeName)
const bool Connect(const std::wstring& pipeName)
{
if (m_Pipe == NULL || m_PipeName != pipeName)
{
@ -25,7 +25,7 @@ public:
CreateOverlapped(m_WritingOverlapped);
}
m_Pipe = CreateNamedPipeA(("\\\\.\\pipe\\" + pipeName).c_str(),
m_Pipe = CreateNamedPipeW((L"\\\\.\\pipe\\" + pipeName).c_str(),
PIPE_ACCESS_DUPLEX | FILE_FLAG_OVERLAPPED,
PIPE_TYPE_MESSAGE | PIPE_READMODE_MESSAGE | PIPE_WAIT,
PIPE_UNLIMITED_INSTANCES,
@ -58,7 +58,7 @@ public:
return m_Connected;
}
void Send(const std::string& message)
void Send(const std::wstring& message)
{
if (!m_Connected)
{
@ -66,7 +66,7 @@ public:
}
DWORD written;
const auto result = WriteFile(m_Pipe, message.c_str(), message.size() + 1, &written, &m_WritingOverlapped);
const auto result = WriteFile(m_Pipe, message.c_str(), (message.size() + 1) * sizeof(wchar_t), &written, &m_WritingOverlapped);
const auto lastError = GetLastError();
if (!result)
@ -88,16 +88,16 @@ public:
}
}
const std::string Receive()
const std::wstring Receive()
{
if (!m_Connected)
{
return "";
return L"";
}
DWORD dwRead;
std::unique_ptr<char[]> buffer = std::make_unique<char[]>(BUFFER_SIZE);
const auto result = ReadFile(m_Pipe, buffer.get(), BUFFER_SIZE * sizeof(char), &dwRead, &m_ReadingOverlapped);
std::unique_ptr<wchar_t[]> buffer = std::make_unique<wchar_t[]>(BUFFER_SIZE);
const auto result = ReadFile(m_Pipe, buffer.get(), BUFFER_SIZE * sizeof(wchar_t), &dwRead, &m_ReadingOverlapped);
const auto lastError = GetLastError();
if (!result)
@ -110,17 +110,17 @@ public:
if (!overlappedResult)
{
m_Connected = false;
return "";
return L"";
}
}
else
{
m_Connected = false;
return "";
return L"";
}
}
std::string message = std::string(buffer.get());
std::wstring message = std::wstring(buffer.get());
return message;
}
@ -182,7 +182,7 @@ private:
}
private:
std::string m_PipeName = "";
std::wstring m_PipeName = L"";
HANDLE m_Pipe = NULL;
bool m_Connected = false;
OVERLAPPED m_ConntectingOverlapped = OVERLAPPED();

View File

@ -11,7 +11,7 @@ class NamedPipeTransport : public Transports::TransportInterface
public:
const bool Connect() override
{
OutputDebugStringA(m_PipeName.c_str());
OutputDebugStringW(m_PipeName.c_str());
if (!m_ConnectionPipe.Connect(m_PipeName))
{
return false;
@ -19,9 +19,9 @@ public:
OutputDebugStringA("Client connected to connection pipe");
const std::string mainPipeName = GenerateUUID();
const auto mainPipeName = GenerateUUID();
m_ConnectionPipe.Send("\\\\.\\pipe\\" + mainPipeName);
m_ConnectionPipe.Send(L"\\\\.\\pipe\\" + mainPipeName);
OutputDebugStringA("Name of main pipe sended");
@ -32,12 +32,12 @@ public:
}
OutputDebugStringA("Client connected to main pipe");
m_Pipe.Send("Hello!");
m_Pipe.Send(L"Hello!");
return true;
}
const void Send(const std::string& data) override
const void Send(const std::wstring& data) override
{
if (!m_Pipe.IsConnected())
{
@ -46,11 +46,11 @@ public:
m_Pipe.Send(data);
}
const std::string Receive() override
const std::wstring Receive() override
{
if (!m_Pipe.IsConnected())
{
return "";
return L"";
}
return m_Pipe.Receive();
@ -61,7 +61,7 @@ public:
return m_Pipe.IsConnected();
}
NamedPipeTransport(const std::string& pipeName) :
NamedPipeTransport(const std::wstring& pipeName) :
m_PipeName(pipeName)
{
}
@ -72,5 +72,5 @@ public:
private:
NamedPipe m_ConnectionPipe;
NamedPipe m_Pipe;
std::string m_PipeName = "";
std::wstring m_PipeName = L"";
};

View File

@ -35,9 +35,9 @@ namespace Interlude
return std::make_unique<Entities::AbnormalEffect>(
skillId,
static_cast<uint8_t>(level),
ConvertFromWideChar(name),
ConvertFromWideChar(description),
iconEntry ? ConvertFromWideChar(iconEntry->value) : ""
std::wstring(name),
std::wstring(description),
iconEntry ? std::wstring(iconEntry->value) : L""
);
}

View File

@ -41,8 +41,8 @@ namespace Interlude
),
item->itemId,
item->amount,
nameEntry ? ConvertFromWideChar(nameEntry->value) : "",
iconEntry ? ConvertFromWideChar(iconEntry->value) : ""
nameEntry ? std::wstring(nameEntry->value) : L"",
iconEntry ? std::wstring(iconEntry->value) : L""
);
}

View File

@ -30,8 +30,8 @@ namespace Interlude
ValueObjects::Vector3(item->pawn->Acceleration.x, item->pawn->Acceleration.y, item->pawn->Acceleration.z)
),
ValueObjects::FullName(
ConvertFromWideChar(item->nickname),
ConvertFromWideChar(item->title)
std::wstring(item->nickname),
std::wstring(item->title)
),
ValueObjects::VitalStats(
item->maxHp, item->hp,

View File

@ -35,10 +35,10 @@ namespace Interlude
const auto data = m_L2GameData.GetItemData(itemInfo.itemId);
const auto nameEntry = data ? m_FName.GetEntry(data->nameIndex) : nullptr;
const auto name = nameEntry ? ConvertFromWideChar(nameEntry->value) : "";
const auto name = nameEntry ? std::wstring(nameEntry->value) : L"";
const auto iconEntry = data ? m_FName.GetEntry(data->iconNameIndex) : nullptr;
const auto icon = iconEntry ? ConvertFromWideChar(iconEntry->value) : "";
const auto description = data && data->description ? ConvertFromWideChar(data->description) : "";
const auto icon = iconEntry ? std::wstring(iconEntry->value) : L"";
const auto description = data && data->description ? std::wstring(data->description) : L"";
if (data)
{
@ -92,9 +92,9 @@ namespace Interlude
std::unique_ptr<Entities::BaseItem> CreateEtc(
const ItemData& itemInfo,
const FL2ItemDataBase* itemData,
const std::string& name,
const std::string& icon,
const std::string& description
const std::wstring& name,
const std::wstring& icon,
const std::wstring& description
) const
{
return std::make_unique<Entities::EtcItem>(
@ -113,16 +113,16 @@ namespace Interlude
std::unique_ptr<Entities::BaseItem> CreateArmor(
const ItemData& itemInfo,
const FL2ItemDataBase* itemData,
const std::string& name,
const std::string& icon,
const std::string& description
const std::wstring& name,
const std::wstring& icon,
const std::wstring& description
) const
{
const auto casted = static_cast<const FL2ArmorItemData*>(itemData);
const auto setEffect = casted && casted->setEffect ? ConvertFromWideChar(casted->setEffect) : "";
const auto addSetEffect = casted && casted->setEffect ? ConvertFromWideChar(casted->setEffect) : "";
const auto enchantEffect = casted && casted->enchantEffect ? ConvertFromWideChar(casted->enchantEffect) : "";
const auto setEffect = casted && casted->setEffect ? std::wstring(casted->setEffect) : L"";
const auto addSetEffect = casted && casted->setEffect ? std::wstring(casted->setEffect) : L"";
const auto enchantEffect = casted && casted->enchantEffect ? std::wstring(casted->enchantEffect) : L"";
return std::make_unique<Entities::ArmorItem>(
itemInfo.objectId,
@ -147,9 +147,9 @@ namespace Interlude
std::unique_ptr<Entities::BaseItem> CreateWeaponOrShield(
const ItemData& itemInfo,
const FL2ItemDataBase* itemData,
const std::string& name,
const std::string& icon,
const std::string& description
const std::wstring& name,
const std::wstring& icon,
const std::wstring& description
) const
{
const auto casted = static_cast<const FL2WeaponItemData*>(itemData);

View File

@ -30,8 +30,8 @@ namespace Interlude
item->npcId,
spoiledState,
ValueObjects::FullName(
ConvertFromWideChar(item->nickname),
ConvertFromWideChar(item->title)
std::wstring(item->nickname),
std::wstring(item->title)
),
ValueObjects::VitalStats(
item->maxHp, item->hp,

View File

@ -27,8 +27,8 @@ namespace Interlude
ValueObjects::Vector3(item->pawn->Acceleration.x, item->pawn->Acceleration.y, item->pawn->Acceleration.z)
),
ValueObjects::FullName(
ConvertFromWideChar(item->nickname),
ConvertFromWideChar(item->title)
std::wstring(item->nickname),
std::wstring(item->title)
),
ValueObjects::Phenotype(
(Enums::RaceEnum)item->raceId,

View File

@ -40,9 +40,9 @@ namespace Interlude
isActive != 1,
static_cast<uint8_t>(cost),
static_cast<int16_t>(range),
ConvertFromWideChar(name),
ConvertFromWideChar(description),
iconEntry ? ConvertFromWideChar(iconEntry->value) : "",
std::wstring(name),
std::wstring(description),
iconEntry ? std::wstring(iconEntry->value) : L"",
false,
false,
false

View File

@ -177,8 +177,8 @@ namespace Interlude
{
buffer[0],
static_cast<uint8_t>(buffer[1]),
ConvertFromWideChar(reinterpret_cast<wchar_t*>(buffer[2])),
ConvertFromWideChar(reinterpret_cast<wchar_t*>(buffer[3]))
std::wstring(reinterpret_cast<wchar_t*>(buffer[2])),
std::wstring(reinterpret_cast<wchar_t*>(buffer[3]))
}
}
);

View File

@ -30,6 +30,4 @@
#include <ctime>
#include <iomanip>
std::string ConvertFromWideChar(const wchar_t* str);
#endif //PCH_H