Add project files.
This commit is contained in:
50
L2BotDll/Versions/Interlude/Factories/DropFactory.h
Normal file
50
L2BotDll/Versions/Interlude/Factories/DropFactory.h
Normal file
@ -0,0 +1,50 @@
|
||||
#pragma once
|
||||
|
||||
#include "../GameStructs/L2GameDataWrapper.h"
|
||||
#include "../GameStructs/FName.h"
|
||||
#include "../../../Common/Common.h"
|
||||
|
||||
namespace Interlude
|
||||
{
|
||||
class DropFactory
|
||||
{
|
||||
public:
|
||||
DropFactory(const L2GameDataWrapper& l2GameData, const FName& fName) :
|
||||
m_L2GameData(l2GameData),
|
||||
m_FName(fName)
|
||||
{
|
||||
}
|
||||
|
||||
DropFactory() = delete;
|
||||
virtual ~DropFactory() = default;
|
||||
|
||||
const DTO::Drop 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{
|
||||
item->objectId,
|
||||
ValueObjects::Transform(
|
||||
ValueObjects::Vector3(item->pawn->Location.x, item->pawn->Location.y, item->pawn->Location.z),
|
||||
ValueObjects::Vector3(
|
||||
static_cast<float_t>(item->pawn->Rotation.Pitch),
|
||||
static_cast<float_t>(item->pawn->Rotation.Yaw),
|
||||
static_cast<float_t>(item->pawn->Rotation.Roll)
|
||||
),
|
||||
ValueObjects::Vector3(item->pawn->Velocity.x, item->pawn->Velocity.y, item->pawn->Velocity.z),
|
||||
ValueObjects::Vector3(item->pawn->Acceleration.x, item->pawn->Acceleration.y, item->pawn->Acceleration.z)
|
||||
),
|
||||
item->itemId,
|
||||
item->amount,
|
||||
nameEntry ? ConvertFromWideChar(nameEntry->value) : "",
|
||||
iconEntry ? ConvertFromWideChar(iconEntry->value) : ""
|
||||
};
|
||||
}
|
||||
|
||||
private:
|
||||
const L2GameDataWrapper& m_L2GameData;
|
||||
const FName& m_FName;
|
||||
};
|
||||
}
|
86
L2BotDll/Versions/Interlude/Factories/HeroFactory.h
Normal file
86
L2BotDll/Versions/Interlude/Factories/HeroFactory.h
Normal file
@ -0,0 +1,86 @@
|
||||
#pragma once
|
||||
|
||||
#include "../GameStructs/NetworkHandlerWrapper.h"
|
||||
#include "../../../Common/Common.h"
|
||||
|
||||
namespace Interlude
|
||||
{
|
||||
class HeroFactory
|
||||
{
|
||||
public:
|
||||
HeroFactory() = default;
|
||||
virtual ~HeroFactory() = default;
|
||||
|
||||
const DTO::Hero Create(const User* item) const
|
||||
{
|
||||
const auto playerController = item->pawn ? item->pawn->lineagePlayerController : nullptr;
|
||||
|
||||
return DTO::Hero{
|
||||
item->objectId,
|
||||
ValueObjects::Transform(
|
||||
ValueObjects::Vector3(item->pawn->Location.x, item->pawn->Location.y, item->pawn->Location.z),
|
||||
ValueObjects::Vector3(
|
||||
static_cast<float_t>(item->pawn->Rotation.Pitch),
|
||||
static_cast<float_t>(item->pawn->Rotation.Yaw),
|
||||
static_cast<float_t>(item->pawn->Rotation.Roll)
|
||||
),
|
||||
ValueObjects::Vector3(item->pawn->Velocity.x, item->pawn->Velocity.y, item->pawn->Velocity.z),
|
||||
ValueObjects::Vector3(item->pawn->Acceleration.x, item->pawn->Acceleration.y, item->pawn->Acceleration.z)
|
||||
),
|
||||
ValueObjects::FullName(
|
||||
ConvertFromWideChar(item->nickname),
|
||||
ConvertFromWideChar(item->title)
|
||||
),
|
||||
ValueObjects::VitalStats(
|
||||
item->maxHp, item->hp,
|
||||
item->maxMp, item->mp,
|
||||
item->maxCp, item->cp
|
||||
),
|
||||
ValueObjects::Phenotype(
|
||||
(Enums::RaceEnum)item->raceId,
|
||||
item->gender == L2::Gender::MALE,
|
||||
(Enums::ClassEnum)item->classId,
|
||||
(Enums::ClassEnum)item->activeClassId
|
||||
),
|
||||
ValueObjects::ExperienceInfo(
|
||||
item->lvl,
|
||||
item->exp,
|
||||
item->sp
|
||||
),
|
||||
ValueObjects::PermanentStats(
|
||||
item->str,
|
||||
item->dex,
|
||||
item->con,
|
||||
item->int_,
|
||||
item->men,
|
||||
item->wit
|
||||
),
|
||||
ValueObjects::VariableStats(
|
||||
item->accuracy,
|
||||
item->critRate,
|
||||
item->pAttack,
|
||||
item->attackSpeed,
|
||||
item->pDefense,
|
||||
item->evasion,
|
||||
item->mAttack,
|
||||
item->mDefense,
|
||||
item->castingSpeed
|
||||
),
|
||||
ValueObjects::Reputation(
|
||||
item->karma,
|
||||
item->pkKills,
|
||||
item->pvpKills,
|
||||
static_cast<uint8_t>(item->recRemaining),
|
||||
static_cast<uint8_t>(item->evalScore)
|
||||
),
|
||||
ValueObjects::InventoryInfo(
|
||||
item->maxWeight,
|
||||
item->weight,
|
||||
item->invSlotCount
|
||||
),
|
||||
playerController ? playerController->targetObjectId : 0,
|
||||
playerController ? playerController->isStanding == 1 : true
|
||||
};
|
||||
}
|
||||
};
|
||||
}
|
43
L2BotDll/Versions/Interlude/Factories/NPCFactory.h
Normal file
43
L2BotDll/Versions/Interlude/Factories/NPCFactory.h
Normal file
@ -0,0 +1,43 @@
|
||||
#pragma once
|
||||
|
||||
|
||||
#include "../../../Common/Common.h"
|
||||
|
||||
namespace Interlude
|
||||
{
|
||||
class NPCFactory
|
||||
{
|
||||
public:
|
||||
NPCFactory() = default;
|
||||
virtual ~NPCFactory() = default;
|
||||
|
||||
const DTO::NPC Create(const User* item, const Enums::SpoilStateEnum spoiledState) const
|
||||
{
|
||||
return DTO::NPC{
|
||||
item->objectId,
|
||||
ValueObjects::Transform(
|
||||
ValueObjects::Vector3(item->pawn->Location.x, item->pawn->Location.y, item->pawn->Location.z),
|
||||
ValueObjects::Vector3(
|
||||
static_cast<float_t>(item->pawn->Rotation.Pitch),
|
||||
static_cast<float_t>(item->pawn->Rotation.Yaw),
|
||||
static_cast<float_t>(item->pawn->Rotation.Roll)
|
||||
),
|
||||
ValueObjects::Vector3(item->pawn->Velocity.x, item->pawn->Velocity.y, item->pawn->Velocity.z),
|
||||
ValueObjects::Vector3(item->pawn->Acceleration.x, item->pawn->Acceleration.y, item->pawn->Acceleration.z)
|
||||
),
|
||||
item->isMob != 0,
|
||||
item->npcId,
|
||||
spoiledState,
|
||||
ValueObjects::FullName(
|
||||
ConvertFromWideChar(item->nickname),
|
||||
ConvertFromWideChar(item->title)
|
||||
),
|
||||
ValueObjects::VitalStats(
|
||||
item->maxHp, item->hp,
|
||||
item->maxMp, item->mp,
|
||||
item->maxCp, item->cp
|
||||
)
|
||||
};
|
||||
}
|
||||
};
|
||||
}
|
40
L2BotDll/Versions/Interlude/Factories/PlayerFactory.h
Normal file
40
L2BotDll/Versions/Interlude/Factories/PlayerFactory.h
Normal file
@ -0,0 +1,40 @@
|
||||
#pragma once
|
||||
|
||||
#include "../../../Common/Common.h"
|
||||
|
||||
namespace Interlude
|
||||
{
|
||||
class PlayerFactory
|
||||
{
|
||||
public:
|
||||
PlayerFactory() = default;
|
||||
virtual ~PlayerFactory() = default;
|
||||
|
||||
const DTO::Player Create(const User* item) const
|
||||
{
|
||||
return DTO::Player{
|
||||
item->objectId,
|
||||
ValueObjects::Transform(
|
||||
ValueObjects::Vector3(item->pawn->Location.x, item->pawn->Location.y, item->pawn->Location.z),
|
||||
ValueObjects::Vector3(
|
||||
static_cast<float_t>(item->pawn->Rotation.Pitch),
|
||||
static_cast<float_t>(item->pawn->Rotation.Yaw),
|
||||
static_cast<float_t>(item->pawn->Rotation.Roll)
|
||||
),
|
||||
ValueObjects::Vector3(item->pawn->Velocity.x, item->pawn->Velocity.y, item->pawn->Velocity.z),
|
||||
ValueObjects::Vector3(item->pawn->Acceleration.x, item->pawn->Acceleration.y, item->pawn->Acceleration.z)
|
||||
),
|
||||
ValueObjects::FullName(
|
||||
ConvertFromWideChar(item->nickname),
|
||||
ConvertFromWideChar(item->title)
|
||||
),
|
||||
ValueObjects::Phenotype(
|
||||
(Enums::RaceEnum)item->raceId,
|
||||
item->gender == L2::Gender::MALE,
|
||||
(Enums::ClassEnum)item->classId,
|
||||
(Enums::ClassEnum)item->activeClassId
|
||||
),
|
||||
};
|
||||
}
|
||||
};
|
||||
}
|
107
L2BotDll/Versions/Interlude/Factories/SkillFactory.h
Normal file
107
L2BotDll/Versions/Interlude/Factories/SkillFactory.h
Normal file
@ -0,0 +1,107 @@
|
||||
#pragma once
|
||||
|
||||
#include <map>
|
||||
#include <chrono>
|
||||
#include "../GameStructs/L2GameDataWrapper.h"
|
||||
#include "../GameStructs/FName.h"
|
||||
#include "../../../Common/Common.h"
|
||||
|
||||
namespace Interlude
|
||||
{
|
||||
class SkillFactory
|
||||
{
|
||||
public:
|
||||
SkillFactory(const L2GameDataWrapper& l2GameData, const FName& fName) :
|
||||
m_L2GameData(l2GameData),
|
||||
m_FName(fName)
|
||||
{
|
||||
}
|
||||
|
||||
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
|
||||
{
|
||||
const auto data = m_L2GameData.GetMSData(skillId, level);
|
||||
|
||||
const auto cost = data ? data->mpCost : 0;
|
||||
const auto range = data ? data->range : 0;
|
||||
const auto name = data ? data->name : L"";
|
||||
const auto description = data ? data->description : L"";
|
||||
const auto iconEntry = data ? m_FName.GetEntry(data->iconNameIndex) : nullptr;
|
||||
|
||||
return DTO::Skill
|
||||
{
|
||||
skillId,
|
||||
static_cast<uint8_t>(level),
|
||||
isActive != 1,
|
||||
static_cast<uint8_t>(cost),
|
||||
static_cast<int16_t>(range),
|
||||
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
|
||||
};
|
||||
}
|
||||
|
||||
private:
|
||||
const L2GameDataWrapper& m_L2GameData;
|
||||
const FName& m_FName;
|
||||
};
|
||||
}
|
Reference in New Issue
Block a user