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     2.0
// @author      -
// @description Aimbot with smooth aim, custom crosshair, and FPS booster for Fortnite on Xbox cloud gaming (Made by CHATGPT)
// ==/UserScript==
(function() {
    'use strict';

    let lunar;
    let sensitivitySettings;
    let nearbyTargets = [];
    const CROSSHAIR_LOCK_DISTANCE = 200;  // Distance to "lock" onto the target
    const SMOOTHNESS = 0.1;  // Smoothness factor for gradual aiming
    const TARGET_DETECTION_INTERVAL = 200;  // Detection update every 200ms (adjust as needed)
    let targetDetectionTimer;

    // Function to create and add custom crosshair to the page
    function createCustomCrosshair() {
        let 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 = '30px';  // Set the crosshair width to 30px (smaller size)
        crosshair.style.height = '30px'; // Set the crosshair height to 30px (smaller size)
        document.body.appendChild(crosshair);
    }

    // Function to simulate detecting nearby enemies (replace with actual enemy detection)
    function detectTargets() {
        // Simulating random target positions (replace with actual enemy detection)
        nearbyTargets = [
            { x: Math.random() * window.innerWidth, y: Math.random() * window.innerHeight, id: 'target_1' },
            { x: Math.random() * window.innerWidth, y: Math.random() * window.innerHeight, id: 'target_2' }
        ];

        // Highlight the targets that are close
        highlightTargets(nearbyTargets);

        // Lock cursor on the closest target
        lockCursorToTarget(nearbyTargets);

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

        // Create ESP markers for each target
        createPlayerESP(nearbyTargets);
    }

    // Function to highlight targets that are close to the player
    function highlightTargets(targets) {
        targets.forEach(target => {
            const distanceToTarget = distance(window.innerWidth / 2, window.innerHeight / 2, target.x, target.y);

            // Highlight targets within a specific range (e.g., 200px)
            if (distanceToTarget < CROSSHAIR_LOCK_DISTANCE) {
                // You can modify the border or style here if you want visual feedback for locking on
            }
        });
    }

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

    // Function to lock the cursor on the closest target with smoothness
    function lockCursorToTarget(targets) {
        if (targets.length === 0) return;

        // Find the closest target
        const closestTarget = targets.reduce((prev, current) => {
            const prevDistance = distance(window.innerWidth / 2, window.innerHeight / 2, prev.x, prev.y);
            const currDistance = distance(window.innerWidth / 2, window.innerHeight / 2, current.x, current.y);
            return prevDistance < currDistance ? prev : current;
        });

        const targetX = closestTarget.x;
        const targetY = closestTarget.y;

        const crosshairX = window.innerWidth / 2;
        const crosshairY = window.innerHeight / 2;

        // If the target is within lock distance, snap to it
        if (distance(crosshairX, crosshairY, targetX, targetY) < CROSSHAIR_LOCK_DISTANCE) {
            // Smoothly move the cursor towards the target
            const newX = (1 - SMOOTHNESS) * crosshairX + SMOOTHNESS * targetX;
            const newY = (1 - SMOOTHNESS) * crosshairY + SMOOTHNESS * targetY;

            // Move the cursor to the new position
            moveCursor(newX, newY);

            console.log(`[INFO] Cursor locked to target: X(${newX}), Y(${newY})`);
        }
    }

    // Function to adjust sensitivity when targeting is close
    function adjustSensitivity(targets) {
        if (targets.length > 0) {
            // Reduce sensitivity when an enemy is nearby (for better precision)
            document.body.style.cursor = 'crosshair'; // Change cursor to a more precise one

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

            // Simulate sensitivity adjustment (e.g., decrease it as the enemy gets closer)
            const sensitivityFactor = 0.5 + (100 / (distance(window.innerWidth / 2, window.innerHeight / 2, closestTarget.x, closestTarget.y)));
            console.log("Adjusted Sensitivity: ", sensitivityFactor);
        } else {
            document.body.style.cursor = ''; // Reset cursor when no targets are close
        }
    }

    // Function to create Player ESP
    function createPlayerESP(targets) {
        // Remove previous ESP elements to avoid duplicates
        const existingESP = document.querySelectorAll('.player-esp');
        existingESP.forEach(esp => esp.remove());

        // Create new ESP markers for each target
        targets.forEach(target => {
            const espMarker = document.createElement('div');
            espMarker.classList.add('player-esp');
            espMarker.style.position = 'absolute';
            espMarker.style.top = `${target.y - 25}px`; // Position the ESP slightly above the target
            espMarker.style.left = `${target.x - 25}px`;
            espMarker.style.width = '50px';
            espMarker.style.height = '50px';
            espMarker.style.border = '2px solid red';
            espMarker.style.borderRadius = '50%'; // Circle shape
            espMarker.style.zIndex = '9999'; // Make sure ESP is visible above other elements
            espMarker.style.pointerEvents = 'none'; // Prevent interaction with the ESP
            espMarker.style.opacity = '1'; // Ensure full visibility (even behind walls)

            // Add the ESP element to the document body
            document.body.appendChild(espMarker);
        });
    }

    // Function to initialize sensitivity settings (user-configurable)
    function setupSensitivity() {
        sensitivitySettings = {
            "xy_sens": 0.5,  // Base sensitivity (adjust as per user preference)
            "targeting_sens": 0.5,
        };
        console.log("[INFO] Sensitivity setup: ", sensitivitySettings);
    }

    // Function to initialize and start the aimbot
    function initializeAimbot() {
        lunar = new Aimbot({
            collect_data: location.href.includes('collect_data')
        });
        lunar.start();
    }

    // Aimbot class implementation (for automatic aim assistance)
    class Aimbot {
        constructor(options) {
            this.collectData = options.collect_data;
            this.isAimbotActive = false;
        }

        start() {
            console.log("[Aimbot] Aimbot is now active!");
            this.isAimbotActive = true;
            this.autoAimbot(); // Automatically aim at the nearest target
        }

        // Automatically aim at the closest target
        autoAimbot() {
            targetDetectionTimer = setInterval(() => {
                if (this.isAimbotActive) {
                    detectTargets();  // Run the target detection and auto-aim assistance
                }
            }, TARGET_DETECTION_INTERVAL);  // Reduce frequency of detection (e.g., 200ms)
        }

        update_status_aimbot() {
            this.isAimbotActive = !this.isAimbotActive;
            if (this.isAimbotActive) {
                console.log("[Aimbot] Aimbot enabled.");
            } else {
                console.log("[Aimbot] Aimbot disabled.");
                clearInterval(targetDetectionTimer);  // Stop target detection when aimbot is disabled
            }
        }

        clean_up() {
            console.log("[Aimbot] Aimbot has been cleaned up.");
            this.isAimbotActive = false;
            clearInterval(targetDetectionTimer);  // Cleanup detection timer
        }
    }

    // Start the aimbot and setup
    setupSensitivity();
    initializeAimbot();

})();