#pragma once
#include "Mod.h"

class Fly : public Mod {
public:
	int mode = 0;
	float jumpheight = 0.2f;

	float speed = 0.2f;
	float timer = 20.f;
	float boosttimer = 20.f;
	bool damagefly = false;
	float damagetime = 1.f;
	bool autoenablewhenwin = true;
	bool half = false;
	bool nohalfy = false;

	bool vanillajump = false;
	float glide = 0.f;
	bool boost = false;
	float boosttiming = 0.f;
	float boostspeed = 0.f;
	float boostglide = 0.f;
	bool slowitdown = false;
	float downamount = 0.f;
	float downvalue = 0.f;
	bool forceonground = false;

	Fly() : Mod("Fly", "It just flies.", Category::MOVEMENT) {
		settings.push_back(new Setting{ _("Mode"), &mode, new int(3), new int(0), 1, {"Vanilla", "Jump", "Flareon Glide", "Debug" }, true });

		settings.push_back(new Setting{ _("General Settings"), 0, 0, 0, 3, {}, true });
		settings.push_back(new Setting{ _("Speed"), &speed, new float(1.f), new float(0.f), 2, {}, true });

		settings.push_back(new Setting{ _("Timer Settings"), 0, 0, 0, 3, {}, true });
		settings.push_back(new Setting{ _("Timer"), &timer, new float(30.f), new float(0.f), 2, {}, true, 5.f });
		settings.push_back(new Setting{ _("Boost Timer"), &boosttimer, new float(30.f), new float(0.f), 2, {}, true, 5.f });


		settings.push_back(new Setting{ _("Damage Settings"), 0, 0, 0, 3, {}, true });
		settings.push_back(new Setting{ _("Damage Fly"), &damagefly, 0, 0, 0, {}, true });
		settings.push_back(new Setting{ _("Damage Time"), &damagetime, new float(10.f), new float(0.f), 2, {}, true, 10.f });
		settings.push_back(new Setting{ _("Auto Enable When Win"), &autoenablewhenwin, 0, 0, 0, {}, true });
		settings.push_back(new Setting{ _("Half"), &half, 0, 0, 0, {}, true });
		settings.push_back(new Setting{ _("No Half Y"), &nohalfy, 0, 0, 0, {}, true });



		settings.push_back(new Setting{ _("Debug Fly Settings"), 0, 0, 0, 3, {}, true });
		settings.push_back(new Setting{ _("Jump from ground"), &vanillajump, 0, 0, 0, {}, true });
		settings.push_back(new Setting{ _("Glide amount"), &glide, new float(1.f), new float(0.f), 2, {}, true }); //glide amount, 0.06

		settings.push_back(new Setting{ _("Debug Boost Settings"), 0, 0, 0, 3, {}, true });
		settings.push_back(new Setting{ _("Boost"), &boost, 0, 0, 0, {}, true });
		settings.push_back(new Setting{ _("Boost Timing"), &boosttiming, new float(1.f), new float(0.f), 2, {}, true }); //1.f = 1000ms/1sec
		settings.push_back(new Setting{ _("Horizontal Boost Speed"), &boostspeed, new float(1.f), new float(0.f), 2, {}, true });//bps horizontal boost,normal.
		settings.push_back(new Setting{ _("Glide Boost Speed"), &boostglide, new float(1.f), new float(0.f), 2, {}, true });//glide amount, 0.06

		settings.push_back(new Setting{ _("Debug Slow Down Settings"), 0, 0, 0, 3, {}, true });
		settings.push_back(new Setting{ _("Apply Slow Down"), &slowitdown, 0, 0, 0, {}, true });
		settings.push_back(new Setting{ _("Slower Amount"), &downamount, new float(1.f), new float(0.f), 2, {}, true }); //1.f = 1000ms/1sec
		settings.push_back(new Setting{ _("Slow Down Speed"), &downvalue, new float(1.f), new float(0.f), 2, {}, true }); //normal

		settings.push_back(new Setting{ _("Debug Force Settings"), 0, 0, 0, 3, {}, true });
		settings.push_back(new Setting{ _("Force onground when disabled"), &forceonground, 0, 0, 0, {}, true });



		enabled = false;
		onlyenabled = false;
	}

	bool damaged = false;
private:
	bool getY = false;
	float jumpY = 0.f;
	float testdownvalue_ = 0.f;
	float downvalue_ = 0.f;

	bool requestdisable = false;
	virtual auto onWorldTick(Player* _this) -> void override;
	virtual auto onDimensionChanged() -> void override;
	virtual auto onWinGame() -> void override;
	virtual auto onDisabled() -> void override;
	virtual auto onClient() -> void override;
	virtual auto getMode() -> std::string override;
};
