Sploop Keystrokes

Sploop.io Keystrokes, Includes Cps & Max Cps!

30.06.2024 itibariyledir. En son verisyonu görün.

Bu betiği kurabilmeniz için Tampermonkey, Greasemonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

You will need to install an extension such as Tampermonkey to install this script.

Bu betiği kurabilmeniz için Tampermonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Userscripts gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

You will need to install an extension such as Tampermonkey to install this script.

Bu komut dosyasını yüklemek için bir kullanıcı komut dosyası yöneticisi uzantısı yüklemeniz gerekecek.

(Zaten bir kullanıcı komut dosyası yöneticim var, kurmama izin verin!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Zateb bir user-style yöneticim var, yükleyeyim!)

// ==UserScript==
// @name Sploop Keystrokes
// @version 1
// @description Sploop.io Keystrokes, Includes Cps & Max Cps!
// @author DETIX
// @match *://sploop.io/*
// @icon https://sploop.io/img/ui/favicon.png
// @license MIT
// @namespace https://greasyfork.org/users/1311498
// ==/UserScript==
//God is the greatest!
const DATA = {
    CPS: 0,
    MAXCPS: 0
}
const OBJECT = {
    KEYS: {
        PRIMARY:{KEY:"Digit1", KEY2: "Numpad1", PRESSED: false},
        SECONDARY:{KEY:"Digit2", KEY2: "Numpad2", PRESSED: false},
        FOOD:{KEY: "KeyQ", KEY2: "Digit3", PRESSED: false},
        SPIKE:{KEY: "KeyR", KEY2: "Digit5", PRESSED: false},
        TRAP: {KEY: "KeyF", KEY2: "Digit7", PRESSED: false},
        SPACE: {KEY: "Space", PRESSED: false},
        LOCK: {KEY: "KeyX", PRESSED: false},
        AUTOHIT: {KEY: "KeyE", PRESSED: false}
    },
    BUTTONS: {
        LEFT:{BUTTON: 0, PRESSED: false},
        MIDDLE:{BUTTON: 1, PRESSED: false},
        //These three buttons will not be shown in the menu, but using them will still increase the CPS in the menu.
        RIGHT:{BUTTON: 2, PRESSED: false},
        XBUTTON1:{BUTTON: 3, PRESSED: false},
        XBUTTON2:{BUTTON: 4, PRESSED: false}
    }
};
const isInGame = () => {
    const homepage = document.getElementById("homepage");
    return homepage.style.display !== "flex";
};

const isAVAILABLE = () => {
    if (!isInGame()) return false;
    const chatWrapper = document.getElementById("chat-wrapper");
    const clanMenu = document.getElementById("clan-menu");
    if (chatWrapper.style.display === "block" || clanMenu.style.display === "block") return false;
    return true;
}
const UPDATE = {
    KEYS: {
        DOWN: function(e){
            if(e.code === OBJECT.KEYS.PRIMARY.KEY || e.code === OBJECT.KEYS.PRIMARY.KEY2){
                OBJECT.KEYS.PRIMARY.PRESSED = true;
            }
            if(e.code === OBJECT.KEYS.SECONDARY.KEY || e.code === OBJECT.KEYS.SECONDARY.KEY2){
                OBJECT.KEYS.SECONDARY.PRESSED = true;
            }
            if(e.code === OBJECT.KEYS.FOOD.KEY || e.code === OBJECT.KEYS.FOOD.KEY2){
                OBJECT.KEYS.FOOD.PRESSED = true;
            }
            if(e.code === OBJECT.KEYS.SPIKE.KEY || e.code === OBJECT.KEYS.SPIKE.KEY2){
                OBJECT.KEYS.SPIKE.PRESSED = true;
            }
            if(e.code === OBJECT.KEYS.TRAP.KEY || e.code === OBJECT.KEYS.TRAP.KEY2){
                OBJECT.KEYS.TRAP.PRESSED = true;
            }
            if(e.code === OBJECT.KEYS.SPACE.KEY){
                if (event.repeat) return;
                OBJECT.KEYS.SPACE.PRESSED = true;
                UPDATE.CPS();
            }

            //KeyE & KeyX
            if(e.code === OBJECT.KEYS.LOCK.KEY && isAVAILABLE()){
                if (event.repeat) return;
                OBJECT.KEYS.LOCK.PRESSED = !OBJECT.KEYS.LOCK.PRESSED;
            }
            if(e.code === OBJECT.KEYS.AUTOHIT.KEY && isAVAILABLE()){
                if (event.repeat) return;
                OBJECT.KEYS.AUTOHIT.PRESSED = !OBJECT.KEYS.AUTOHIT.PRESSED;
            }
        },
        UP: function(e){
            if(e.code === OBJECT.KEYS.PRIMARY.KEY || e.code === OBJECT.KEYS.PRIMARY.KEY2){
                OBJECT.KEYS.PRIMARY.PRESSED = false;
            }
            if(e.code === OBJECT.KEYS.SECONDARY.KEY || e.code === OBJECT.KEYS.SECONDARY.KEY2){
                OBJECT.KEYS.SECONDARY.PRESSED = false;
            }
            if(e.code === OBJECT.KEYS.FOOD.KEY || e.code === OBJECT.KEYS.FOOD.KEY2){
                OBJECT.KEYS.FOOD.PRESSED = false;
            }
            if(e.code === OBJECT.KEYS.SPIKE.KEY || e.code === OBJECT.KEYS.SPIKE.KEY2){
                OBJECT.KEYS.SPIKE.PRESSED = false;
            }
            if(e.code === OBJECT.KEYS.TRAP.KEY || e.code === OBJECT.KEYS.TRAP.KEY2){
                OBJECT.KEYS.TRAP.PRESSED = false;
            }
            if(e.code === OBJECT.KEYS.SPACE.KEY){
                OBJECT.KEYS.SPACE.PRESSED = false;
                UPDATE.CPS();
            }
        }
    },
    BUTTONS: {
        DOWN: function(e){
            if(e.button === OBJECT.BUTTONS.LEFT.BUTTON){
                OBJECT.BUTTONS.LEFT.PRESSED = true;
                UPDATE.CPS();
            }
            if(e.button === OBJECT.BUTTONS.MIDDLE.BUTTON){
                OBJECT.BUTTONS.MIDDLE.PRESSED = true;
                UPDATE.CPS();
            }
            if(e.button === OBJECT.BUTTONS.RIGHT.BUTTON){
                OBJECT.BUTTONS.RIGHT.PRESSED = true;
                UPDATE.CPS();
            }
            if(e.button === OBJECT.BUTTONS.XBUTTON1.BUTTON){
                OBJECT.BUTTONS.XBUTTON1.PRESSED = true;
                UPDATE.CPS();
            }
            if(e.button === OBJECT.BUTTONS.XBUTTON2.BUTTON){
                OBJECT.BUTTONS.XBUTTON2.PRESSED = true;
                UPDATE.CPS();
            }
        },
        UP: function(e){
            if(e.button === OBJECT.BUTTONS.LEFT.BUTTON){
                OBJECT.BUTTONS.LEFT.PRESSED = false;
            }
            if(e.button === OBJECT.BUTTONS.MIDDLE.BUTTON){
                OBJECT.BUTTONS.MIDDLE.PRESSED = false;
            }
            if(e.button === OBJECT.BUTTONS.RIGHT.BUTTON){
                OBJECT.BUTTONS.RIGHT.PRESSED = false;
            }
            if(e.button === OBJECT.BUTTONS.XBUTTON1.BUTTON){
                OBJECT.BUTTONS.XBUTTON1.PRESSED = false;
            }
            if(e.button === OBJECT.BUTTONS.XBUTTON2.BUTTON){
                OBJECT.BUTTONS.XBUTTON2.PRESSED = false;
            }
        }
    },
    CPS: function(){
        DATA.CPS++;
        if(DATA.CPS > DATA.MAXCPS){
            DATA.MAXCPS = DATA.CPS
        };
        setTimeout(() => {
            DATA.CPS--;
        },1000);
    },
    VISUALS: function(COLOR){
        COLOR = "#D0D0D0"
        //Primary Key
        document.getElementById("primary").style.backgroundColor = OBJECT.KEYS.PRIMARY.PRESSED ? COLOR : "";

        //Secondary Key
        document.getElementById("secondary").style.backgroundColor = OBJECT.KEYS.SECONDARY.PRESSED ? COLOR : "";

        //Food Key
        document.getElementById("food").style.backgroundColor = OBJECT.KEYS.FOOD.PRESSED ? COLOR : "";

        //Spike Key
        document.getElementById("spike").style.backgroundColor = OBJECT.KEYS.SPIKE.PRESSED ? COLOR : "";

        //Trap Key
        document.getElementById("trap").style.backgroundColor = OBJECT.KEYS.TRAP.PRESSED ? COLOR : "";

        //Autohit Key
        document.getElementById("autohit").style.backgroundColor = OBJECT.KEYS.AUTOHIT.PRESSED ? COLOR : "";

        //Lock Key
        document.getElementById("lockdir").style.backgroundColor = OBJECT.KEYS.LOCK.PRESSED ? COLOR : "";

        //Space Key
        document.getElementById("spacebar").style.backgroundColor = OBJECT.KEYS.SPACE.PRESSED ? COLOR : "";

        //Left Click
        document.getElementById("left-click").style.backgroundColor = OBJECT.BUTTONS.LEFT.PRESSED ? COLOR : "";

        //Right Click
        document.getElementById("right-click").style.backgroundColor = OBJECT.BUTTONS.RIGHT.PRESSED ? COLOR : "";

        document.getElementById("cps").textContent = `CPS: ${DATA.CPS}`;
        document.getElementById("maxcps").textContent = `MCPS: ${DATA.MAXCPS}`;
        requestAnimationFrame(UPDATE.VISUALS);
    }

};

const MENU = () => {
    const menuHTML = `
<div id="menu">
<div class="menu-row">
<div class="menu-item" id="primary">Primary</div>
<div class="menu-item" id="secondary">Secondary</div>
</div>
<div class="menu-row">
<div class="menu-item" id="food">Food</div>
<div class="menu-item" id="spike">Spike</div>
<div class="menu-item" id="trap">Trap</div>
</div>
<div class="menu-row">
<div class="menu-item" id="autohit">KeyE</div>
<div class="menu-item" id="lockdir">KeyX</div>
</div>
<div class="menu-row">
<div class="menu-item mouse-button" id="left-click">LEFT</div>
<div class="menu-item mouse-button" id="right-click">RIGHT</div>
</div>
<div class="menu-row">
<div class="menu-item spacebar" id="spacebar">Spacebar</div>
</div>
<div class="menu-row">
<div class="menu-item cps" id="cps">CPS: 0</div>
<div class="menu-item maxcps" id="maxcps">MAXCPS: 0</div>
</div>
</div>
    `;

    const menuStyles = `
#menu {
position: fixed;
top: 20px;
left: 20px;
color: #fff;
padding: 10px;
border-radius: 5px;
z-index: 1000;
font-family: Arial, sans-serif;
font-size: 14px;
pointer-events: none; /* this allows the user to click through the menu. */
}
.menu-row {
display: flex;
justify-content: space-between;
margin-bottom: 8px;
}
.menu-item {
flex: 1;
text-align: center;
padding: 8px;
background-color: rgba(0, 0, 0, 0.2);
border-radius: 5px;
}
.spacebar {
width: 100%;
background-color: rgba(0, 0, 0, 0.2);
border-radius: 5px;
text-align: center;
padding: 8px;
}
.cps, .maxcps {
width: 50%;
}
.mouse-button {
width: 48%;
}
.menu-item:last-child {
margin-bottom: 0;
}
`;
    document.body.insertAdjacentHTML('beforeend', menuHTML);
    const styleElement = document.createElement('style');
    styleElement.textContent = menuStyles;
    document.head.appendChild(styleElement);
    UPDATE.VISUALS();
};

document.addEventListener("keydown", UPDATE.KEYS.DOWN);
document.addEventListener("keyup", UPDATE.KEYS.UP);
document.addEventListener("mousedown", UPDATE.BUTTONS.DOWN);
document.addEventListener("mouseup", UPDATE.BUTTONS.UP);

MENU();