feat: change dtos to entities
This commit is contained in:
@ -2,7 +2,9 @@
|
||||
|
||||
#include "../GameStructs/L2GameDataWrapper.h"
|
||||
#include "../GameStructs/FName.h"
|
||||
#include "../GameStructs/GameStructs.h"
|
||||
#include "../../../Common/Common.h"
|
||||
#include "Domain/Entities/Drop.h"
|
||||
|
||||
namespace Interlude
|
||||
{
|
||||
@ -18,13 +20,13 @@ namespace Interlude
|
||||
DropFactory() = delete;
|
||||
virtual ~DropFactory() = default;
|
||||
|
||||
const DTO::Drop Create(const Item* item) const
|
||||
Entities::EntityInterface* Create(const Item* item) const
|
||||
{
|
||||
const auto itemData = m_L2GameData.GetItemData(item->itemId);
|
||||
const auto nameEntry = itemData ? m_FName.GetEntry(itemData->nameIndex) : nullptr;
|
||||
const auto iconEntry = itemData ? m_FName.GetEntry(itemData->iconNameIndex) : nullptr;
|
||||
|
||||
return DTO::Drop{
|
||||
return new Entities::Drop{
|
||||
item->objectId,
|
||||
ValueObjects::Transform(
|
||||
ValueObjects::Vector3(item->pawn->Location.x, item->pawn->Location.y, item->pawn->Location.z),
|
||||
|
@ -1,7 +1,8 @@
|
||||
#pragma once
|
||||
|
||||
#include "../GameStructs/NetworkHandlerWrapper.h"
|
||||
#include "../GameStructs/GameStructs.h"
|
||||
#include "../../../Common/Common.h"
|
||||
#include "Domain/Entities/Hero.h"
|
||||
|
||||
namespace Interlude
|
||||
{
|
||||
@ -11,11 +12,11 @@ namespace Interlude
|
||||
HeroFactory() = default;
|
||||
virtual ~HeroFactory() = default;
|
||||
|
||||
const DTO::Hero Create(const User* item) const
|
||||
Entities::EntityInterface* Create(const User* item) const
|
||||
{
|
||||
const auto playerController = item->pawn ? item->pawn->lineagePlayerController : nullptr;
|
||||
|
||||
return DTO::Hero{
|
||||
return new Entities::Hero{
|
||||
item->objectId,
|
||||
ValueObjects::Transform(
|
||||
ValueObjects::Vector3(item->pawn->Location.x, item->pawn->Location.y, item->pawn->Location.z),
|
||||
|
@ -1,7 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
|
||||
#include "../../../Common/Common.h"
|
||||
#include "Domain/Entities/NPC.h"
|
||||
|
||||
namespace Interlude
|
||||
{
|
||||
@ -11,9 +11,9 @@ namespace Interlude
|
||||
NPCFactory() = default;
|
||||
virtual ~NPCFactory() = default;
|
||||
|
||||
const DTO::NPC Create(const User* item, const Enums::SpoilStateEnum spoiledState) const
|
||||
Entities::EntityInterface* Create(const User* item, const Enums::SpoilStateEnum spoiledState) const
|
||||
{
|
||||
return DTO::NPC{
|
||||
return new Entities::NPC{
|
||||
item->objectId,
|
||||
ValueObjects::Transform(
|
||||
ValueObjects::Vector3(item->pawn->Location.x, item->pawn->Location.y, item->pawn->Location.z),
|
||||
|
@ -1,6 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "../../../Common/Common.h"
|
||||
#include "Domain/Entities/Player.h"
|
||||
|
||||
namespace Interlude
|
||||
{
|
||||
@ -10,9 +11,9 @@ namespace Interlude
|
||||
PlayerFactory() = default;
|
||||
virtual ~PlayerFactory() = default;
|
||||
|
||||
const DTO::Player Create(const User* item) const
|
||||
Entities::EntityInterface* Create(const User* item) const
|
||||
{
|
||||
return DTO::Player{
|
||||
return new Entities::Player{
|
||||
item->objectId,
|
||||
ValueObjects::Transform(
|
||||
ValueObjects::Vector3(item->pawn->Location.x, item->pawn->Location.y, item->pawn->Location.z),
|
||||
|
@ -5,6 +5,9 @@
|
||||
#include "../GameStructs/L2GameDataWrapper.h"
|
||||
#include "../GameStructs/FName.h"
|
||||
#include "../../../Common/Common.h"
|
||||
#include "Domain/Entities/Skill.h"
|
||||
|
||||
using namespace L2Bot::Domain;
|
||||
|
||||
namespace Interlude
|
||||
{
|
||||
@ -20,7 +23,7 @@ namespace Interlude
|
||||
SkillFactory() = delete;
|
||||
virtual ~SkillFactory() = default;
|
||||
|
||||
const DTO::Skill Create(const DTO::Skill source, const uint32_t skillId, const uint32_t level, const uint32_t isActive) const
|
||||
Entities::Skill* Create(const uint32_t skillId, const uint32_t level, const uint32_t isActive) const
|
||||
{
|
||||
const auto data = m_L2GameData.GetMSData(skillId, level);
|
||||
|
||||
@ -30,7 +33,7 @@ namespace Interlude
|
||||
const auto description = data ? data->description : L"";
|
||||
const auto iconEntry = data ? m_FName.GetEntry(data->iconNameIndex) : nullptr;
|
||||
|
||||
return DTO::Skill
|
||||
return new Entities::Skill
|
||||
{
|
||||
skillId,
|
||||
static_cast<uint8_t>(level),
|
||||
@ -40,63 +43,9 @@ namespace Interlude
|
||||
ConvertFromWideChar(name),
|
||||
ConvertFromWideChar(description),
|
||||
iconEntry ? ConvertFromWideChar(iconEntry->value) : "",
|
||||
source.isToggled,
|
||||
source.isCasting,
|
||||
source.isReloading
|
||||
};
|
||||
}
|
||||
|
||||
const DTO::Skill UpdateToggle(const DTO::Skill source, const bool isToggled) const
|
||||
{
|
||||
return DTO::Skill
|
||||
{
|
||||
source.skillId,
|
||||
source.level,
|
||||
source.isActive,
|
||||
source.cost,
|
||||
source.range,
|
||||
source.name,
|
||||
source.description,
|
||||
source.iconName,
|
||||
isToggled,
|
||||
source.isCasting,
|
||||
source.isReloading
|
||||
};
|
||||
}
|
||||
|
||||
const DTO::Skill UpdateCastingState(const DTO::Skill source, const bool isCasting) const
|
||||
{
|
||||
return DTO::Skill
|
||||
{
|
||||
source.skillId,
|
||||
source.level,
|
||||
source.isActive,
|
||||
source.cost,
|
||||
source.range,
|
||||
source.name,
|
||||
source.description,
|
||||
source.iconName,
|
||||
source.isToggled,
|
||||
isCasting,
|
||||
source.isReloading
|
||||
};
|
||||
}
|
||||
|
||||
const DTO::Skill UpdateReloadingState(const DTO::Skill source, const bool isReloading) const
|
||||
{
|
||||
return DTO::Skill
|
||||
{
|
||||
source.skillId,
|
||||
source.level,
|
||||
source.isActive,
|
||||
source.cost,
|
||||
source.range,
|
||||
source.name,
|
||||
source.description,
|
||||
source.iconName,
|
||||
source.isToggled,
|
||||
source.isCasting,
|
||||
isReloading
|
||||
false,
|
||||
false,
|
||||
false
|
||||
};
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user