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

#include "SDK/ItemRenderer.h"
#include "SDK/BaseActorRenderContext.h"
#include "SDK/ActorRenderData.h"

namespace Hooks {
	class ItemRenderers {
	private:
		typedef void(__thiscall* ItemRenderer_render)(ItemRenderer* _this, BaseActorRenderContext* renderCtx, ActorRenderData* renderData);
		inline static ItemRenderer_render itemrenderer_render;

		static void callback_render(ItemRenderer* _this, BaseActorRenderContext* renderCtx, ActorRenderData* renderData);
	public:
		inline static int state = -1;
		static void Init() {
			std::thread([&] {
				void* pattern = Utils::Memory::FindPattern(_("48 8B C4 48 89 58 20 55 56 57 41 54 41 55 41 56 41 57 48 81 EC F0"));

				state = Utils::Memory::CreateHook(pattern, (void*)&callback_render, &itemrenderer_render);

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