HitmanZ's Pack

Full pack of all my scripts in one!

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

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

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

Advertisement:

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

Advertisement:

// ==UserScript==
// @name         HitmanZ's Pack
// @namespace    http://tampermonkey.net/
// @version      Zz.7
// @description  Full pack of all my scripts in one!
// @author       HitmanZ
// @icon         https://i.ibb.co/jvbW1tVX/New-gats-io-logo-XD.png
// @license      MIT
// @match        *://gats.io/*
// @grant        none
// ==/UserScript==

(function () {

'use strict';

const customBackground = "https://i.imgur.com/vZVbyT3.jpeg";

let autoFire = false;
let autoFireInterval = null;
let autoFireIndicator;

function createAutoFireUI() {
    autoFireIndicator = document.createElement('div');
    autoFireIndicator.textContent = 'AUTO FIRE';

    Object.assign(autoFireIndicator.style, {
        position: 'fixed',
        bottom: '20px',
        left: '50%',
        transform: 'translateX(-50%)',
        padding: '6px 14px',
        fontSize: '14px',
        fontFamily: 'Arial',
        color: '#fff',
        background: 'rgba(0,0,0,0.3)',
        borderRadius: '6px',
        pointerEvents: 'none',
        opacity: '0',
        visibility: 'hidden',
        transition: 'opacity 0.2s ease',
        zIndex: '999999'
    });

    document.body.appendChild(autoFireIndicator);
}

function updateAutoFireUI(state) {
    if (!autoFireIndicator) return;

    autoFireIndicator.style.opacity = state ? '1' : '0';
    autoFireIndicator.style.visibility = state ? 'visible' : 'hidden';
}

function startAutoFire() {
    if (autoFireInterval) return;

    autoFireInterval = setInterval(() => {
        document.dispatchEvent(new MouseEvent('mousedown', {
            button: 0,
            bubbles: true
        }));
    }, 10);
}

function stopAutoFire() {
    if (!autoFireInterval) return;

    clearInterval(autoFireInterval);
    autoFireInterval = null;

    document.dispatchEvent(new MouseEvent('mouseup', {
        button: 0,
        bubbles: true
    }));
}

document.addEventListener('keydown', (e) => {

    const active = document.activeElement;
    const isTyping = active && (
        active.tagName === 'INPUT' ||
        active.tagName === 'TEXTAREA' ||
        active.isContentEditable
    );

    if (!isTyping && e.key.toLowerCase() === 'e' && !e.repeat) {

        autoFire = !autoFire;

        if (autoFire) startAutoFire();
        else stopAutoFire();

        updateAutoFireUI(autoFire);
    }

});

    let mouseX = 0;
    let mouseY = 0;

    const players = [];

    document.addEventListener('mousemove', e => {
        mouseX = e.clientX;
        mouseY = e.clientY;
    });

    const wait = setInterval(() => {

        const canvas = document.querySelector('canvas');
        if (!canvas) return;

        const ctx = canvas.getContext('2d');

        if (ctx._hitIndicatorHooked) return;
        ctx._hitIndicatorHooked = true;

        clearInterval(wait);

        canvas.style.cursor = 'crosshair';

        const originalArc = ctx.arc;

        ctx.arc = function(x, y, r, s, e, cc) {

            if (
                r > 12 &&
                r < 35 &&
                s === 0 &&
                e > 6
            ) {
                const rect = canvas.getBoundingClientRect();

                players.push({
                    x: rect.left + x,
                    y: rect.top + y,
                    r: r
                });
            }

            return originalArc.call(this, x, y, r, s, e, cc);
        };

        function frame() {

            let hovering = false;

            for (let i = players.length - 1; i >= 0; i--) {

                const p = players[i];

                const dx = mouseX - p.x;
                const dy = mouseY - p.y;

                if ((dx * dx + dy * dy) <= (p.r * p.r)) {
                    hovering = true;
                    break;
                }
            }

            canvas.style.cursor = hovering ? 'move' : 'crosshair';

            players.length = 0;

            requestAnimationFrame(frame);
        }

        frame();

    }, 100);

window.addEventListener('load', createAutoFireUI);

const bgStyle = document.createElement("style");
bgStyle.textContent = `
    body {
        background: none !important;
    }

    canvas {
        background: none !important;
    }

    body::before {
        content: "";
        position: fixed;
        inset: 0;
        background: url(${customBackground}) no-repeat center center fixed;
        background-size: cover;
        z-index: -1;
        pointer-events: none;
    }
`;

document.head.appendChild(bgStyle);

let darkMode = localStorage.getItem('gatsDarkMode') === 'true';
let statusLabel;
let menuStyle;

document.addEventListener('keydown', (e) => {

    const active = document.activeElement;

    const isTyping = active && (
        active.tagName === 'INPUT' ||
        active.tagName === 'TEXTAREA' ||
        active.isContentEditable
    );

    if (!isTyping && e.key === 'F9') {

        darkMode = !darkMode;

        localStorage.setItem('gatsDarkMode', darkMode);

        updateStatusLabel();
        applyMenuDarkMode();

    }

});

 function enableCrosshairCursor() {
    const style = document.createElement('style');
    style.innerHTML = `
        * {
            cursor: crosshair;
        }
    `;
    document.head.appendChild(style);
}
    enableCrosshairCursor();

function createStatusLabel(){

    statusLabel = document.createElement('div');

    statusLabel.innerHTML = `
        <span id="dm-icon">🌙</span>
        <span id="dm-text">DARK MODE</span>
    `;

    Object.assign(statusLabel.style,{
        position:'fixed',
        left:'20px',
        bottom:'60px',
        display:'flex',
        alignItems:'center',
        gap:'8px',
        padding:'8px 14px',
        fontSize:'13px',
        fontFamily:'Arial, sans-serif',
        color:'#cfd8ff',
        background:'rgba(20,20,40,0.35)',
        border:'1px solid rgba(120,120,255,0.3)',
        borderRadius:'10px',
        backdropFilter:'blur(6px)',
        boxShadow:'0 0 12px rgba(120,120,255,0.25)',
        zIndex:999999,
        pointerEvents:'none',
        userSelect:'none',

        opacity:'0',
        transform:'translateY(10px)',
        transition:'all 0.25s ease'
    });

    document.body.appendChild(statusLabel);

    updateStatusLabel(true); // show on load
}

function updateStatusLabel(show = false){

    const text = statusLabel.querySelector('#dm-text');
    const icon = statusLabel.querySelector('#dm-icon');

    text.textContent = darkMode ? 'DARK MODE ON' : 'LIGHT MODE';
    icon.textContent = darkMode ? '🌙' : '☀️';


    statusLabel.style.borderColor = darkMode
        ? 'rgba(120,120,255,0.4)'
        : 'rgba(255,200,120,0.4)';

    statusLabel.style.boxShadow = darkMode
        ? '0 0 14px rgba(120,120,255,0.35)'
        : '0 0 14px rgba(255,200,120,0.35)';

    if(show){
        statusLabel.style.opacity = '1';
        statusLabel.style.transform = 'translateY(0)';
    }

    
    statusLabel.style.opacity = '1';
    statusLabel.style.transform = 'translateY(0)';

    clearTimeout(statusLabel._hideTimeout);
    statusLabel._hideTimeout = setTimeout(() => {
        statusLabel.style.opacity = '0';
        statusLabel.style.transform = 'translateY(10px)';
    }, 1200);
}


function applyMenuDarkMode(){

    if(!menuStyle){
        menuStyle = document.createElement("style");
        document.head.appendChild(menuStyle);
    }

    if(darkMode){

        menuStyle.textContent = `

        
        .container, .menu, .panel {
            border-radius: 20px;
            background: rgba(0, 0, 0, 0) !important;
            border:1px solid rgba(255,255,255,0.08);
        }

       
        .container div {
            border-radius: 50px;
            background: rgba(0,0,0,0.1) !important;
        }


       
        button, select {

            background: rgba(0,0,0,0.45) !important;
            color:rgb(255, 178, 237) !important;
            border:1px solid #444 !important;

        }

        button:hover {

            background: rgba(0,0,0,0.65) !important;

        }

      

        button[style*="green"] {

            box-shadow:0 0 12px rgba(0,255,120,0.7);

        }

        `;

    }else{

        menuStyle.textContent = '';

    }

}

        const serverMessage = document.querySelector('a, .message, .status');
        serverMessage.textContent = "HitmanZ's pack!, any bugs or recommendations, click me";
        serverMessage.href = "https://discord.gg/dBJC9644a8";

function overrideCanvas(){

    const canvas = document.querySelector('canvas');
    if(!canvas) return;

    const ctx = canvas.getContext('2d');

    if(ctx._darkModeHooked) return;
    ctx._darkModeHooked = true;

    const fillDesc = Object.getOwnPropertyDescriptor(CanvasRenderingContext2D.prototype,"fillStyle");
    const strokeDesc = Object.getOwnPropertyDescriptor(CanvasRenderingContext2D.prototype,"strokeStyle");

    function replaceColor(value){

    if(!darkMode || typeof value !== "string")
        return value;

    const lower = value.toLowerCase();

    if(
        lower.includes("#c") ||
        lower.includes("#d") ||
        lower.includes("#e") ||
        lower.includes("rgb(200") ||
        lower.includes("rgb(180") ||
        lower.includes("rgb(220")
    ){
        return "#1a1919";
    }


    if(lower === "#000000" || lower === "#000" || lower === "black")
        return "white";

    if(lower === "#efeff5")
        return "#212020";

    if(lower === "#bec8dd")
        return "#1a1919";

    return value;
}

    Object.defineProperty(ctx,"fillStyle",{

        set(value){
            fillDesc.set.call(this,replaceColor(value));
        },

        get(){
            return fillDesc.get.call(this);
        }

    });

    Object.defineProperty(ctx,"strokeStyle",{

        set(value){
            strokeDesc.set.call(this,replaceColor(value));
        },

        get(){
            return strokeDesc.get.call(this);
        }

    });

    const originalFill = ctx.fill.bind(ctx);

    ctx.fill = function(...args){

        if(darkMode){

            const style = ctx.fillStyle;

            if(typeof style === "string" && (

                style.includes("red") ||
                style.includes("#ff") ||
                style.includes("rgb(255")

            )){

                const oldAlpha = ctx.globalAlpha;

                ctx.globalAlpha = Math.min(1, oldAlpha * 2.5);

                originalFill(...args);

                ctx.globalAlpha = oldAlpha;

                return;

            }

        }

        originalFill(...args);

    };

    const originalFillRect = ctx.fillRect.bind(ctx);

    ctx.fillRect = function(x,y,w,h){

        if(darkMode){

            if(x === 0 && y === 0)
                ctx.fillStyle = '#1b1b1b';

            else if(w > 200 && h > 200)
                ctx.fillStyle = '#101010';

            else if(w > 40 && h > 40)
                ctx.fillStyle = '#2b2b2b';

        }

        originalFillRect(x,y,w,h);

    };

    const originalStroke = ctx.stroke.bind(ctx);

    ctx.stroke = function(){

        if(darkMode){

            if(ctx.lineWidth === 1)
                ctx.strokeStyle = '#3a3a3a';

        }

        originalStroke();

    };

    const originalFillText = ctx.fillText.bind(ctx);

    ctx.fillText = function(text,x,y,maxWidth){

        if(darkMode)
            ctx.fillStyle = 'white';

        originalFillText(text,x,y,maxWidth);

    };

}

function animationLoop(){

    overrideCanvas();
    requestAnimationFrame(animationLoop);

}

createStatusLabel();
applyMenuDarkMode();
animationLoop();

})();