feat: add resurrection

This commit is contained in:
Иванов Иван
2024-08-12 18:20:55 +02:00
parent c3f6d10dc6
commit c61019961b
13 changed files with 94 additions and 2 deletions

View File

@@ -26,6 +26,7 @@ namespace Interlude
int(__thiscall* NetworkHandlerWrapper::__RequestUseItem)(NetworkHandler*, L2ParamStack&) = 0;
void(__thiscall* NetworkHandlerWrapper::__RequestAutoSoulShot)(NetworkHandler*, L2ParamStack&) = 0;
void(__thiscall* NetworkHandlerWrapper::__ChangeWaitType)(NetworkHandler*, int) = 0;
void(__thiscall* NetworkHandlerWrapper::__RequestRestartPoint)(NetworkHandler*, L2ParamStack&) = 0;
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* initAddress = GetProcAddress(hModule, "?Tick@UNetworkHandler@@UAEXM@Z");
@@ -210,6 +224,7 @@ namespace Interlude
(FARPROC&)__RequestUseItem = GetProcAddress(hModule, "?RequestUseItem@UNetworkHandler@@UAEHAAVL2ParamStack@@@Z");
(FARPROC&)__RequestAutoSoulShot = GetProcAddress(hModule, "?RequestAutoSoulShot@UNetworkHandler@@UAEXAAVL2ParamStack@@@Z");
(FARPROC&)__ChangeWaitType = GetProcAddress(hModule, "?ChangeWaitType@UNetworkHandler@@UAEXH@Z");
(FARPROC&)__RequestRestartPoint = GetProcAddress(hModule, "?RequestRestartPoint@UNetworkHandler@@UAEXAAVL2ParamStack@@@Z");
(FARPROC&)__AddNetworkQueue = (FARPROC)splice(
GetProcAddress(hModule, "?AddNetworkQueue@UNetworkHandler@@UAEHPAUNetworkPacket@@@Z"), __AddNetworkQueue_hook

View File

@@ -31,6 +31,7 @@ namespace Interlude
int RequestUseItem(L2ParamStack& stack) const;
void RequestAutoSoulShot(L2ParamStack& stack) const;
void ChangeWaitType(int type) const;
void RequestRestartPoint(L2ParamStack& stack) const;
private:
static void __fastcall __Init_hook(NetworkHandler* This, int /*edx*/, float unk);
@@ -52,6 +53,7 @@ namespace Interlude
static void(__thiscall* __RequestAutoSoulShot)(NetworkHandler*, L2ParamStack&);
//params objectId, unk
static void(__thiscall* __ChangeWaitType)(NetworkHandler*, int);
static void(__thiscall* __RequestRestartPoint)(NetworkHandler*, L2ParamStack&);
private:
static void* originalInitAddress;

View File

@@ -4,6 +4,7 @@
#include "../Repositories/ItemRepository.h"
#include "../GameStructs/NetworkHandlerWrapper.h"
#include "../GameStructs/L2GameDataWrapper.h"
#include "Domain/Enums/RestartPointTypeEnum.h"
using namespace L2Bot::Domain;
@@ -123,6 +124,16 @@ namespace Interlude
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:
const NetworkHandlerWrapper& m_NetworkHandler;
const ItemRepository& m_ItemRespository;