feat: add resurrection
This commit is contained in:
parent
c3f6d10dc6
commit
c61019961b
@ -17,6 +17,7 @@ namespace Client.Domain.Enums
|
|||||||
UseItem,
|
UseItem,
|
||||||
ToggleSoulshot,
|
ToggleSoulshot,
|
||||||
Sit,
|
Sit,
|
||||||
Stand
|
Stand,
|
||||||
|
RestartPoint
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
18
Client/Domain/Enums/RestartPointTypeEnum.cs
Normal file
18
Client/Domain/Enums/RestartPointTypeEnum.cs
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Client.Domain.Enums
|
||||||
|
{
|
||||||
|
public enum RestartPointTypeEnum: short
|
||||||
|
{
|
||||||
|
Village = 0,
|
||||||
|
ClanHall,
|
||||||
|
Castle,
|
||||||
|
Siege,
|
||||||
|
Festival,
|
||||||
|
Jail = 27
|
||||||
|
}
|
||||||
|
}
|
@ -177,6 +177,15 @@ namespace Client.Domain.Service
|
|||||||
|
|
||||||
SendMessage(OutgoingMessageTypeEnum.Stand);
|
SendMessage(OutgoingMessageTypeEnum.Stand);
|
||||||
}
|
}
|
||||||
|
public void RequestRestartPoint(RestartPointTypeEnum type)
|
||||||
|
{
|
||||||
|
if (hero == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
SendMessage(OutgoingMessageTypeEnum.RestartPoint, type);
|
||||||
|
}
|
||||||
|
|
||||||
private void SendMessage<T>(OutgoingMessageTypeEnum type, T? content = default)
|
private void SendMessage<T>(OutgoingMessageTypeEnum type, T? content = default)
|
||||||
{
|
{
|
||||||
|
16
L2BotCore/Domain/Enums/RestartPointTypeEnum.h
Normal file
16
L2BotCore/Domain/Enums/RestartPointTypeEnum.h
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <cstdint>
|
||||||
|
|
||||||
|
namespace L2Bot::Domain::Enums
|
||||||
|
{
|
||||||
|
enum class RestartPointTypeEnum : uint8_t
|
||||||
|
{
|
||||||
|
village = 0,
|
||||||
|
clanhall,
|
||||||
|
castle,
|
||||||
|
siege,
|
||||||
|
festival,
|
||||||
|
jail = 27
|
||||||
|
};
|
||||||
|
}
|
@ -19,7 +19,8 @@ namespace L2Bot::Domain::Serializers
|
|||||||
useItem,
|
useItem,
|
||||||
toggleSoulshot,
|
toggleSoulshot,
|
||||||
sit,
|
sit,
|
||||||
stand
|
stand,
|
||||||
|
restartPoint
|
||||||
};
|
};
|
||||||
|
|
||||||
const Type GetType() const
|
const Type GetType() const
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
#include <vector>
|
#include <vector>
|
||||||
#include "../DTO/EntityState.h"
|
#include "../DTO/EntityState.h"
|
||||||
#include "../ValueObjects/Vector3.h"
|
#include "../ValueObjects/Vector3.h"
|
||||||
|
#include "../Enums/RestartPointTypeEnum.h"
|
||||||
|
|
||||||
namespace L2Bot::Domain::Services
|
namespace L2Bot::Domain::Services
|
||||||
{
|
{
|
||||||
@ -18,5 +19,6 @@ namespace L2Bot::Domain::Services
|
|||||||
virtual void ToggleAutouseSoulshot(int objectId) const = 0;
|
virtual void ToggleAutouseSoulshot(int objectId) const = 0;
|
||||||
virtual void Sit() const = 0;
|
virtual void Sit() const = 0;
|
||||||
virtual void Stand() const = 0;
|
virtual void Stand() const = 0;
|
||||||
|
virtual void RestartPoint(Enums::RestartPointTypeEnum type) const = 0;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include "../Serializers/IncomingMessageFactoryInterface.h"
|
#include "../Serializers/IncomingMessageFactoryInterface.h"
|
||||||
#include "HeroServiceInterface.h"
|
#include "HeroServiceInterface.h"
|
||||||
|
#include "../Enums/RestartPointTypeEnum.h"
|
||||||
|
|
||||||
namespace L2Bot::Domain::Services
|
namespace L2Bot::Domain::Services
|
||||||
{
|
{
|
||||||
@ -51,6 +52,9 @@ namespace L2Bot::Domain::Services
|
|||||||
case Serializers::IncomingMessage::Type::stand:
|
case Serializers::IncomingMessage::Type::stand:
|
||||||
m_HeroService.Stand();
|
m_HeroService.Stand();
|
||||||
break;
|
break;
|
||||||
|
case Serializers::IncomingMessage::Type::restartPoint:
|
||||||
|
m_HeroService.RestartPoint(message.GetRawContent<Enums::RestartPointTypeEnum>());
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return message.GetType();
|
return message.GetType();
|
||||||
|
@ -176,6 +176,7 @@
|
|||||||
<ClInclude Include="Domain\Enums\CrystalTypeEnum.h" />
|
<ClInclude Include="Domain\Enums\CrystalTypeEnum.h" />
|
||||||
<ClInclude Include="Domain\Enums\ChatChannelEnum.h" />
|
<ClInclude Include="Domain\Enums\ChatChannelEnum.h" />
|
||||||
<ClInclude Include="Domain\Enums\ItemTypeEnum.h" />
|
<ClInclude Include="Domain\Enums\ItemTypeEnum.h" />
|
||||||
|
<ClInclude Include="Domain\Enums\RestartPointTypeEnum.h" />
|
||||||
<ClInclude Include="Domain\Enums\WeaponTypeEnum.h" />
|
<ClInclude Include="Domain\Enums\WeaponTypeEnum.h" />
|
||||||
<ClInclude Include="Domain\Events\AbnormalEffectChangedEvent.h" />
|
<ClInclude Include="Domain\Events\AbnormalEffectChangedEvent.h" />
|
||||||
<ClInclude Include="Domain\Events\AttackedEvent.h" />
|
<ClInclude Include="Domain\Events\AttackedEvent.h" />
|
||||||
|
@ -240,6 +240,9 @@
|
|||||||
<ClInclude Include="Domain\Events\AttackedEvent.h">
|
<ClInclude Include="Domain\Events\AttackedEvent.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="Domain\Enums\RestartPointTypeEnum.h">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</ClInclude>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="pch.cpp">
|
<ClCompile Include="pch.cpp">
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
#include "Domain/Serializers/IncomingMessageFactoryInterface.h"
|
#include "Domain/Serializers/IncomingMessageFactoryInterface.h"
|
||||||
#include "../ThirdParty/json.hpp"
|
#include "../ThirdParty/json.hpp"
|
||||||
#include "Domain/ValueObjects/Vector3.h"
|
#include "Domain/ValueObjects/Vector3.h"
|
||||||
|
#include "Domain/Enums/RestartPointTypeEnum.h"
|
||||||
|
|
||||||
using namespace L2Bot::Domain;
|
using namespace L2Bot::Domain;
|
||||||
using json = nlohmann::json;
|
using json = nlohmann::json;
|
||||||
@ -112,6 +113,14 @@ private:
|
|||||||
Serializers::IncomingMessage::Type::stand
|
Serializers::IncomingMessage::Type::stand
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
else if (type == "RestartPoint")
|
||||||
|
{
|
||||||
|
return Serializers::IncomingMessage
|
||||||
|
{
|
||||||
|
Serializers::IncomingMessage::Type::restartPoint,
|
||||||
|
std::make_shared<Enums::RestartPointTypeEnum>(jsonObject.get<Enums::RestartPointTypeEnum>())
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
return Serializers::IncomingMessage();
|
return Serializers::IncomingMessage();
|
||||||
}
|
}
|
||||||
|
@ -26,6 +26,7 @@ namespace Interlude
|
|||||||
int(__thiscall* NetworkHandlerWrapper::__RequestUseItem)(NetworkHandler*, L2ParamStack&) = 0;
|
int(__thiscall* NetworkHandlerWrapper::__RequestUseItem)(NetworkHandler*, L2ParamStack&) = 0;
|
||||||
void(__thiscall* NetworkHandlerWrapper::__RequestAutoSoulShot)(NetworkHandler*, L2ParamStack&) = 0;
|
void(__thiscall* NetworkHandlerWrapper::__RequestAutoSoulShot)(NetworkHandler*, L2ParamStack&) = 0;
|
||||||
void(__thiscall* NetworkHandlerWrapper::__ChangeWaitType)(NetworkHandler*, int) = 0;
|
void(__thiscall* NetworkHandlerWrapper::__ChangeWaitType)(NetworkHandler*, int) = 0;
|
||||||
|
void(__thiscall* NetworkHandlerWrapper::__RequestRestartPoint)(NetworkHandler*, L2ParamStack&) = 0;
|
||||||
|
|
||||||
Item* NetworkHandlerWrapper::GetNextItem(float_t radius, int prevId) const
|
Item* NetworkHandlerWrapper::GetNextItem(float_t radius, int prevId) const
|
||||||
{
|
{
|
||||||
@ -193,6 +194,19 @@ namespace Interlude
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void NetworkHandlerWrapper::RequestRestartPoint(L2ParamStack& stack) const
|
||||||
|
{
|
||||||
|
__try {
|
||||||
|
if (__RequestRestartPoint && _target) {
|
||||||
|
(*__RequestRestartPoint)(_target, stack);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
__except (EXCEPTION_EXECUTE_HANDLER)
|
||||||
|
{
|
||||||
|
throw CriticalRuntimeException(L"UNetworkHandler::RequestRestartPoint failed");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void NetworkHandlerWrapper::Init(HMODULE hModule)
|
void NetworkHandlerWrapper::Init(HMODULE hModule)
|
||||||
{
|
{
|
||||||
void* initAddress = GetProcAddress(hModule, "?Tick@UNetworkHandler@@UAEXM@Z");
|
void* initAddress = GetProcAddress(hModule, "?Tick@UNetworkHandler@@UAEXM@Z");
|
||||||
@ -210,6 +224,7 @@ namespace Interlude
|
|||||||
(FARPROC&)__RequestUseItem = GetProcAddress(hModule, "?RequestUseItem@UNetworkHandler@@UAEHAAVL2ParamStack@@@Z");
|
(FARPROC&)__RequestUseItem = GetProcAddress(hModule, "?RequestUseItem@UNetworkHandler@@UAEHAAVL2ParamStack@@@Z");
|
||||||
(FARPROC&)__RequestAutoSoulShot = GetProcAddress(hModule, "?RequestAutoSoulShot@UNetworkHandler@@UAEXAAVL2ParamStack@@@Z");
|
(FARPROC&)__RequestAutoSoulShot = GetProcAddress(hModule, "?RequestAutoSoulShot@UNetworkHandler@@UAEXAAVL2ParamStack@@@Z");
|
||||||
(FARPROC&)__ChangeWaitType = GetProcAddress(hModule, "?ChangeWaitType@UNetworkHandler@@UAEXH@Z");
|
(FARPROC&)__ChangeWaitType = GetProcAddress(hModule, "?ChangeWaitType@UNetworkHandler@@UAEXH@Z");
|
||||||
|
(FARPROC&)__RequestRestartPoint = GetProcAddress(hModule, "?RequestRestartPoint@UNetworkHandler@@UAEXAAVL2ParamStack@@@Z");
|
||||||
|
|
||||||
(FARPROC&)__AddNetworkQueue = (FARPROC)splice(
|
(FARPROC&)__AddNetworkQueue = (FARPROC)splice(
|
||||||
GetProcAddress(hModule, "?AddNetworkQueue@UNetworkHandler@@UAEHPAUNetworkPacket@@@Z"), __AddNetworkQueue_hook
|
GetProcAddress(hModule, "?AddNetworkQueue@UNetworkHandler@@UAEHPAUNetworkPacket@@@Z"), __AddNetworkQueue_hook
|
||||||
|
@ -31,6 +31,7 @@ namespace Interlude
|
|||||||
int RequestUseItem(L2ParamStack& stack) const;
|
int RequestUseItem(L2ParamStack& stack) const;
|
||||||
void RequestAutoSoulShot(L2ParamStack& stack) const;
|
void RequestAutoSoulShot(L2ParamStack& stack) const;
|
||||||
void ChangeWaitType(int type) const;
|
void ChangeWaitType(int type) const;
|
||||||
|
void RequestRestartPoint(L2ParamStack& stack) const;
|
||||||
private:
|
private:
|
||||||
|
|
||||||
static void __fastcall __Init_hook(NetworkHandler* This, int /*edx*/, float unk);
|
static void __fastcall __Init_hook(NetworkHandler* This, int /*edx*/, float unk);
|
||||||
@ -52,6 +53,7 @@ namespace Interlude
|
|||||||
static void(__thiscall* __RequestAutoSoulShot)(NetworkHandler*, L2ParamStack&);
|
static void(__thiscall* __RequestAutoSoulShot)(NetworkHandler*, L2ParamStack&);
|
||||||
//params objectId, unk
|
//params objectId, unk
|
||||||
static void(__thiscall* __ChangeWaitType)(NetworkHandler*, int);
|
static void(__thiscall* __ChangeWaitType)(NetworkHandler*, int);
|
||||||
|
static void(__thiscall* __RequestRestartPoint)(NetworkHandler*, L2ParamStack&);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static void* originalInitAddress;
|
static void* originalInitAddress;
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
#include "../Repositories/ItemRepository.h"
|
#include "../Repositories/ItemRepository.h"
|
||||||
#include "../GameStructs/NetworkHandlerWrapper.h"
|
#include "../GameStructs/NetworkHandlerWrapper.h"
|
||||||
#include "../GameStructs/L2GameDataWrapper.h"
|
#include "../GameStructs/L2GameDataWrapper.h"
|
||||||
|
#include "Domain/Enums/RestartPointTypeEnum.h"
|
||||||
|
|
||||||
using namespace L2Bot::Domain;
|
using namespace L2Bot::Domain;
|
||||||
|
|
||||||
@ -123,6 +124,16 @@ namespace Interlude
|
|||||||
m_NetworkHandler.ChangeWaitType(1);
|
m_NetworkHandler.ChangeWaitType(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void RestartPoint(Enums::RestartPointTypeEnum type) const override
|
||||||
|
{
|
||||||
|
L2ParamStack* stack = new L2ParamStack(1);
|
||||||
|
stack->PushBack((void*)type);
|
||||||
|
|
||||||
|
m_NetworkHandler.RequestRestartPoint(*stack);
|
||||||
|
|
||||||
|
delete stack;
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const NetworkHandlerWrapper& m_NetworkHandler;
|
const NetworkHandlerWrapper& m_NetworkHandler;
|
||||||
const ItemRepository& m_ItemRespository;
|
const ItemRepository& m_ItemRespository;
|
||||||
|
Loading…
Reference in New Issue
Block a user