#pragma once
#include "Utils/MemoryUtils.h"
#include "Client.h"

namespace Hooks {
	class Mouse {
	private:
		typedef void(__thiscall* Mouse_)(void*, char, char, short, short, short, short, char);
		inline static Mouse_ mouse;

		static void callback(void* _this, char button, char action, short x, short y, short movex, short mousey, char a8);
	public:
		inline static int state = -1;
		static void Init() {
			std::thread([&] {
				void* pattern = Utils::Memory::FindPattern(_("48 8B C4 48 89 58 08 48 89 68 10 48 89 70 18 57 41 54 41 55 41 56 41 57 48 83 EC 60"));

				state = Utils::Memory::CreateHook(pattern, (void*)&callback, &mouse);

				if (state == 0)
					MessageBoxA(0, _("The program was terminated due to an error.\nError code: 1-3"), _("Valkyrie"), MB_ICONERROR);
				else {
					std::cout << _("Test 1-3... OK\n");
					Client::mouseptr = pattern;
				}
				}).detach();
		}
	};
}
