feat: change dtos to entities

This commit is contained in:
k0t9i
2023-01-21 13:15:11 +04:00
parent 3c20df7683
commit 7637260d19
58 changed files with 704 additions and 1310 deletions

View File

@ -1,13 +1,13 @@
#pragma once
#include "../VersionAbstractFactory.h"
#include "Factories/HeroFactory.h"
#include "Factories/DropFactory.h"
#include "Factories/HeroFactory.h"
#include "Factories/NPCFactory.h"
#include "Factories/PlayerFactory.h"
#include "Factories/SkillFactory.h"
#include "Repositories/HeroRepository.h"
#include "Repositories/DropRepository.h"
#include "Repositories/HeroRepository.h"
#include "Repositories/NPCRepository.h"
#include "Repositories/PlayerRepository.h"
#include "Repositories/SkillRepository.h"
@ -15,6 +15,7 @@
#include "GameStructs/GameEngineWrapper.h"
#include "GameStructs/L2GameDataWrapper.h"
#include "GameStructs/FName.h"
#include "../../Services/EntityHandler.h"
namespace Interlude
{
@ -32,18 +33,22 @@ namespace Interlude
HeroRepository& GetHeroRepository() const override
{
static auto factory = HeroFactory();
static EntityHandler handler;
static auto result = HeroRepository(
GetNetworkHandler(),
factory
factory,
handler
);
return result;
}
DropRepository& GetDropRepository() const override
{
static auto factory = DropFactory(GetL2GameData(), GetFName());
static EntityHandler handler;
static auto result = DropRepository(
GetNetworkHandler(),
factory,
handler,
m_Radius
);
return result;
@ -51,19 +56,36 @@ namespace Interlude
NPCRepository& GetNPCRepository() const override
{
static auto factory = NPCFactory();
static auto result = NPCRepository(GetNetworkHandler(), factory, m_Radius);
static EntityHandler handler;
static auto result = NPCRepository(
GetNetworkHandler(),
factory,
handler,
m_Radius
);
return result;
}
PlayerRepository& GetPlayerRepository() const override
{
static auto factory = PlayerFactory();
static auto result = PlayerRepository(GetNetworkHandler(), factory, m_Radius);
static EntityHandler handler;
static auto result = PlayerRepository(
GetNetworkHandler(),
factory,
handler,
m_Radius
);
return result;
}
SkillRepository& GetSkillRepository() const override
{
static auto factory = SkillFactory(GetL2GameData(), GetFName());
static auto result = SkillRepository(GetNetworkHandler(), factory);
static EntityHandler handler;
static auto result = SkillRepository(
GetNetworkHandler(),
factory,
handler
);
return result;
}
NetworkHandlerWrapper& GetNetworkHandler() const override

View File

@ -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),

View File

@ -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),

View File

@ -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),

View File

@ -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),

View File

@ -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
};
}

View File

@ -38,7 +38,7 @@ namespace Interlude
User* NetworkHandlerWrapper::GetHero() const
{
const auto creatures = GetAllObjects<User*>(0.1f, [this](float_t radius, int32_t prevId) {
const auto creatures = FindAllObjects<User*>(0.1f, [this](float_t radius, int32_t prevId) {
return GetNextCreature(radius, prevId);
});

View File

@ -1,38 +1,49 @@
#pragma once
#include <map>
#include "Domain/Repositories/DropRepositoryInterface.h"
#include "Domain/Repositories/EntityRepositoryInterface.h"
#include "Domain/DTO/EntityState.h"
#include "../Factories/DropFactory.h"
#include "../../GameStructs/FindObjectsTrait.h"
#include "../GameStructs/NetworkHandlerWrapper.h"
#include "../../../Services/EntityHandler.h"
using namespace L2Bot::Domain;
namespace Interlude
{
class DropRepository : public Repositories::DropRepositoryInterface, public FindObjectsTrait
class DropRepository : public Repositories::EntityRepositoryInterface, public FindObjectsTrait
{
public:
const std::map<uint32_t, DTO::Drop> GetObjects() override
const std::vector<DTO::EntityState*> GetEntities() override
{
const auto items = GetAllObjects<Item*>(m_Radius, [this](float_t radius, int32_t prevId) {
const std::map<uint32_t, Item*> items = FindAllObjects<Item*>(m_Radius, [this](float_t radius, int32_t prevId) {
return m_NetworkHandler.GetNextItem(radius, prevId);
});
const auto objects = m_Container.GetEntities<Item*>(items, [this](Item* item) {
return m_Factory.Create(item);
});
std::map<uint32_t, DTO::Drop> map;
auto result = std::vector<DTO::EntityState*>();
for (const auto& kvp : items)
for (const auto kvp : objects)
{
const auto item = kvp.second;
map.emplace(item->objectId, m_Factory.Create(item));
result.push_back(kvp.second);
}
return map;
return result;
}
DropRepository(const NetworkHandlerWrapper& networkHandler, const DropFactory& factory, const uint16_t radius) :
void Reset() override
{
m_Container.Reset();
}
DropRepository(const NetworkHandlerWrapper& networkHandler, const DropFactory& factory, EntityHandler& handler, const uint16_t radius) :
m_NetworkHandler(networkHandler),
m_Factory(factory),
m_Radius(radius)
m_Radius(radius),
m_Container(handler)
{
}
@ -44,5 +55,6 @@ namespace Interlude
const NetworkHandlerWrapper& m_NetworkHandler;
const DropFactory& m_Factory;
const uint16_t m_Radius;
EntityHandler& m_Container;
};
}

View File

@ -1,26 +1,24 @@
#pragma once
#include "Domain/Repositories/HeroRepositoryInterface.h"
#include "Domain/Repositories/EntityRepositoryInterface.h"
#include "../Factories/HeroFactory.h"
#include "../../../Events/EventDispatcher.h"
#include "../../../Events/HeroCreatedEvent.h"
#include "../../../Events/HeroDeletedEvent.h"
#include "../GameStructs/NetworkHandlerWrapper.h"
#include "../../../Services/EntityHandler.h"
using namespace L2Bot::Domain;
namespace Interlude
{
class HeroRepository : public Repositories::HeroRepositoryInterface
class HeroRepository : public Repositories::EntityRepositoryInterface
{
public:
const std::map<uint32_t, DTO::Hero> GetObjects() override
const std::vector<DTO::EntityState*> GetEntities() override
{
std::map<uint32_t, DTO::Hero> map;
const auto hero = m_NetworkHandler.GetHero();
if (hero)
{
map.emplace(hero->objectId, m_Factory.Create(hero));
}
auto hero = m_NetworkHandler.GetHero();
if (hero != nullptr && m_PrevHero == nullptr)
{
@ -30,15 +28,38 @@ namespace Interlude
{
EventDispatcher::GetInstance().Dispatch(HeroDeletedEvent{});
}
m_PrevHero = hero;
return map;
std::map<uint32_t, User*> items;
if (hero)
{
items.emplace(hero->objectId, hero);
}
const auto objects = m_EntityHandler.GetEntities<User*>(items, [this](User* item) {
return m_Factory.Create(item);
});
auto result = std::vector<DTO::EntityState*>();
for (const auto kvp : objects)
{
result.push_back(kvp.second);
}
return result;
}
HeroRepository(const NetworkHandlerWrapper& networkHandler, const HeroFactory& factory) :
void Reset() override
{
m_EntityHandler.Reset();
}
HeroRepository(const NetworkHandlerWrapper& networkHandler, const HeroFactory& factory, EntityHandler& handler) :
m_NetworkHandler(networkHandler),
m_Factory(factory)
m_Factory(factory),
m_EntityHandler(handler)
{
}
@ -50,5 +71,6 @@ namespace Interlude
const HeroFactory& m_Factory;
const NetworkHandlerWrapper& m_NetworkHandler;
User* m_PrevHero = nullptr;
EntityHandler& m_EntityHandler;
};
}

View File

@ -2,44 +2,61 @@
#include <map>
#include "../GameStructs/NetworkHandlerWrapper.h"
#include "Domain/Repositories/NPCRepositoryInterface.h"
#include "Domain/Repositories/EntityRepositoryInterface.h"
#include "../Factories/NPCFactory.h"
#include "../../../Events/EventDispatcher.h"
#include "../../../Events/SpoiledEvent.h"
#include "../../../Events/CreatureDiedEvent.h"
#include "../../GameStructs/FindObjectsTrait.h"
#include "../../../Services/EntityHandler.h"
using namespace L2Bot::Domain;
namespace Interlude
{
class NPCRepository : public Repositories::NPCRepositoryInterface, public FindObjectsTrait
class NPCRepository : public Repositories::EntityRepositoryInterface, public FindObjectsTrait
{
public:
const std::map<uint32_t, DTO::NPC> GetObjects() override
const std::vector<DTO::EntityState*> GetEntities() override
{
const auto creatures = GetAllObjects<User*>(m_Radius, [this](float_t radius, int32_t prevId) {
const auto creatures = FindAllObjects<User*>(m_Radius, [this](float_t radius, int32_t prevId) {
return m_NetworkHandler.GetNextCreature(radius, prevId);
});
std::map<uint32_t, DTO::NPC> map;
std::map<uint32_t, User*> items;
for (const auto& kvp : creatures)
{
const auto creature = kvp.second;
if (creature->userType == L2::UserType::NPC) {
const auto spoilState = m_Spoiled.find(creature->objectId) == m_Spoiled.end() ? Enums::SpoilStateEnum::none : m_Spoiled.at(creature->objectId);
map.emplace(creature->objectId, m_Factory.Create(creature, spoilState));
items.emplace(creature->objectId, creature);
}
}
return map;
const auto objects = m_EntityHandler.GetEntities<User*>(items, [this](User* item) {
const auto spoilState = m_Spoiled.find(item->objectId) == m_Spoiled.end() ? Enums::SpoilStateEnum::none : m_Spoiled.at(item->objectId);
return m_Factory.Create(item, spoilState);
});
auto result = std::vector<DTO::EntityState*>();
for (const auto kvp : objects)
{
result.push_back(kvp.second);
}
return result;
}
NPCRepository(const NetworkHandlerWrapper& networkHandler, const NPCFactory& factory, const uint16_t radius) :
void Reset() override
{
m_EntityHandler.Reset();
}
NPCRepository(const NetworkHandlerWrapper& networkHandler, const NPCFactory& factory, EntityHandler& handler, const uint16_t radius) :
m_NetworkHandler(networkHandler),
m_Factory(factory),
m_Radius(radius)
m_Radius(radius),
m_EntityHandler(handler)
{
EventDispatcher::GetInstance().Subscribe(SpoiledEvent::name, [this](const Event& evt) {
OnSpoiled(evt);
@ -93,5 +110,6 @@ namespace Interlude
std::map<uint32_t, Enums::SpoilStateEnum> m_Spoiled;
const NetworkHandlerWrapper& m_NetworkHandler;
const uint16_t m_Radius = 0;
EntityHandler& m_EntityHandler;
};
}

View File

@ -1,40 +1,57 @@
#pragma once
#include <map>
#include "Domain/Repositories/PlayerRepositoryInterface.h"
#include "Domain/Repositories/EntityRepositoryInterface.h"
#include "../Factories/PlayerFactory.h"
#include "../../GameStructs/FindObjectsTrait.h"
#include "../GameStructs/NetworkHandlerWrapper.h"
#include "../../../Services/EntityHandler.h"
using namespace L2Bot::Domain;
namespace Interlude
{
class PlayerRepository : public Repositories::PlayerRepositoryInterface, public FindObjectsTrait
class PlayerRepository : public Repositories::EntityRepositoryInterface, public FindObjectsTrait
{
public:
const std::map<uint32_t, DTO::Player> GetObjects() override
const std::vector<DTO::EntityState*> GetEntities() override
{
const auto creatures = GetAllObjects<User*>(m_Radius, [this](float_t radius, int32_t prevId) {
const auto creatures = FindAllObjects<User*>(m_Radius, [this](float_t radius, int32_t prevId) {
return m_NetworkHandler.GetNextCreature(radius, prevId);
});
std::map<uint32_t, DTO::Player> map;
std::map<uint32_t, User*> items;
for (const auto& kvp : creatures)
{
const auto creature = kvp.second;
if (creature->userType == L2::UserType::USER && creature->lvl == 0) {
map.emplace(creature->objectId, m_Factory.Create(creature));
items.emplace(creature->objectId, creature);
}
}
return map;
const auto objects = m_EntityHandler.GetEntities<User*>(items, [this](User* item) {
return m_Factory.Create(item);
});
auto result = std::vector<DTO::EntityState*>();
for (const auto kvp : objects)
{
result.push_back(kvp.second);
}
return result;
}
PlayerRepository(const NetworkHandlerWrapper& networkHandler, const PlayerFactory& factory, const uint16_t radius) :
void Reset() override
{
m_EntityHandler.Reset();
}
PlayerRepository(const NetworkHandlerWrapper& networkHandler, const PlayerFactory& factory, EntityHandler& handler, const uint16_t radius) :
m_NetworkHandler(networkHandler),
m_Factory(factory),
m_Radius(radius)
m_Radius(radius),
m_EntityHandler(handler)
{
}
@ -46,5 +63,6 @@ namespace Interlude
const PlayerFactory& m_Factory;
const NetworkHandlerWrapper& m_NetworkHandler;
const uint16_t m_Radius;
EntityHandler& m_EntityHandler;
};
}

View File

@ -3,32 +3,47 @@
#include <map>
#include <chrono>
#include <shared_mutex>
#include "Domain/Repositories/SkillRepositoryInterface.h"
#include "Domain/Repositories/EntityRepositoryInterface.h"
#include "../Factories/SkillFactory.h"
#include "../../../Events/SkillCreatedEvent.h"
#include "../../../Events/SkillUsedEvent.h"
#include "../../../Events/SkillCancelledEvent.h"
#include "../../../Events/AbnormalEffectChangedEvent.h"
#include "../../../Events/HeroDeletedEvent.h"
#include "../../../Events/EventDispatcher.h"
#include "../GameStructs/NetworkHandlerWrapper.h"
#include "../../../Common/TimerMap.h"
#include "../../../Services/EntityHandler.h"
using namespace L2Bot::Domain;
namespace Interlude
{
class SkillRepository : public Repositories::SkillRepositoryInterface
class SkillRepository : public Repositories::EntityRepositoryInterface
{
public:
const std::map<uint32_t, DTO::Skill> GetObjects() override
const std::vector<DTO::EntityState*> GetEntities() override
{
std::unique_lock<std::shared_timed_mutex>(m_Mutex);
return m_Skills;
const auto objects = m_EntityHandler.GetEntities<Entities::Skill*>(m_Skills, [this](Entities::Skill* item) {
return new Entities::Skill(item);
});
auto result = std::vector<DTO::EntityState*>();
for (const auto kvp : objects)
{
result.push_back(kvp.second);
}
return result;
}
SkillRepository(const NetworkHandlerWrapper& networkHandler, const SkillFactory& factory) :
SkillRepository(const NetworkHandlerWrapper& networkHandler, const SkillFactory& factory, EntityHandler& handler) :
m_NetworkHandler(networkHandler),
m_Factory(factory)
m_Factory(factory),
m_EntityHandler(handler)
{
EventDispatcher::GetInstance().Subscribe(SkillCreatedEvent::name, [this](const Event& evt) {
OnSkillCreated(evt);
@ -45,17 +60,31 @@ namespace Interlude
EventDispatcher::GetInstance().Subscribe(HeroDeletedEvent::name, [this](const Event& evt) {
OnHeroDeleted(evt);
});
// TODO delete outdated skills: on hero change subclass?
}
SkillRepository() = delete;
virtual ~SkillRepository() = default;
virtual ~SkillRepository()
{
Reset();
}
void Reset() override
{
std::shared_lock<std::shared_timed_mutex>(m_Mutex);
for (const auto kvp : m_Skills)
{
delete kvp.second;
}
m_Skills.clear();
}
void OnHeroDeleted(const Event& evt)
{
std::shared_lock<std::shared_timed_mutex>(m_Mutex);
if (evt.GetName() == HeroDeletedEvent::name)
{
m_Skills.clear();
Reset();
m_CastingTimers.StopAll();
m_ReloadingTimers.StopAll();
}
@ -69,16 +98,20 @@ namespace Interlude
const auto skillInfo = casted.GetSkillInfo();
const auto skillId = skillInfo[2];
const auto alreadyExists = m_Skills.find(skillId) != m_Skills.end();
if (m_Skills.find(skillId) == m_Skills.end())
{
auto skill = m_Factory.Create(
skillInfo[2],
skillInfo[1],
skillInfo[0]
);
auto skill = m_Factory.Create(
alreadyExists ? m_Skills[skillId] : DTO::Skill(),
skillInfo[2],
skillInfo[1],
skillInfo[0]
);
UpdateSkill(skill);
m_Skills.emplace(skill->GetId(), skill);
}
else
{
m_Skills[skillId]->UpdateLevel(skillInfo[1]);
}
}
}
void OnSkillUsed(const Event& evt)
@ -96,32 +129,19 @@ namespace Interlude
return;
}
auto skill = m_Factory.UpdateReloadingState(
m_Factory.UpdateCastingState(
m_Skills[skillId],
true
),
true
);
auto skill = m_Skills[skillId];
skill->UpdateReloadingState(true);
skill->UpdateCastingState(true);
UpdateSkill(skill);
m_UsedSkillId = skill.skillId;
m_UsedSkillId = skill->GetId();
m_ReloadingTimers.StartTimer(skill.skillId, skillInfo[3], [this] (uint32_t skillId) {
m_ReloadingTimers.StartTimer(skill->GetId(), skillInfo[3], [this] (uint32_t skillId) {
std::shared_lock<std::shared_timed_mutex>(m_Mutex);
auto skill = m_Factory.UpdateReloadingState(
m_Skills[skillId],
false
);
UpdateSkill(skill);
m_Skills[skillId]->UpdateReloadingState(false);
});
m_CastingTimers.StartTimer(skill.skillId, skillInfo[2], [this] (uint32_t skillId) {
m_CastingTimers.StartTimer(skill->GetId(), skillInfo[2], [this] (uint32_t skillId) {
std::shared_lock<std::shared_timed_mutex>(m_Mutex);
auto skill = m_Factory.UpdateCastingState(
m_Skills[m_UsedSkillId],
false
);
UpdateSkill(skill);
m_Skills[skillId]->UpdateCastingState(false);
});
}
}
@ -141,16 +161,12 @@ namespace Interlude
//todo exception?
return;
}
auto skill = m_Skills[m_UsedSkillId];
skill->UpdateCastingState(false);
auto skill = m_Factory.UpdateCastingState(
m_Skills[m_UsedSkillId],
false
);
UpdateSkill(skill);
m_UsedSkillId = 0;
m_CastingTimers.StopTimer(skill.skillId);
m_CastingTimers.StopTimer(skill->GetId());
}
}
}
@ -171,21 +187,19 @@ namespace Interlude
for (auto it = m_Skills.begin(); it != m_Skills.end();)
{
const auto needToToggle = ids.find(it->second.skillId) != ids.end();
// buff time less than zero means this is a aura
const auto isAura = needToToggle ? ids[it->second.skillId] < 0 : false;
auto skill = it->second;
if (it->second.isToggled && !needToToggle)
const auto needToToggle = ids.find(skill->GetId()) != ids.end();
// buff time less than zero means this is a aura
const auto isAura = needToToggle ? ids[skill->GetId()] < 0 : false;
if (skill->IsToggled() && !needToToggle)
{
auto skill = m_Factory.UpdateToggle(it->second, false);
it = m_Skills.erase(it);
m_Skills.emplace(skill.skillId, skill);
skill->UpdateToggle(false);
}
else if (!it->second.isToggled && needToToggle && isAura)
else if (!skill->IsToggled() && needToToggle && isAura)
{
auto skill = m_Factory.UpdateToggle(it->second, true);
it = m_Skills.erase(it);
m_Skills.emplace(skill.skillId, skill);
skill->UpdateToggle(true);
}
else
{
@ -195,20 +209,14 @@ namespace Interlude
}
}
private:
void UpdateSkill(const DTO::Skill skill)
{
m_Skills.erase(skill.skillId);
m_Skills.emplace(skill.skillId, skill);
}
private:
const SkillFactory& m_Factory;
std::map<uint32_t, DTO::Skill> m_Skills;
std::map<uint32_t, Entities::Skill*> m_Skills;
uint32_t m_UsedSkillId = 0;
const NetworkHandlerWrapper& m_NetworkHandler;
TimerMap m_ReloadingTimers;
TimerMap m_CastingTimers;
std::shared_timed_mutex m_Mutex;
EntityHandler& m_EntityHandler;
};
}