Add project files.
This commit is contained in:
21
L2BotCore/Domain/DTO/BaseItem.h
Normal file
21
L2BotCore/Domain/DTO/BaseItem.h
Normal file
@@ -0,0 +1,21 @@
|
||||
#pragma once
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
#include "WorldObject.h"
|
||||
|
||||
namespace L2Bot::Domain::DTO
|
||||
{
|
||||
struct BaseItem
|
||||
{
|
||||
public:
|
||||
const uint32_t itemId = 0;
|
||||
const uint32_t amount = 0;
|
||||
const bool isEquipped = 0;
|
||||
const uint16_t enchantLevel = 0;
|
||||
const int32_t mana = -1;
|
||||
const std::string name = "";
|
||||
const std::string iconName = "";
|
||||
const std::string description = "";
|
||||
const uint16_t weight = 0;
|
||||
};
|
||||
}
|
16
L2BotCore/Domain/DTO/Drop.h
Normal file
16
L2BotCore/Domain/DTO/Drop.h
Normal file
@@ -0,0 +1,16 @@
|
||||
#pragma once
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
#include "WorldObject.h"
|
||||
|
||||
namespace L2Bot::Domain::DTO
|
||||
{
|
||||
struct Drop : public WorldObject
|
||||
{
|
||||
public:
|
||||
const uint32_t itemId = 0;
|
||||
const uint32_t amount = 0;
|
||||
const std::string name = "";
|
||||
const std::string iconName = "";
|
||||
};
|
||||
}
|
29
L2BotCore/Domain/DTO/Hero.h
Normal file
29
L2BotCore/Domain/DTO/Hero.h
Normal file
@@ -0,0 +1,29 @@
|
||||
#pragma once
|
||||
#include "WorldObject.h"
|
||||
#include "../ValueObjects/FullName.h"
|
||||
#include "../ValueObjects/VitalStats.h"
|
||||
#include "../ValueObjects/Phenotype.h"
|
||||
#include "../ValueObjects/ExperienceInfo.h"
|
||||
#include "../ValueObjects/PermanentStats.h"
|
||||
#include "../ValueObjects/VariableStats.h"
|
||||
#include "../ValueObjects/Reputation.h"
|
||||
#include "../ValueObjects/InventoryInfo.h"
|
||||
#include <cstdint>
|
||||
|
||||
namespace L2Bot::Domain::DTO
|
||||
{
|
||||
struct Hero : public WorldObject
|
||||
{
|
||||
public:
|
||||
const ValueObjects::FullName fullName = ValueObjects::FullName();
|
||||
const ValueObjects::VitalStats vitalStats = ValueObjects::VitalStats();
|
||||
const ValueObjects::Phenotype phenotype = ValueObjects::Phenotype();
|
||||
const ValueObjects::ExperienceInfo experienceInfo = ValueObjects::ExperienceInfo();
|
||||
const ValueObjects::PermanentStats permanentStats = ValueObjects::PermanentStats();
|
||||
const ValueObjects::VariableStats variableStats = ValueObjects::VariableStats();
|
||||
const ValueObjects::Reputation reputation = ValueObjects::Reputation();
|
||||
const ValueObjects::InventoryInfo inventoryInfo = ValueObjects::InventoryInfo();
|
||||
const uint32_t targetId = 0;
|
||||
const bool isStanding = true;
|
||||
};
|
||||
}
|
19
L2BotCore/Domain/DTO/NPC.h
Normal file
19
L2BotCore/Domain/DTO/NPC.h
Normal file
@@ -0,0 +1,19 @@
|
||||
#pragma once
|
||||
#include <cstdint>
|
||||
#include "WorldObject.h"
|
||||
#include "../ValueObjects/FullName.h"
|
||||
#include "../ValueObjects/VitalStats.h"
|
||||
#include "../Enums/SpoilStateEnum.h"
|
||||
|
||||
namespace L2Bot::Domain::DTO
|
||||
{
|
||||
struct NPC : public WorldObject
|
||||
{
|
||||
public:
|
||||
const bool isHostile = false;
|
||||
const uint32_t npcId = 0;
|
||||
const Enums::SpoilStateEnum spoilState = Enums::SpoilStateEnum::none;
|
||||
const ValueObjects::FullName fullName = ValueObjects::FullName();
|
||||
const ValueObjects::VitalStats vitalStats = ValueObjects::VitalStats();
|
||||
};
|
||||
}
|
13
L2BotCore/Domain/DTO/ObjectState.h
Normal file
13
L2BotCore/Domain/DTO/ObjectState.h
Normal file
@@ -0,0 +1,13 @@
|
||||
#pragma once
|
||||
#include "../Enums/ObjectStateEnum.h"
|
||||
|
||||
namespace L2Bot::Domain::DTO
|
||||
{
|
||||
template <typename T>
|
||||
struct ObjectState
|
||||
{
|
||||
public:
|
||||
T object;
|
||||
Enums::ObjectStateEnum state = Enums::ObjectStateEnum::none;
|
||||
};
|
||||
}
|
14
L2BotCore/Domain/DTO/Player.h
Normal file
14
L2BotCore/Domain/DTO/Player.h
Normal file
@@ -0,0 +1,14 @@
|
||||
#pragma once
|
||||
#include "WorldObject.h"
|
||||
#include "../ValueObjects/FullName.h"
|
||||
#include "../ValueObjects/VitalStats.h"
|
||||
#include "../ValueObjects/Phenotype.h"
|
||||
namespace L2Bot::Domain::DTO
|
||||
{
|
||||
struct Player : public WorldObject
|
||||
{
|
||||
public:
|
||||
const ValueObjects::FullName fullName = ValueObjects::FullName();
|
||||
const ValueObjects::Phenotype phenotype = ValueObjects::Phenotype();
|
||||
};
|
||||
}
|
22
L2BotCore/Domain/DTO/Skill.h
Normal file
22
L2BotCore/Domain/DTO/Skill.h
Normal file
@@ -0,0 +1,22 @@
|
||||
#pragma once
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
|
||||
namespace L2Bot::Domain::DTO
|
||||
{
|
||||
struct Skill
|
||||
{
|
||||
public:
|
||||
const uint32_t skillId = 0;
|
||||
const uint8_t level = 0;
|
||||
const bool isActive = false;
|
||||
const uint8_t cost = 0;
|
||||
const int16_t range = 0;
|
||||
const std::string name = "";
|
||||
const std::string description = "";
|
||||
const std::string iconName = "";
|
||||
const bool isToggled = false;
|
||||
const bool isCasting = false;
|
||||
const bool isReloading = false;
|
||||
};
|
||||
}
|
13
L2BotCore/Domain/DTO/WorldObject.h
Normal file
13
L2BotCore/Domain/DTO/WorldObject.h
Normal file
@@ -0,0 +1,13 @@
|
||||
#pragma once
|
||||
#include <cstdint>
|
||||
#include "../ValueObjects/Transform.h"
|
||||
|
||||
namespace L2Bot::Domain::DTO
|
||||
{
|
||||
struct WorldObject
|
||||
{
|
||||
public:
|
||||
const uint32_t id = 0;
|
||||
const ValueObjects::Transform transform = ValueObjects::Transform();
|
||||
};
|
||||
}
|
97
L2BotCore/Domain/Entities/Drop.h
Normal file
97
L2BotCore/Domain/Entities/Drop.h
Normal file
@@ -0,0 +1,97 @@
|
||||
#pragma once
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
#include "WorldObject.h"
|
||||
#include "../DTO/Drop.h"
|
||||
|
||||
namespace L2Bot::Domain::Entities
|
||||
{
|
||||
class Drop : public WorldObject
|
||||
{
|
||||
public:
|
||||
const uint32_t GetItemId() const
|
||||
{
|
||||
return m_ItemId;
|
||||
}
|
||||
const uint32_t GetAmount() const
|
||||
{
|
||||
return m_Amount;
|
||||
}
|
||||
const std::string GetName() const
|
||||
{
|
||||
return m_Name;
|
||||
}
|
||||
const std::string GetIconName() const
|
||||
{
|
||||
return m_IconName;
|
||||
}
|
||||
void UpdateFromDTO(const DTO::WorldObject* dto) override
|
||||
{
|
||||
const DTO::Drop* castedDto = static_cast<const DTO::Drop*>(dto);
|
||||
WorldObject::UpdateFromDTO(dto);
|
||||
m_ItemId = castedDto->itemId;
|
||||
m_Amount = castedDto->amount;
|
||||
m_Name = castedDto->name;
|
||||
m_IconName = castedDto->iconName;
|
||||
}
|
||||
void SaveState() override
|
||||
{
|
||||
WorldObject::SaveState();
|
||||
m_IsNewState = false;
|
||||
}
|
||||
const static Drop CreateFromDTO(const DTO::Drop& dto)
|
||||
{
|
||||
return Drop(dto.id, dto.transform, dto.itemId, dto.amount, dto.name, dto.iconName);
|
||||
}
|
||||
const bool IsEqual(const DTO::WorldObject* dto) const override
|
||||
{
|
||||
const DTO::Drop* castedDto = static_cast<const DTO::Drop*>(dto);
|
||||
return WorldObject::IsEqual(dto) &&
|
||||
m_ItemId == castedDto->itemId &&
|
||||
m_Amount == castedDto->amount &&
|
||||
m_Name == castedDto->name &&
|
||||
m_IconName == castedDto->iconName;
|
||||
}
|
||||
|
||||
const std::vector<Serializers::Node> BuildSerializationNodes() const override
|
||||
{
|
||||
std::vector<Serializers::Node> result = WorldObject::BuildSerializationNodes();
|
||||
|
||||
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 });
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
Drop(
|
||||
const uint32_t id,
|
||||
const ValueObjects::Transform transform,
|
||||
const uint32_t itemId,
|
||||
const uint32_t amount,
|
||||
const std::string name,
|
||||
const std::string iconName
|
||||
) :
|
||||
WorldObject(id, transform),
|
||||
m_ItemId(itemId),
|
||||
m_Amount(amount),
|
||||
m_Name(name),
|
||||
m_IconName(iconName)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
Drop() = default;
|
||||
virtual ~Drop() = default;
|
||||
private:
|
||||
uint32_t m_ItemId = 0;
|
||||
uint32_t m_Amount = 0;
|
||||
std::string m_Name = "";
|
||||
std::string m_IconName = "";
|
||||
bool m_IsNewState = true;
|
||||
};
|
||||
}
|
235
L2BotCore/Domain/Entities/Hero.h
Normal file
235
L2BotCore/Domain/Entities/Hero.h
Normal file
@@ -0,0 +1,235 @@
|
||||
#pragma once
|
||||
#include "WorldObject.h"
|
||||
#include "../DTO/Hero.h"
|
||||
#include "../ValueObjects/FullName.h"
|
||||
#include "../ValueObjects/VitalStats.h"
|
||||
#include "../ValueObjects/Phenotype.h"
|
||||
#include "../ValueObjects/ExperienceInfo.h"
|
||||
#include "../ValueObjects/PermanentStats.h"
|
||||
#include "../ValueObjects/VariableStats.h"
|
||||
#include "../ValueObjects/Reputation.h"
|
||||
#include "../ValueObjects/InventoryInfo.h"
|
||||
#include <cstdint>
|
||||
|
||||
namespace L2Bot::Domain::Entities
|
||||
{
|
||||
class Hero : public WorldObject
|
||||
{
|
||||
public:
|
||||
const ValueObjects::FullName& GetFullName() const
|
||||
{
|
||||
return m_FullName;
|
||||
}
|
||||
const ValueObjects::VitalStats& GetVitalStats() const
|
||||
{
|
||||
return m_VitalStats;
|
||||
}
|
||||
const ValueObjects::Phenotype& GetPhenotype() const
|
||||
{
|
||||
return m_Phenotype;
|
||||
}
|
||||
const ValueObjects::ExperienceInfo& GetExperienceInfo() const
|
||||
{
|
||||
return m_ExperienceInfo;
|
||||
}
|
||||
const ValueObjects::PermanentStats& GetPermanentStats() const
|
||||
{
|
||||
return m_PermanentStats;
|
||||
}
|
||||
const ValueObjects::VariableStats& GetVariableStats() const
|
||||
{
|
||||
return m_VariableStats;
|
||||
}
|
||||
const ValueObjects::Reputation& GetReputation() const
|
||||
{
|
||||
return m_Reputation;
|
||||
}
|
||||
const ValueObjects::InventoryInfo& GetInventoryInfo() const
|
||||
{
|
||||
return m_InventoryInfo;
|
||||
}
|
||||
const uint32_t GetTargetId() const
|
||||
{
|
||||
return m_TargetId;
|
||||
}
|
||||
const bool IsStanding() const
|
||||
{
|
||||
return m_IsStanding;
|
||||
}
|
||||
void UpdateFromDTO(const DTO::WorldObject* dto) override
|
||||
{
|
||||
const DTO::Hero* castedDto = static_cast<const DTO::Hero*>(dto);
|
||||
WorldObject::UpdateFromDTO(dto);
|
||||
m_FullName = castedDto->fullName;
|
||||
m_VitalStats = castedDto->vitalStats;
|
||||
m_Phenotype = castedDto->phenotype;
|
||||
m_ExperienceInfo = castedDto->experienceInfo;
|
||||
m_PermanentStats = castedDto->permanentStats;
|
||||
m_VariableStats = castedDto->variableStats;
|
||||
m_Reputation = castedDto->reputation;
|
||||
m_InventoryInfo = castedDto->inventoryInfo;
|
||||
m_TargetId = castedDto->targetId;
|
||||
m_IsStanding = castedDto->isStanding;
|
||||
}
|
||||
void SaveState() override
|
||||
{
|
||||
WorldObject::SaveState();
|
||||
m_PrevState =
|
||||
{
|
||||
m_FullName,
|
||||
m_VitalStats,
|
||||
m_Phenotype,
|
||||
m_ExperienceInfo,
|
||||
m_PermanentStats,
|
||||
m_VariableStats,
|
||||
m_Reputation,
|
||||
m_InventoryInfo,
|
||||
m_TargetId,
|
||||
m_IsStanding,
|
||||
false
|
||||
};
|
||||
}
|
||||
const static Hero CreateFromDTO(const DTO::Hero& dto)
|
||||
{
|
||||
return Hero(
|
||||
dto.id,
|
||||
dto.transform,
|
||||
dto.fullName,
|
||||
dto.vitalStats,
|
||||
dto.phenotype,
|
||||
dto.experienceInfo,
|
||||
dto.permanentStats,
|
||||
dto.variableStats,
|
||||
dto.reputation,
|
||||
dto.inventoryInfo,
|
||||
dto.targetId,
|
||||
dto.isStanding
|
||||
);
|
||||
}
|
||||
const bool IsEqual(const DTO::WorldObject* dto) const override
|
||||
{
|
||||
const DTO::Hero* castedDto = static_cast<const DTO::Hero*>(dto);
|
||||
return WorldObject::IsEqual(dto) &&
|
||||
m_FullName.IsEqual(&castedDto->fullName) &&
|
||||
m_VitalStats.IsEqual(&castedDto->vitalStats) &&
|
||||
m_Phenotype.IsEqual(&castedDto->phenotype) &&
|
||||
m_ExperienceInfo.IsEqual(&castedDto->experienceInfo) &&
|
||||
m_PermanentStats.IsEqual(&castedDto->permanentStats) &&
|
||||
m_VariableStats.IsEqual(&castedDto->variableStats) &&
|
||||
m_Reputation.IsEqual(&castedDto->reputation) &&
|
||||
m_InventoryInfo.IsEqual(&castedDto->inventoryInfo) &&
|
||||
m_TargetId == castedDto->targetId &&
|
||||
m_IsStanding == castedDto->isStanding;
|
||||
}
|
||||
|
||||
const std::vector<Serializers::Node> BuildSerializationNodes() const override
|
||||
{
|
||||
std::vector<Serializers::Node> result = WorldObject::BuildSerializationNodes();
|
||||
|
||||
if (m_PrevState.isNewState || !m_FullName.IsEqual(&m_PrevState.fullName))
|
||||
{
|
||||
result.push_back({ "fullName", m_FullName.BuildSerializationNodes() });
|
||||
}
|
||||
if (m_PrevState.isNewState || !m_VitalStats.IsEqual(&m_PrevState.vitalStats))
|
||||
{
|
||||
result.push_back({ "vitalStats", m_VitalStats.BuildSerializationNodes() });
|
||||
}
|
||||
if (m_PrevState.isNewState || !m_Phenotype.IsEqual(&m_PrevState.phenotype))
|
||||
{
|
||||
result.push_back({ "phenotype", m_Phenotype.BuildSerializationNodes() });
|
||||
}
|
||||
if (m_PrevState.isNewState || !m_ExperienceInfo.IsEqual(&m_PrevState.experienceInfo))
|
||||
{
|
||||
result.push_back({ "experienceInfo", m_ExperienceInfo.BuildSerializationNodes() });
|
||||
}
|
||||
if (m_PrevState.isNewState || !m_PermanentStats.IsEqual(&m_PrevState.permanentStats))
|
||||
{
|
||||
result.push_back({ "permanentStats", m_PermanentStats.BuildSerializationNodes() });
|
||||
}
|
||||
if (m_PrevState.isNewState || !m_VariableStats.IsEqual(&m_PrevState.variableStats))
|
||||
{
|
||||
result.push_back({ "variableStats", m_VariableStats.BuildSerializationNodes() });
|
||||
}
|
||||
if (m_PrevState.isNewState || !m_Reputation.IsEqual(&m_PrevState.reputation))
|
||||
{
|
||||
result.push_back({ "reputation", m_Reputation.BuildSerializationNodes() });
|
||||
}
|
||||
if (m_PrevState.isNewState || !m_InventoryInfo.IsEqual(&m_PrevState.inventoryInfo))
|
||||
{
|
||||
result.push_back({ "inventoryInfo", m_InventoryInfo.BuildSerializationNodes() });
|
||||
}
|
||||
if (m_PrevState.isNewState || m_TargetId != m_PrevState.targetId)
|
||||
{
|
||||
result.push_back({ "targetId", std::to_string(m_TargetId) });
|
||||
}
|
||||
if (m_PrevState.isNewState || m_IsStanding != m_PrevState.isStanding)
|
||||
{
|
||||
result.push_back({ "isStanding", std::to_string(m_IsStanding) });
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
Hero(
|
||||
const uint32_t id,
|
||||
const ValueObjects::Transform transform,
|
||||
const ValueObjects::FullName fullName,
|
||||
const ValueObjects::VitalStats vitalStats,
|
||||
const ValueObjects::Phenotype phenotype,
|
||||
const ValueObjects::ExperienceInfo experienceInfo,
|
||||
const ValueObjects::PermanentStats permanentStats,
|
||||
const ValueObjects::VariableStats variableStats,
|
||||
const ValueObjects::Reputation reputation,
|
||||
const ValueObjects::InventoryInfo inventoryInfo,
|
||||
const uint32_t targetId,
|
||||
const bool isStanding
|
||||
) :
|
||||
WorldObject(id, transform),
|
||||
m_FullName(fullName),
|
||||
m_VitalStats(vitalStats),
|
||||
m_Phenotype(phenotype),
|
||||
m_ExperienceInfo(experienceInfo),
|
||||
m_PermanentStats(permanentStats),
|
||||
m_VariableStats(variableStats),
|
||||
m_Reputation(reputation),
|
||||
m_InventoryInfo(inventoryInfo),
|
||||
m_TargetId(targetId),
|
||||
m_IsStanding(isStanding)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
Hero() = default;
|
||||
virtual ~Hero() = default;
|
||||
|
||||
private:
|
||||
struct State
|
||||
{
|
||||
ValueObjects::FullName fullName = ValueObjects::FullName();
|
||||
ValueObjects::VitalStats vitalStats = ValueObjects::VitalStats();
|
||||
ValueObjects::Phenotype phenotype = ValueObjects::Phenotype();
|
||||
ValueObjects::ExperienceInfo experienceInfo = ValueObjects::ExperienceInfo();
|
||||
ValueObjects::PermanentStats permanentStats = ValueObjects::PermanentStats();
|
||||
ValueObjects::VariableStats variableStats = ValueObjects::VariableStats();
|
||||
ValueObjects::Reputation reputation = ValueObjects::Reputation();
|
||||
ValueObjects::InventoryInfo inventoryInfo = ValueObjects::InventoryInfo();
|
||||
uint32_t targetId = 0;
|
||||
bool isStanding = true;
|
||||
|
||||
bool isNewState = true;
|
||||
};
|
||||
|
||||
private:
|
||||
ValueObjects::FullName m_FullName = ValueObjects::FullName();
|
||||
ValueObjects::VitalStats m_VitalStats = ValueObjects::VitalStats();
|
||||
ValueObjects::Phenotype m_Phenotype = ValueObjects::Phenotype();
|
||||
ValueObjects::ExperienceInfo m_ExperienceInfo = ValueObjects::ExperienceInfo();
|
||||
ValueObjects::PermanentStats m_PermanentStats = ValueObjects::PermanentStats();
|
||||
ValueObjects::VariableStats m_VariableStats = ValueObjects::VariableStats();
|
||||
ValueObjects::Reputation m_Reputation = ValueObjects::Reputation();
|
||||
ValueObjects::InventoryInfo m_InventoryInfo = ValueObjects::InventoryInfo();
|
||||
uint32_t m_TargetId = 0;
|
||||
bool m_IsStanding = true;
|
||||
State m_PrevState = State();
|
||||
};
|
||||
}
|
149
L2BotCore/Domain/Entities/NPC.h
Normal file
149
L2BotCore/Domain/Entities/NPC.h
Normal file
@@ -0,0 +1,149 @@
|
||||
#pragma once
|
||||
#include <cstdint>
|
||||
#include "WorldObject.h"
|
||||
#include "../DTO/NPC.h"
|
||||
#include "../ValueObjects/FullName.h"
|
||||
#include "../ValueObjects/VitalStats.h"
|
||||
#include "../Serializers/Serializable.h"
|
||||
#include "../Enums/SpoilStateEnum.h"
|
||||
|
||||
namespace L2Bot::Domain::Entities
|
||||
{
|
||||
class NPC : public WorldObject
|
||||
{
|
||||
public:
|
||||
const bool IsHostile() const
|
||||
{
|
||||
return m_IsHostile;
|
||||
}
|
||||
const uint32_t GetNpcId() const
|
||||
{
|
||||
return m_NpcId;
|
||||
}
|
||||
const bool IsSpoiled() const
|
||||
{
|
||||
return m_SpoilState == Enums::SpoilStateEnum::spoiled;
|
||||
}
|
||||
const bool CanBeSweeped() const
|
||||
{
|
||||
return !m_VitalStats.IsAlive() && m_SpoilState == Enums::SpoilStateEnum::sweepable;
|
||||
}
|
||||
const ValueObjects::FullName& GetFullName() const
|
||||
{
|
||||
return m_FullName;
|
||||
}
|
||||
const ValueObjects::VitalStats& GetVitalStats() const
|
||||
{
|
||||
return m_VitalStats;
|
||||
}
|
||||
|
||||
void UpdateFromDTO(const DTO::WorldObject* dto) override
|
||||
{
|
||||
const DTO::NPC* castedDto = static_cast<const DTO::NPC*>(dto);
|
||||
WorldObject::UpdateFromDTO(dto);
|
||||
m_IsHostile = castedDto->isHostile;
|
||||
m_NpcId = castedDto->npcId;
|
||||
m_SpoilState = castedDto->spoilState;
|
||||
m_FullName = castedDto->fullName;
|
||||
m_VitalStats = castedDto->vitalStats;
|
||||
}
|
||||
void SaveState() override
|
||||
{
|
||||
WorldObject::SaveState();
|
||||
m_PrevState =
|
||||
{
|
||||
m_FullName,
|
||||
m_SpoilState,
|
||||
m_VitalStats,
|
||||
false
|
||||
};
|
||||
}
|
||||
const static NPC CreateFromDTO(const DTO::NPC& dto)
|
||||
{
|
||||
return NPC(
|
||||
dto.id,
|
||||
dto.transform,
|
||||
dto.isHostile,
|
||||
dto.npcId,
|
||||
dto.spoilState,
|
||||
dto.fullName,
|
||||
dto.vitalStats
|
||||
);
|
||||
}
|
||||
const bool IsEqual(const DTO::WorldObject* dto) const override
|
||||
{
|
||||
const DTO::NPC* castedDto = static_cast<const DTO::NPC*>(dto);
|
||||
return WorldObject::IsEqual(dto) &&
|
||||
m_IsHostile == castedDto->isHostile &&
|
||||
m_NpcId == castedDto->npcId &&
|
||||
m_SpoilState == castedDto->spoilState &&
|
||||
m_FullName.IsEqual(&castedDto->fullName) &&
|
||||
m_VitalStats.IsEqual(&castedDto->vitalStats);
|
||||
}
|
||||
|
||||
const std::vector<Serializers::Node> BuildSerializationNodes() const override
|
||||
{
|
||||
std::vector<Serializers::Node> result = WorldObject::BuildSerializationNodes();
|
||||
|
||||
if (m_PrevState.isNewState || !m_FullName.IsEqual(&m_PrevState.fullName))
|
||||
{
|
||||
result.push_back({ "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) });
|
||||
}
|
||||
if (m_PrevState.isNewState || m_SpoilState != m_PrevState.spoilState)
|
||||
{
|
||||
result.push_back({ "spoilState", std::to_string(static_cast<uint32_t>(m_SpoilState)) });
|
||||
}
|
||||
if (m_PrevState.isNewState || !m_VitalStats.IsEqual(&m_PrevState.vitalStats))
|
||||
{
|
||||
result.push_back({ "vitalStats", m_VitalStats.BuildSerializationNodes() });
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
NPC(
|
||||
const uint32_t id,
|
||||
const ValueObjects::Transform transform,
|
||||
const bool isHostile,
|
||||
const uint32_t npcId,
|
||||
const Enums::SpoilStateEnum spoilState,
|
||||
const ValueObjects::FullName fullName,
|
||||
const ValueObjects::VitalStats vitalStats
|
||||
) :
|
||||
WorldObject(id, transform),
|
||||
m_IsHostile(isHostile),
|
||||
m_NpcId(npcId),
|
||||
m_SpoilState(spoilState),
|
||||
m_FullName(fullName),
|
||||
m_VitalStats(vitalStats)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
NPC() = default;
|
||||
virtual ~NPC() = default;
|
||||
|
||||
private:
|
||||
struct State
|
||||
{
|
||||
ValueObjects::FullName fullName = ValueObjects::FullName();
|
||||
Enums::SpoilStateEnum spoilState = Enums::SpoilStateEnum::none;
|
||||
ValueObjects::VitalStats vitalStats = ValueObjects::VitalStats();
|
||||
|
||||
bool isNewState = true;
|
||||
};
|
||||
|
||||
private:
|
||||
bool m_IsHostile = false;
|
||||
uint32_t m_NpcId = 0;
|
||||
Enums::SpoilStateEnum m_SpoilState = Enums::SpoilStateEnum::none;
|
||||
ValueObjects::FullName m_FullName = ValueObjects::FullName();
|
||||
ValueObjects::VitalStats m_VitalStats = ValueObjects::VitalStats();
|
||||
State m_PrevState = State();
|
||||
};
|
||||
}
|
101
L2BotCore/Domain/Entities/Player.h
Normal file
101
L2BotCore/Domain/Entities/Player.h
Normal file
@@ -0,0 +1,101 @@
|
||||
#pragma once
|
||||
#include "WorldObject.h"
|
||||
#include "../DTO/Player.h"
|
||||
#include "../ValueObjects/FullName.h"
|
||||
#include "../ValueObjects/VitalStats.h"
|
||||
#include "../ValueObjects/Phenotype.h"
|
||||
|
||||
namespace L2Bot::Domain::Entities
|
||||
{
|
||||
class Player : public WorldObject
|
||||
{
|
||||
public:
|
||||
const ValueObjects::FullName& GetFullName() const
|
||||
{
|
||||
return m_FullName;
|
||||
}
|
||||
const ValueObjects::Phenotype& GetPhenotype() const
|
||||
{
|
||||
return m_Phenotype;
|
||||
}
|
||||
|
||||
void UpdateFromDTO(const DTO::WorldObject* dto) override
|
||||
{
|
||||
const DTO::Player* castedDto = static_cast<const DTO::Player*>(dto);
|
||||
WorldObject::UpdateFromDTO(dto);
|
||||
m_FullName = castedDto->fullName;
|
||||
m_Phenotype = castedDto->phenotype;
|
||||
}
|
||||
void SaveState() override
|
||||
{
|
||||
WorldObject::SaveState();
|
||||
m_PrevState =
|
||||
{
|
||||
m_FullName,
|
||||
m_Phenotype
|
||||
};
|
||||
}
|
||||
const static Player CreateFromDTO(const DTO::Player& dto)
|
||||
{
|
||||
return Player(
|
||||
dto.id,
|
||||
dto.transform,
|
||||
dto.fullName,
|
||||
dto.phenotype
|
||||
);
|
||||
}
|
||||
const bool IsEqual(const DTO::WorldObject* dto) const override
|
||||
{
|
||||
const DTO::Player* castedDto = static_cast<const DTO::Player*>(dto);
|
||||
return WorldObject::IsEqual(dto) &&
|
||||
m_FullName.IsEqual(&castedDto->fullName) &&
|
||||
m_Phenotype.IsEqual(&castedDto->phenotype);
|
||||
}
|
||||
|
||||
const std::vector<Serializers::Node> BuildSerializationNodes() const override
|
||||
{
|
||||
std::vector<Serializers::Node> result = WorldObject::BuildSerializationNodes();
|
||||
|
||||
if (m_PrevState.isNewState || !m_FullName.IsEqual(&m_PrevState.fullName))
|
||||
{
|
||||
result.push_back({ "fullName", m_FullName.BuildSerializationNodes() });
|
||||
}
|
||||
if (m_PrevState.isNewState || !m_Phenotype.IsEqual(&m_PrevState.phenotype))
|
||||
{
|
||||
result.push_back({ "phenotype", m_Phenotype.BuildSerializationNodes() });
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
Player(
|
||||
const uint32_t id,
|
||||
const ValueObjects::Transform transform,
|
||||
const ValueObjects::FullName fullName,
|
||||
const ValueObjects::Phenotype phenotype
|
||||
) :
|
||||
WorldObject(id, transform),
|
||||
m_FullName(fullName),
|
||||
m_Phenotype(phenotype)
|
||||
{
|
||||
SaveState();
|
||||
}
|
||||
|
||||
Player() = default;
|
||||
virtual ~Player() = default;
|
||||
|
||||
private:
|
||||
struct State
|
||||
{
|
||||
ValueObjects::FullName fullName = ValueObjects::FullName();
|
||||
ValueObjects::Phenotype phenotype = ValueObjects::Phenotype();
|
||||
|
||||
bool isNewState = true;
|
||||
};
|
||||
|
||||
private:
|
||||
ValueObjects::FullName m_FullName = ValueObjects::FullName();
|
||||
ValueObjects::Phenotype m_Phenotype = ValueObjects::Phenotype();
|
||||
State m_PrevState = State();
|
||||
};
|
||||
}
|
79
L2BotCore/Domain/Entities/WorldObject.h
Normal file
79
L2BotCore/Domain/Entities/WorldObject.h
Normal file
@@ -0,0 +1,79 @@
|
||||
#pragma once
|
||||
#include <cstdint>
|
||||
#include "../ValueObjects/Transform.h"
|
||||
#include "../DTO/WorldObject.h"
|
||||
#include "../Serializers/Serializable.h"
|
||||
|
||||
namespace L2Bot::Domain::Entities
|
||||
{
|
||||
class WorldObject : public Serializers::Serializable
|
||||
{
|
||||
public:
|
||||
const uint32_t GetId() const
|
||||
{
|
||||
return m_Id;
|
||||
}
|
||||
const ValueObjects::Transform& GetTransform() const
|
||||
{
|
||||
return m_Transform;
|
||||
}
|
||||
virtual void UpdateFromDTO(const DTO::WorldObject* dto)
|
||||
{
|
||||
SaveState();
|
||||
|
||||
m_Id = dto->id;
|
||||
m_Transform = dto->transform;
|
||||
}
|
||||
virtual void SaveState()
|
||||
{
|
||||
m_PrevState = { m_Transform, false };
|
||||
}
|
||||
virtual const bool IsEqual(const DTO::WorldObject* dto) const
|
||||
{
|
||||
return m_Id == dto->id && m_Transform.IsEqual(&dto->transform);
|
||||
}
|
||||
const float_t GetSqrDistance(const WorldObject& other) const
|
||||
{
|
||||
return m_Transform.GetSqrDistance(other.m_Transform);
|
||||
}
|
||||
const float_t GetHorizontalSqrDistance(const WorldObject& other) const
|
||||
{
|
||||
return m_Transform.GetHorizontalSqrDistance(other.m_Transform);
|
||||
}
|
||||
|
||||
const std::vector<Serializers::Node> BuildSerializationNodes() const override
|
||||
{
|
||||
std::vector<Serializers::Node> result;
|
||||
|
||||
result.push_back({ "id", std::to_string(GetId()) });
|
||||
if (m_PrevState.isNewState || !GetTransform().IsEqual(&m_PrevState.transform))
|
||||
{
|
||||
result.push_back({ "transform", GetTransform().BuildSerializationNodes() });
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
WorldObject(const uint32_t id, const ValueObjects::Transform transform) :
|
||||
m_Id(id), m_Transform(transform)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
WorldObject() = default;
|
||||
virtual ~WorldObject() = default;
|
||||
private:
|
||||
private:
|
||||
struct State
|
||||
{
|
||||
ValueObjects::Transform transform = ValueObjects::Transform();
|
||||
|
||||
bool isNewState = true;
|
||||
};
|
||||
|
||||
private:
|
||||
uint32_t m_Id = 0;
|
||||
ValueObjects::Transform m_Transform = ValueObjects::Transform();
|
||||
State m_PrevState = State();
|
||||
};
|
||||
}
|
99
L2BotCore/Domain/Enums/ClassEnum.h
Normal file
99
L2BotCore/Domain/Enums/ClassEnum.h
Normal file
@@ -0,0 +1,99 @@
|
||||
#pragma once
|
||||
#include <cstdint>
|
||||
|
||||
namespace L2Bot::Domain::Enums
|
||||
{
|
||||
enum class ClassEnum : uint8_t
|
||||
{
|
||||
none = 255,
|
||||
humanFighter = 0,
|
||||
warrior,
|
||||
gladiator,
|
||||
warlord,
|
||||
humanKnight,
|
||||
paladin,
|
||||
darkAvenger,
|
||||
rogue,
|
||||
treasureHunter,
|
||||
hawkeye,
|
||||
humanMystic,
|
||||
humanWizard,
|
||||
sorceror,
|
||||
necromancer,
|
||||
warlock,
|
||||
cleric,
|
||||
bishop,
|
||||
prophet,
|
||||
elvenFighter,
|
||||
elvenKnight,
|
||||
templeKnight,
|
||||
swordsinger,
|
||||
elvenScout,
|
||||
plainsWalker,
|
||||
silverRanger,
|
||||
elvenMystic,
|
||||
elvenWizard,
|
||||
spellsinger,
|
||||
elementalSummoner,
|
||||
elvenOracle,
|
||||
elvenElder,
|
||||
darkElvenFighter,
|
||||
palusKnight,
|
||||
shillienKnight,
|
||||
bladedancer,
|
||||
assassin,
|
||||
abyssWalker,
|
||||
phantomRanger,
|
||||
darkElvenMystic,
|
||||
darkElvenWizard,
|
||||
spellhowler,
|
||||
phantomSummoner,
|
||||
shillienOracle,
|
||||
shillienElder,
|
||||
orcFighter,
|
||||
orcRaider,
|
||||
destroyer,
|
||||
orcMonk,
|
||||
tyrant,
|
||||
orcMystic,
|
||||
orcShaman,
|
||||
overlord,
|
||||
warcryer,
|
||||
dwarvenFighter,
|
||||
dwarvenScavenger,
|
||||
bountyHunter,
|
||||
dwarvenArtisan,
|
||||
warsmith,
|
||||
duelist = 88,
|
||||
dreadnought,
|
||||
phoenixKnight,
|
||||
hellKnight,
|
||||
sagittarius,
|
||||
adventurer,
|
||||
archmage,
|
||||
soultaker,
|
||||
arcanaLord,
|
||||
cardinal,
|
||||
hierophant,
|
||||
evaTemplar,
|
||||
swordMuse,
|
||||
windRider,
|
||||
moonlightSentinel,
|
||||
mysticMuse,
|
||||
elementalMaster,
|
||||
evaSaint,
|
||||
shillienTemplar,
|
||||
spectralDancer,
|
||||
ghostHunter,
|
||||
ghostSentinel,
|
||||
stormScreamer,
|
||||
spectralMaster,
|
||||
shillienSaint,
|
||||
titan,
|
||||
grandKhauatari,
|
||||
dominator,
|
||||
doomcryer,
|
||||
fortuneSeeker,
|
||||
maestro
|
||||
};
|
||||
}
|
12
L2BotCore/Domain/Enums/ObjectStateEnum.h
Normal file
12
L2BotCore/Domain/Enums/ObjectStateEnum.h
Normal file
@@ -0,0 +1,12 @@
|
||||
#pragma once
|
||||
|
||||
namespace L2Bot::Domain::Enums
|
||||
{
|
||||
enum class ObjectStateEnum
|
||||
{
|
||||
none,
|
||||
created,
|
||||
updated,
|
||||
deleted
|
||||
};
|
||||
}
|
15
L2BotCore/Domain/Enums/RaceEnum.h
Normal file
15
L2BotCore/Domain/Enums/RaceEnum.h
Normal file
@@ -0,0 +1,15 @@
|
||||
#pragma once
|
||||
#include <cstdint>
|
||||
|
||||
namespace L2Bot::Domain::Enums
|
||||
{
|
||||
enum class RaceEnum : uint8_t
|
||||
{
|
||||
none = 255,
|
||||
darkElf = 2,
|
||||
dwarf = 4,
|
||||
elf = 1,
|
||||
human = 0,
|
||||
orc = 3
|
||||
};
|
||||
}
|
13
L2BotCore/Domain/Enums/SpoilStateEnum.h
Normal file
13
L2BotCore/Domain/Enums/SpoilStateEnum.h
Normal file
@@ -0,0 +1,13 @@
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
namespace L2Bot::Domain::Enums
|
||||
{
|
||||
enum class SpoilStateEnum : uint32_t
|
||||
{
|
||||
none = 0,
|
||||
spoiled,
|
||||
sweepable
|
||||
};
|
||||
};
|
14
L2BotCore/Domain/Repositories/DropRepositoryInterface.h
Normal file
14
L2BotCore/Domain/Repositories/DropRepositoryInterface.h
Normal file
@@ -0,0 +1,14 @@
|
||||
#pragma once
|
||||
#include <cstdint>
|
||||
#include <map>
|
||||
#include "ObjectRepositoryInterface.h"
|
||||
#include "../DTO/Drop.h"
|
||||
|
||||
namespace L2Bot::Domain::Repositories
|
||||
{
|
||||
class DropRepositoryInterface : public ObjectRepositoryInterface<DTO::Drop>
|
||||
{
|
||||
public:
|
||||
virtual const std::map<uint32_t, DTO::Drop> GetObjects() override = 0;
|
||||
};
|
||||
}
|
14
L2BotCore/Domain/Repositories/HeroRepositoryInterface.h
Normal file
14
L2BotCore/Domain/Repositories/HeroRepositoryInterface.h
Normal file
@@ -0,0 +1,14 @@
|
||||
#pragma once
|
||||
#include <cstdint>
|
||||
#include <map>
|
||||
#include "ObjectRepositoryInterface.h"
|
||||
#include "../DTO/Hero.h"
|
||||
|
||||
namespace L2Bot::Domain::Repositories
|
||||
{
|
||||
class HeroRepositoryInterface : public ObjectRepositoryInterface<DTO::Hero>
|
||||
{
|
||||
public:
|
||||
virtual const std::map<uint32_t, DTO::Hero> GetObjects() override = 0;
|
||||
};
|
||||
}
|
14
L2BotCore/Domain/Repositories/ItemRepositoryInterface.h
Normal file
14
L2BotCore/Domain/Repositories/ItemRepositoryInterface.h
Normal file
@@ -0,0 +1,14 @@
|
||||
#pragma once
|
||||
#include <cstdint>
|
||||
#include <map>
|
||||
#include "ObjectRepositoryInterface.h"
|
||||
#include "../DTO/BaseItem.h"
|
||||
|
||||
namespace L2Bot::Domain::Repositories
|
||||
{
|
||||
class ItemRepositoryInterface : public ObjectRepositoryInterface<DTO::BaseItem>
|
||||
{
|
||||
public:
|
||||
virtual const std::map<uint32_t, DTO::BaseItem> GetObjects() override = 0;
|
||||
};
|
||||
}
|
14
L2BotCore/Domain/Repositories/NPCRepositoryInterface.h
Normal file
14
L2BotCore/Domain/Repositories/NPCRepositoryInterface.h
Normal file
@@ -0,0 +1,14 @@
|
||||
#pragma once
|
||||
#include <cstdint>
|
||||
#include <map>
|
||||
#include "ObjectRepositoryInterface.h"
|
||||
#include "../DTO/NPC.h"
|
||||
|
||||
namespace L2Bot::Domain::Repositories
|
||||
{
|
||||
class NPCRepositoryInterface : public ObjectRepositoryInterface<DTO::NPC>
|
||||
{
|
||||
public:
|
||||
virtual const std::map<uint32_t, DTO::NPC> GetObjects() override = 0;
|
||||
};
|
||||
}
|
13
L2BotCore/Domain/Repositories/ObjectRepositoryInterface.h
Normal file
13
L2BotCore/Domain/Repositories/ObjectRepositoryInterface.h
Normal file
@@ -0,0 +1,13 @@
|
||||
#pragma once
|
||||
#include <cstdint>
|
||||
#include <map>
|
||||
|
||||
namespace L2Bot::Domain::Repositories
|
||||
{
|
||||
template <typename T>
|
||||
class ObjectRepositoryInterface
|
||||
{
|
||||
public:
|
||||
virtual const std::map<uint32_t, T> GetObjects() = 0;
|
||||
};
|
||||
}
|
14
L2BotCore/Domain/Repositories/PlayerRepositoryInterface.h
Normal file
14
L2BotCore/Domain/Repositories/PlayerRepositoryInterface.h
Normal file
@@ -0,0 +1,14 @@
|
||||
#pragma once
|
||||
#include <cstdint>
|
||||
#include <map>
|
||||
#include "ObjectRepositoryInterface.h"
|
||||
#include "../DTO/Player.h"
|
||||
|
||||
namespace L2Bot::Domain::Repositories
|
||||
{
|
||||
class PlayerRepositoryInterface : public ObjectRepositoryInterface<DTO::Player>
|
||||
{
|
||||
public:
|
||||
virtual const std::map<uint32_t, DTO::Player> GetObjects() override = 0;
|
||||
};
|
||||
}
|
14
L2BotCore/Domain/Repositories/SkillRepositoryInterface.h
Normal file
14
L2BotCore/Domain/Repositories/SkillRepositoryInterface.h
Normal file
@@ -0,0 +1,14 @@
|
||||
#pragma once
|
||||
#include <cstdint>
|
||||
#include <map>
|
||||
#include "ObjectRepositoryInterface.h"
|
||||
#include "../DTO/Skill.h"
|
||||
|
||||
namespace L2Bot::Domain::Repositories
|
||||
{
|
||||
class SkillRepositoryInterface : public ObjectRepositoryInterface<DTO::Skill>
|
||||
{
|
||||
public:
|
||||
virtual const std::map<uint32_t, DTO::Skill> GetObjects() override = 0;
|
||||
};
|
||||
}
|
26
L2BotCore/Domain/Serializers/Node.h
Normal file
26
L2BotCore/Domain/Serializers/Node.h
Normal file
@@ -0,0 +1,26 @@
|
||||
#pragma once
|
||||
#include <map>
|
||||
#include <vector>
|
||||
#include <string>
|
||||
|
||||
namespace L2Bot::Domain::Serializers
|
||||
{
|
||||
struct Node
|
||||
{
|
||||
const std::string name = "";
|
||||
const std::string value = "";
|
||||
const std::vector<Node> children;
|
||||
const bool isArray = false;
|
||||
const bool isContainer = false;
|
||||
|
||||
Node() = delete;
|
||||
Node(const std::string name, const std::string value) :
|
||||
name(name), value(value)
|
||||
{
|
||||
}
|
||||
Node(const std::string name, const std::vector<Node> children, const bool isArray = false) :
|
||||
name(name), children(children), isArray(isArray), isContainer(true)
|
||||
{
|
||||
}
|
||||
};
|
||||
}
|
12
L2BotCore/Domain/Serializers/Serializable.h
Normal file
12
L2BotCore/Domain/Serializers/Serializable.h
Normal file
@@ -0,0 +1,12 @@
|
||||
#pragma once
|
||||
#include <vector>
|
||||
#include "Node.h"
|
||||
|
||||
namespace L2Bot::Domain::Serializers
|
||||
{
|
||||
class Serializable
|
||||
{
|
||||
public:
|
||||
virtual const std::vector<Node> BuildSerializationNodes() const = 0;
|
||||
};
|
||||
}
|
57
L2BotCore/Domain/Serializers/SerializableStateContainer.h
Normal file
57
L2BotCore/Domain/Serializers/SerializableStateContainer.h
Normal file
@@ -0,0 +1,57 @@
|
||||
#pragma once
|
||||
#include <vector>
|
||||
#include "../DTO/ObjectState.h"
|
||||
#include "Serializable.h"
|
||||
|
||||
namespace L2Bot::Domain::Serializers
|
||||
{
|
||||
template <typename T>
|
||||
class SerializableStateContainer : public Serializers::Serializable
|
||||
{
|
||||
public:
|
||||
const std::vector<Serializers::Node> BuildSerializationNodes() const override
|
||||
{
|
||||
std::vector<Serializers::Node> result;
|
||||
|
||||
for (const auto& kvp : m_Objects)
|
||||
{
|
||||
std::string operationName = "";
|
||||
switch (kvp.state)
|
||||
{
|
||||
case Enums::ObjectStateEnum::created:
|
||||
operationName = "created";
|
||||
break;
|
||||
case Enums::ObjectStateEnum::updated:
|
||||
operationName = "updated";
|
||||
break;
|
||||
case Enums::ObjectStateEnum::deleted:
|
||||
operationName = "deleted";
|
||||
break;
|
||||
}
|
||||
|
||||
if (operationName != "")
|
||||
{
|
||||
result.push_back(
|
||||
{
|
||||
m_ContainerName,
|
||||
std::vector<Serializers::Node>{ { operationName, kvp.object.BuildSerializationNodes() } }
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
SerializableStateContainer(const std::vector<DTO::ObjectState<T>> objects, const std::string containerName) :
|
||||
m_Objects(objects), m_ContainerName(containerName)
|
||||
{
|
||||
|
||||
}
|
||||
SerializableStateContainer() = delete;
|
||||
virtual ~SerializableStateContainer() = default;
|
||||
private:
|
||||
const std::vector<DTO::ObjectState<T>> m_Objects;
|
||||
const std::string m_ContainerName;
|
||||
};
|
||||
}
|
57
L2BotCore/Domain/Serializers/SerializableStateContainerPtr.h
Normal file
57
L2BotCore/Domain/Serializers/SerializableStateContainerPtr.h
Normal file
@@ -0,0 +1,57 @@
|
||||
#pragma once
|
||||
#include <vector>
|
||||
#include "../DTO/ObjectState.h"
|
||||
#include "Serializable.h"
|
||||
|
||||
namespace L2Bot::Domain::Serializers
|
||||
{
|
||||
template <typename T>
|
||||
class SerializableStateContainerPtr : public Serializers::Serializable
|
||||
{
|
||||
public:
|
||||
const std::vector<Serializers::Node> BuildSerializationNodes() const override
|
||||
{
|
||||
std::vector<Serializers::Node> result;
|
||||
|
||||
for (const auto& kvp : m_Objects)
|
||||
{
|
||||
std::string operationName = "";
|
||||
switch (kvp.state)
|
||||
{
|
||||
case Enums::ObjectStateEnum::created:
|
||||
operationName = "created";
|
||||
break;
|
||||
case Enums::ObjectStateEnum::updated:
|
||||
operationName = "updated";
|
||||
break;
|
||||
case Enums::ObjectStateEnum::deleted:
|
||||
operationName = "deleted";
|
||||
break;
|
||||
}
|
||||
|
||||
if (operationName != "")
|
||||
{
|
||||
result.push_back(
|
||||
{
|
||||
m_ContainerName,
|
||||
std::vector<Serializers::Node>{ { operationName, kvp.object->BuildSerializationNodes() } }
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
SerializableStateContainerPtr(const std::vector<DTO::ObjectState<T>> objects, const std::string containerName) :
|
||||
m_Objects(objects), m_ContainerName(containerName)
|
||||
{
|
||||
|
||||
}
|
||||
SerializableStateContainerPtr() = delete;
|
||||
virtual ~SerializableStateContainerPtr() = default;
|
||||
private:
|
||||
const std::vector<DTO::ObjectState<T>> m_Objects;
|
||||
const std::string m_ContainerName;
|
||||
};
|
||||
}
|
13
L2BotCore/Domain/Serializers/SerializerInterface.h
Normal file
13
L2BotCore/Domain/Serializers/SerializerInterface.h
Normal file
@@ -0,0 +1,13 @@
|
||||
#pragma once
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include "Serializable.h"
|
||||
|
||||
namespace L2Bot::Domain::Serializers
|
||||
{
|
||||
class SerializerInterface
|
||||
{
|
||||
public:
|
||||
virtual const std::string Serialize(std::vector<Node> nodes, const bool isArray = false) const = 0;
|
||||
};
|
||||
}
|
20
L2BotCore/Domain/Services/DropService.h
Normal file
20
L2BotCore/Domain/Services/DropService.h
Normal file
@@ -0,0 +1,20 @@
|
||||
#pragma once
|
||||
#include <cstdint>
|
||||
#include <map>
|
||||
#include "ObjectService.h"
|
||||
#include "../DTO/Drop.h"
|
||||
#include "../Entities/Drop.h"
|
||||
#include "../Repositories/DropRepositoryInterface.h"
|
||||
|
||||
namespace L2Bot::Domain::Services
|
||||
{
|
||||
class DropService : public ObjectService<Entities::Drop, DTO::Drop>
|
||||
{
|
||||
public:
|
||||
DropService(Repositories::DropRepositoryInterface& repository) : ObjectService(repository)
|
||||
{
|
||||
|
||||
}
|
||||
virtual ~DropService() override = default;
|
||||
};
|
||||
}
|
31
L2BotCore/Domain/Services/HeroService.h
Normal file
31
L2BotCore/Domain/Services/HeroService.h
Normal file
@@ -0,0 +1,31 @@
|
||||
#pragma once
|
||||
#include <cstdint>
|
||||
#include <map>
|
||||
#include "ObjectService.h"
|
||||
#include "../DTO/Hero.h"
|
||||
#include "../Entities/Hero.h"
|
||||
#include "../Repositories/HeroRepositoryInterface.h"
|
||||
|
||||
namespace L2Bot::Domain::Services
|
||||
{
|
||||
class HeroService : public ObjectService<Entities::Hero, DTO::Hero>
|
||||
{
|
||||
public:
|
||||
const DTO::ObjectState<Entities::Hero> GetHero()
|
||||
{
|
||||
const auto map = GetObjects();
|
||||
if (map.size() == 0)
|
||||
{
|
||||
return DTO::ObjectState <Entities::Hero>{};
|
||||
}
|
||||
|
||||
return map[0];
|
||||
}
|
||||
|
||||
HeroService(Repositories::HeroRepositoryInterface& repository) : ObjectService(repository)
|
||||
{
|
||||
|
||||
}
|
||||
virtual ~HeroService() override = default;
|
||||
};
|
||||
}
|
20
L2BotCore/Domain/Services/ItemService.h
Normal file
20
L2BotCore/Domain/Services/ItemService.h
Normal file
@@ -0,0 +1,20 @@
|
||||
#pragma once
|
||||
#include <cstdint>
|
||||
#include <map>
|
||||
#include "ObjectService.h"
|
||||
#include "../DTO/BaseItem.h"
|
||||
#include "../ValueObjects/BaseItem.h"
|
||||
#include "../Repositories/ItemRepositoryInterface.h"
|
||||
|
||||
namespace L2Bot::Domain::Services
|
||||
{
|
||||
class ItemService : public ObjectService<ValueObjects::BaseItem, DTO::BaseItem>
|
||||
{
|
||||
public:
|
||||
ItemService(Repositories::ItemRepositoryInterface& repository) : ObjectService(repository)
|
||||
{
|
||||
|
||||
}
|
||||
virtual ~ItemService() override = default;
|
||||
};
|
||||
}
|
20
L2BotCore/Domain/Services/NPCService.h
Normal file
20
L2BotCore/Domain/Services/NPCService.h
Normal file
@@ -0,0 +1,20 @@
|
||||
#pragma once
|
||||
#include <cstdint>
|
||||
#include <map>
|
||||
#include "ObjectService.h"
|
||||
#include "../DTO/NPC.h"
|
||||
#include "../Entities/NPC.h"
|
||||
#include "../Repositories/NPCRepositoryInterface.h"
|
||||
|
||||
namespace L2Bot::Domain::Services
|
||||
{
|
||||
class NPCService : public ObjectService<Entities::NPC, DTO::NPC>
|
||||
{
|
||||
public:
|
||||
NPCService(Repositories::NPCRepositoryInterface& repository) : ObjectService(repository)
|
||||
{
|
||||
|
||||
}
|
||||
virtual ~NPCService() override = default;
|
||||
};
|
||||
}
|
100
L2BotCore/Domain/Services/ObjectService.h
Normal file
100
L2BotCore/Domain/Services/ObjectService.h
Normal file
@@ -0,0 +1,100 @@
|
||||
#pragma once
|
||||
#include <cstdint>
|
||||
#include <map>
|
||||
#include <vector>
|
||||
#include <math.h>
|
||||
#include "../DTO/ObjectState.h"
|
||||
#include "../Entities/Hero.h"
|
||||
#include "../Repositories/ObjectRepositoryInterface.h"
|
||||
|
||||
namespace L2Bot::Domain::Services
|
||||
{
|
||||
template <typename T, typename U>
|
||||
class ObjectService
|
||||
{
|
||||
public:
|
||||
ObjectService(Repositories::ObjectRepositoryInterface<U>& repository) : m_Repository(repository)
|
||||
{
|
||||
|
||||
}
|
||||
ObjectService() = delete;
|
||||
virtual ~ObjectService() = default;
|
||||
|
||||
virtual const std::vector<DTO::ObjectState<T>> GetObjects()
|
||||
{
|
||||
UpdateObjectsFromRepository();
|
||||
|
||||
std::vector<DTO::ObjectState<T>> objects;
|
||||
|
||||
for (const auto& kvp : m_ObjectStates) {
|
||||
objects.push_back(kvp.second);
|
||||
}
|
||||
|
||||
return objects;
|
||||
}
|
||||
|
||||
void Invalidate()
|
||||
{
|
||||
m_ObjectStates.clear();
|
||||
}
|
||||
|
||||
protected:
|
||||
virtual void UpdateObjectsFromRepository()
|
||||
{
|
||||
auto objects = m_Repository.GetObjects();
|
||||
|
||||
RemoveOutdatedStates();
|
||||
|
||||
|
||||
for (const auto& kvp : objects)
|
||||
{
|
||||
const auto& dto = kvp.second;
|
||||
if (m_ObjectStates.contains(kvp.first))
|
||||
{
|
||||
if (!m_ObjectStates[kvp.first].object.IsEqual(&dto)) {
|
||||
m_ObjectStates[kvp.first].object.UpdateFromDTO(&dto);
|
||||
m_ObjectStates[kvp.first].state = Enums::ObjectStateEnum::updated;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_ObjectStates[kvp.first].state = Enums::ObjectStateEnum::none;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_ObjectStates.emplace(kvp.first, DTO::ObjectState<T>{ T::CreateFromDTO(dto), Enums::ObjectStateEnum::created });
|
||||
}
|
||||
}
|
||||
|
||||
for (auto& kvp : m_ObjectStates)
|
||||
{
|
||||
if (!objects.contains(kvp.second.object.GetId()))
|
||||
{
|
||||
m_ObjectStates[kvp.first].object.SaveState();
|
||||
kvp.second.state = Enums::ObjectStateEnum::deleted;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
void RemoveOutdatedStates()
|
||||
{
|
||||
auto it = m_ObjectStates.begin();
|
||||
while (it != m_ObjectStates.end())
|
||||
{
|
||||
if (it->second.state == Enums::ObjectStateEnum::deleted)
|
||||
{
|
||||
m_ObjectStates.erase(it++);
|
||||
}
|
||||
else
|
||||
{
|
||||
it++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
Repositories::ObjectRepositoryInterface<U>& m_Repository;
|
||||
std::map<uint32_t, DTO::ObjectState<T>> m_ObjectStates;
|
||||
};
|
||||
}
|
99
L2BotCore/Domain/Services/ObjectServicePtr.h
Normal file
99
L2BotCore/Domain/Services/ObjectServicePtr.h
Normal file
@@ -0,0 +1,99 @@
|
||||
#pragma once
|
||||
#include <cstdint>
|
||||
#include <map>
|
||||
#include <vector>
|
||||
#include <math.h>
|
||||
#include "../DTO/ObjectState.h"
|
||||
#include "../Entities/Hero.h"
|
||||
#include "../Repositories/ObjectRepositoryInterface.h"
|
||||
|
||||
namespace L2Bot::Domain::Services
|
||||
{
|
||||
template <typename T, typename U>
|
||||
class ObjectServicePtr
|
||||
{
|
||||
public:
|
||||
ObjectServicePtr(Repositories::ObjectRepositoryInterface<U>& repository) : m_Repository(repository)
|
||||
{
|
||||
|
||||
}ObjectServicePtr() = delete;
|
||||
virtual ~ObjectServicePtr() = default;
|
||||
|
||||
virtual const std::vector<DTO::ObjectState<T>> GetObjects()
|
||||
{
|
||||
UpdateObjectsFromRepository();
|
||||
|
||||
std::vector<DTO::ObjectState<T>> objects;
|
||||
|
||||
for (const auto& kvp : m_ObjectStates) {
|
||||
objects.push_back(kvp.second);
|
||||
}
|
||||
|
||||
return objects;
|
||||
}
|
||||
|
||||
void Invalidate()
|
||||
{
|
||||
m_ObjectStates.clear();
|
||||
}
|
||||
|
||||
protected:
|
||||
virtual void UpdateObjectsFromRepository()
|
||||
{
|
||||
auto objects = m_Repository.GetObjects();
|
||||
|
||||
RemoveOutdatedStates();
|
||||
|
||||
|
||||
for (const auto& kvp : objects)
|
||||
{
|
||||
const auto& dto = kvp.second;
|
||||
if (m_ObjectStates.contains(kvp.first))
|
||||
{
|
||||
if (!m_ObjectStates[kvp.first].object->IsEqual(dto.get())) {
|
||||
m_ObjectStates[kvp.first].object->UpdateFromDTO(dto.get());
|
||||
m_ObjectStates[kvp.first].state = Enums::ObjectStateEnum::updated;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_ObjectStates[kvp.first].state = Enums::ObjectStateEnum::none;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//m_ObjectStates.emplace(kvp.first, DTO::ObjectState<T>{ T::CreateFromDTO(dto), Enums::ObjectStateEnum::created });
|
||||
}
|
||||
}
|
||||
|
||||
for (auto& kvp : m_ObjectStates)
|
||||
{
|
||||
if (!objects.contains(kvp.second.object->GetId()))
|
||||
{
|
||||
m_ObjectStates[kvp.first].object->SaveState();
|
||||
kvp.second.state = Enums::ObjectStateEnum::deleted;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
void RemoveOutdatedStates()
|
||||
{
|
||||
auto it = m_ObjectStates.begin();
|
||||
while (it != m_ObjectStates.end())
|
||||
{
|
||||
if (it->second.state == Enums::ObjectStateEnum::deleted)
|
||||
{
|
||||
m_ObjectStates.erase(it++);
|
||||
}
|
||||
else
|
||||
{
|
||||
it++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
Repositories::ObjectRepositoryInterface<U>& m_Repository;
|
||||
std::map<uint32_t, DTO::ObjectState<T>> m_ObjectStates;
|
||||
};
|
||||
}
|
20
L2BotCore/Domain/Services/PlayerService.h
Normal file
20
L2BotCore/Domain/Services/PlayerService.h
Normal file
@@ -0,0 +1,20 @@
|
||||
#pragma once
|
||||
#include <cstdint>
|
||||
#include <map>
|
||||
#include "ObjectService.h"
|
||||
#include "../DTO/Player.h"
|
||||
#include "../Entities/Player.h"
|
||||
#include "../Repositories/PlayerRepositoryInterface.h"
|
||||
|
||||
namespace L2Bot::Domain::Services
|
||||
{
|
||||
class PlayerService : public ObjectService<Entities::Player, DTO::Player>
|
||||
{
|
||||
public:
|
||||
PlayerService(Repositories::PlayerRepositoryInterface& repository) : ObjectService(repository)
|
||||
{
|
||||
|
||||
}
|
||||
virtual ~PlayerService() override = default;
|
||||
};
|
||||
}
|
20
L2BotCore/Domain/Services/SkillService.h
Normal file
20
L2BotCore/Domain/Services/SkillService.h
Normal file
@@ -0,0 +1,20 @@
|
||||
#pragma once
|
||||
#include <cstdint>
|
||||
#include <map>
|
||||
#include "ObjectService.h"
|
||||
#include "../DTO/Skill.h"
|
||||
#include "../ValueObjects/Skill.h"
|
||||
#include "../Repositories/SkillRepositoryInterface.h"
|
||||
|
||||
namespace L2Bot::Domain::Services
|
||||
{
|
||||
class SkillService : public ObjectService<ValueObjects::Skill, DTO::Skill>
|
||||
{
|
||||
public:
|
||||
SkillService(Repositories::SkillRepositoryInterface& repository) : ObjectService(repository)
|
||||
{
|
||||
|
||||
}
|
||||
virtual ~SkillService() override = default;
|
||||
};
|
||||
}
|
14
L2BotCore/Domain/Transports/TransportInterface.h
Normal file
14
L2BotCore/Domain/Transports/TransportInterface.h
Normal file
@@ -0,0 +1,14 @@
|
||||
#pragma once
|
||||
#include <string>
|
||||
|
||||
namespace L2Bot::Domain::Transports
|
||||
{
|
||||
class TransportInterface
|
||||
{
|
||||
public:
|
||||
virtual const bool Connect() = 0;
|
||||
virtual const bool IsConnected() const = 0;
|
||||
virtual const void Send(std::string data) = 0;
|
||||
virtual const std::string Receive() = 0;
|
||||
};
|
||||
}
|
158
L2BotCore/Domain/ValueObjects/BaseItem.h
Normal file
158
L2BotCore/Domain/ValueObjects/BaseItem.h
Normal file
@@ -0,0 +1,158 @@
|
||||
#pragma once
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include "../DTO/BaseItem.h"
|
||||
#include "../Serializers/Serializable.h"
|
||||
#include "../Serializers/Node.h"
|
||||
|
||||
namespace L2Bot::Domain::ValueObjects
|
||||
{
|
||||
class BaseItem : public Serializers::Serializable
|
||||
{
|
||||
public:
|
||||
const uint32_t GetId() const
|
||||
{
|
||||
return m_ItemId;
|
||||
}
|
||||
void UpdateFromDTO(const DTO::BaseItem* dto)
|
||||
{
|
||||
SaveState();
|
||||
|
||||
m_ItemId = dto->itemId;
|
||||
m_Amount = dto->amount;
|
||||
m_IsEquipped = dto->isEquipped;
|
||||
m_EnchantLevel = dto->enchantLevel;
|
||||
m_Mana = dto->mana;
|
||||
m_Name = dto->name;
|
||||
m_IconName = dto->iconName;
|
||||
m_Description = dto->description;
|
||||
m_Weight = dto->weight;
|
||||
}
|
||||
void SaveState()
|
||||
{
|
||||
m_PrevState =
|
||||
{
|
||||
m_Amount,
|
||||
m_IsEquipped,
|
||||
m_EnchantLevel,
|
||||
m_Mana,
|
||||
m_Weight,
|
||||
false
|
||||
};
|
||||
}
|
||||
const static BaseItem CreateFromDTO(const DTO::BaseItem& dto)
|
||||
{
|
||||
return BaseItem(
|
||||
dto.itemId,
|
||||
dto.amount,
|
||||
dto.isEquipped,
|
||||
dto.enchantLevel,
|
||||
dto.mana,
|
||||
dto.name,
|
||||
dto.iconName,
|
||||
dto.description,
|
||||
dto.weight
|
||||
);
|
||||
}
|
||||
const bool IsEqual(const DTO::BaseItem* dto) const
|
||||
{
|
||||
return m_ItemId == dto->itemId &&
|
||||
m_Amount == dto->amount &&
|
||||
m_IsEquipped == dto->isEquipped &&
|
||||
m_EnchantLevel == dto->enchantLevel &&
|
||||
m_Mana == dto->mana &&
|
||||
m_Name == dto->name &&
|
||||
m_IconName == dto->iconName &&
|
||||
m_Description == dto->description &&
|
||||
m_Weight == dto->weight;
|
||||
}
|
||||
|
||||
const std::vector<Serializers::Node> BuildSerializationNodes() const override
|
||||
{
|
||||
std::vector<Serializers::Node> result;
|
||||
|
||||
result.push_back({ "itemId", std::to_string(m_ItemId) });
|
||||
|
||||
if (m_PrevState.isNewState)
|
||||
{
|
||||
result.push_back({ "name", m_Name });
|
||||
result.push_back({ "iconName", m_IconName });
|
||||
result.push_back({ "description", m_Description });
|
||||
}
|
||||
|
||||
if (m_PrevState.isNewState || m_Amount != m_PrevState.amount)
|
||||
{
|
||||
result.push_back({ "amount", std::to_string(m_Amount) });
|
||||
}
|
||||
if (m_PrevState.isNewState || m_IsEquipped != m_PrevState.isEquipped)
|
||||
{
|
||||
result.push_back({ "isEquipped", std::to_string(m_IsEquipped) });
|
||||
}
|
||||
if (m_PrevState.isNewState || m_EnchantLevel != m_PrevState.enchantLevel)
|
||||
{
|
||||
result.push_back({ "enchantLevel", std::to_string(m_EnchantLevel) });
|
||||
}
|
||||
if (m_PrevState.isNewState || m_Mana != m_PrevState.mana)
|
||||
{
|
||||
result.push_back({ "mana", std::to_string(m_Mana) });
|
||||
}
|
||||
if (m_PrevState.isNewState || m_Weight != m_PrevState.weight)
|
||||
{
|
||||
result.push_back({ "weight", std::to_string(m_Weight) });
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
BaseItem(
|
||||
const uint32_t itemId,
|
||||
const uint32_t amount,
|
||||
const bool isEquipped,
|
||||
const uint16_t enchantLevel,
|
||||
const int32_t mana,
|
||||
const std::string name,
|
||||
const std::string iconName,
|
||||
const std::string description,
|
||||
const uint16_t weight
|
||||
) :
|
||||
m_ItemId(itemId),
|
||||
m_Amount(amount),
|
||||
m_IsEquipped(isEquipped),
|
||||
m_EnchantLevel(enchantLevel),
|
||||
m_Mana(mana),
|
||||
m_Name(name),
|
||||
m_IconName(iconName),
|
||||
m_Description(description),
|
||||
m_Weight(weight)
|
||||
{
|
||||
}
|
||||
|
||||
BaseItem() = default;
|
||||
virtual ~BaseItem() = default;
|
||||
|
||||
private:
|
||||
struct State
|
||||
{
|
||||
uint32_t amount = 0;
|
||||
bool isEquipped = 0;
|
||||
uint16_t enchantLevel = 0;
|
||||
int32_t mana = -1;
|
||||
uint16_t weight = 0;
|
||||
|
||||
bool isNewState = true;
|
||||
};
|
||||
|
||||
private:
|
||||
uint32_t m_ItemId = 0;
|
||||
uint32_t m_Amount = 0;
|
||||
bool m_IsEquipped = 0;
|
||||
uint16_t m_EnchantLevel = 0;
|
||||
int32_t m_Mana = -1;
|
||||
std::string m_Name = "";
|
||||
std::string m_IconName = "";
|
||||
std::string m_Description = "";
|
||||
uint16_t m_Weight = 0;
|
||||
State m_PrevState = State();
|
||||
};
|
||||
}
|
55
L2BotCore/Domain/ValueObjects/ExperienceInfo.h
Normal file
55
L2BotCore/Domain/ValueObjects/ExperienceInfo.h
Normal file
@@ -0,0 +1,55 @@
|
||||
#pragma once
|
||||
#include <cstdint>
|
||||
#include "../Serializers/Serializable.h"
|
||||
|
||||
namespace L2Bot::Domain::ValueObjects
|
||||
{
|
||||
class ExperienceInfo : public Serializers::Serializable
|
||||
{
|
||||
public:
|
||||
const uint8_t GetLevel() const
|
||||
{
|
||||
return m_Level;
|
||||
}
|
||||
const uint8_t GetExp() const
|
||||
{
|
||||
return m_Exp;
|
||||
}
|
||||
const uint8_t GetSp() const
|
||||
{
|
||||
return m_Sp;
|
||||
}
|
||||
const bool IsEqual(const ExperienceInfo* other) const
|
||||
{
|
||||
return m_Level == other->m_Level && m_Exp == other->m_Exp && m_Sp == other->m_Sp;
|
||||
}
|
||||
|
||||
const std::vector<Serializers::Node> BuildSerializationNodes() const override
|
||||
{
|
||||
return std::vector<Serializers::Node>
|
||||
{
|
||||
{ "level", std::to_string(m_Level) },
|
||||
{ "exp", std::to_string(m_Exp) },
|
||||
{ "sp", std::to_string(m_Sp) }
|
||||
};
|
||||
}
|
||||
|
||||
ExperienceInfo(
|
||||
const uint8_t level,
|
||||
const uint32_t exp,
|
||||
const uint32_t sp
|
||||
) :
|
||||
m_Level(level),
|
||||
m_Exp(exp),
|
||||
m_Sp(sp)
|
||||
{
|
||||
}
|
||||
|
||||
ExperienceInfo() = default;
|
||||
virtual ~ExperienceInfo() = default;
|
||||
private:
|
||||
uint8_t m_Level = 0;
|
||||
uint32_t m_Exp = 0;
|
||||
uint32_t m_Sp = 0;
|
||||
};
|
||||
}
|
47
L2BotCore/Domain/ValueObjects/FullName.h
Normal file
47
L2BotCore/Domain/ValueObjects/FullName.h
Normal file
@@ -0,0 +1,47 @@
|
||||
#pragma once
|
||||
#include <string>
|
||||
#include "../Serializers/Serializable.h"
|
||||
|
||||
namespace L2Bot::Domain::ValueObjects
|
||||
{
|
||||
class FullName : public Serializers::Serializable
|
||||
{
|
||||
public:
|
||||
const std::string& GetNickname() const
|
||||
{
|
||||
return m_Nickname;
|
||||
}
|
||||
const std::string& GetTitle() const
|
||||
{
|
||||
return m_Title;
|
||||
}
|
||||
const bool IsEqual(const FullName* other) const
|
||||
{
|
||||
return m_Nickname == other->m_Nickname && m_Title == other->m_Title;
|
||||
}
|
||||
|
||||
const std::vector<Serializers::Node> BuildSerializationNodes() const override
|
||||
{
|
||||
return std::vector<Serializers::Node>
|
||||
{
|
||||
{ "nickname", m_Nickname },
|
||||
{ "title", m_Title }
|
||||
};
|
||||
}
|
||||
|
||||
FullName(
|
||||
const std::string nickname,
|
||||
const std::string title
|
||||
) :
|
||||
m_Nickname(nickname),
|
||||
m_Title(title)
|
||||
{
|
||||
}
|
||||
|
||||
FullName() = default;
|
||||
virtual ~FullName() = default;
|
||||
private:
|
||||
std::string m_Nickname = "";
|
||||
std::string m_Title = "";
|
||||
};
|
||||
}
|
61
L2BotCore/Domain/ValueObjects/InventoryInfo.h
Normal file
61
L2BotCore/Domain/ValueObjects/InventoryInfo.h
Normal file
@@ -0,0 +1,61 @@
|
||||
#pragma once
|
||||
#include <cstdint>
|
||||
#include "../Serializers/Serializable.h"
|
||||
|
||||
namespace L2Bot::Domain::ValueObjects
|
||||
{
|
||||
class InventoryInfo : public Serializers::Serializable
|
||||
{
|
||||
public:
|
||||
const bool IsOverloaded() const
|
||||
{
|
||||
return m_Weight >= m_MaxWeight;
|
||||
}
|
||||
const uint16_t GetMaxWeight() const
|
||||
{
|
||||
return m_MaxWeight;
|
||||
}
|
||||
const uint16_t GetWeight() const
|
||||
{
|
||||
return m_Weight;
|
||||
}
|
||||
const uint16_t GetSlots() const
|
||||
{
|
||||
return m_Slots;
|
||||
}
|
||||
const bool IsEqual(const InventoryInfo* other) const
|
||||
{
|
||||
return m_MaxWeight == other->m_MaxWeight &&
|
||||
m_Weight == other->m_Weight &&
|
||||
m_Slots == other->m_Slots;
|
||||
}
|
||||
|
||||
const std::vector<Serializers::Node> BuildSerializationNodes() const override
|
||||
{
|
||||
return std::vector<Serializers::Node>
|
||||
{
|
||||
{ "maxWeight", std::to_string(m_MaxWeight) },
|
||||
{ "weight", std::to_string(m_Weight) },
|
||||
{ "slots", std::to_string(m_Slots) }
|
||||
};
|
||||
}
|
||||
|
||||
InventoryInfo(
|
||||
const uint16_t maxWeight,
|
||||
const uint16_t weight,
|
||||
const uint16_t slots
|
||||
) :
|
||||
m_MaxWeight(maxWeight),
|
||||
m_Weight(weight),
|
||||
m_Slots(slots)
|
||||
{
|
||||
}
|
||||
|
||||
InventoryInfo() = default;
|
||||
virtual ~InventoryInfo() = default;
|
||||
private:
|
||||
uint16_t m_MaxWeight = 0;
|
||||
uint16_t m_Weight = 0;
|
||||
uint16_t m_Slots = 0;
|
||||
};
|
||||
}
|
85
L2BotCore/Domain/ValueObjects/PermanentStats.h
Normal file
85
L2BotCore/Domain/ValueObjects/PermanentStats.h
Normal file
@@ -0,0 +1,85 @@
|
||||
#pragma once
|
||||
#include <cstdint>
|
||||
#include "../Serializers/Serializable.h"
|
||||
|
||||
namespace L2Bot::Domain::ValueObjects
|
||||
{
|
||||
class PermanentStats : public Serializers::Serializable
|
||||
{
|
||||
public:
|
||||
const uint16_t GetStr() const
|
||||
{
|
||||
return m_Str;
|
||||
}
|
||||
const uint16_t GetDex() const
|
||||
{
|
||||
return m_Dex;
|
||||
}
|
||||
const uint16_t GetCon() const
|
||||
{
|
||||
return m_Con;
|
||||
}
|
||||
const uint16_t GetInt() const
|
||||
{
|
||||
return m_Int;
|
||||
}
|
||||
const uint16_t GetMen() const
|
||||
{
|
||||
return m_Men;
|
||||
}
|
||||
const uint16_t GetWit() const
|
||||
{
|
||||
return m_Wit;
|
||||
}
|
||||
const bool IsEqual(const PermanentStats* other) const
|
||||
{
|
||||
return m_Str == other->m_Str &&
|
||||
m_Dex == other->m_Dex &&
|
||||
m_Con == other->m_Con &&
|
||||
m_Int == other->m_Int &&
|
||||
m_Men == other->m_Men &&
|
||||
m_Wit == other->m_Wit;
|
||||
}
|
||||
|
||||
const std::vector<Serializers::Node> BuildSerializationNodes() const override
|
||||
{
|
||||
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) }
|
||||
};
|
||||
}
|
||||
|
||||
PermanentStats(
|
||||
uint16_t str,
|
||||
uint16_t dex,
|
||||
uint16_t con,
|
||||
uint16_t int_,
|
||||
uint16_t men,
|
||||
uint16_t wit
|
||||
) :
|
||||
m_Str(str),
|
||||
m_Dex(dex),
|
||||
m_Con(con),
|
||||
m_Int(int_),
|
||||
m_Men(men),
|
||||
m_Wit(wit)
|
||||
{
|
||||
}
|
||||
|
||||
PermanentStats() = default;
|
||||
virtual ~PermanentStats() = default;
|
||||
|
||||
private:
|
||||
uint16_t m_Str = 0;
|
||||
uint16_t m_Dex = 0;
|
||||
uint16_t m_Con = 0;
|
||||
uint16_t m_Int = 0;
|
||||
uint16_t m_Men = 0;
|
||||
uint16_t m_Wit = 0;
|
||||
};
|
||||
}
|
72
L2BotCore/Domain/ValueObjects/Phenotype.h
Normal file
72
L2BotCore/Domain/ValueObjects/Phenotype.h
Normal file
@@ -0,0 +1,72 @@
|
||||
#pragma once
|
||||
#include "../Enums/RaceEnum.h"
|
||||
#include "../Enums/ClassEnum.h"
|
||||
#include "../Serializers/Serializable.h"
|
||||
|
||||
namespace L2Bot::Domain::ValueObjects
|
||||
{
|
||||
class Phenotype : public Serializers::Serializable
|
||||
{
|
||||
public:
|
||||
const bool IsSubClass() const
|
||||
{
|
||||
return m_ActiveClass != Enums::ClassEnum::none && m_Class != m_ActiveClass;
|
||||
}
|
||||
const Enums::RaceEnum GetRace() const
|
||||
{
|
||||
return m_Race;
|
||||
}
|
||||
const bool IsMale() const
|
||||
{
|
||||
return m_IsMale;
|
||||
}
|
||||
const Enums::ClassEnum GetClass() const
|
||||
{
|
||||
return m_Class;
|
||||
}
|
||||
const Enums::ClassEnum GetActiveClass() const
|
||||
{
|
||||
return m_ActiveClass;
|
||||
}
|
||||
const bool IsEqual(const Phenotype* other) const
|
||||
{
|
||||
return m_Race == other->m_Race &&
|
||||
m_IsMale == other->m_IsMale &&
|
||||
m_Class == other->m_Class &&
|
||||
m_ActiveClass == other->m_ActiveClass;
|
||||
}
|
||||
|
||||
const std::vector<Serializers::Node> BuildSerializationNodes() const override
|
||||
{
|
||||
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)) }
|
||||
};
|
||||
}
|
||||
|
||||
Phenotype(
|
||||
Enums::RaceEnum race,
|
||||
bool isMale,
|
||||
Enums::ClassEnum class_,
|
||||
Enums::ClassEnum activeClass
|
||||
) :
|
||||
m_Race(race),
|
||||
m_IsMale(isMale),
|
||||
m_Class(class_),
|
||||
m_ActiveClass(activeClass)
|
||||
{
|
||||
}
|
||||
|
||||
Phenotype() = default;
|
||||
virtual ~Phenotype() = default;
|
||||
|
||||
private:
|
||||
Enums::RaceEnum m_Race = Enums::RaceEnum::none;
|
||||
bool m_IsMale = true;
|
||||
Enums::ClassEnum m_Class = Enums::ClassEnum::none;
|
||||
Enums::ClassEnum m_ActiveClass = Enums::ClassEnum::none;
|
||||
};
|
||||
}
|
80
L2BotCore/Domain/ValueObjects/Reputation.h
Normal file
80
L2BotCore/Domain/ValueObjects/Reputation.h
Normal file
@@ -0,0 +1,80 @@
|
||||
#pragma once
|
||||
#include <cstdint>
|
||||
#include "../Serializers/Serializable.h"
|
||||
|
||||
namespace L2Bot::Domain::ValueObjects
|
||||
{
|
||||
class Reputation : public Serializers::Serializable
|
||||
{
|
||||
public:
|
||||
const bool IsPlayerKiller() const
|
||||
{
|
||||
return m_Karma > 0;
|
||||
}
|
||||
const uint16_t GetKarma() const
|
||||
{
|
||||
return m_Karma;
|
||||
}
|
||||
const uint16_t GetPkKills() const
|
||||
{
|
||||
return m_PkKills;
|
||||
}
|
||||
const uint16_t GetPvpKills() const
|
||||
{
|
||||
return m_PvpKills;
|
||||
}
|
||||
const uint8_t GetRecRemaining() const
|
||||
{
|
||||
return m_RecRemaining;
|
||||
}
|
||||
const uint8_t GetEvalScore() const
|
||||
{
|
||||
return m_EvalScore;
|
||||
}
|
||||
const bool IsEqual(const Reputation* other) const
|
||||
{
|
||||
return m_Karma == other->m_Karma &&
|
||||
m_PkKills == other->m_PkKills &&
|
||||
m_PvpKills == other->m_PvpKills &&
|
||||
m_RecRemaining == other->m_RecRemaining &&
|
||||
m_EvalScore == other->m_EvalScore;
|
||||
}
|
||||
|
||||
const std::vector<Serializers::Node> BuildSerializationNodes() const override
|
||||
{
|
||||
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) }
|
||||
};
|
||||
}
|
||||
|
||||
Reputation(
|
||||
uint16_t karma,
|
||||
uint16_t pkKills,
|
||||
uint16_t pvpKills,
|
||||
uint8_t recRemaining,
|
||||
uint8_t evalScore
|
||||
) :
|
||||
m_Karma(karma),
|
||||
m_PkKills(pkKills),
|
||||
m_PvpKills(pvpKills),
|
||||
m_RecRemaining(recRemaining),
|
||||
m_EvalScore(evalScore)
|
||||
{
|
||||
}
|
||||
|
||||
Reputation() = default;
|
||||
virtual ~Reputation() = default;
|
||||
|
||||
private:
|
||||
uint16_t m_Karma = 0;
|
||||
uint16_t m_PkKills = 0;
|
||||
uint16_t m_PvpKills = 0;
|
||||
uint8_t m_RecRemaining = 0;
|
||||
uint8_t m_EvalScore = 0;
|
||||
};
|
||||
}
|
188
L2BotCore/Domain/ValueObjects/Skill.h
Normal file
188
L2BotCore/Domain/ValueObjects/Skill.h
Normal file
@@ -0,0 +1,188 @@
|
||||
#pragma once
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include "../DTO/Skill.h"
|
||||
#include "../Serializers/Serializable.h"
|
||||
#include "../Serializers/Node.h"
|
||||
|
||||
namespace L2Bot::Domain::ValueObjects
|
||||
{
|
||||
class Skill : public Serializers::Serializable
|
||||
{
|
||||
public:
|
||||
const uint32_t GetId() const
|
||||
{
|
||||
return m_SkillId;
|
||||
}
|
||||
const bool IsReadyToUse() const
|
||||
{
|
||||
return !m_IsCasting && !m_IsReloading;
|
||||
}
|
||||
void UpdateFromDTO(const DTO::Skill* dto)
|
||||
{
|
||||
SaveState();
|
||||
|
||||
m_SkillId = dto->skillId;
|
||||
m_Level = dto->level;
|
||||
m_IsActive = dto->isActive;
|
||||
m_Cost = dto->cost;
|
||||
m_Range = dto->range;
|
||||
m_Name = dto->name;
|
||||
m_Description = dto->description;
|
||||
m_IconName = dto->iconName;
|
||||
m_IsToggled = dto->isToggled;
|
||||
m_IsCasting = dto->isCasting;
|
||||
m_IsReloading = dto->isReloading;
|
||||
}
|
||||
void SaveState()
|
||||
{
|
||||
m_PrevState =
|
||||
{
|
||||
m_Cost,
|
||||
m_Range,
|
||||
m_Description,
|
||||
m_IsToggled,
|
||||
m_IsCasting,
|
||||
m_IsReloading,
|
||||
IsReadyToUse(),
|
||||
false
|
||||
};
|
||||
}
|
||||
const static Skill CreateFromDTO(const DTO::Skill& dto)
|
||||
{
|
||||
return Skill(
|
||||
dto.skillId,
|
||||
dto.level,
|
||||
dto.isActive,
|
||||
dto.cost,
|
||||
dto.range,
|
||||
dto.name,
|
||||
dto.description,
|
||||
dto.iconName,
|
||||
dto.isToggled,
|
||||
dto.isCasting,
|
||||
dto.isReloading
|
||||
);
|
||||
}
|
||||
const bool IsEqual(const DTO::Skill* dto) const
|
||||
{
|
||||
return m_SkillId == dto->skillId &&
|
||||
m_Level == dto->level &&
|
||||
m_IsActive == dto->isActive &&
|
||||
m_Cost == dto->cost &&
|
||||
m_Range == dto->range &&
|
||||
m_Name == dto->name &&
|
||||
m_Description == dto->description &&
|
||||
m_IconName == dto->iconName &&
|
||||
m_IsToggled == dto->isToggled &&
|
||||
m_IsCasting == dto->isCasting &&
|
||||
m_IsReloading == dto->isReloading;
|
||||
}
|
||||
|
||||
const std::vector<Serializers::Node> BuildSerializationNodes() const override
|
||||
{
|
||||
std::vector<Serializers::Node> result;
|
||||
|
||||
result.push_back({ "skillId", std::to_string(m_SkillId) });
|
||||
result.push_back({ "level", std::to_string(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 });
|
||||
}
|
||||
|
||||
if (m_PrevState.isNewState || m_Description != m_PrevState.description)
|
||||
{
|
||||
result.push_back({ "description", m_Description });
|
||||
}
|
||||
if (m_PrevState.isNewState || m_Cost != m_PrevState.cost)
|
||||
{
|
||||
result.push_back({ "cost", std::to_string(m_Cost) });
|
||||
}
|
||||
if (m_PrevState.isNewState || m_Range != m_PrevState.range)
|
||||
{
|
||||
result.push_back({ "range", std::to_string(m_Range) });
|
||||
}
|
||||
if (m_PrevState.isNewState || m_IsToggled != m_PrevState.isToggled)
|
||||
{
|
||||
result.push_back({ "isToggled", std::to_string(m_IsToggled) });
|
||||
}
|
||||
if (m_PrevState.isNewState || m_IsCasting != m_PrevState.isCasting)
|
||||
{
|
||||
result.push_back({ "isCasting", std::to_string(m_IsCasting) });
|
||||
}
|
||||
if (m_PrevState.isNewState || m_IsReloading != m_PrevState.isReloading)
|
||||
{
|
||||
result.push_back({ "isReloading", std::to_string(m_IsReloading) });
|
||||
}
|
||||
if (m_PrevState.isNewState || IsReadyToUse() != m_PrevState.isReadyToUse)
|
||||
{
|
||||
result.push_back({ "isReadyToUse", std::to_string(IsReadyToUse()) });
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
Skill(
|
||||
const uint32_t skillId,
|
||||
const uint8_t level,
|
||||
const bool isActive,
|
||||
const uint8_t cost,
|
||||
const int16_t range,
|
||||
const std::string& name,
|
||||
const std::string& description,
|
||||
const std::string& iconName,
|
||||
const bool isToggled,
|
||||
const bool isCasting,
|
||||
const bool isReloading
|
||||
) :
|
||||
m_SkillId(skillId),
|
||||
m_Level(level),
|
||||
m_IsActive(isActive),
|
||||
m_Cost(cost),
|
||||
m_Range(range),
|
||||
m_Name(name),
|
||||
m_Description(description),
|
||||
m_IconName(iconName),
|
||||
m_IsToggled(isToggled),
|
||||
m_IsCasting(isCasting),
|
||||
m_IsReloading(isReloading)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
Skill() = default;
|
||||
virtual ~Skill() = default;
|
||||
|
||||
private:
|
||||
struct State
|
||||
{
|
||||
uint8_t cost = 0;
|
||||
int16_t range = 0;
|
||||
std::string description = "";
|
||||
bool isToggled = false;
|
||||
bool isCasting = false;
|
||||
bool isReloading = false;
|
||||
bool isReadyToUse = true;
|
||||
|
||||
bool isNewState = true;
|
||||
};
|
||||
|
||||
private:
|
||||
uint32_t m_SkillId = 0;
|
||||
uint8_t m_Level = 0;
|
||||
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 = "";
|
||||
bool m_IsToggled = false;
|
||||
bool m_IsCasting = false;
|
||||
bool m_IsReloading = false;
|
||||
State m_PrevState = State();
|
||||
};
|
||||
}
|
74
L2BotCore/Domain/ValueObjects/Transform.h
Normal file
74
L2BotCore/Domain/ValueObjects/Transform.h
Normal file
@@ -0,0 +1,74 @@
|
||||
#pragma once
|
||||
#include "../ValueObjects/Vector3.h"
|
||||
#include "../Serializers/Serializable.h"
|
||||
|
||||
namespace L2Bot::Domain::ValueObjects
|
||||
{
|
||||
class Transform : public Serializers::Serializable
|
||||
{
|
||||
public:
|
||||
const Vector3& GetPosition() const
|
||||
{
|
||||
return m_Position;
|
||||
}
|
||||
const Vector3& GetRotation() const
|
||||
{
|
||||
return m_Rotation;
|
||||
}
|
||||
const Vector3& GetVelocity() const
|
||||
{
|
||||
return m_Velocity;
|
||||
}
|
||||
const Vector3& GetAcceleration() const
|
||||
{
|
||||
return m_Acceleration;
|
||||
}
|
||||
const bool IsEqual(const Transform* other) const
|
||||
{
|
||||
return m_Position.IsEqual(&other->m_Position) &&
|
||||
m_Rotation.IsEqual(&other->m_Rotation) &&
|
||||
m_Velocity.IsEqual(&other->m_Velocity) &&
|
||||
m_Acceleration.IsEqual(&other->m_Acceleration);
|
||||
}
|
||||
const float_t GetSqrDistance(const Transform& other) const
|
||||
{
|
||||
return m_Position.GetSqrDistance(other.m_Position);
|
||||
}
|
||||
const float_t GetHorizontalSqrDistance(const Transform& other) const
|
||||
{
|
||||
return m_Position.GetHorizontalSqrDistance(other.m_Position);
|
||||
}
|
||||
|
||||
const std::vector<Serializers::Node> BuildSerializationNodes() const override
|
||||
{
|
||||
return std::vector<Serializers::Node>
|
||||
{
|
||||
{ "position", m_Position.BuildSerializationNodes() },
|
||||
{ "rotation", m_Rotation.BuildSerializationNodes() },
|
||||
{ "velocity", m_Velocity.BuildSerializationNodes() },
|
||||
{ "acceleration", m_Acceleration.BuildSerializationNodes() }
|
||||
};
|
||||
}
|
||||
|
||||
Transform(
|
||||
const Vector3 position,
|
||||
const Vector3 rotation,
|
||||
const Vector3 velocity,
|
||||
const Vector3 acceleration
|
||||
) :
|
||||
m_Position(position),
|
||||
m_Rotation(rotation),
|
||||
m_Velocity(velocity),
|
||||
m_Acceleration(acceleration)
|
||||
{
|
||||
}
|
||||
|
||||
Transform() = default;
|
||||
virtual ~Transform() = default;
|
||||
private:
|
||||
Vector3 m_Position = Vector3();
|
||||
Vector3 m_Rotation = Vector3();
|
||||
Vector3 m_Velocity = Vector3();
|
||||
Vector3 m_Acceleration = Vector3();
|
||||
};
|
||||
}
|
112
L2BotCore/Domain/ValueObjects/VariableStats.h
Normal file
112
L2BotCore/Domain/ValueObjects/VariableStats.h
Normal file
@@ -0,0 +1,112 @@
|
||||
#pragma once
|
||||
#include <cstdint>
|
||||
#include "../Serializers/Serializable.h"
|
||||
|
||||
namespace L2Bot::Domain::ValueObjects
|
||||
{
|
||||
class VariableStats : public Serializers::Serializable
|
||||
{
|
||||
public:
|
||||
const uint16_t GetAccuracy() const
|
||||
{
|
||||
return m_Accuracy;
|
||||
}
|
||||
const uint16_t GetCritRate() const
|
||||
{
|
||||
return m_CritRate;
|
||||
}
|
||||
const uint16_t GetPAttack() const
|
||||
{
|
||||
return m_PAttack;
|
||||
}
|
||||
const uint16_t GetAttackSpeed() const
|
||||
{
|
||||
return m_AttackSpeed;
|
||||
}
|
||||
const uint16_t GetPDefense() const
|
||||
{
|
||||
return m_PDefense;
|
||||
}
|
||||
const uint16_t GetEvasion() const
|
||||
{
|
||||
return m_Evasion;
|
||||
}
|
||||
const uint16_t GetMAttack() const
|
||||
{
|
||||
return m_MAttack;
|
||||
}
|
||||
const uint16_t GetMDefense() const
|
||||
{
|
||||
return m_MDefense;
|
||||
}
|
||||
const uint16_t GetCastingSpeed() const
|
||||
{
|
||||
return m_CastingSpeed;
|
||||
}
|
||||
const bool IsEqual(const VariableStats* other) const
|
||||
{
|
||||
return m_Accuracy == other->m_Accuracy &&
|
||||
m_CritRate == other->m_CritRate &&
|
||||
m_PAttack == other->m_PAttack &&
|
||||
m_AttackSpeed == other->m_AttackSpeed &&
|
||||
m_PDefense == other->m_PDefense &&
|
||||
m_Evasion == other->m_Evasion &&
|
||||
m_MAttack == other->m_MAttack &&
|
||||
m_MDefense == other->m_MDefense &&
|
||||
m_CastingSpeed == other->m_CastingSpeed;
|
||||
}
|
||||
|
||||
const std::vector<Serializers::Node> BuildSerializationNodes() const override
|
||||
{
|
||||
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) }
|
||||
};
|
||||
}
|
||||
|
||||
VariableStats(
|
||||
uint16_t accuracy,
|
||||
uint16_t critRate,
|
||||
uint16_t pAttack,
|
||||
uint16_t attackSpeed,
|
||||
uint16_t pDefense,
|
||||
uint16_t evasion,
|
||||
uint16_t mAttack,
|
||||
uint16_t mDefense,
|
||||
uint16_t castingSpeed
|
||||
) :
|
||||
m_Accuracy(accuracy),
|
||||
m_CritRate(critRate),
|
||||
m_PAttack(pAttack),
|
||||
m_AttackSpeed(attackSpeed),
|
||||
m_PDefense(pDefense),
|
||||
m_Evasion(evasion),
|
||||
m_MAttack(mAttack),
|
||||
m_MDefense(mDefense),
|
||||
m_CastingSpeed(castingSpeed)
|
||||
{
|
||||
}
|
||||
|
||||
VariableStats() = default;
|
||||
virtual ~VariableStats() = default;
|
||||
|
||||
private:
|
||||
uint16_t m_Accuracy = 0;
|
||||
uint16_t m_CritRate = 0;
|
||||
uint16_t m_PAttack = 0;
|
||||
uint16_t m_AttackSpeed = 0;
|
||||
uint16_t m_PDefense = 0;
|
||||
uint16_t m_Evasion = 0;
|
||||
uint16_t m_MAttack = 0;
|
||||
uint16_t m_MDefense = 0;
|
||||
uint16_t m_CastingSpeed = 0;
|
||||
};
|
||||
}
|
64
L2BotCore/Domain/ValueObjects/Vector3.h
Normal file
64
L2BotCore/Domain/ValueObjects/Vector3.h
Normal file
@@ -0,0 +1,64 @@
|
||||
#pragma once
|
||||
#include <math.h>
|
||||
#include "../Serializers/Serializable.h"
|
||||
|
||||
namespace L2Bot::Domain::ValueObjects
|
||||
{
|
||||
class Vector3 : public Serializers::Serializable
|
||||
{
|
||||
public:
|
||||
const float_t GetX() const
|
||||
{
|
||||
return m_X;
|
||||
}
|
||||
const float_t GetY() const
|
||||
{
|
||||
return m_Y;
|
||||
}
|
||||
const float_t GetZ() const
|
||||
{
|
||||
return m_Z;
|
||||
}
|
||||
const bool IsEqual(const Vector3* other) const
|
||||
{
|
||||
float_t epsilon = 0.0001f;
|
||||
return fabsf(m_X - other->m_X) < epsilon &&
|
||||
fabsf(m_Y - other->m_Y) < epsilon &&
|
||||
fabsf(m_Z - other->m_Z) < epsilon;
|
||||
}
|
||||
const float_t GetSqrDistance(const Vector3& other) const
|
||||
{
|
||||
return (m_X - other.m_X) * (m_X - other.m_X) +
|
||||
(m_Y - other.m_Y) * (m_Y - other.m_Y) +
|
||||
(m_Z - other.m_Z) * (m_Z - other.m_Z);
|
||||
}
|
||||
const float_t GetHorizontalSqrDistance(const Vector3& other) const
|
||||
{
|
||||
return (m_X - other.m_X) * (m_X - other.m_X) +
|
||||
(m_Y - other.m_Y) * (m_Y - other.m_Y);
|
||||
}
|
||||
|
||||
const std::vector<Serializers::Node> BuildSerializationNodes() const override
|
||||
{
|
||||
return std::vector<Serializers::Node>
|
||||
{
|
||||
{ "x", std::to_string(m_X) },
|
||||
{ "y", std::to_string(m_Y) },
|
||||
{ "z", std::to_string(m_Z) }
|
||||
};
|
||||
}
|
||||
|
||||
Vector3(const float_t x, const float_t y, const float_t z) :
|
||||
m_X(x), m_Y(y), m_Z(z)
|
||||
{
|
||||
}
|
||||
|
||||
Vector3() = default;
|
||||
virtual ~Vector3() = default;
|
||||
|
||||
private:
|
||||
float_t m_X = 0;
|
||||
float_t m_Y = 0;
|
||||
float_t m_Z = 0;
|
||||
};
|
||||
}
|
89
L2BotCore/Domain/ValueObjects/VitalStats.h
Normal file
89
L2BotCore/Domain/ValueObjects/VitalStats.h
Normal file
@@ -0,0 +1,89 @@
|
||||
#pragma once
|
||||
#include <cstdint>
|
||||
#include "../Serializers/Serializable.h"
|
||||
|
||||
namespace L2Bot::Domain::ValueObjects
|
||||
{
|
||||
class VitalStats : public Serializers::Serializable
|
||||
{
|
||||
public:
|
||||
const bool IsAlive() const
|
||||
{
|
||||
return m_MaxHp <= 0 || m_Hp > 0;
|
||||
}
|
||||
const uint32_t GetMaxHp() const
|
||||
{
|
||||
return m_MaxHp;
|
||||
}
|
||||
const uint32_t GetHp() const
|
||||
{
|
||||
return m_Hp;
|
||||
}
|
||||
const uint32_t GetMaxMp() const
|
||||
{
|
||||
return m_MaxMp;
|
||||
}
|
||||
const uint32_t GetMp() const
|
||||
{
|
||||
return m_Mp;
|
||||
}
|
||||
const uint32_t GetMaxCp() const
|
||||
{
|
||||
return m_MaxCp;
|
||||
}
|
||||
const uint32_t GetCp() const
|
||||
{
|
||||
return m_Cp;
|
||||
}
|
||||
const bool IsEqual(const VitalStats* other) const
|
||||
{
|
||||
return m_MaxHp == other->m_MaxHp &&
|
||||
m_Hp == other->m_Hp &&
|
||||
m_MaxMp == other->m_MaxMp &&
|
||||
m_Mp == other->m_Mp &&
|
||||
m_MaxCp == other->m_MaxCp &&
|
||||
m_Cp == other->m_Cp;
|
||||
}
|
||||
|
||||
const std::vector<Serializers::Node> BuildSerializationNodes() const override
|
||||
{
|
||||
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) }
|
||||
};
|
||||
}
|
||||
|
||||
VitalStats(
|
||||
uint32_t maxHp,
|
||||
uint32_t hp,
|
||||
uint32_t maxMp,
|
||||
uint32_t mp,
|
||||
uint32_t maxCp,
|
||||
uint32_t cp
|
||||
) :
|
||||
m_MaxHp(maxHp),
|
||||
m_Hp(hp),
|
||||
m_MaxMp(maxMp),
|
||||
m_Mp(mp),
|
||||
m_MaxCp(maxCp),
|
||||
m_Cp(cp)
|
||||
{
|
||||
}
|
||||
|
||||
VitalStats() = default;
|
||||
virtual ~VitalStats() = default;
|
||||
|
||||
private:
|
||||
uint32_t m_MaxHp = 0;
|
||||
uint32_t m_Hp = 0;
|
||||
uint32_t m_MaxMp = 0;
|
||||
uint32_t m_Mp = 0;
|
||||
uint32_t m_MaxCp = 0;
|
||||
uint32_t m_Cp = 0;
|
||||
};
|
||||
}
|
230
L2BotCore/L2BotCore.vcxproj
Normal file
230
L2BotCore/L2BotCore.vcxproj
Normal file
@@ -0,0 +1,230 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<VCProjectVersion>16.0</VCProjectVersion>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<ProjectGuid>{504a5403-ba08-46df-aa8a-b79993b56bca}</ProjectGuid>
|
||||
<RootNamespace>L2BotCore</RootNamespace>
|
||||
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="Shared">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
<OutDir>$(SolutionDir)$(Configuration)\bin\</OutDir>
|
||||
<IntDir>$(SolutionDir)$(Configuration)\$(ProjectName)\</IntDir>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<OutDir>$(SolutionDir)$(Configuration)\bin\</OutDir>
|
||||
<IntDir>$(SolutionDir)$(Configuration)\$(ProjectName)\</IntDir>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
|
||||
<LanguageStandard>stdcpp20</LanguageStandard>
|
||||
<LanguageStandard_C>stdc17</LanguageStandard_C>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>
|
||||
</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
|
||||
<LanguageStandard>stdcpp20</LanguageStandard>
|
||||
<LanguageStandard_C>stdc17</LanguageStandard_C>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>
|
||||
</SubSystem>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>
|
||||
</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>
|
||||
</SubSystem>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="Domain\DTO\BaseItem.h" />
|
||||
<ClInclude Include="Domain\DTO\Skill.h" />
|
||||
<ClInclude Include="Domain\Repositories\ItemRepositoryInterface.h" />
|
||||
<ClInclude Include="Domain\Repositories\SkillRepositoryInterface.h" />
|
||||
<ClInclude Include="Domain\Serializers\SerializableStateContainerPtr.h" />
|
||||
<ClInclude Include="Domain\Services\ItemService.h" />
|
||||
<ClInclude Include="Domain\Services\ObjectServicePtr.h" />
|
||||
<ClInclude Include="Domain\Services\SkillService.h" />
|
||||
<ClInclude Include="Domain\ValueObjects\BaseItem.h" />
|
||||
<ClInclude Include="Domain\ValueObjects\Skill.h" />
|
||||
<ClInclude Include="Domain\ValueObjects\Vector3.h" />
|
||||
<ClInclude Include="Domain\Enums\SpoilStateEnum.h" />
|
||||
<ClInclude Include="Domain\Transports\TransportInterface.h" />
|
||||
<ClInclude Include="Domain\DTO\Drop.h" />
|
||||
<ClInclude Include="Domain\DTO\Hero.h" />
|
||||
<ClInclude Include="Domain\DTO\NPC.h" />
|
||||
<ClInclude Include="Domain\DTO\ObjectState.h" />
|
||||
<ClInclude Include="Domain\DTO\Player.h" />
|
||||
<ClInclude Include="Domain\DTO\WorldObject.h" />
|
||||
<ClInclude Include="Domain\Entities\Drop.h" />
|
||||
<ClInclude Include="Domain\Entities\Hero.h" />
|
||||
<ClInclude Include="Domain\Entities\NPC.h" />
|
||||
<ClInclude Include="Domain\Entities\Player.h" />
|
||||
<ClInclude Include="Domain\Entities\WorldObject.h" />
|
||||
<ClInclude Include="Domain\Enums\ClassEnum.h" />
|
||||
<ClInclude Include="Domain\Enums\ObjectStateEnum.h" />
|
||||
<ClInclude Include="Domain\Enums\RaceEnum.h" />
|
||||
<ClInclude Include="Domain\Repositories\DropRepositoryInterface.h" />
|
||||
<ClInclude Include="Domain\Repositories\HeroRepositoryInterface.h" />
|
||||
<ClInclude Include="Domain\Repositories\NPCRepositoryInterface.h" />
|
||||
<ClInclude Include="Domain\Repositories\ObjectRepositoryInterface.h" />
|
||||
<ClInclude Include="Domain\Repositories\PlayerRepositoryInterface.h" />
|
||||
<ClInclude Include="Domain\Serializers\Node.h" />
|
||||
<ClInclude Include="Domain\Serializers\Serializable.h" />
|
||||
<ClInclude Include="Domain\Serializers\SerializerInterface.h" />
|
||||
<ClInclude Include="Domain\Services\DropService.h" />
|
||||
<ClInclude Include="Domain\Services\HeroService.h" />
|
||||
<ClInclude Include="Domain\Services\NPCService.h" />
|
||||
<ClInclude Include="Domain\Services\ObjectService.h" />
|
||||
<ClInclude Include="Domain\Services\PlayerService.h" />
|
||||
<ClInclude Include="Domain\ValueObjects\ExperienceInfo.h" />
|
||||
<ClInclude Include="Domain\ValueObjects\FullName.h" />
|
||||
<ClInclude Include="Domain\ValueObjects\InventoryInfo.h" />
|
||||
<ClInclude Include="Domain\Serializers\SerializableStateContainer.h" />
|
||||
<ClInclude Include="Domain\ValueObjects\PermanentStats.h" />
|
||||
<ClInclude Include="Domain\ValueObjects\Phenotype.h" />
|
||||
<ClInclude Include="Domain\ValueObjects\Reputation.h" />
|
||||
<ClInclude Include="Domain\ValueObjects\Transform.h" />
|
||||
<ClInclude Include="Domain\ValueObjects\VariableStats.h" />
|
||||
<ClInclude Include="Domain\ValueObjects\VitalStats.h" />
|
||||
<ClInclude Include="framework.h" />
|
||||
<ClInclude Include="pch.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="pch.cpp">
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
|
||||
<LanguageStandard Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">stdcpp20</LanguageStandard>
|
||||
<LanguageStandard Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">stdcpp20</LanguageStandard>
|
||||
<LanguageStandard Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">stdcpp20</LanguageStandard>
|
||||
<LanguageStandard Condition="'$(Configuration)|$(Platform)'=='Release|x64'">stdcpp20</LanguageStandard>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
180
L2BotCore/L2BotCore.vcxproj.filters
Normal file
180
L2BotCore/L2BotCore.vcxproj.filters
Normal file
@@ -0,0 +1,180 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Source Files">
|
||||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||
<Extensions>cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Header Files">
|
||||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||
<Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Resource Files">
|
||||
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="framework.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="pch.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Domain\ValueObjects\Vector3.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Domain\DTO\Drop.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Domain\DTO\WorldObject.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Domain\Entities\Drop.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Domain\Entities\Hero.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Domain\Entities\NPC.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Domain\Entities\Player.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Domain\Entities\WorldObject.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Domain\Enums\ClassEnum.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Domain\Enums\RaceEnum.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Domain\Repositories\DropRepositoryInterface.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Domain\Services\DropService.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Domain\ValueObjects\ExperienceInfo.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Domain\ValueObjects\FullName.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Domain\ValueObjects\InventoryInfo.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Domain\ValueObjects\PermanentStats.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Domain\ValueObjects\Phenotype.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Domain\ValueObjects\Reputation.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Domain\ValueObjects\Transform.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Domain\ValueObjects\VariableStats.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Domain\ValueObjects\VitalStats.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Domain\DTO\Hero.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Domain\DTO\NPC.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Domain\DTO\Player.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Domain\Services\ObjectService.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Domain\Repositories\ObjectRepositoryInterface.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Domain\Services\NPCService.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Domain\Repositories\NPCRepositoryInterface.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Domain\Repositories\PlayerRepositoryInterface.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Domain\Services\PlayerService.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Domain\Repositories\HeroRepositoryInterface.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Domain\Services\HeroService.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Domain\Enums\ObjectStateEnum.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Domain\DTO\ObjectState.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Domain\Serializers\Serializable.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Domain\Serializers\SerializerInterface.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Domain\Serializers\Node.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Domain\Serializers\SerializableStateContainer.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Domain\Transports\TransportInterface.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Domain\Enums\SpoilStateEnum.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Domain\DTO\Skill.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Domain\ValueObjects\Skill.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Domain\Repositories\SkillRepositoryInterface.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Domain\Services\SkillService.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Domain\DTO\BaseItem.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Domain\ValueObjects\BaseItem.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Domain\Repositories\ItemRepositoryInterface.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Domain\Services\ItemService.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Domain\Serializers\SerializableStateContainerPtr.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Domain\Services\ObjectServicePtr.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="pch.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
</Project>
|
7
L2BotCore/framework.h
Normal file
7
L2BotCore/framework.h
Normal file
@@ -0,0 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
|
||||
// Windows Header Files
|
||||
#include <windows.h>
|
||||
#include <math.h>
|
||||
#include <cstdint>
|
5
L2BotCore/pch.cpp
Normal file
5
L2BotCore/pch.cpp
Normal file
@@ -0,0 +1,5 @@
|
||||
// pch.cpp: source file corresponding to the pre-compiled header
|
||||
|
||||
#include "pch.h"
|
||||
|
||||
// When you are using pre-compiled headers, this source file is necessary for compilation to succeed.
|
13
L2BotCore/pch.h
Normal file
13
L2BotCore/pch.h
Normal file
@@ -0,0 +1,13 @@
|
||||
// pch.h: This is a precompiled header file.
|
||||
// Files listed below are compiled only once, improving build performance for future builds.
|
||||
// This also affects IntelliSense performance, including code completion and many code browsing features.
|
||||
// However, files listed here are ALL re-compiled if any one of them is updated between builds.
|
||||
// Do not add files here that you will be updating frequently as this negates the performance advantage.
|
||||
|
||||
#ifndef PCH_H
|
||||
#define PCH_H
|
||||
|
||||
// add headers that you want to pre-compile here
|
||||
#include "framework.h"
|
||||
|
||||
#endif //PCH_H
|
Reference in New Issue
Block a user