AimBot 0.2

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

이 스크립트를 설치하려면 Tampermonkey, Greasemonkey 또는 Violentmonkey와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 Tampermonkey와 같은 확장 프로그램을 설치해야 합니다.

이 스크립트를 설치하려면 Tampermonkey 또는 Violentmonkey와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 Tampermonkey 또는 Userscripts와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 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();
})();