#pragma once
#include "Mod.h"

class Regen : public Mod {
public:
	int mode = 0;
	int rotations = 0;
	int uncover = 0;
	int visuals = 0;

	float opacity = 1.f;
	float blurs = 5.f;
	bool bold = false;

	int swing = 0;
	int spoof = 0;
	bool autopickaxe = true;
	float speed = 1.f;
	float auraspeed = 1.f;
	float range = 5.f;
	float waittime = 1.f;
	float waitrottime = 1.f;
	bool stopoffground = true;
	bool norenderrots = false;
	bool noghosts = false;

	Regen() : Mod(_("Regen"), _("The player's physical streangth is automatically restored."), Category::COMBAT) {
		settings.push_back(new Setting{ _("Mode"), &rotations, new int(0), new int(0), 1, {
			_("Flareon")
			}, true });
		settings.push_back(new Setting{ _("Rotations"), &rotations, new int(0), new int(0), 1, {
			_("Normal")
			}, true });
		settings.push_back(new Setting{ _("Uncover"), &uncover, new int(1), new int(0), 1, {
			_("Off"),
			_("2 Blocks")
			}, true });
		settings.push_back(new Setting{ _("Visuals"), &visuals, new int(2), new int(0), 1, {
			_("Off"),
			_("Normal"),
			_("Halcyon")
			}, true });
		settings.push_back(new Setting{ _("Bold"), &bold, 0, 0, 0, {}, true });

		settings.push_back(new Setting{ _("Opacity"), &opacity, new float(1.f), new float(0.f), 2, {}, true });
		settings.push_back(new Setting{ _("Blurs"), &blurs, new float(10.f), new float(0.f), 2, {}, true, 10.f });

		settings.push_back(new Setting{ _("Swing"), &swing, new int(2), new int(0), 1, {
			_("Normal"),
			_("Fake"),
			_("Off")
			}, true });

		settings.push_back(new Setting{ _("Spoof"), &spoof, new int(1), new int(0), 1, {
			_("Off"),
			_("Fake")
			}, true });

		settings.push_back(new Setting{ _("Speed"), &speed, new float(2.5f), new float(0.f), 2, {}, true, 15.f });
		settings.push_back(new Setting{ _("Aura Speed"), &auraspeed, new float(2.5f), new float(0.f), 2, {}, true, 15.f });
		settings.push_back(new Setting{ _("Range"), &range, new float(10.f), new float(0.f), 2, {}, true, 15.f });
		settings.push_back(new Setting{ _("Wait Time"), &waittime, new float(10.f), new float(0.f), 2, {}, true, 15.f });
		settings.push_back(new Setting{ _("Wait Rot Time"), &waitrottime, new float(10.f), new float(0.f), 2, {}, true, 15.f });
		settings.push_back(new Setting{ _("Auto Pickaxe"), &autopickaxe, 0, 0, 0, {}, true });
		settings.push_back(new Setting{ _("Stop Off Ground"), &stopoffground, 0, 0, 0, {}, true });
		settings.push_back(new Setting{ _("No Render Rots"), &norenderrots, 0, 0, 0, {}, true });
		settings.push_back(new Setting{ _("No Ghosts"), &noghosts, 0, 0, 0, {}, true });

		enabled = false;
		onlyenabled = false;
	}

	float currentlyrate = 0.f;
	long long now = 0L, start = 0L;
	bool destroying = false;
	bool dorot = false;
	int oldslot = -1;
private:
	bool breaknow = false, uncovering = false, noredstones = true;
	bool cancelswing = false;
	glm::ivec3 blockpos = glm::ivec3();
	std::vector<glm::ivec3> ghostblocks = {};
	bool onceRot = false;
	bool breaking = false;

	auto isAir(glm::vec3 pos) -> bool;
	auto handlePacket(Packet* packet) -> void;

	virtual auto onSwing(Player* _this, bool* cancel) -> void;
	virtual auto onWorldTick(Player* _this) -> void;
	virtual auto onPacketSendBefore(Packet* packet) -> void;
	virtual auto onPacketSendAfter2(Packet* Packet, bool* cancel) -> void;
	virtual auto onImGuiRender() -> void;
	virtual auto onDisabled() -> void;
	virtual auto onEnabled() -> void;
	virtual auto onClient() -> void;
	virtual auto getMode() -> std::string;
};