From b97a2ea63ce4aaacc43c98c39cd36d595d0825a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=98=D0=B2=D0=B0=D0=BD=D0=BE=D0=B2=20=D0=98=D0=B2=D0=B0?= =?UTF-8?q?=D0=BD?= Date: Mon, 12 Aug 2024 22:06:01 +0200 Subject: [PATCH] feat: add force skill using --- Client/Domain/DTO/UseSkillParams.cs | 15 +++++++++++++++ Client/Domain/Service/WorldHandler.cs | 9 ++++++++- L2BotCore/Domain/DTO/UseSkillParams.h | 15 +++++++++++++++ .../Domain/Services/IncomingMessageProcessor.h | 4 +++- L2BotCore/L2BotCore.vcxproj | 1 + L2BotCore/L2BotCore.vcxproj.filters | 3 +++ L2BotDll/Serializers/JsonIncomingMessageFactory.h | 7 ++++++- 7 files changed, 51 insertions(+), 3 deletions(-) create mode 100644 Client/Domain/DTO/UseSkillParams.cs create mode 100644 L2BotCore/Domain/DTO/UseSkillParams.h diff --git a/Client/Domain/DTO/UseSkillParams.cs b/Client/Domain/DTO/UseSkillParams.cs new file mode 100644 index 0000000..aa594d2 --- /dev/null +++ b/Client/Domain/DTO/UseSkillParams.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Client.Domain.DTO +{ + public struct UseSkillParams + { + public uint skillId; + public bool isForced; + public bool isShiftPressed; + } +} diff --git a/Client/Domain/Service/WorldHandler.cs b/Client/Domain/Service/WorldHandler.cs index c755e43..0a39060 100644 --- a/Client/Domain/Service/WorldHandler.cs +++ b/Client/Domain/Service/WorldHandler.cs @@ -111,7 +111,14 @@ namespace Client.Domain.Service return; } - SendMessage(OutgoingMessageTypeEnum.UseSkill, id); + var data = new UseSkillParams + { + skillId = id, + isForced = isForced, + isShiftPressed = isShiftPressed + }; + + SendMessage(OutgoingMessageTypeEnum.UseSkill, data); } public void RequestUseItem(uint id) diff --git a/L2BotCore/Domain/DTO/UseSkillParams.h b/L2BotCore/Domain/DTO/UseSkillParams.h new file mode 100644 index 0000000..e9a6eb3 --- /dev/null +++ b/L2BotCore/Domain/DTO/UseSkillParams.h @@ -0,0 +1,15 @@ +#pragma once + +#include +#include "../Events/EventDispatcher.h" +#include "../Logger/Logger.h" + +namespace L2Bot::Domain::DTO +{ + struct UseSkillParams + { + uint32_t skillId; + bool isForced; + bool isShiftPressed; + }; +} \ No newline at end of file diff --git a/L2BotCore/Domain/Services/IncomingMessageProcessor.h b/L2BotCore/Domain/Services/IncomingMessageProcessor.h index 78c1f49..2018458 100644 --- a/L2BotCore/Domain/Services/IncomingMessageProcessor.h +++ b/L2BotCore/Domain/Services/IncomingMessageProcessor.h @@ -4,6 +4,7 @@ #include "../Serializers/IncomingMessageFactoryInterface.h" #include "HeroServiceInterface.h" #include "../Enums/RestartPointTypeEnum.h" +#include "../DTO/UseSkillParams.h" namespace L2Bot::Domain::Services { @@ -38,7 +39,8 @@ namespace L2Bot::Domain::Services m_HeroService.Pickup(message.GetRawContent()); break; case Serializers::IncomingMessage::Type::useSkill: - m_HeroService.UseSkill(message.GetRawContent(), false, false); + const auto params = message.GetRawContent(); + m_HeroService.UseSkill(params.skillId, params.isForced, params.isShiftPressed); break; case Serializers::IncomingMessage::Type::useItem: m_HeroService.UseItem(message.GetRawContent()); diff --git a/L2BotCore/L2BotCore.vcxproj b/L2BotCore/L2BotCore.vcxproj index 60e7c50..95eb4e2 100644 --- a/L2BotCore/L2BotCore.vcxproj +++ b/L2BotCore/L2BotCore.vcxproj @@ -201,6 +201,7 @@ + diff --git a/L2BotCore/L2BotCore.vcxproj.filters b/L2BotCore/L2BotCore.vcxproj.filters index 19eb53c..54ee5bc 100644 --- a/L2BotCore/L2BotCore.vcxproj.filters +++ b/L2BotCore/L2BotCore.vcxproj.filters @@ -243,6 +243,9 @@ Header Files + + Header Files + diff --git a/L2BotDll/Serializers/JsonIncomingMessageFactory.h b/L2BotDll/Serializers/JsonIncomingMessageFactory.h index a083139..7456aa0 100644 --- a/L2BotDll/Serializers/JsonIncomingMessageFactory.h +++ b/L2BotDll/Serializers/JsonIncomingMessageFactory.h @@ -4,6 +4,7 @@ #include "../ThirdParty/json.hpp" #include "Domain/ValueObjects/Vector3.h" #include "Domain/Enums/RestartPointTypeEnum.h" +#include "Domain/DTO/UseSkillParams.h" using namespace L2Bot::Domain; using json = nlohmann::json; @@ -80,7 +81,11 @@ private: return Serializers::IncomingMessage { Serializers::IncomingMessage::Type::useSkill, - std::make_shared(jsonObject.get()) + std::make_shared( + jsonObject["skillId"].get(), + jsonObject["isForced"].get(), + jsonObject["isShiftPressed"].get() + ) }; } else if (type == "UseItem")