refactor: remove unnecessary classes

This commit is contained in:
k0t9i
2023-10-16 00:03:43 +04:00
parent a7a9b626f4
commit 787f4969ed
57 changed files with 1651 additions and 1600 deletions

View File

@@ -2,7 +2,9 @@
#include <cstdint>
#include <string>
#include <vector>
#include <functional>
#include "EntityInterface.h"
#include "../Helpers/HashCombiner.h"
namespace L2Bot::Domain::Entities
{
@@ -14,29 +16,30 @@ namespace L2Bot::Domain::Entities
return m_SkillId;
}
void Update(const EntityInterface* other) override
{
const AbnormalEffect* casted = static_cast<const AbnormalEffect*>(other);
SaveState();
m_SkillId = casted->m_SkillId;
m_Level = casted->m_Level;
m_Name = casted->m_Name;
m_Description = casted->m_Description;
m_IconName = casted->m_IconName;
void Update(
const uint8_t level,
const std::wstring& name,
const std::wstring& description,
const std::wstring& iconName
) {
m_Level = level;
m_Name = name;
m_Description = description;
m_IconName = iconName;
}
void SaveState() override
const size_t GetHash() const override
{
m_IsNewState = false;
return Helpers::CombineHashes({
std::hash<uint32_t>{}(m_SkillId),
std::hash<uint8_t>{}(m_Level),
std::hash<std::wstring>{}(m_Name),
std::hash<std::wstring>{}(m_Description),
std::hash<std::wstring>{}(m_IconName)
});
}
const bool IsEqual(const EntityInterface* other) const override
const std::string GetEntityName() const override
{
const AbnormalEffect* casted = static_cast<const AbnormalEffect*>(other);
return m_SkillId == casted->m_SkillId &&
m_Level == casted->m_Level &&
m_Name == casted->m_Name &&
m_Description == casted->m_Description &&
m_IconName == casted->m_IconName;
return "abnormalEffect";
}
const std::vector<Serializers::Node> BuildSerializationNodes() const override
@@ -45,13 +48,9 @@ namespace L2Bot::Domain::Entities
result.push_back({ L"id", std::to_wstring(m_SkillId) });
result.push_back({ L"level", std::to_wstring(m_Level) });
if (m_IsNewState)
{
result.push_back({ L"name", m_Name });
result.push_back({ L"iconName", m_IconName });
result.push_back({ L"description", m_Description });
}
result.push_back({ L"name", m_Name });
result.push_back({ L"iconName", m_IconName });
result.push_back({ L"description", m_Description });
return result;
}
@@ -72,15 +71,6 @@ namespace L2Bot::Domain::Entities
}
AbnormalEffect(const AbnormalEffect* other) :
m_SkillId(other->m_SkillId),
m_Level(other->m_Level),
m_Name(other->m_Name),
m_Description(other->m_Description),
m_IconName(other->m_IconName)
{
}
AbnormalEffect() = default;
virtual ~AbnormalEffect() = default;
@@ -90,6 +80,5 @@ namespace L2Bot::Domain::Entities
std::wstring m_Name = L"";
std::wstring m_Description = L"";
std::wstring m_IconName = L"";
bool m_IsNewState = true;
};
}