AimBot 0.2

aimbot will only work if you have a character rotation database; without it, it will not work

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name          AimBot 0.2
// @namespace     Tampermonkey
// @match         *://cavegame.io/*
// @grant         unsafeWindow
// @version       0.2
// @author        MihaLAS
// @description   aimbot will only work if you have a character rotation database; without it, it will not work
// @run-at        document-start
// @license       MIT
// ==/UserScript==

(function() {
    'use strict';
    const win = unsafeWindow || window;
    let myPos = { x: 0, y: 0 }, enemies = [], isAimActive = false;
    let currentAimAngle = 0, aimSpeed = 500;

    const rotationDatabase = {};

    const isTyping = () => {
        const el = document.activeElement;
        return el && (el.tagName === 'INPUT' || el.tagName === 'TEXTAREA');
    };

    const OriginalWS = win.WebSocket;
    win.WebSocket = function(url, protocols) {
        const socket = new OriginalWS(url, protocols);
        const originalSend = socket.send;

        socket.send = function(data) {
            if (!data) return originalSend.apply(this, arguments);
            const bytes = new Uint8Array(data instanceof ArrayBuffer ? data : (data.buffer || data));

            if (bytes[0] === 34 && isAimActive) {
                const target = getNearest();
                if (target) {
                    const dx = target.x - myPos.x;
                    const dy = target.y - myPos.y;
                    let targetAngle = (Math.round(Math.atan2(dy, dx) * (180 / Math.PI)) + 360) % 360;

                    currentAimAngle = targetAngle;
                    const roundedAngle = Math.round(currentAimAngle);
                    const packet = rotationDatabase[roundedAngle] || rotationDatabase[String(roundedAngle)];

                    if (packet) {
                        originalSend.call(this, new Uint8Array(packet).buffer);
                        return;
                    }
                }
            }
            return originalSend.apply(this, arguments);
        };

        socket.addEventListener('message', async (e) => {
            const buffer = e.data instanceof Blob ? await e.data.arrayBuffer() : e.data;
            if (buffer instanceof ArrayBuffer) {
                const bytes = new Uint8Array(buffer), view = new DataView(buffer);
                let found = [];
                for (let i = 0; i < bytes.length - 15; i++) {
                    if (bytes[i] === 6 && bytes[i+1] === 112 && bytes[i+2] === 108) {
                        found.push({ x: view.getFloat32(i+7, false), y: view.getFloat32(i+11, false) });
                    }
                    if (bytes[i] === 6 && bytes[i+1] === 99 && bytes[i+2] === 97) {
                        let off = (bytes[i+7] === 6) ? 14 : 7;
                        myPos.x = view.getFloat32(i + off, false);
                        myPos.y = view.getFloat32(i + off + 4, false);
                    }
                }
                if (found.length > 0) enemies = found;
            }
        });
        return socket;
    };

    function getNearest() {
        return enemies
            .filter(e => Math.hypot(e.x - myPos.x, e.y - myPos.y) > 2)
            .sort((a, b) => Math.hypot(a.x - myPos.x, a.y - myPos.y) - Math.hypot(b.x - myPos.x, b.y - myPos.y))[0];
    }

    window.addEventListener('keydown', (e) => {
        if (isTyping()) return;
        if (e.code === 'KeyB') isAimActive = !isAimActive;
    });

    const createUI = () => {
        if (document.getElementById('aim-ui')) return;
        if (!document.body) {
            setTimeout(createUI, 100);
            return;
        }

        const ui = document.createElement('div');
        ui.id = 'aim-ui';
        Object.assign(ui.style, {
            position: 'fixed',
            bottom: '20px',
            right: '20px',
            padding: '8px 12px',
            background: 'rgba(0,0,0,0.8)',
            color: '#fff',
            fontSize: '14px',
            fontWeight: 'bold',
            fontFamily: 'monospace',
            zIndex: '100000',
            borderRadius: '4px',
            border: '1px solid #333',
            pointerEvents: 'none'
        });
        document.body.appendChild(ui);

        setInterval(() => {
            ui.innerHTML = `AIMBOT: <span style="color: ${isAimActive ? '#0f0' : '#f00'}">${isAimActive ? 'ON' : 'OFF'}</span> <small style="font-weight:normal; font-size:10px; opacity:0.6">[B]</small>`;
        }, 100);
    };

    createUI();
})();