BattleDudes.io Aim Line

Adds a line indicating the weapon direction in BattleDudes.io

Stan na 09-06-2024. Zobacz najnowsza wersja.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Greasemonkey lub Violentmonkey.

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

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana będzie instalacja rozszerzenia Tampermonkey lub Userscripts.

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

Aby zainstalować ten skrypt, musisz zainstalować rozszerzenie menedżera skryptów użytkownika.

(Mam już menedżera skryptów użytkownika, pozwól mi to zainstalować!)

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.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Musisz zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

(Mam już menedżera stylów użytkownika, pozwól mi to zainstalować!)

// ==UserScript==
// @name         BattleDudes.io Aim Line
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  Adds a line indicating the weapon direction in BattleDudes.io
// @author       blahblah
// @match        *://*.battledudes.io/*
// @license      MIT
// @icon         https://sun9-74.userapi.com/impg/6jY26kEuZ0qU5I9x7mdBOdQ2zA8pG8H9s3AkDw/BTLz1oDKei0.jpg?size=604x340&quality=96&sign=9fe860f5ff054a01d1ffef1c2f9c79fb&type=album
// @grant        play hornex.pro
// ==/UserScript==

(function() {
    'use strict';

    var aimLine = document.createElement('div');
    aimLine.style.position = 'fixed';
    aimLine.style.width = '700px';
    aimLine.style.height = '3px';
    aimLine.style.backgroundColor = 'red';
    aimLine.style.zIndex = '9999';
    aimLine.style.transformOrigin = 'top left';
    aimLine.style.display = 'none';
    aimLine.style.pointerEvents = 'none';

    document.body.appendChild(aimLine);

    function updateAimLine(event) {
        var centerX = window.innerWidth / 2;
        var centerY = window.innerHeight / 2;

        var mouseX = event.clientX;
        var mouseY = event.clientY;

        var angle = Math.atan2(mouseY - centerY, mouseX - centerX) * 180 / Math.PI;

        aimLine.style.left = centerX + 'px';
        aimLine.style.top = centerY + 'px';
        aimLine.style.transform = `rotate(${angle}deg)`;
        aimLine.style.display = 'block';
    }

    document.addEventListener('mousemove', updateAimLine);

    document.addEventListener('keydown', function(event) {
        if (event.key === 'l') {
            aimLine.style.display = aimLine.style.display === 'none' ? 'block' : 'none';
        }
    });
})();