#pragma once
#include "Mod.h"

class KillAura : public Mod {
public:
	int rotations = 0;
	int flick = 0;
	int visuals = 0;
	int mode = 0;
	int swing = 0;
	float flickticks = 3.f, flickreset = 5.f;
	float switchspeed = 1.f;
	bool apslimitter = true;
	float range = 5.f, attackrange = 3.5f;
	float minaps = 10.f, maxaps = 12.f;
	float minsps = 10.f, maxsps = 14.f;
	bool autosword = true;
	bool autofire = false;
	bool noswitch = true;
	bool throwsnowballs = false;
	float throwspeed = 1.f;
	std::vector<Player*> list;
	int targetindex = 0;
	bool throughwalls = true;
	bool syncrotation = true;
	bool regenfullSwing = false;

	KillAura() : Mod(_("Kill Aura"), _("Attack nearby players."), Category::COMBAT) {
		settings.push_back(new Setting{ _("Rotations"), &rotations, new int(2), new int(0), 1, {
			_("Normal"),
			_("Flick"),
			_("Silent")
			}, true });
		settings.push_back(new Setting{ _("Flick"), &flick, new int(1), new int(0), 1, {
			_("Server Sided"),
			_("Both")
			}, true });
		settings.push_back(new Setting{ _("Flick Ticks"), &flickticks, new float(10.f), new float(0.f), 2, {}, true, 10.f });
		settings.push_back(new Setting{ _("Flick Reset"), &flickreset, new float(10.f), new float(0.f), 2, {}, true, 10.f });
		settings.push_back(new Setting{ _("Sync Rotation"), &syncrotation, 0, 0, 0, {}, true });

		settings.push_back(new Setting{ _("Visuals"), &visuals, new int(1), new int(0), 1, {_("None"), _("Normal")}, true });

		settings.push_back(new Setting{ _("Mode"), &mode, new int(2), new int(0), 1, {_("Switch"), _("Single"),_("Multi")}, true });
		settings.push_back(new Setting{ _("Swing"), &swing, new int(1), new int(0), 1, {_("Normal"), _("Off")}, true });



		settings.push_back(new Setting{ _("Switch Speed"), &switchspeed, new float(10.f), new float(0.f), 2, {}, true, 10.f });
		settings.push_back(new Setting{ _("Aps Limitter"), &apslimitter, 0, 0, 0, {}, true });

		settings.push_back(new Setting{ _("Target Range"), &range, new float(10.f), new float(0.f), 2, {}, true, 10.f });
		settings.push_back(new Setting{ _("Attack Range"), &attackrange, new float(10.f), new float(0.f), 2, {}, true, 10.f });

		settings.push_back(new Setting{ _("Min Aps"), &minaps, new float(20.f), new float(0.f), 2, {}, true, 10.f });
		settings.push_back(new Setting{ _("Max Aps"), &maxaps, new float(20.f), new float(0.f), 2, {}, true, 10.f });

		settings.push_back(new Setting{ _("Min Sps"), &minsps, new float(20.f), new float(0.f), 2, {}, true, 10.f });
		settings.push_back(new Setting{ _("Max Sps"), &maxsps, new float(20.f), new float(0.f), 2, {}, true, 10.f });

		settings.push_back(new Setting{ _("Auto Sword"), &autosword, 0, 0, 0, {}, true });
		settings.push_back(new Setting{ _("Auto Fire"), &autofire, 0, 0, 0, {}, true });
		settings.push_back(new Setting{ _("No Switch"), &noswitch, 0, 0, 0, {}, true });

		settings.push_back(new Setting{ _("Throw Snowballs"), &throwsnowballs, 0, 0, 0, {}, true });
		settings.push_back(new Setting{ _("Throw Speed"), &throwspeed, new float(10.f), new float(0.f), 2, {}, true, 15.f });
		settings.push_back(new Setting{ _("Through Walls"), &throughwalls, 0, 0, 0, {}, true });
		settings.push_back(new Setting{ _("Regen Full Swing"), &regenfullSwing, 0, 0, 0, {}, true });

		enabled = false;
		onlyenabled = false;
	}

	bool flicking = false;
	float pitch, yaw, headyaw;
private:
	Player* lastPlayer = 0;
	bool cancelswing = false;
	auto handlePacket(Packet* packet, Player* arg1, bool arg3, bool arg4) -> void;

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