Auto Down Attack

Join us! - https://discord.gg/3xDbJ8QD8f

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey, Greasemonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

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

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

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

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्क्रिप्ट व्यवस्थापक एक्स्टेंशन इंस्टॉल करावे लागेल.

(माझ्याकडे आधीच युझर स्क्रिप्ट व्यवस्थापक आहे, मला इंस्टॉल करू द्या!)

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

(माझ्याकडे आधीच युझर स्टाईल व्यवस्थापक आहे, मला इंस्टॉल करू द्या!)

// ==UserScript==
// @name         Auto Down Attack
// @namespace    http://tampermonkey.net/
// @version      1.2.1
// @description  Join us! - https://discord.gg/3xDbJ8QD8f
// @author       GoBattle Hacks Official
// @match        *://gobattle.io/*
// @match        *://*.gobattle.io/*
// @grant        none
// @license      MIT
// ==/UserScript==

(function() {
    'use strict';

    const aerial_down_attack_button = "z";
    const attack_frequency = 100;

    let textfield = null;

    let interval_id = null;

    function getTextField() {
        if (!textfield) {
            textfield = document.getElementById("shinobit-textfield");
        }
        return textfield;
    }

    document.addEventListener("keydown", event => {

        const currentTextField = getTextField();

        if (event.key === aerial_down_attack_button && !interval_id && currentTextField !== document.activeElement){
            aerial_down_attack();

            interval_id = setInterval(aerial_down_attack, attack_frequency);
        }
    });

    document.addEventListener("keyup", event => {

        const currentTextField = getTextField();

        if (event.key === aerial_down_attack_button && currentTextField !== document.activeElement){

            clearInterval(interval_id);
            interval_id = null;
        }
    });

    function aerial_down_attack(){

        const eventOptions = {
            "key": "ArrowUp",
            "keyCode": 38,
            "which": 38,
            "code": "ArrowUp",
            "location": 0,
            "altKey": false,
            "ctrlKey": false,
            "metaKey": false,
            "shiftKey": false,
            "repeat": false
        };

        document.dispatchEvent(new KeyboardEvent("keydown", eventOptions));

        temporarily_crouched();
        temporarily_crouched();

        sword_attack();

        document.dispatchEvent(new KeyboardEvent("keyup", eventOptions));
    }

    function jump(){
        const eventOptions = {
            "key": "ArrowUp",
            "keyCode": 38,
            "which": 38,
            "code": "ArrowUp",
            "location": 0,
            "altKey": false,
            "ctrlKey": false,
            "metaKey": false,
            "shiftKey": false,
            "repeat": false
        };
        document.dispatchEvent(new KeyboardEvent("keydown", eventOptions));
        document.dispatchEvent(new KeyboardEvent("keyup", eventOptions));
    }

    function temporarily_crouched(){

        const eventOptions = {
            "key": "ArrowDown",
            "keyCode": 40,
            "which": 40,
            "code": "ArrowDown",
            "location": 0,
            "altKey": false,
            "ctrlKey": false,
            "metaKey": false,
            "shiftKey": false,
            "repeat": false
        };
        document.dispatchEvent(new KeyboardEvent("keydown", eventOptions));
        document.dispatchEvent(new KeyboardEvent("keyup", eventOptions));
    }

    function sword_attack(){
        const eventOptions = {
            "key": "v",
            "keyCode": 86,
            "which": 86,
            "code": "KeyV",
            "location": 0,
            "altKey": false,
            "ctrlKey": false,
            "metaKey": false,
            "shiftKey": false,
            "repeat": false
        };
        document.dispatchEvent(new KeyboardEvent("keydown", eventOptions));
        document.dispatchEvent(new KeyboardEvent("keyup", eventOptions));
    }
})();