feat: add weapon and shield items
This commit is contained in:
parent
2b94f823f2
commit
ca0183603f
@ -113,7 +113,8 @@ namespace L2Bot::Domain::Entities
|
|||||||
name,
|
name,
|
||||||
iconName,
|
iconName,
|
||||||
description,
|
description,
|
||||||
weight
|
weight,
|
||||||
|
Enums::ItemType::armor
|
||||||
),
|
),
|
||||||
m_IsEquipped(isEquipped),
|
m_IsEquipped(isEquipped),
|
||||||
m_EnchantLevel(enchantLevel),
|
m_EnchantLevel(enchantLevel),
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include "EntityInterface.h"
|
#include "EntityInterface.h"
|
||||||
|
#include "../Enums/ItemType.h"
|
||||||
|
|
||||||
namespace L2Bot::Domain::Entities
|
namespace L2Bot::Domain::Entities
|
||||||
{
|
{
|
||||||
@ -25,6 +26,7 @@ namespace L2Bot::Domain::Entities
|
|||||||
m_IconName = casted->m_IconName;
|
m_IconName = casted->m_IconName;
|
||||||
m_Description = casted->m_Description;
|
m_Description = casted->m_Description;
|
||||||
m_Weight = casted->m_Weight;
|
m_Weight = casted->m_Weight;
|
||||||
|
m_Type = casted->m_Type;
|
||||||
}
|
}
|
||||||
virtual void SaveState() override
|
virtual void SaveState() override
|
||||||
{
|
{
|
||||||
@ -44,7 +46,8 @@ namespace L2Bot::Domain::Entities
|
|||||||
m_Name == casted->m_Name &&
|
m_Name == casted->m_Name &&
|
||||||
m_IconName == casted->m_IconName &&
|
m_IconName == casted->m_IconName &&
|
||||||
m_Description == casted->m_Description &&
|
m_Description == casted->m_Description &&
|
||||||
m_Weight == casted->m_Weight;
|
m_Weight == casted->m_Weight &&
|
||||||
|
m_Type == casted->m_Type;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual const std::vector<Serializers::Node> BuildSerializationNodes() const override
|
virtual const std::vector<Serializers::Node> BuildSerializationNodes() const override
|
||||||
@ -56,6 +59,7 @@ namespace L2Bot::Domain::Entities
|
|||||||
|
|
||||||
if (m_PrevState.isNewState)
|
if (m_PrevState.isNewState)
|
||||||
{
|
{
|
||||||
|
result.push_back({ "type", std::to_string(static_cast<int8_t>(m_Type))});
|
||||||
result.push_back({ "name", m_Name });
|
result.push_back({ "name", m_Name });
|
||||||
result.push_back({ "iconName", m_IconName });
|
result.push_back({ "iconName", m_IconName });
|
||||||
result.push_back({ "description", m_Description });
|
result.push_back({ "description", m_Description });
|
||||||
@ -80,7 +84,8 @@ namespace L2Bot::Domain::Entities
|
|||||||
const std::string& name,
|
const std::string& name,
|
||||||
const std::string& iconName,
|
const std::string& iconName,
|
||||||
const std::string& description,
|
const std::string& description,
|
||||||
const uint16_t weight
|
const uint16_t weight,
|
||||||
|
const Enums::ItemType type
|
||||||
) :
|
) :
|
||||||
m_ObjectId(objectId),
|
m_ObjectId(objectId),
|
||||||
m_ItemId(itemId),
|
m_ItemId(itemId),
|
||||||
@ -88,7 +93,8 @@ namespace L2Bot::Domain::Entities
|
|||||||
m_Name(name),
|
m_Name(name),
|
||||||
m_IconName(iconName),
|
m_IconName(iconName),
|
||||||
m_Description(description),
|
m_Description(description),
|
||||||
m_Weight(weight)
|
m_Weight(weight),
|
||||||
|
m_Type(type)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -99,7 +105,8 @@ namespace L2Bot::Domain::Entities
|
|||||||
m_Name(other->m_Name),
|
m_Name(other->m_Name),
|
||||||
m_IconName(other->m_IconName),
|
m_IconName(other->m_IconName),
|
||||||
m_Description(other->m_Description),
|
m_Description(other->m_Description),
|
||||||
m_Weight(other->m_Weight)
|
m_Weight(other->m_Weight),
|
||||||
|
m_Type(other->m_Type)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -123,6 +130,7 @@ namespace L2Bot::Domain::Entities
|
|||||||
std::string m_IconName = "";
|
std::string m_IconName = "";
|
||||||
std::string m_Description = "";
|
std::string m_Description = "";
|
||||||
uint16_t m_Weight = 0;
|
uint16_t m_Weight = 0;
|
||||||
|
Enums::ItemType m_Type = Enums::ItemType::none;
|
||||||
GetState m_PrevState = GetState();
|
GetState m_PrevState = GetState();
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -71,7 +71,8 @@ namespace L2Bot::Domain::Entities
|
|||||||
name,
|
name,
|
||||||
iconName,
|
iconName,
|
||||||
description,
|
description,
|
||||||
weight
|
weight,
|
||||||
|
Enums::ItemType::etc
|
||||||
),
|
),
|
||||||
m_Amount(amount),
|
m_Amount(amount),
|
||||||
m_IsQuest(isQuest)
|
m_IsQuest(isQuest)
|
||||||
|
146
L2BotCore/Domain/Entities/ShieldItem.h
Normal file
146
L2BotCore/Domain/Entities/ShieldItem.h
Normal file
@ -0,0 +1,146 @@
|
|||||||
|
#pragma once
|
||||||
|
#include <cstdint>
|
||||||
|
#include <string>
|
||||||
|
#include <vector>
|
||||||
|
#include "BaseItem.h"
|
||||||
|
#include "../Enums/CrystalType.h"
|
||||||
|
|
||||||
|
namespace L2Bot::Domain::Entities
|
||||||
|
{
|
||||||
|
class ShieldItem : public BaseItem
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
void Update(const EntityInterface* other) override
|
||||||
|
{
|
||||||
|
const ShieldItem* casted = static_cast<const ShieldItem*>(other);
|
||||||
|
|
||||||
|
BaseItem::Update(other);
|
||||||
|
|
||||||
|
m_IsEquipped = casted->m_IsEquipped;
|
||||||
|
m_EnchantLevel = casted->m_EnchantLevel;
|
||||||
|
m_CrystalType = casted->m_CrystalType;
|
||||||
|
m_Evasion = casted->m_Evasion;
|
||||||
|
m_PDef = casted->m_PDef;
|
||||||
|
m_DefRate = casted->m_DefRate;
|
||||||
|
}
|
||||||
|
void SaveState() override
|
||||||
|
{
|
||||||
|
BaseItem::SaveState();
|
||||||
|
m_PrevState =
|
||||||
|
{
|
||||||
|
m_IsEquipped,
|
||||||
|
m_EnchantLevel,
|
||||||
|
m_PDef,
|
||||||
|
false
|
||||||
|
};
|
||||||
|
}
|
||||||
|
const bool IsEqual(const EntityInterface* other) const override
|
||||||
|
{
|
||||||
|
const ShieldItem* casted = static_cast<const ShieldItem*>(other);
|
||||||
|
return BaseItem::IsEqual(other) &&
|
||||||
|
m_IsEquipped == casted->m_IsEquipped &&
|
||||||
|
m_EnchantLevel == casted->m_EnchantLevel &&
|
||||||
|
m_CrystalType == casted->m_CrystalType &&
|
||||||
|
m_Evasion == casted->m_Evasion &&
|
||||||
|
m_PDef == casted->m_PDef &&
|
||||||
|
m_DefRate == casted->m_DefRate;
|
||||||
|
}
|
||||||
|
|
||||||
|
const std::vector<Serializers::Node> BuildSerializationNodes() const override
|
||||||
|
{
|
||||||
|
std::vector<Serializers::Node> result = BaseItem::BuildSerializationNodes();
|
||||||
|
|
||||||
|
if (m_PrevState.isNewState)
|
||||||
|
{
|
||||||
|
result.push_back({ "crystalType", std::to_string(static_cast<int8_t>(m_CrystalType)) });
|
||||||
|
result.push_back({ "evasion", std::to_string(m_Evasion) });
|
||||||
|
result.push_back({ "defRate", std::to_string(m_DefRate) });
|
||||||
|
}
|
||||||
|
|
||||||
|
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_PDef != m_PrevState.pDef)
|
||||||
|
{
|
||||||
|
result.push_back({ "pDef", std::to_string(m_PDef) });
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
ShieldItem(
|
||||||
|
const uint32_t objectId,
|
||||||
|
const uint32_t itemId,
|
||||||
|
const int32_t mana,
|
||||||
|
const std::string& name,
|
||||||
|
const std::string& iconName,
|
||||||
|
const std::string& description,
|
||||||
|
const uint16_t weight,
|
||||||
|
const bool isEquipped,
|
||||||
|
const uint16_t enchantLevel,
|
||||||
|
const Enums::CrystalType crystalType,
|
||||||
|
const int16_t evasion,
|
||||||
|
const uint16_t pDef,
|
||||||
|
const uint16_t defRate
|
||||||
|
) :
|
||||||
|
BaseItem
|
||||||
|
(
|
||||||
|
objectId,
|
||||||
|
itemId,
|
||||||
|
mana,
|
||||||
|
name,
|
||||||
|
iconName,
|
||||||
|
description,
|
||||||
|
weight,
|
||||||
|
Enums::ItemType::shield
|
||||||
|
),
|
||||||
|
m_IsEquipped(isEquipped),
|
||||||
|
m_EnchantLevel(enchantLevel),
|
||||||
|
m_CrystalType(crystalType),
|
||||||
|
m_Evasion(evasion),
|
||||||
|
m_PDef(pDef),
|
||||||
|
m_DefRate(defRate)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
ShieldItem(const ShieldItem* other) :
|
||||||
|
BaseItem(other),
|
||||||
|
m_IsEquipped(other->m_IsEquipped),
|
||||||
|
m_EnchantLevel(other->m_EnchantLevel),
|
||||||
|
m_CrystalType(other->m_CrystalType),
|
||||||
|
m_Evasion(other->m_Evasion),
|
||||||
|
m_PDef(other->m_PDef),
|
||||||
|
m_DefRate(other->m_DefRate)
|
||||||
|
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
ShieldItem() = default;
|
||||||
|
virtual ~ShieldItem() = default;
|
||||||
|
|
||||||
|
private:
|
||||||
|
struct GetState
|
||||||
|
{
|
||||||
|
bool isEquipped = 0;
|
||||||
|
uint16_t enchantLevel = 0;
|
||||||
|
uint16_t pDef = 0;
|
||||||
|
|
||||||
|
bool isNewState = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
private:
|
||||||
|
bool m_IsEquipped = 0;
|
||||||
|
uint16_t m_EnchantLevel = 0;
|
||||||
|
Enums::CrystalType m_CrystalType = Enums::CrystalType::none;
|
||||||
|
int16_t m_Evasion = 0;
|
||||||
|
uint16_t m_PDef = 0;
|
||||||
|
uint16_t m_DefRate = 0;
|
||||||
|
|
||||||
|
GetState m_PrevState = GetState();
|
||||||
|
};
|
||||||
|
}
|
201
L2BotCore/Domain/Entities/WeaponItem.h
Normal file
201
L2BotCore/Domain/Entities/WeaponItem.h
Normal file
@ -0,0 +1,201 @@
|
|||||||
|
#pragma once
|
||||||
|
#include <cstdint>
|
||||||
|
#include <string>
|
||||||
|
#include <vector>
|
||||||
|
#include "BaseItem.h"
|
||||||
|
#include "../Enums/WeaponType.h"
|
||||||
|
#include "../Enums/CrystalType.h"
|
||||||
|
|
||||||
|
namespace L2Bot::Domain::Entities
|
||||||
|
{
|
||||||
|
class WeaponItem : public BaseItem
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
void Update(const EntityInterface* other) override
|
||||||
|
{
|
||||||
|
const WeaponItem* casted = static_cast<const WeaponItem*>(other);
|
||||||
|
|
||||||
|
BaseItem::Update(other);
|
||||||
|
|
||||||
|
m_IsEquipped = casted->m_IsEquipped;
|
||||||
|
m_EnchantLevel = casted->m_EnchantLevel;
|
||||||
|
m_WeaponType = casted->m_WeaponType;
|
||||||
|
m_CrystalType = casted->m_CrystalType;
|
||||||
|
m_PAtk = casted->m_PAtk;
|
||||||
|
m_MAtk = casted->m_MAtk;
|
||||||
|
m_RndDamage = casted->m_RndDamage;
|
||||||
|
m_Critical = casted->m_Critical;
|
||||||
|
m_HitModify = casted->m_HitModify;
|
||||||
|
m_AtkSpd = casted->m_AtkSpd;
|
||||||
|
m_MpConsume = casted->m_MpConsume;
|
||||||
|
m_SoulshotCount = casted->m_SoulshotCount;
|
||||||
|
m_SpiritshotCount = casted->m_SpiritshotCount;
|
||||||
|
}
|
||||||
|
void SaveState() override
|
||||||
|
{
|
||||||
|
BaseItem::SaveState();
|
||||||
|
m_PrevState =
|
||||||
|
{
|
||||||
|
m_IsEquipped,
|
||||||
|
m_EnchantLevel,
|
||||||
|
m_PAtk,
|
||||||
|
m_MAtk,
|
||||||
|
false
|
||||||
|
};
|
||||||
|
}
|
||||||
|
const bool IsEqual(const EntityInterface* other) const override
|
||||||
|
{
|
||||||
|
const WeaponItem* casted = static_cast<const WeaponItem*>(other);
|
||||||
|
return BaseItem::IsEqual(other) &&
|
||||||
|
m_IsEquipped == casted->m_IsEquipped &&
|
||||||
|
m_EnchantLevel == casted->m_EnchantLevel &&
|
||||||
|
m_WeaponType == casted->m_WeaponType &&
|
||||||
|
m_CrystalType == casted->m_CrystalType &&
|
||||||
|
m_PAtk == casted->m_PAtk &&
|
||||||
|
m_MAtk == casted->m_MAtk &&
|
||||||
|
m_RndDamage == casted->m_RndDamage &&
|
||||||
|
m_Critical == casted->m_Critical &&
|
||||||
|
m_HitModify == casted->m_HitModify &&
|
||||||
|
m_AtkSpd == casted->m_AtkSpd &&
|
||||||
|
m_MpConsume == casted->m_MpConsume &&
|
||||||
|
m_SoulshotCount == casted->m_SoulshotCount &&
|
||||||
|
m_SpiritshotCount == casted->m_SpiritshotCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
const std::vector<Serializers::Node> BuildSerializationNodes() const override
|
||||||
|
{
|
||||||
|
std::vector<Serializers::Node> result = BaseItem::BuildSerializationNodes();
|
||||||
|
|
||||||
|
if (m_PrevState.isNewState)
|
||||||
|
{
|
||||||
|
result.push_back({ "weaponType", std::to_string(static_cast<uint8_t>(m_WeaponType)) });
|
||||||
|
result.push_back({ "crystalType", std::to_string(static_cast<int8_t>(m_CrystalType)) });
|
||||||
|
result.push_back({ "rndDamage", std::to_string(m_RndDamage) });
|
||||||
|
result.push_back({ "critical", std::to_string(m_Critical) });
|
||||||
|
result.push_back({ "hitModify", std::to_string(m_HitModify) });
|
||||||
|
result.push_back({ "atkSpd", std::to_string(m_AtkSpd) });
|
||||||
|
result.push_back({ "mpConsume", std::to_string(m_MpConsume) });
|
||||||
|
result.push_back({ "soulshotCount", std::to_string(m_SoulshotCount) });
|
||||||
|
result.push_back({ "spiritshotCount", std::to_string(m_SpiritshotCount) });
|
||||||
|
}
|
||||||
|
|
||||||
|
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_PAtk != m_PrevState.pAtk)
|
||||||
|
{
|
||||||
|
result.push_back({ "pAtk", std::to_string(m_PAtk) });
|
||||||
|
}
|
||||||
|
if (m_PrevState.isNewState || m_MAtk != m_PrevState.mAtk)
|
||||||
|
{
|
||||||
|
result.push_back({ "mAtk", std::to_string(m_MAtk) });
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
WeaponItem(
|
||||||
|
const uint32_t objectId,
|
||||||
|
const uint32_t itemId,
|
||||||
|
const int32_t mana,
|
||||||
|
const std::string& name,
|
||||||
|
const std::string& iconName,
|
||||||
|
const std::string& description,
|
||||||
|
const uint16_t weight,
|
||||||
|
const bool isEquipped,
|
||||||
|
const uint16_t enchantLevel,
|
||||||
|
const Enums::WeaponType weaponType,
|
||||||
|
const Enums::CrystalType crystalType,
|
||||||
|
const uint8_t rndDamage,
|
||||||
|
const uint16_t pAtk,
|
||||||
|
const uint16_t mAtk,
|
||||||
|
const uint16_t critical,
|
||||||
|
const int8_t hitModify,
|
||||||
|
const uint16_t atkSpd,
|
||||||
|
const uint8_t mpConsume,
|
||||||
|
const uint8_t soulshotCount,
|
||||||
|
const uint8_t spiritshotCount
|
||||||
|
) :
|
||||||
|
BaseItem
|
||||||
|
(
|
||||||
|
objectId,
|
||||||
|
itemId,
|
||||||
|
mana,
|
||||||
|
name,
|
||||||
|
iconName,
|
||||||
|
description,
|
||||||
|
weight,
|
||||||
|
Enums::ItemType::weapon
|
||||||
|
),
|
||||||
|
m_IsEquipped(isEquipped),
|
||||||
|
m_EnchantLevel(enchantLevel),
|
||||||
|
m_WeaponType(weaponType),
|
||||||
|
m_CrystalType(crystalType),
|
||||||
|
m_RndDamage(rndDamage),
|
||||||
|
m_PAtk(pAtk),
|
||||||
|
m_MAtk(mAtk),
|
||||||
|
m_Critical(critical),
|
||||||
|
m_HitModify(hitModify),
|
||||||
|
m_AtkSpd(atkSpd),
|
||||||
|
m_MpConsume(mpConsume),
|
||||||
|
m_SoulshotCount(soulshotCount),
|
||||||
|
m_SpiritshotCount(spiritshotCount)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
WeaponItem(const WeaponItem* other) :
|
||||||
|
BaseItem(other),
|
||||||
|
m_IsEquipped(other->m_IsEquipped),
|
||||||
|
m_EnchantLevel(other->m_EnchantLevel),
|
||||||
|
m_WeaponType(other->m_WeaponType),
|
||||||
|
m_CrystalType(other->m_CrystalType),
|
||||||
|
m_RndDamage(other->m_RndDamage),
|
||||||
|
m_PAtk(other->m_PAtk),
|
||||||
|
m_MAtk(other->m_MAtk),
|
||||||
|
m_Critical(other->m_Critical),
|
||||||
|
m_HitModify(other->m_HitModify),
|
||||||
|
m_AtkSpd(other->m_AtkSpd),
|
||||||
|
m_MpConsume(other->m_MpConsume),
|
||||||
|
m_SoulshotCount(other->m_SoulshotCount),
|
||||||
|
m_SpiritshotCount(other->m_SpiritshotCount)
|
||||||
|
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
WeaponItem() = default;
|
||||||
|
virtual ~WeaponItem() = default;
|
||||||
|
|
||||||
|
private:
|
||||||
|
struct GetState
|
||||||
|
{
|
||||||
|
bool isEquipped = 0;
|
||||||
|
uint16_t enchantLevel = 0;
|
||||||
|
uint16_t pAtk = 0;
|
||||||
|
uint16_t mAtk = 0;
|
||||||
|
|
||||||
|
bool isNewState = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
private:
|
||||||
|
bool m_IsEquipped = 0;
|
||||||
|
uint16_t m_EnchantLevel = 0;
|
||||||
|
Enums::WeaponType m_WeaponType = Enums::WeaponType::none;
|
||||||
|
Enums::CrystalType m_CrystalType = Enums::CrystalType::none;
|
||||||
|
uint8_t m_RndDamage = 0;
|
||||||
|
uint16_t m_PAtk = 0;
|
||||||
|
uint16_t m_MAtk = 0;
|
||||||
|
uint16_t m_Critical = 0;
|
||||||
|
int8_t m_HitModify = 0;
|
||||||
|
uint16_t m_AtkSpd = 0;
|
||||||
|
uint8_t m_MpConsume = 0;
|
||||||
|
uint8_t m_SoulshotCount = 0;
|
||||||
|
uint8_t m_SpiritshotCount = 0;
|
||||||
|
|
||||||
|
GetState m_PrevState = GetState();
|
||||||
|
};
|
||||||
|
}
|
15
L2BotCore/Domain/Enums/ItemType.h
Normal file
15
L2BotCore/Domain/Enums/ItemType.h
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <cstdint>
|
||||||
|
|
||||||
|
namespace L2Bot::Domain::Enums
|
||||||
|
{
|
||||||
|
enum class ItemType : int8_t
|
||||||
|
{
|
||||||
|
none = -1,
|
||||||
|
etc,
|
||||||
|
armor,
|
||||||
|
weapon,
|
||||||
|
shield
|
||||||
|
};
|
||||||
|
}
|
21
L2BotCore/Domain/Enums/WeaponType.h
Normal file
21
L2BotCore/Domain/Enums/WeaponType.h
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <cstdint>
|
||||||
|
|
||||||
|
namespace L2Bot::Domain::Enums
|
||||||
|
{
|
||||||
|
enum class WeaponType : uint8_t
|
||||||
|
{
|
||||||
|
none = 0,
|
||||||
|
sword,
|
||||||
|
blunt,
|
||||||
|
dagger,
|
||||||
|
pole,
|
||||||
|
fist,
|
||||||
|
bow,
|
||||||
|
etc,
|
||||||
|
dualsword,
|
||||||
|
pet,
|
||||||
|
fishingRod
|
||||||
|
};
|
||||||
|
}
|
@ -164,9 +164,13 @@
|
|||||||
<ClInclude Include="Domain\Entities\EntityInterface.h" />
|
<ClInclude Include="Domain\Entities\EntityInterface.h" />
|
||||||
<ClInclude Include="Domain\Entities\BaseItem.h" />
|
<ClInclude Include="Domain\Entities\BaseItem.h" />
|
||||||
<ClInclude Include="Domain\Entities\EtcItem.h" />
|
<ClInclude Include="Domain\Entities\EtcItem.h" />
|
||||||
|
<ClInclude Include="Domain\Entities\ShieldItem.h" />
|
||||||
<ClInclude Include="Domain\Entities\Skill.h" />
|
<ClInclude Include="Domain\Entities\Skill.h" />
|
||||||
|
<ClInclude Include="Domain\Entities\WeaponItem.h" />
|
||||||
<ClInclude Include="Domain\Enums\ArmorType.h" />
|
<ClInclude Include="Domain\Enums\ArmorType.h" />
|
||||||
<ClInclude Include="Domain\Enums\CrystalType.h" />
|
<ClInclude Include="Domain\Enums\CrystalType.h" />
|
||||||
|
<ClInclude Include="Domain\Enums\ItemType.h" />
|
||||||
|
<ClInclude Include="Domain\Enums\WeaponType.h" />
|
||||||
<ClInclude Include="Domain\ValueObjects\Vector3.h" />
|
<ClInclude Include="Domain\ValueObjects\Vector3.h" />
|
||||||
<ClInclude Include="Domain\Enums\SpoilStateEnum.h" />
|
<ClInclude Include="Domain\Enums\SpoilStateEnum.h" />
|
||||||
<ClInclude Include="Domain\Transports\TransportInterface.h" />
|
<ClInclude Include="Domain\Transports\TransportInterface.h" />
|
||||||
|
@ -123,6 +123,18 @@
|
|||||||
<ClInclude Include="Domain\Enums\CrystalType.h">
|
<ClInclude Include="Domain\Enums\CrystalType.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="Domain\Enums\WeaponType.h">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="Domain\Entities\WeaponItem.h">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="Domain\Entities\ShieldItem.h">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="Domain\Enums\ItemType.h">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</ClInclude>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="pch.cpp">
|
<ClCompile Include="pch.cpp">
|
||||||
|
@ -120,10 +120,10 @@ private:
|
|||||||
std::vector<Serializers::SerializableStateContainer> items
|
std::vector<Serializers::SerializableStateContainer> items
|
||||||
{
|
{
|
||||||
Serializers::SerializableStateContainer{m_HeroService.GetEntities(), "hero"},
|
Serializers::SerializableStateContainer{m_HeroService.GetEntities(), "hero"},
|
||||||
/*Serializers::SerializableStateContainer{m_DropService.GetEntities(), "drop"},
|
Serializers::SerializableStateContainer{m_DropService.GetEntities(), "drop"},
|
||||||
Serializers::SerializableStateContainer{m_NPCService.GetEntities(), "npc"},
|
Serializers::SerializableStateContainer{m_NPCService.GetEntities(), "npc"},
|
||||||
Serializers::SerializableStateContainer{m_PlayerService.GetEntities(), "player"},
|
Serializers::SerializableStateContainer{m_PlayerService.GetEntities(), "player"},
|
||||||
Serializers::SerializableStateContainer{m_SkillService.GetEntities(), "skill"},*/
|
Serializers::SerializableStateContainer{m_SkillService.GetEntities(), "skill"},
|
||||||
Serializers::SerializableStateContainer{m_ItemService.GetEntities(), "item"},
|
Serializers::SerializableStateContainer{m_ItemService.GetEntities(), "item"},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -8,6 +8,8 @@
|
|||||||
#include "../../../Common/Common.h"
|
#include "../../../Common/Common.h"
|
||||||
#include "Domain/Entities/EtcItem.h"
|
#include "Domain/Entities/EtcItem.h"
|
||||||
#include "Domain/Entities/ArmorItem.h"
|
#include "Domain/Entities/ArmorItem.h"
|
||||||
|
#include "Domain/Entities/WeaponItem.h"
|
||||||
|
#include "Domain/Entities/ShieldItem.h"
|
||||||
#include "../../../DTO/ItemData.h"
|
#include "../../../DTO/ItemData.h"
|
||||||
|
|
||||||
using namespace L2Bot::Domain;
|
using namespace L2Bot::Domain;
|
||||||
@ -43,7 +45,7 @@ namespace Interlude
|
|||||||
case L2::ItemDataType::ARMOR:
|
case L2::ItemDataType::ARMOR:
|
||||||
return CreateArmor(itemInfo, data, name, icon, description);
|
return CreateArmor(itemInfo, data, name, icon, description);
|
||||||
case L2::ItemDataType::WEAPON:
|
case L2::ItemDataType::WEAPON:
|
||||||
return CreateEtc(itemInfo, data, name, icon, description);
|
return CreateWeaponOrShield(itemInfo, data, name, icon, description);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -66,6 +68,20 @@ namespace Interlude
|
|||||||
return std::make_unique<Entities::ArmorItem>(object);
|
return std::make_unique<Entities::ArmorItem>(object);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
{
|
||||||
|
const auto object = dynamic_cast<const Entities::WeaponItem*>(other);
|
||||||
|
if (object)
|
||||||
|
{
|
||||||
|
return std::make_unique<Entities::WeaponItem>(object);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
{
|
||||||
|
const auto object = dynamic_cast<const Entities::ShieldItem*>(other);
|
||||||
|
if (object)
|
||||||
|
{
|
||||||
|
return std::make_unique<Entities::ShieldItem>(object);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return std::make_unique<Entities::BaseItem>(other);
|
return std::make_unique<Entities::BaseItem>(other);
|
||||||
}
|
}
|
||||||
@ -126,6 +142,59 @@ namespace Interlude
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::unique_ptr<Entities::BaseItem> CreateWeaponOrShield(
|
||||||
|
const ItemData& itemInfo,
|
||||||
|
const FL2ItemDataBase* itemData,
|
||||||
|
const std::string& name,
|
||||||
|
const std::string& icon,
|
||||||
|
const std::string& description
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
const auto casted = static_cast<const FL2WeaponItemData*>(itemData);
|
||||||
|
|
||||||
|
if (casted->weaponType != L2::WeaponType::SHIELD)
|
||||||
|
{
|
||||||
|
return std::make_unique<Entities::WeaponItem>(
|
||||||
|
itemInfo.objectId,
|
||||||
|
itemInfo.itemId,
|
||||||
|
itemInfo.mana,
|
||||||
|
name,
|
||||||
|
icon,
|
||||||
|
description,
|
||||||
|
itemData ? itemData->weight : 0,
|
||||||
|
itemInfo.isEquipped > 0,
|
||||||
|
itemInfo.enchantLevel,
|
||||||
|
casted ? static_cast<Enums::WeaponType>(casted->weaponType) : Enums::WeaponType::none,
|
||||||
|
casted ? static_cast<Enums::CrystalType>(casted->crystalType) : Enums::CrystalType::none,
|
||||||
|
casted ? casted->rndDamage : 0,
|
||||||
|
casted ? casted->pAtk : 0,
|
||||||
|
casted ? casted->mAtk : 0,
|
||||||
|
casted ? casted->critical : 0,
|
||||||
|
casted ? casted->hitModify : 0,
|
||||||
|
casted ? casted->atkSpd : 0,
|
||||||
|
casted ? casted->mpConsume : 0,
|
||||||
|
casted ? casted->soulshotCount : 0,
|
||||||
|
casted ? casted->spiritshotCount : 0
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return std::make_unique<Entities::ShieldItem>(
|
||||||
|
itemInfo.objectId,
|
||||||
|
itemInfo.itemId,
|
||||||
|
itemInfo.mana,
|
||||||
|
name,
|
||||||
|
icon,
|
||||||
|
description,
|
||||||
|
itemData ? itemData->weight : 0,
|
||||||
|
itemInfo.isEquipped > 0,
|
||||||
|
itemInfo.enchantLevel,
|
||||||
|
casted ? static_cast<Enums::CrystalType>(casted->crystalType) : Enums::CrystalType::none,
|
||||||
|
casted ? casted->shieldEvasion : 0,
|
||||||
|
casted ? casted->shieldPdef : 0,
|
||||||
|
casted ? casted->shieldDefRate : 0
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const L2GameDataWrapper& m_L2GameData;
|
const L2GameDataWrapper& m_L2GameData;
|
||||||
const FName& m_FName;
|
const FName& m_FName;
|
||||||
|
Loading…
Reference in New Issue
Block a user