#pragma once
#include "Mod.h"

class NoRender : public Mod {
public:
	bool hurtcam = false;
	bool shadows = false;
	bool onfire = false;
	bool oneffect = false;
	NoRender() : Mod(_("No Render"), _("Improve lag/fov for cancel render block/fire or something."), Category::RENDER) {
		settings.push_back(new Setting{ _("Hurt Cam"), &hurtcam, 0, 0, 0, {}, true });
		settings.push_back(new Setting{ _("Shadows"), &shadows, 0, 0, 0, {}, true });
		settings.push_back(new Setting{ _("On Fire"), &onfire, 0, 0, 0, {}, true });
		settings.push_back(new Setting{ _("On Effect"), &oneffect, 0, 0, 0, {}, true });

		enabled = false;
		onlyenabled = false;

		{
			if (Utils::File::getVersion() == _("1.21.73"))
				cameraassignangle_ = Utils::Memory::FindPattern(_("76 0E F3 0F 5C"));
			else if (Utils::File::getVersion() == _("1.21.72"))
				cameraassignangle_ = Utils::Memory::FindPattern(_("76 0E F3 0F 5C"));
			else if (Utils::File::getVersion() == _("1.21.71"))
				cameraassignangle_ = Utils::Memory::FindPattern(_("76 0E F3 0F 5C"));
			else if (Utils::File::getVersion() == _("1.21.70"))
				cameraassignangle_ = Utils::Memory::FindPattern(_("76 0E F3 0F 5C"));
			else
				cameraassignangle_ = Utils::Memory::FindPattern(_("F3 0F 11 43 08 C6 43 0C"));

			DWORD oldProtect;
			VirtualProtect((void*)cameraassignangle_, 5, PAGE_EXECUTE_READWRITE, &oldProtect);
			memcpy(ogBytes, (void*)cameraassignangle_, 5);
			VirtualProtect((void*)cameraassignangle_, 5, oldProtect, &oldProtect);
		}
	}

private:
	void* cameraassignangle_;
	void* ogBytes[5] = { 0 };
	bool patched = false;
	virtual auto onBobHurt(glm::mat4* mat, bool* cancel) -> void override;
	virtual auto onClient() -> void override;
	virtual auto onGetShadowRadius(Player* _this, float* radius) -> void override;
	virtual auto onFire(Player* _this, bool* isonfire) -> void override;
	virtual auto onPacketReceive(Packet* packet, bool* cancel) -> void override;
	virtual auto onDisabled() -> void override;
};
