i30cps' Utility Mod

ESC = Mod Menu, P = WS Sender, L = Console Command. Features: Increases FPS, Blocks Ads, Biome Map, CPS Viewer (by CyRuler#3691), and more! This is a utility mod, not a hack. Made by i30cps.

// ==UserScript==
// @name i30cps' Utility Mod
// @author       i30cps
// @version    1.4.4 - P = WS Sender, Toggle Aim Cursor!
// @description ESC = Mod Menu,  P = WS Sender, L = Console Command. Features: Increases FPS, Blocks Ads, Biome Map, CPS Viewer (by CyRuler#3691), and more! This is a utility mod, not a hack. Made by i30cps.
// @match        *://moomoo.io/*
// @match        *://sandbox.moomoo.io/*
// @match        *://dev.moomoo.io/*
// @match        *://abc.moomoo.io/*
// @icon         data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAOEAAADhCAMAAAAJbSJIAAAAgVBMVEX///8AAAD19fW7u7v5+fnm5ubx8fFfX1+2trZNTU38/Pynp6etra3r6+uEhIRvb2/Y2Njg4OBkZGQ+Pj54eHjR0dGPj4/FxcWZmZkzMzNUVFRpaWkUFBR1dXUhISHi4uJGRkYMDAwvLy+BgYEbGxuWlpYoKCgSEhJQUFAxMTFHR0fdMdvYAAAGDElEQVR4nO2d61YaQRCEaSVG8B5BoxKESDDx/R8wAcQDuzNTzVzcrpz5frOeLpfd6a7pHnq9SqVSqVQqlUrlEIZdB1CY+8WR7oOnd2UDKUT/SUSp8FgW12WDKcG1yAEKRb6XDSc/Z3KgQvlWNqDc3MnBCuWW6b30IhEK5YFH4kiiFMpD2bDycSmRCuWxbGC5OJdohTIqG1oexpKgUE7LBpeDI0lSKBdlw8vAIFHhW9nw0jmVRIVyXjbAVPqSrFD6ZUNM5DKDQtOFxoVkUKi9qhNesig0fBOPJItCsZufnmVSaHfZf8ikcFYyyBS+NAXGKpQvZQONpvUljVZ4VjbQaL5lUzgoG2g082wKpWygsbTWigSF47KhRjLOqNDmg9iOM17hj7KhRtJ+lcYrvC0baiTfMypclA01kpwKbdYXDoXKFPq8feVJ2VjjcMT5qKrXHQ+wTUPq3hHo6w2+7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/HAwbk/j0eMCD37/GAAbl/rzi9ktu/V4xkk/v3eCSb3L/H5yKQt3T9ggLJ/XvFIUjc/r1i5pz5UATVzDm5f4+TNfKWLjynRe7f42SN3L9XJGvc/r0iWSP37/9AgeT+PW79JR/Jxq2/5P69Ilnj9u8VJ+Nyl4SKoXpy/x4P1ZP793hOi9y/x8kauX+vSNa4/XtFskbu3+OhenL/Hidr5CPZOFkj9+8VR6py+/eKZI27JFQM1ZP793ionty/x3Na5P694nBxbv9ekaxx+/eKoXpu/36IkzVy/x73rJH79/ghJPfvFSsht3+vyNbIS0K8V0/u3+MRA/KWrh78MRhy/34FuIXc/v2aeVAgt3+/ITjLRO7fbwjZT+T+/TuBNnzy8++3+NvU2Y9U/cC7IHL79zv4RrbYk7Ud3K3q5P79Pq5NUfKSsEn7USTfBm3T3LIgdy1cjHfnC3l/zi7IeLSpMhYv/6e+NSfP18/c20uVSqVSqVQqFbv8BRGjP0vcrmCnAAAAAElFTkSuQmCC
// @require https://greasyfork.org/scripts/423602-msgpack/code/msgpack.js?version=912797
// @require http://code.jquery.com/jquery-3.3.1.min.js
// @require https://code.jquery.com/ui/1.12.0/jquery-ui.min.js
// @require https://cdnjs.cloudflare.com/ajax/libs/jquery-confirm/3.3.0/jquery-confirm.min.js
// @namespace -
// ==/UserScript==

//Start edit

console.log("The mod is working.");
alert("Note: i30cps' Utility Mod does not give any unfair advantages, and is therefore not a hack.");

$("#gameCanvas").css('cursor', 'url(http://cur.cursors-4u.net/user/use-1/use153.cur), default');
$("#enterGame").css('cursor', 'url(http://cur.cursors-4u.net/user/use-1/use153.cur), default');
document.getElementById("storeHolder").style = "height: 800px; width: 400px;"
document.getElementById('loadingText').innerHTML = 'Wait...';
document.getElementById('gameName').innerHTML = 'i30cps';
document.getElementById("leaderboard").append('i30cps\' Utility Mod');;
document.getElementById('errorNotification').remove();
//more fps:
window.location.native_resolution = true;
$("#consentBlock").css({display: "none"});
$("#youtuberOf").css({display: "none"});
$("#mapDisplay").css({background: `url('https://i.imgur.com/fgFsQJp.png')`});
document.getElementById("moomooio_728x90_home").style.display = "none";
$("#moomooio_728x90_home").parent().css({display: "none"});
document.getElementById("linksContainer2").innerHTML = `<a href="https://www.youtube.com/" target="_blank" class="menuLink">YouTube</a> | <a href="https://discord.com/channels/@me" target="_blank" class="menuLink"> Discord </a> | <a href="https://youtube.com/watch?v=dQw4w9WgXcQ" target="_blank" class="menuLink"> Little Bots </a> `
//Edit end
try {
    document.getElementById("moomooio_728x90_home").style.display = "none"; //Remove sidney's ads
    $("#moomooio_728x90_home").parent().css({display: "none"});
} catch (e) {
    console.log("error removing ad");
}


let mouseX;
let mouseY;

let width;
let height;

var animateyorn = false;

setInterval(() => {

    if(messageToggle == 1) {
        doNewSend(["ch", [animate(true, animateyorn)]])
    }
}, 200);

setInterval(() => {
    SPIKE=document.getElementById("spikechanger").value.toLowerCase();
    MILL=document.getElementById("millchanger").value.toLowerCase();
    BOOST=document.getElementById("boostchanger").value.toLowerCase();
    TURRET=document.getElementById("turretchanger").value.toLowerCase();
}, 500)

setInterval(() => {
    if(autoaim == true) {
        doNewSend(["2", [nearestEnemyAngle]]);
    }
}, 0);

setInterval(() => {
    if(false) {
        if(oldHat != normalHat) {
            hat(normalHat);
            console.log("Tried. - Hat")
        }
        if(oldAcc != normalAcc) {
            acc(normalAcc);
            console.log("Tried. - Accessory")
        }
        oldHat = normalHat;
        oldAcc = normalAcc
    }
}, 25);

function normal() {
    hat(normalHat);
    acc(normalAcc);
}

function aim(x, y){
    var cvs = document.getElementById("gameCanvas");
    cvs.dispatchEvent(new MouseEvent("mousemove", {
        clientX: x,
        clientY: y

    }));
}

let coreURL = new URL(window.location.href);
window.sessionStorage.force = coreURL.searchParams.get("fc");

var nearestEnemy;
var nearestEnemyAngle;
var isEnemyNear;
var instaSpeed = 230;
var primary;
var instapike = true;
var instaCHAT = true;
var secondary;
var MooJaxAntiAds = true;
var foodType;
var wallType;
var spikeType;
var millType;
var mineType;
var boostType;
var fdng = true;
var turretType;
var spawnpadType = 36;
var autoaim = false;
var tick = 1;
var oldHat;
var oldAcc;
var enemiesNear;
var normalHat;
var normalAcc;
var ws;
var searchp = true;
var msgpack5 = msgpack;
var boostDir;
var boostDir1;
let myPlayer = {
    id: null,
    x: null,
    y: null,
    dir: null,
    object: null,
    weapon: null,
    clan: null,
    isLeader: null,
    hat: null,
    accessory: null,
    isSkull: null
};

let healSpeed = 100;
var messageToggle = 0;
var clanToggle = 0;
let healToggle = 0;
let hatToggle = 1;

var PRIMARY;
var SECONDARY;
var HEAL;
var WALL;
var SPIKE = "v";
var BOOST = "f";
var MILL = "z";
var TURRET = "g";
var MINE;
var SPAWNPAD;

var nocommand = ["ach1", "spikechanger", "millchanger", "boostchanger", "turretchanger", "chatbox", "allianceinput"]

document.msgpack = msgpack;
function n(){
    this.buffer = new Uint8Array([0]);
    this.buffer.__proto__ = new Uint8Array;
    this.type = 0;
}

WebSocket.prototype.oldSend = WebSocket.prototype.send;
WebSocket.prototype.send = function(m){
    if (!ws){
        document.ws = this;

        ws = this;
        socketFound(this);
    }
    this.oldSend(m);
};


function socketFound(socket){
    socket.addEventListener('message', function(message){
        handleMessage(message);
    });
}

function handleMessage(m){
    let temp = msgpack5.decode(new Uint8Array(m.data));
    let data;
    if(temp.length > 1) {
        data = [temp[0], ...temp[1]];
        if (data[1] instanceof Array){
            data = data;
        }
    } else {
        data = temp;
    }
    let item = data[0];
    if(!data) {return};

    if(item === "io-init") {
        let cvs = document.getElementById("gameCanvas");
        width = cvs.clientWidth;
        height = cvs.clientHeight;
        $(window).resize(function() {
            width = cvs.clientWidth;
            height = cvs.clientHeight;
        });
        cvs.addEventListener("mousemove", e => {
            mouseX = e.clientX;
            mouseY = e.clientY;
        });
    }

    if (item == "1" && myPlayer.id == null){
        myPlayer.id = data[1];
    }

    if (item == "33") {
        enemiesNear = [];
        for(let i = 0; i < data[1].length / 13; i++) {
            let playerInfo = data[1].slice(13*i, 13*i+13);
            if(playerInfo[0] == myPlayer.id) {
                myPlayer.x = playerInfo[1];
                myPlayer.y = playerInfo[2];
                myPlayer.dir = playerInfo[3];
                myPlayer.object = playerInfo[4];
                myPlayer.weapon = playerInfo[5];
                myPlayer.clan = playerInfo[7];
                myPlayer.isLeader = playerInfo[8];
                myPlayer.hat = playerInfo[9];
                myPlayer.accessory = playerInfo[10];
                myPlayer.isSkull = playerInfo[11];
            } else if(playerInfo[7] != myPlayer.clan || playerInfo[7] === null) {
                enemiesNear.push(playerInfo);
            }
        }
    }

    isEnemyNear = false;
    if(enemiesNear) {
        nearestEnemy = enemiesNear.sort((a,b) => dist(a, myPlayer) - dist(b, myPlayer))[0];
    }
    if(nearestEnemy) {
        nearestEnemyAngle = Math.atan2(nearestEnemy[2]-myPlayer.y, nearestEnemy[1]-myPlayer.x);
        if(Math.sqrt(Math.pow((myPlayer.y-nearestEnemy[2]), 2) + Math.pow((myPlayer.x-nearestEnemy[1]), 2)) < 300) {
            isEnemyNear = true;
            console.log("Enemy near.");
            if(autoaim == false && myPlayer.hat != 7 && myPlayer.hat != 53) {
                normalHat = 6;
                if(primary != 8) {
                    normalAcc = 21;
                }
            };
        }
    }
    if(isEnemyNear == false && autoaim == false) {
        normalAcc = 11;
        if (myPlayer.y < 2400){
            normalHat = 15;
        } else if (myPlayer.y > 6850 && myPlayer.y < 7550){
            normalHat = 31;
        } else {
            normalHat = 12;
        }
    }
    if (!nearestEnemy) {
        nearestEnemyAngle = myPlayer.dir;
    }
    if(item == "h" && data[1] == myPlayer.id) {
        if(data[2] < 100 && data[2] > 0 && healToggle == 1) {}
    }
    update();
}


function doNewSend(sender){
    ws.send(new Uint8Array(Array.from(msgpack5.encode(sender))));
}

function acc(id) {
    doNewSend(["13c", [0, 0, 1]]);
    doNewSend(["13c", [0, id, 1]]);
}

function hat(id) {
    doNewSend(["13c", [0, id, 0]]);
}

function placeF(id, angle = Math.atan2(mouseY - height / 2, mouseX - width / 2)) {
    doNewSend(["5", [id, null]]);
    doNewSend(["c", [1, angle]]);
    doNewSend(["c", [0, angle]]);
    doNewSend(["5", [id, null]]);
    doNewSend(["c", [1, angle]]);
    doNewSend(["c", [0, angle]]);
    doNewSend(["5", [myPlayer.weapon, true]]);
}

function place(id, angle = Math.atan2(mouseY - height / 2, mouseX - width / 2)) {
    doNewSend(["5", [id, null]]);
    doNewSend(["c", [1, angle]]);
    doNewSend(["c", [0, angle]]);
    doNewSend(["5", [myPlayer.weapon, true]]);
}

function slot(id) {
    doNewSend(["5", [id, null]])
}
var repeater = function(key, action, interval) {
    let _isKeyDown = false;
    let _intervalId = undefined;

    return {
        start(keycode) {
            if(keycode == key && document.activeElement.id.toLowerCase() !== 'chatbox') {
                _isKeyDown = true;
                if(_intervalId === undefined) {
                    _intervalId = setInterval(() => {
                        action();
                        if(!_isKeyDown){
                            clearInterval(_intervalId);
                            _intervalId = undefined;
                            console.log("claered");
                        }
                    }, interval);
                }
            }
        },

        stop(keycode) {
            if(keycode == key && document.activeElement.id.toLowerCase() !== 'chatbox') {
                _isKeyDown = false;
            }
        }
    };


}

function katana() {
    doNewSend([6, [4]])
}

document.addEventListener('keydown', (e)=>{
    if (e.keyCode == 46 && !nocommand.includes(document.activeElement.id.toLowerCase())) {
        const EDITION = 0;

        var head = document.getElementsByTagName('head')[0];
        var icon = document.createElement('link');

        icon.setAttribute('type', 'image/png');
        icon.setAttribute('rel', 'shortcut icon');

        if (EDITION == 0) icon.setAttribute('href', 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAQAAAAEACAMAAABrrFhUAAAAA3NCSVQICAjb4U/gAAABHVBMVEX///9FRUVFRUVFRUVFRUVFRUVFRUVFRUVFRUVFRUVFRUVFRUVFRUVFRUVFRUXt7e3r6+vp6enn5+fl5eXj4+Ph4eHf39/d3d3b29vZ2dnX19fV1dXT09PR0dHPz8/MzMzJycnHx8fFxcXDw8PBwcG/v7+9vb27u7u5ubm3t7e1tbWzs7OxsbGvr6+tra2rq6upqamnp6elpaWjo6OhoaGfn5+dnZ2ZmZmVlZWTk5ORkZGPj4+NjY2Li4uJiYmHh4eFhYWDg4OBgYF+fn58fHx6enp4eHh2dnZ0dHRycnJwcHBubm5sbGxqampmZmZiYmJgYGBeXl5cXFxaWlpYWFhWVlZUVFRSUlJQUFBOTk5MTExKSkpISEhGRkZFRUUChAOfAAAAX3RSTlMAESIzRFVmd4iZqrvM3e7//////////////////////////////////////////////////////////////////////////////////////////////////////////4gnOa8AAAAJcEhZcwAACpwAAAqcAfTS3xIAAAAcdEVYdFNvZnR3YXJlAEFkb2JlIEZpcmV3b3JrcyBDUzbovLKMAAAAFnRFWHRDcmVhdGlvbiBUaW1lADAzLzE3LzE3CP1IFgAADiFJREFUeJztnXsjG00XwJ8gaULYhLRudSlFL4RS9PKUVsuDEooIkc33/xiviMjuOWdusTOz+s7vX8maM5k9c25z5p9/HA6Hw+FwOBwOh8PhcDgcDofD4XA4HHpIdCdT6Uxftr9/oP7AQH9/ti+TTiW7E7bHp5FEdyqTDUhNM5DNpP7CaehKZrIi0YNkM8m/ZxK6Upl+FeFb9GdSXbbH/mi6Ur3CRc9joPcpT0Kys18erYR0t21JOqE7/aif/qnPQUpJ5cmQTdmWSZ5EOmrpm6SfxsaQyOgRv0HmCUyBpl+/Rdq2fAKe6RW/wTPbMnKIXvVRxFcdanz5w2RsS0qSjMTqkSObtC0txtjP3yRui6BH+u2/Lv36d70492pipJD37skXRiZezRXX//1VupZ9TjZWtqGU8q8efVt59dwT8GJmZeu4KvO8GG0H4r2/8nN1KieSvU1ueu1XRfjQ2NgEvfxx+scb0/Kyt5nePBbMQK9tye/o5r/+x2sjnUjfZPQjfw6yMQgWcF//ypeXnUvfZOIr710YsK4KefKfLObFAorJL51w/klPbOU/nItC+ibzv9n/x+pmwJa/9Do68RvMleK4BrpZY7p4F634Dd5dsP6bNT2QYET9bj4NRi+/5w1+rtH/b8BWmKSPsfondIjfYJKhDfvsyE+7P7VNBYtPldwnehFYcY1oBVie0Sd+g9lL8t9a2Ap6yIH8HtYrv+cN0zui8a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Xbw1XZwVTawVTXv1TVvVTTvFTSu1TPuVPRuVLNt1PLtVPJtFPIs1PGsVLFsVLEr1LDrlLBrVK/q1K9qlG6p1G5plG3pVG1o1CyoVCxoFCvnlCtnVCsm1CqmU+nl0+llU+jlE+hkk+gkU6fkE6dj06bjU6Yi06Zi06XiU2Uh02RhU2Pg02NgUyLgEyJfkyIfUyFe0yDeUuBeEt9dEt8c0t4cEp2bkp0bEpyakpwaUpuZ0ltZklqZEloYklmYUhmYEhlYEhjXkhiXUhgXEheWkhbWEdaV0dYVUdWU0dVUkdSUEZPTkZQTkZNTEZOTEZMS0ZKSkZKSUZISEVFRUVGRkXhDf0HAAAAZ3RSTlMAESIzRFVmd4iZqrvM3e7/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////9O0EYAAAAAlwSFlzAAAKnAAACpwB9NLfEgAAABx0RVh0U29mdHdhcmUAQWRvYmUgRmlyZXdvcmtzIENTNui8sowAAAAWdEVYdENyZWF0aW9uIFRpbWUAMDMvMTcvMTcI/UgWAAAJuElEQVR4nO2de1/URhSG5RKuC7NgVXBRRClaa3XFirRY74ooxVK8K1Jgk+//EbrLwrLJe+aWzCT8wnn+JLPhzOTM7cybkzNnGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGMYFfQMjY2E4NjLQV7QlBdA3ODIedhgfGTxVjdA71FX5TiMM9RZtV14MY+3bDBVtWS70VWT1D8PKKegIg/Lqtxgo2j7P9Iyo6x+GIz1F2+iTHoX7d7pBmVtA+/wPfKBoK/2h6f9HlHYc6DOrfxiWdS4wGADaVIq21A/S9Q9SyhVRr3n9w7CMq2ILByinC9jUPwyLttY9/XYN0F+0vc6h1gCbi7WJau3ev8SlwaLtdc4o1HGvLg6p78HF0aLtdQ6EQPbmRYefoQXGi7bXNbgKrIsu6nC5bKvBAej/IgaMA2XbEMA+sB5vgLvJ62XbE44lK1iLN0AteX2saIsdA31cJIACRVvsmFPfAKe+C+gGQZgHyzYI6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QAZxnH8ik+PANRiTdp+EhXMBY8+Mb4qVbD+knMqi+fPPM+wjQIr3uzzc6XaEjiD6QeaHvBtTT+ElJm1H35A985dhPGirCBTJu9t1AvHTuKQsVusCboivfAs/nfaWiI1zgUtG1F+ISOoC3FEw4Ez4tuvqt7XISf0m4cCbcyRzwyMo5PJn3l4aN6ANW+k8fYNKFFOmHjLFIh5EXH8EknwmoCBe4obfRJ4SazmsKMst0AP5BWaDfJHSECygSQviHkAV6TkOIM6GlCtotmHTEdyJKQgcPwsH8SJN2JiNEH0DhYG6gLNDnHNgGh8EUOmBXYMIN/0kYCRdQpkXxCSELzCENpyJLfN6gLDCPRKzoAo2FORU1JdMqasobL3iURKgwTl6UP/kkY7bMXZIn+aTjDoquphT/c2Abq/xFeZJXIuKg6IrKyC0V9Ql1gfy+zIIJkk4EOX6R4ETOhHl+kMAqj11e5Po9ghPYCXL+JIdRMtc8yftzDCbpfPMk7XtRGVAnNMiZQr7FEBAJ7YthPJdNINJ7QgaCkeI+RtIbDBc8FlSGg6K/xdLTPzRaUTGWAeWNR4f6y/U9LoZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGCYr/wPASlI+YTsoSQAAAABJRU5ErkJggg==');

        head.appendChild(icon);
    }
    if(e.keyCode == 38 && !nocommand.includes(document.activeElement.id.toLowerCase())) {
        messageToggle = (messageToggle + 1) % 2;
    }
    if(e.key == "\\" && !nocommand.includes(document.activeElement.id.toLowerCase())) {
        doNewSend(["6", [4]]);
    }
    if(e.keyCode == 189 && !nocommand.includes(document.activeElement.id.toLowerCase())) {
        doNewSend(["6", [28]]);
        /*setTimeout(() => {
            doNewSend(["6", [25]]);
        }, 100);*/
    }
    if(e.key == BOOST && !nocommand.includes(document.activeElement.id.toLowerCase())) {
        slot(boostType);
    }
    if(e.key == MILL && !nocommand.includes(document.activeElement.id.toLowerCase())) {
        slot(millType);
    }
    if(e.key == SPIKE && !nocommand.includes(document.activeElement.id.toLowerCase())) {
        slot(spikeType)
    }
    if(e.key == TURRET && !nocommand.includes(document.activeElement.id.toLowerCase())) {
        doNewSend(["5", [turretType, null]])
    }
    if(e.keyCode == 80 && !nocommand.includes(document.activeElement.id.toLowerCase())) {
        let sendPrompt = prompt("Send (Type Help for Help):").split(", ");

        if (sendPrompt.length == 2) {
            eval("doNewSend(["+sendPrompt[0]+", ["+sendPrompt[1]+"]])");
        } else if (sendPrompt.length == 3) {
            eval("doNewSend(["+sendPrompt[0]+", ["+sendPrompt[1]+", "+sendPrompt[2]+"]])");
        } else if (sendPrompt.length == 1 && sendPrompt[0].toLowerCase() == "help") {
            alert("6, 4 = Katana, 6, 25 = Spinning Spikes, 6, 28 = Power Mill, 6, 15 = Musket, 33, angle = Move, 2, angle = Aim, 5, id = Slot, 'c', 1, angle = start hit, c, 0, angle = stop hit")
        } else {
            alert("Ws Sender Error. Use a, b, c option format. Do not use brackets ( (), [], {} ).")
        }
    }
    if(e.keyCode == 76 && !nocommand.includes(document.activeElement.id.toLowerCase())) {
        let evals = prompt("Console Command: Available Commands: katana(), place(spikeType:millType:boostType:turretType, optionalangle):")
        eval(evals);
    }
})


function isElementVisible(e) {
    return (e.offsetParent !== null);
}


function toRad(angle) {
    return angle * 0.01745329251;
}

function dist(a, b){
    return Math.sqrt( Math.pow((b.y-a[2]), 2) + Math.pow((b.x-a[1]), 2) );
}


document.title = "Utility Mod by i30cps"

function update() {
    for (let i=0;i<9;i++){
        if (isElementVisible(document.getElementById("actionBarItem" + i.toString()))){
            primary = i;
        }
    }

    for (let i=9;i<16;i++){
        if (isElementVisible(document.getElementById("actionBarItem" + i.toString()))){
            secondary = i;
        }
    }

    for (let i=16;i<19;i++){
        if (isElementVisible(document.getElementById("actionBarItem" + i.toString()))){
            foodType = i - 16;
        }
    }

    for (let i=19;i<22;i++){
        if (isElementVisible(document.getElementById("actionBarItem" + i.toString()))){
            wallType = i - 16;
        }
    }

    for (let i=22;i<26;i++){
        if (isElementVisible(document.getElementById("actionBarItem" + i.toString()))){
            spikeType = i - 16;
        }
    }

    for (let i=26;i<29;i++){
        if (isElementVisible(document.getElementById("actionBarItem" + i.toString()))){
            millType = i - 16;
        }
    }

    for (let i=29;i<31;i++){
        if (isElementVisible(document.getElementById("actionBarItem" + i.toString()))){
            mineType = i - 16;
        }
    }

    for (let i=31;i<33;i++){
        if (isElementVisible(document.getElementById("actionBarItem" + i.toString()))){
            boostType = i - 16;
        }
    }

    for (let i=33;i<39;i++){
        if (isElementVisible(document.getElementById("actionBarItem" + i.toString())) && i != 36){
            turretType = i - 16;
        }
    }

    spawnpadType = 36;
}

try {
    document.getElementById("moomooio_728x90_home").style.display = "none";
    $("moomooio728x90_home").parent().css({display: "none"});
} catch (e) {
    console.log("There was an error removing the ads.");
}


var menuChange = document.createElement("div");
menuChange.className = "menuCard";
menuChange.id = "mainSettings";
menuChange.innerHTML = `
<div id="simpleModal" class="modal">
<div class="modal-content">
<div class="modal-header">
<span class="closeBtn">&times;</span>
<h2 style="font-size: 17px;">Settings</h2>
</div>
<div class="modal-body" style="font-size: 17px;">
<div class="modal-content" style="font-size:14px">
<p>This mod does not give any unfair advantages. ESC = Open Menu, P = WS Sender L = Console Command, Up Arrow=Autochat, Dash (-) = Power Mill, Backslash (\\) = Katana</p>
</div>
<div class="flexControl">
<h3 style="font-size: 17px;"> Settings </h3>
<label class="container">Show biomes on the map ?(Snow, Plains, desert)
<input type="checkbox" id="myCheck">
<span class="checkmark"></span>
</label>
<label class="container">Aim Cursor?
<input type="checkbox" id="myCheck3">
<span class="checkmark"></span>
</label>
<label for="spikechanger" class="container">Spike Key:</label>
<input type="text" id="spikechanger" value="v"><label for="millchanger" class="container">Windmill Key:
</label><input type="text" id="millchanger" value="z"><label for="boostchanger" class="container">Boost/Trap Key:</label>
<input type="text" id="boostchanger" value="f"><label for="turretchanger" class="container">Turret/Teleporter/Other Key:</label>
<input type="text" id="turretchanger" value="g">
<h3 style="font-size: 17px;"> Autochat settings </h3>
<label class="container">AutoChat Animation?
<input type="checkbox" id="myCheck2">
<span class="checkmark"></span>
</label>
<br>AutoChat:<input type="text" value="bit.ly/i30cpsmod not unfair" id="ach1" width="100" height="50"/><br>
</div>
</div>
</div>
</div>
`
document.body.appendChild(menuChange)



var styleItem = document.createElement("style");
styleItem.type = "text/css";
styleItem.appendChild(document.createTextNode(`
.keyPressLow {
margin-left: 8px;
font-size: 16px;
margin-right: 8px;
height: 25px;
width: 50px;
background-color: #fcfcfc;
border-radius: 3.5px;
border: none;
text-align: center;
color: #4A4A4A;
border: 0.5px solid #f2f2f2;
}
.menuPrompt {
font-size: 17px;
font-family: 'Hammersmith One';
color: #4A4A4A;
flex: 0.2;
text-align: center;
margin-top: 10px;
display: inline-block;
}

.modal {
display: none;
position: fixed;
z-index: 1;
left: 0;
top: 0;
overflow: auto;
height: 100%;
width: 100%;
}

.modal-content {
margin: 10% auto;
width: 40%;
box-shadow: 0 5px 8px 0 rgba(0, 0, 0, 0.2), 0 7px 20px 0 rgba(0, 0, 0, 0.17);
font-size: 14px;
line-height: 1.6;
}

.modal-header h2,
.modal-footer h3 {
margin: 0;
}

.modal-header {
background: #4287f5;
padding: 15px;
color: #fff;
border-top-left-radius: 5px;
border-top-right-radius: 5px;
}

.modal-body {
padding: 10px 20px;
background: #fff;
}

.modal-footer {
background: #cf2727;
padding: 10px;
color: #fff;
text-align: center;
border-bottom-left-radius: 5px;
border-bottom-right-radius: 5px;
}

.closeBtn {
color: #ccc;
float: right;
font-size: 30px;
color: #fff;
}

.closeBtn:hover,
.closeBtn:focus {
color: #000;
text-decoration: none;
cursor: pointer;
}

/* Customize the label (the container) */
.container {
display: block;
position: relative;
padding-left: 35px;
margin-bottom: 12px;
cursor: pointer;
font-size: 16px;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}

/* Hide the browser's default checkbox */
.container input {
position: absolute;
opacity: 0;
cursor: pointer;
height: 0;
width: 0;
}

/* Create a custom checkbox */
.checkmark {
position: absolute;
top: 0;
left: 0;
height: 25px;
width: 25px;
background-color: #eee;
}

/* On mouse-over, add a grey background color */
.container:hover input ~ .checkmark {
background-color: #ccc;
}

/* When the checkbox is checked, add a red background */
.container input:checked ~ .checkmark {
background-color: #cf2727;
}

/* Create the checkmark/indicator (hidden when not checked) */
.checkmark:after {
content: "";
position: absolute;
display: none;
}

/* Show the checkmark when checked */
.container input:checked ~ .checkmark:after {
display: block;
}

/* Style the checkmark/indicator */
.container .checkmark:after {
left: 9px;
top: 5px;
width: 5px;
height: 10px;
border: solid white;
border-width: 0 3px 3px 0;
-webkit-transform: rotate(45deg);
-ms-transform: rotate(45deg);
transform: rotate(45deg);
}

`))
document.head.appendChild(styleItem);


$("#adCard").css({display: "none"});


document.addEventListener('keydown', function(e) {
    if (e.keyCode == 27){
        if (modal.style.display = "none") {
            modal.style.display = "block";
        } else {
            modal.style.display = "none";
        }
    }
})

// Get modal element
var modal = document.getElementById("simpleModal");
// Get close button
var closeBtn = document.getElementsByClassName('closeBtn')[0];

// Events
closeBtn.addEventListener('click', closeModal);
window.addEventListener('click', outsideClick);

// Close
function closeModal() {
    modal.style.display = 'none';
}

// Close If Outside Click
function outsideClick(e) {
    if (e.target == modal) {
        modal.style.display = 'none';
    }
}

var checkbox = document.querySelector("#myCheck")

checkbox.addEventListener('change', function() {
    if (this.checked) {
        $("#mapDisplay").css({background: `url('https://i.imgur.com/fgFsQJp.png')`});
        console.log('checked')
    } else {
        $("#mapDisplay").css({background: `rgba(0, 0, 0, 0.25)`})
        console.log('unchecked')
    }
})
var checkbox2 = document.querySelector("#myCheck2")

checkbox2.addEventListener('change', function() {
    if (this.checked) {
        animateyorn = true;
    } else {
        animateyorn = false;
    }
})
var checkbox3 = document.querySelector("#myCheck3")

checkbox3.addEventListener('change', function() {
    if (this.checked) {
        $("#gameCanvas").css('cursor', 'url(http://cur.cursors-4u.net/user/use-1/use153.cur), default');
    } else {
        document.getElementById("gameCanvas").style.cursor = 'default';
    }
})

document.addEventListener('keyup', (e)=>{
    if(e.keyCode == 71 && document.activeElement.id.toLowerCase() !== 'chatbox') {
        setTimeout( () => {
            boostDir = null;
        }, 10);
    }
})

function animate(space, animateyn) {
    let result = '';
    if (space) {
        result = document.getElementById("ach1").value;
    } else {
        result = "i30cps"
    }
    if (animateyn) {
        let place = Math.floor(Math.random()*result.length);
        result = result.substring(0, place) + "_" + result.substring(place+1, result.length);
    }
    return result;
}

unsafeWindow.admob = {
    requestInterstitialAd: ()=>{},
    showInterstitialAd: ()=>{}
}
function ichat(space, chance) {
    var ach1 = document.getElementById("ach2").value;
    let result = '';
    let characters;
    if(space) {
        characters = ach1;
    }
    if(space) {
        characters = characters.padStart((30 - characters.length) / 2 + characters.length)
        characters = characters.padEnd(30);
    }
    let count = 0;
    for (let i = 0; i < characters.length; i++ ) {
        if(Math.floor(Math.random() * chance) == 0 && characters.charAt(i) != "-" && count < 0 && characters.charAt(i) != " ") {
            result += "";
            count++
        } else {
            result += characters.charAt(i);
        }
    }
    return result;
}




// CPS VIEWER BY CyRuler#3691





var cps = 0;
var iCliked = 1;
$("#gameCanvas").mousedown(function(e){
    if(e.which == 1 && iCliked == 1)
    {
        cps = (cps + 1)
        setTimeout( () => {
            cps = (cps - 1)
        }, 950);
    }
});
$("#gameCanvas").mousedown(function(e){
    if(e.which == 3 && iCliked == 1)
    {
        cps = (cps + 1)
        setTimeout( () => {
            cps = (cps - 1)
        }, 950);
    }
});
document.addEventListener("mousedown", buttonPress, false);
function buttonPress(e) {
    if(e.button==1 && iCliked == 1)
    {
        cps = (cps + 1)
        setTimeout( () => {
            cps = (cps - 1)
        }, 950);
    }
}

document.addEventListener('keydown', function (e) {
    if(e.keyCode == 16){
        SendKeys.Send("{F3}");
    }
});
var CpsMenu = document.createElement("div");
CpsMenu.style.padding = "5px";
CpsMenu.id = "CpsDiv";
CpsMenu.style.font = "30px Arial";
CpsMenu.style.display = "block";
CpsMenu.style.position = "fixed";
CpsMenu.style.top = "3%";
CpsMenu.style.left = "0%";
CpsMenu.textContent = "Loading";
document.body.appendChild(CpsMenu);
setInterval(()=>{
    CpsMenu.textContent = "Cps:"+cps;
}, 0);