Greasy Fork

Greasy Fork is available in English.

Fortnite Xbox Cloud Aim Assist with GUI, FOV Circle & Auto Detection

Fortnite on Xbox Cloud with GUI, FOV Circle, and auto-detection.

当前为 2024-12-11 提交的版本,查看 最新版本

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         Fortnite Xbox Cloud Aim Assist with GUI, FOV Circle & Auto Detection
// @namespace    http://tampermonkey.net/
// @version      22
// @description  Fortnite on Xbox Cloud with GUI, FOV Circle, and auto-detection.
// @author       Your Name
// @match        https://www.xbox.com/en-US/play/launch/fortnite/BT5P2X999VH2
// @grant        none
// ==/UserScript==

(function () {
    'use strict';

    // Default configuration values
    const config = {
        enemySelector: '.enemy-class', // Replace with actual enemy selector
        playerSelector: '.PlayerInfo-module__container___ROgVL', // Replace with actual player selector
        aimInterval: 100, // Interval in milliseconds for aim checks
        aimSmoothing: 0.2, // Smoothing factor for more natural aim adjustments
        fov: 60, // Field of View for the aimbot in degrees
        fovRadius: 100, // Radius of the FOV circle (in pixels)
    };

    // Add GUI overlay to control FOV, sensitivity, etc.
    const guiStyle = `
        position: fixed;
        top: 10px;
        right: 10px;
        background: rgba(0, 0, 0, 0.7);
        color: white;
        padding: 10px;
        border-radius: 10px;
        z-index: 1000;
    `;
    const sliderStyle = `
        margin: 5px 0;
    `;

    const gui = document.createElement('div');
    gui.style.cssText = guiStyle;

    // FOV slider
    const fovLabel = document.createElement('label');
    fovLabel.innerText = 'FOV: ';
    const fovSlider = document.createElement('input');
    fovSlider.type = 'range';
    fovSlider.min = 20;
    fovSlider.max = 180;
    fovSlider.value = config.fov;
    fovSlider.style.cssText = sliderStyle;
    fovSlider.addEventListener('input', () => {
        config.fov = fovSlider.value;
        fovValue.innerText = `${config.fov}°`;
        config.fovRadius = (config.fov / 180) * window.innerWidth * 0.3; // Dynamically adjust the FOV circle size
        updateFovCircle();
    });
    const fovValue = document.createElement('span');
    fovValue.innerText = `${config.fov}°`;

    // Smoothing slider
    const smoothingLabel = document.createElement('label');
    smoothingLabel.innerText = 'Aim Smoothing: ';
    const smoothingSlider = document.createElement('input');
    smoothingSlider.type = 'range';
    smoothingSlider.min = 0;
    smoothingSlider.max = 1;
    smoothingSlider.step = 0.05;
    smoothingSlider.value = config.aimSmoothing;
    smoothingSlider.style.cssText = sliderStyle;
    smoothingSlider.addEventListener('input', () => {
        config.aimSmoothing = smoothingSlider.value;
        smoothingValue.innerText = config.aimSmoothing;
    });
    const smoothingValue = document.createElement('span');
    smoothingValue.innerText = config.aimSmoothing;

    // Append the elements to the GUI
    gui.appendChild(fovLabel);
    gui.appendChild(fovSlider);
    gui.appendChild(fovValue);
    gui.appendChild(document.createElement('br'));
    gui.appendChild(smoothingLabel);
    gui.appendChild(smoothingSlider);
    gui.appendChild(smoothingValue);

    // Add the GUI to the page
    document.body.appendChild(gui);

    // Create FOV Circle (hidden initially)
    const fovCircle = document.createElement('div');
    fovCircle.style.cssText = `
        position: fixed;
        top: 50%;
        left: 50%;
        width: ${config.fovRadius * 2}px;
        height: ${config.fovRadius * 2}px;
        border-radius: 50%;
        border: 2px solid red;
        pointer-events: none;
        transform: translate(-50%, -50%);
        opacity: 0.5;
        z-index: 999;
    `;
    document.body.appendChild(fovCircle);

    /**
     * Update the FOV Circle based on the current FOV setting
     */
    function updateFovCircle() {
        fovCircle.style.width = `${config.fovRadius * 2}px`;
        fovCircle.style.height = `${config.fovRadius * 2}px`;
    }

    /**
     * Calculate the angle between two points.
     * @param {number} targetX - Target X coordinate.
     * @param {number} targetY - Target Y coordinate.
     * @param {number} playerX - Player X coordinate.
     * @param {number} playerY - Player Y coordinate.
     * @returns {number} Angle in degrees.
     */
    function calculateAngle(targetX, targetY, playerX, playerY) {
        return Math.atan2(targetY - playerY, targetX - playerX) * (180 / Math.PI);
    }

    /**
     * Smoothly rotate the player towards the enemy.
     * @param {number} angle - The calculated angle to rotate the player.
     */
    function smoothAim(angle) {
        const player = document.querySelector(config.playerSelector);
        if (player) {
            const currentRotation = parseFloat(player.style.transform.replace('rotate(', '').replace('deg)', '')) || 0;
            const targetRotation = angle;
            const smoothedRotation = currentRotation + (targetRotation - currentRotation) * config.aimSmoothing;
            player.style.transform = `rotate(${smoothedRotation}deg)`;
        }
    }

    /**
     * Check if the enemy is within the player's Field of View (FOV).
     * @param {number} angle - The angle between the player and the enemy.
     * @returns {boolean} Whether the enemy is within the FOV.
     */
    function isWithinFov(angle) {
        return Math.abs(angle) <= (config.fov / 2);
    }

    /**
     * Aim at the closest enemy based on the player's position.
     */
    function aimAtEnemies() {
        const enemy = document.querySelector(config.enemySelector);
        const player = document.querySelector(config.playerSelector);

        // Ensure enemy and player elements exist
        if (!enemy || !player) {
            console.warn('Enemy or player element not found.');
            return;
        }

        // Get bounding rectangles of the enemy and player
        const enemyRect = enemy.getBoundingClientRect();
        const playerRect = player.getBoundingClientRect();

        // Calculate center coordinates for both the enemy and player
        const enemyX = enemyRect.x + enemyRect.width / 2;
        const enemyY = enemyRect.y + enemyRect.height / 2;
        const playerX = playerRect.x + playerRect.width / 2;
        const playerY = playerRect.y + playerRect.height / 2;

        // Calculate the angle to aim at the enemy
        const angle = calculateAngle(enemyX, enemyY, playerX, playerY);

        // If the enemy is within the FOV, aim at them
        if (isWithinFov(angle)) {
            smoothAim(angle);
            console.log(`Aimed at enemy: angle = ${angle.toFixed(2)} degrees`);
        }
    }

    /**
     * Initialize the aim assist functionality.
     */
    function initializeAimAssist() {
        console.log('Aim Assist Initialized');
        setInterval(aimAtEnemies, config.aimInterval);
    }

    // Start the aim assist script
    initializeAimAssist();
})();