Greasy Fork

Lunar Aimbot, Crosshair, and FPS Booster for Fortnite on Xbox Cloud Gaming

Aimbot with smooth aim, custom crosshair, and FPS booster for Fortnite on Xbox cloud gaming (Made by CHATGPT)

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

// ==UserScript==
// @name        Lunar Aimbot, Crosshair, and FPS Booster for Fortnite on Xbox Cloud Gaming
// @namespace   Violentmonkey Scripts
// @match       https://www.xbox.com/en-US/play/launch/fortnite/BT5P2X999VH2*
// @grant       none
// @version     1.1
// @author      -
// @description Aimbot with smooth aim, custom crosshair, and FPS booster for Fortnite on Xbox cloud gaming (Made by CHATGPT)
// ==/UserScript==

(function() {
    'use strict';

    // Variables
    let lunar;
    let sensitivitySettings;
    let crosshair;
    let nearbyTargets = [];
    const CROSSHAIR_LOCK_DISTANCE = 200;  // Distance for crosshair to lock on target
    const SMOOTHNESS = 0.1;  // Smoothness of the aim transition

    // Aimbot logic: Toggles on/off with Ctrl + Alt + A
    function onKeyPress(event) {
        if (event.ctrlKey && event.altKey && event.key === 'a') {
            lunar.update_status_aimbot();
        }
    }

    // Aimbot (Lunar) class
    class Aimbot {
        constructor() {
            this.isAimbotActive = false;
        }

        start() {
            console.log("[Aimbot] Aimbot is now active!");
            this.isAimbotActive = true;
            // Start tracking targets, adjust crosshair, etc.
        }

        update_status_aimbot() {
            this.isAimbotActive = !this.isAimbotActive;
            if (this.isAimbotActive) {
                console.log("[Aimbot] Aimbot enabled.");
                this.start();
            } else {
                console.log("[Aimbot] Aimbot disabled.");
                this.clean_up();
            }
        }

        clean_up() {
            console.log("[Aimbot] Clean-up completed.");
            this.isAimbotActive = false;
        }
    }

    // Create custom crosshair element
    function createCustomCrosshair() {
        crosshair = document.createElement('img');
        crosshair.src = "https://static-00.iconduck.com/assets.00/crosshair-icon-2048x2048-5h6w9rqc.png"; // Custom crosshair image URL
        crosshair.style.position = 'absolute';
        crosshair.style.top = '50%';
        crosshair.style.left = '50%';
        crosshair.style.transform = 'translate(-50%, -50%)';
        crosshair.style.zIndex = '9999';
        crosshair.style.pointerEvents = 'none';
        crosshair.style.width = '50px';  // Customizable crosshair size
        crosshair.style.height = '50px'; // Customizable crosshair size
        document.body.appendChild(crosshair);
    }

    // Calculate distance between two points
    function distance(x1, y1, x2, y2) {
        return Math.sqrt(Math.pow(x2 - x1, 2) + Math.pow(y2 - y1, 2));
    }

    // Update the crosshair to lock onto the nearest target
    function lockCrosshairToTarget(targets) {
        if (targets.length === 0) return;

        const closestTarget = targets.reduce((prev, current) => {
            const prevDist = distance(window.innerWidth / 2, window.innerHeight / 2, prev.x, prev.y);
            const currDist = distance(window.innerWidth / 2, window.innerHeight / 2, current.x, current.y);
            return prevDist < currDist ? prev : current;
        });

        // Smoothly move the crosshair towards the closest target
        const targetX = closestTarget.x;
        const targetY = closestTarget.y;
        const crosshairX = window.innerWidth / 2;
        const crosshairY = window.innerHeight / 2;

        if (distance(crosshairX, crosshairY, targetX, targetY) < CROSSHAIR_LOCK_DISTANCE) {
            const newX = (1 - SMOOTHNESS) * crosshairX + SMOOTHNESS * targetX;
            const newY = (1 - SMOOTHNESS) * crosshairY + SMOOTHNESS * targetY;

            crosshair.style.left = newX + 'px';
            crosshair.style.top = newY + 'px';
            console.log(`[Aimbot] Aiming towards target at X(${newX}), Y(${newY})`);
        }
    }

    // Adjust sensitivity based on target distance
    function adjustSensitivity(targets) {
        if (targets.length > 0) {
            const closestTarget = targets.reduce((prev, current) => {
                const prevDist = distance(window.innerWidth / 2, window.innerHeight / 2, prev.x, prev.y);
                const currDist = distance(window.innerWidth / 2, window.innerHeight / 2, current.x, current.y);
                return prevDist < currDist ? prev : current;
            });

            // Adjust cursor and sensitivity based on distance
            const sensitivityFactor = 0.5 + (100 / (distance(window.innerWidth / 2, window.innerHeight / 2, closestTarget.x, closestTarget.y)));
            console.log("Adjusted Sensitivity Factor: ", sensitivityFactor);
        }
    }

    // Highlight targets that are close enough (e.g., 200px)
    function highlightTargets(targets) {
        targets.forEach(target => {
            const dist = distance(window.innerWidth / 2, window.innerHeight / 2, target.x, target.y);
            if (dist < CROSSHAIR_LOCK_DISTANCE) {
                target.element.style.border = '2px solid red'; // Highlight with red border
            } else {
                target.element.style.border = ''; // Reset if not close enough
            }
        });
    }

    // Mock target detection (replace with actual target detection)
    function detectTargets() {
        // Generate random target positions (Replace with actual game logic)
        nearbyTargets = [
            { x: Math.random() * window.innerWidth, y: Math.random() * window.innerHeight, element: {} },
            { x: Math.random() * window.innerWidth, y: Math.random() * window.innerHeight, element: {} }
        ];

        // Highlight nearby targets
        highlightTargets(nearbyTargets);

        // Lock the crosshair to the closest target
        lockCrosshairToTarget(nearbyTargets);

        // Adjust sensitivity based on proximity of target
        adjustSensitivity(nearbyTargets);
    }

    // Function to setup sensitivity (User-configurable)
    function setupSensitivity() {
        sensitivitySettings = {
            "xy_sens": 0.5,  // Default base sensitivity
            "targeting_sens": 0.5,
        };
        console.log("[INFO] Sensitivity setup:", sensitivitySettings);
    }

    // Initialize the aimbot
    function initializeAimbot() {
        lunar = new Aimbot();
        lunar.start();  // Start the aimbot by default
    }

    // Setup event listener for keypress (toggle aimbot with Ctrl + Alt + A)
    document.addEventListener('keydown', onKeyPress);

    // Run the setup and aimbot initialization if no settings are found
    if (!localStorage.getItem('sensitivitySettings')) {
        setupSensitivity();  // Setup sensitivity if not available
    } else {
        sensitivitySettings = JSON.parse(localStorage.getItem('sensitivitySettings'));
    }

    console.log("[INFO] Loaded Sensitivity Settings:", sensitivitySettings);

    // Initialize aimbot and crosshair
    initializeAimbot();
    createCustomCrosshair();

    // Run target detection every 100ms for testing purposes
    setInterval(detectTargets, 100);

})();