#pragma once
#include "ModuleHook.h"
namespace NosSmoothCore
{
public delegate bool WalkCallback(int position);
typedef bool(__stdcall* NativeWalkCallback)(int position);
class CharacterUnmanaged
{
public:
///
/// Set ups the addresses of objects.
///
/// The hooking module holding the information about NostaleX.dat
void Setup(NosSmoothCore::ModuleHook moduleHook);
///
/// Starts walking to the specified x, y position
///
/// The coordinate to walk to.
void Walk(DWORD position);
///
/// Registers the callback for walk function.
///
/// The callback to call.
void SetWalkCallback(NativeWalkCallback walkCallback);
///
/// Reset the registered hooks.
///
void ResetHooks();
///
/// Executes the walk callback.
///
/// The coordinate the user wants to walk to.
/// Whether to accept the walk.
bool ExecuteWalkCallback(const DWORD position);
static CharacterUnmanaged* GetInstance()
{
static CharacterUnmanaged instance;
return reinterpret_cast(&instance);
}
unsigned int _walkFunctionAddress;
unsigned int _characterObjectAddress;
private:
CharacterUnmanaged();
NativeWalkCallback _walkCallback;
};
}