Greasy Fork

Fortnite Xbox Cloud Aimbot with GUI and Fixes

Aimbot for Fortnite Xbox Cloud with Canvas detection, ESP, FOV, and GUI enhancements.

目前为 2024-12-12 提交的版本。查看 最新版本

// ==UserScript==
// @name         Fortnite Xbox Cloud Aimbot with GUI and Fixes
// @namespace    http://tampermonkey.net/
// @version      26
// @description  Aimbot for Fortnite Xbox Cloud with Canvas detection, ESP, FOV, and GUI enhancements.
// @author       You
// @match        https://www.xbox.com/en-US/play/launch/fortnite/BT5P2X999VH2
// @grant        none
// ==/UserScript==

(function () {
    'use strict';

    const config = {
        aimInterval: 100, // Interval in milliseconds for aim checks
        aimSmoothing: 0.3, // Smoothing for aim adjustments
        fov: 60, // Field of View in degrees
        fovEnabled: true, // Toggle FOV
        autoShoot: false, // Auto-shoot feature
        enableESP: false, // Toggle ESP
        enemyColor: [255, 0, 0], // RGB color of enemy (adjust based on game visuals)
        canvasSelector: 'canvas', // Selector for the game canvas
    };

    let canvas, ctx, gui;

    /**
     * Initialize the game canvas and its context
     */
    function initializeCanvas() {
        canvas = document.querySelector(config.canvasSelector);
        if (!canvas) {
            console.error('Game canvas not found!');
            return false;
        }
        ctx = canvas.getContext('2d');
        console.log('Canvas initialized:', canvas);
        return true;
    }

    /**
     * Create the GUI for controlling the aimbot features
     */
    function createGUI() {
        gui = document.createElement('div');
        gui.style.cssText = `
            position: fixed;
            top: 20px;
            right: 20px;
            background: rgba(0, 0, 0, 0.8);
            color: white;
            padding: 15px;
            border-radius: 10px;
            font-family: Arial, sans-serif;
            z-index: 9999;
            width: 300px;
        `;
        document.body.appendChild(gui);

        // Title
        const title = document.createElement('h3');
        title.textContent = 'Aimbot Settings';
        title.style.cssText = 'margin: 0 0 10px; text-align: center;';
        gui.appendChild(title);

        // FOV Toggle
        createButton(gui, 'Toggle FOV', () => {
            config.fovEnabled = !config.fovEnabled;
            alert(`FOV is now ${config.fovEnabled ? 'Enabled' : 'Disabled'}`);
        });

        // Auto-Shoot Toggle
        createButton(gui, 'Toggle Auto-Shoot', () => {
            config.autoShoot = !config.autoShoot;
            alert(`Auto-Shoot is now ${config.autoShoot ? 'Enabled' : 'Disabled'}`);
        });

        // ESP Toggle
        createButton(gui, 'Toggle ESP', () => {
            config.enableESP = !config.enableESP;
            alert(`ESP is now ${config.enableESP ? 'Enabled' : 'Disabled'}`);
        });

        // FOV Slider
        createSlider(gui, 'Field of View (FOV):', config.fov, 20, 180, (value) => {
            config.fov = value;
        });

        // Smoothing Slider
        createSlider(gui, 'Aim Smoothing:', config.aimSmoothing, 0.1, 1, (value) => {
            config.aimSmoothing = value;
        });

        console.log('GUI initialized.');
    }

    /**
     * Create a button in the GUI
     */
    function createButton(container, label, onClick) {
        const button = document.createElement('button');
        button.textContent = label;
        button.style.cssText = `
            background: #4CAF50;
            border: none;
            color: white;
            padding: 10px;
            width: 100%;
            margin-bottom: 10px;
            cursor: pointer;
            font-size: 14px;
        `;
        button.addEventListener('click', onClick);
        container.appendChild(button);
    }

    /**
     * Create a slider in the GUI
     */
    function createSlider(container, label, defaultValue, min, max, onChange) {
        const sliderContainer = document.createElement('div');
        sliderContainer.style.cssText = 'margin-bottom: 10px;';

        const sliderLabel = document.createElement('label');
        sliderLabel.textContent = label;
        sliderLabel.style.cssText = 'display: block; margin-bottom: 5px;';
        sliderContainer.appendChild(sliderLabel);

        const slider = document.createElement('input');
        slider.type = 'range';
        slider.min = min;
        slider.max = max;
        slider.value = defaultValue;
        slider.step = 0.1;
        slider.style.cssText = 'width: 100%;';
        slider.addEventListener('input', () => {
            const value = parseFloat(slider.value);
            sliderLabel.textContent = `${label} ${value}`;
            onChange(value);
        });
        sliderContainer.appendChild(slider);

        container.appendChild(sliderContainer);
    }

    /**
     * Detect enemies using Canvas color analysis
     * @returns {Array} List of detected enemy positions
     */
    function detectEnemiesFromCanvas() {
        if (!ctx || !canvas) return [];

        const enemies = [];
        const imageData = ctx.getImageData(0, 0, canvas.width, canvas.height).data;

        // Detect enemy color in canvas pixels
        for (let i = 0; i < imageData.length; i += 4) {
            const r = imageData[i];
            const g = imageData[i + 1];
            const b = imageData[i + 2];

            if (
                Math.abs(r - config.enemyColor[0]) < 10 &&
                Math.abs(g - config.enemyColor[1]) < 10 &&
                Math.abs(b - config.enemyColor[2]) < 10
            ) {
                const x = (i / 4) % canvas.width;
                const y = Math.floor(i / 4 / canvas.width);
                enemies.push({ x, y });
            }
        }

        return enemies;
    }

    /**
     * Aimbot logic to aim at enemies
     */
    function aimAtEnemies() {
        if (!canvas || !config.fovEnabled) return;

        const playerX = canvas.width / 2;
        const playerY = canvas.height / 2;

        const enemies = detectEnemiesFromCanvas();
        if (enemies.length === 0) return;

        let closestEnemy = null;
        let closestAngle = Infinity;

        for (const enemy of enemies) {
            const angle = Math.atan2(enemy.y - playerY, enemy.x - playerX) * (180 / Math.PI);
            if (Math.abs(angle) < Math.abs(closestAngle)) {
                closestEnemy = enemy;
                closestAngle = angle;
            }
        }

        if (closestEnemy) {
            console.log('Aiming at:', closestEnemy);
            if (config.autoShoot) simulateShooting();
        }
    }

    /**
     * Simulate shooting by dispatching a click event
     */
    function simulateShooting() {
        const event = new MouseEvent('click', { bubbles: true, cancelable: true });
        document.dispatchEvent(event);
        console.log('Shooting at enemy!');
    }

    /**
     * Initialize aimbot functionality
     */
    function initializeAimAssist() {
        if (!initializeCanvas()) return;
        createGUI();
        setInterval(() => aimAtEnemies(), config.aimInterval);
        console.log('Aimbot initialized.');
    }

    initializeAimAssist();
})();