~ruther/NosSmooth

ref: cf61a90c01f4422396808ed2f731127acc456529 NosSmooth/Local/NosSmooth.LocalCore/CharacterUnmanaged.h -rw-r--r-- 1.4 KiB
cf61a90c — František Boháček feat: add walk detour support 3 years ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#pragma once
#include "ModuleHook.h"

namespace NosSmoothCore
{
	public delegate bool WalkCallback(int position);
	typedef bool(__stdcall* NativeWalkCallback)(int position);

	class CharacterUnmanaged
	{
	public:
		/// <summary>
		/// Set ups the addresses of objects.
		/// </summary>
		/// <param name="moduleHook">The hooking module holding the information about NostaleX.dat</param>
		void Setup(NosSmoothCore::ModuleHook moduleHook);

		/// <summary>
		/// Starts walking to the specified x, y position
		/// </summary>
		/// <param name="x">The coordinate to walk to.</param>
		void Walk(DWORD position);

		/// <summary>
		/// Registers the callback for walk function.
		/// </summary>
		/// <param name="walkCallback">The callback to call.</param>
		void SetWalkCallback(NativeWalkCallback walkCallback);

		/// <summary>
		/// Reset the registered hooks.
		/// </summary>
		void ResetHooks();

		/// <summary>
		/// Executes the walk callback.
		/// </summary>
		/// <param name="position">The coordinate the user wants to walk to.</param>
		/// <returns>Whether to accept the walk.</returns>
		bool ExecuteWalkCallback(const DWORD position);

		static CharacterUnmanaged* GetInstance()
		{
			static CharacterUnmanaged instance;
			return reinterpret_cast<CharacterUnmanaged*>(&instance);
		}
		unsigned int _walkFunctionAddress;
		unsigned int _characterObjectAddress;
	private:
		CharacterUnmanaged();


		NativeWalkCallback _walkCallback;
	};
}
Do not follow this link