UI.AddSubTab(["Config", "SUBTAB_MGR"], "Delp Config")

UI.AddSliderFloat(["Config", "SUBTAB_MGR", "Delp Config", "SHEET_MGR", "Delp Config"], "Delp Public Config", 0, 0)
UI.AddCheckbox(["Config", "SUBTAB_MGR", "Delp Config", "SHEET_MGR", "Delp Config"], "Jitter Randomizer")
UI.AddCheckbox(["Config", "SUBTAB_MGR", "Delp Config", "SHEET_MGR", "Delp Config"], "Fast Recharge")


var master = {
    dir: "back",
    cycle: false,

    GetJitterOffset: function () { return UI.GetValue(["Rage", "Anti Aim", "Directions", "Jitter offset"]) },
    SetJitterOffset: function (jitter) { return UI.SetValue(["Rage", "Anti Aim", "Directions", "Jitter offset"],  jitter) },


}
function getRandomInt(min, max) {
    min = Math.ceil(min);
    max = Math.floor(max);
    return Math.floor(Math.random() * (max - min)) + min;
  }

function jitter() {
	if(UI.GetValue(["Config", "SUBTAB_MGR", "Delp Config", "SHEET_MGR", "Delp Config", "Jitter Randomizer"])){
		master.cycle = !master.cycle;
		master.SetJitterOffset((master.cycle ? (7 / 2) * 2 : -(7 / 2) * 2) + getRandomInt(-13, 13));
	}
}


function main1() {
    Global.RegisterCallback("CreateMove", "jitter");
} main1();

//recharge

var time, delay, fillbar, shotsfired;

function can_shift_shot(ticks_to_shift) {
    var me = Entity.GetLocalPlayer();
    var wpn = Entity.GetWeapon(me);

    if (me == null || wpn == null)
        return false;

    var tickbase = Entity.GetProp(me, "CCSPlayer", "m_nTickBase");
    var curtime = Globals.TickInterval() * (tickbase-ticks_to_shift)

    if (curtime < Entity.GetProp(me, "CCSPlayer", "m_flNextAttack"))
        return false;

    if (curtime < Entity.GetProp(wpn, "CBaseCombatWeapon", "m_flNextPrimaryAttack"))
        return false;

    return true;
}

function _TBC_CREATE_MOVE() {
    var is_charged = Exploit.GetCharge()

    Exploit[(is_charged != 1 ? "Enable" : "Disable") + "Recharge"]()

    if (can_shift_shot(17) && is_charged != 1 && UI.GetValue(["Config", "SUBTAB_MGR", "Delp Config", "SHEET_MGR", "Delp Config", "Fast Recharge"])) {
        Exploit.DisableRecharge();
        Exploit.Recharge()
    }

    Exploit.OverrideTolerance(0);
    Exploit.OverrideShift(17);
}

function _TBC_UNLOAD() {
    Exploit.EnableRecharge();
}

Cheat.RegisterCallback("CreateMove", "_TBC_CREATE_MOVE");
Cheat.RegisterCallback("Unload", "_TBC_UNLOAD");