Greasy Fork

Lunar Client - Crosshair, FPS Booster, and HD Quality for Fortnite on Xbox Cloud Gaming

Crosshair, FPS Booster, and HD Quality for Fortnite on Xbox Cloud Gaming (Made by ChatGPT)

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

// ==UserScript==
// @name        Lunar Client - Crosshair, FPS Booster, and HD Quality for Fortnite on Xbox Cloud Gaming
// @namespace   Violentmonkey Scripts
// @match       https://www.xbox.com/en-US/play/launch/fortnite/BT5P2X999VH2*
// @grant       none
// @version     2.7
// @author      -
// @description Crosshair, FPS Booster, and HD Quality for Fortnite on Xbox Cloud Gaming (Made by ChatGPT)
// ==/UserScript==

// Inject "Product Sans" font
function injectProductSans() {
    const link = document.createElement('link');
    link.rel = 'stylesheet';
    link.href = 'https://fonts.googleapis.com/css2?family=Product+Sans&display=swap';
    document.head.appendChild(link);
    document.body.style.fontFamily = '"Product Sans", sans-serif';
}

// Create a custom crosshair with an image
function createCrosshair() {
    const crosshair = document.createElement('img');
    crosshair.src = 'https://static-00.iconduck.com/assets.00/crosshair-icon-2048x2048-5h6w9rqc.png';
    crosshair.style.position = 'absolute';
    crosshair.style.top = '50%';
    crosshair.style.left = '50%';
    crosshair.style.transform = 'translate(-50%, -50%)';
    crosshair.style.width = '50px';  // You can adjust the size of the crosshair
    crosshair.style.height = '50px';  // Adjust the size to fit your preference
    crosshair.style.pointerEvents = 'none';
    crosshair.style.zIndex = '10000';
    document.body.appendChild(crosshair);
}

// FPS Booster function: Force GPU and browser to render at higher quality
function enableFPSBooster() {
    const meta = document.createElement('meta');
    meta.name = 'viewport';
    meta.content = 'width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no, minimal-ui';
    document.head.appendChild(meta);

    // Set the game to HD quality (This is a placeholder for actual upscaling logic)
    const hdMetaTag = document.createElement('meta');
    hdMetaTag.name = 'x-viewport-scale';
    hdMetaTag.content = 'device-width, initial-scale=1.0, maximum-scale=1.0';
    document.head.appendChild(hdMetaTag);

    // Additional FPS boosting can be done by forcing rendering optimizations
    const style = document.createElement('style');
    style.innerHTML = `
        body {
            overflow: hidden;
        }
        video {
            transform: scale(1);
            filter: brightness(1.2) contrast(1.2);
        }
    `;
    document.head.appendChild(style);
}

// Create and toggle the menu
let menuVisible = true;
let menuMinimized = false;
let espEnabled = true;  // Start with ESP enabled

const menu = document.createElement('div');
menu.style.position = 'fixed';
menu.style.top = '20px';
menu.style.left = '20px';
menu.style.backgroundColor = 'rgba(0, 0, 0, 0.7)';
menu.style.color = '#FFF';
menu.style.padding = '10px';
menu.style.fontSize = '16px';
menu.style.fontFamily = 'Product Sans, sans-serif';
menu.style.zIndex = '10001';
menu.style.cursor = 'move'; // Make the menu draggable
menu.innerHTML = `
    <div style="display: flex; justify-content: space-between;">
        <span id="menuTitle">Lunar Client</span>
        <span id="menuMinimize" style="cursor: pointer;">-</span>
    </div>
    <div id="menuContent">
        <button id="toggleESP">Toggle ESP</button>
        Crosshair and FPS Booster
    </div>
`;
document.body.appendChild(menu);

// Menu dragging functionality
let isDragging = false;
let offsetX, offsetY;

menu.addEventListener('mousedown', (event) => {
    isDragging = true;
    offsetX = event.clientX - menu.offsetLeft;
    offsetY = event.clientY - menu.offsetTop;
    menu.style.transition = 'none'; // Disable smooth transition while dragging
});

document.addEventListener('mousemove', (event) => {
    if (isDragging) {
        menu.style.left = `${event.clientX - offsetX}px`;
        menu.style.top = `${event.clientY - offsetY}px`;
    }
});

document.addEventListener('mouseup', () => {
    isDragging = false;
    menu.style.transition = 'all 0.3s'; // Re-enable smooth transition after drag
});

// Minimize/Restore menu functionality
const menuMinimizeButton = document.getElementById('menuMinimize');
const menuContent = document.getElementById('menuContent');

menuMinimizeButton.addEventListener('click', () => {
    if (menuMinimized) {
        menuContent.style.display = 'block';
        menuMinimizeButton.textContent = '-';
    } else {
        menuContent.style.display = 'none';
        menuMinimizeButton.textContent = '+';
    }
    menuMinimized = !menuMinimized;
});

// Function to toggle menu visibility with Ctrl + A
function toggleMenu() {
    menuVisible = !menuVisible;
    menu.style.display = menuVisible ? 'block' : 'none';
}

// Listen for Ctrl+A keypress to toggle the menu visibility
window.addEventListener('keydown', (event) => {
    if (event.ctrlKey && event.key === 'a') {
        event.preventDefault(); // Prevent default Ctrl+A behavior
        toggleMenu();
    }
});

// Toggle ESP functionality
const toggleESPButton = document.getElementById('toggleESP');
toggleESPButton.addEventListener('click', () => {
    espEnabled = !espEnabled;
    toggleESPButton.textContent = espEnabled ? 'Disable ESP' : 'Enable ESP';  // Change button text
    if (espEnabled) {
        console.log("[ESP] ESP enabled.");
    } else {
        console.log("[ESP] ESP disabled.");
    }
});

// Display ESP (Extra Sensory Perception) - Shows nearby players (without health info)
function drawESP(targets) {
    if (!espEnabled) return;  // If ESP is disabled, don't draw anything

    targets.forEach(target => {
        const espElement = document.createElement('div');
        espElement.style.position = 'absolute';
        espElement.style.top = `${target.y}px`;
        espElement.style.left = `${target.x}px`;
        espElement.style.color = '#FFFFFF';
        espElement.style.fontSize = '12px';
        espElement.style.fontFamily = 'Product Sans, sans-serif';
        espElement.style.zIndex = '9999';

        espElement.innerHTML = `Name: ${target.id}`; // No health displayed
        document.body.appendChild(espElement);
    });
}

// Example of using ESP
function updateESP() {
    // Here you can fetch real player data or use placeholders
    const targets = [
        { x: 300, y: 250, id: 'Player1' },
        { x: 500, y: 400, id: 'Player2' }
    ];
    drawESP(targets);
}

// Initialize everything
function initialize() {
    injectProductSans();
    createCrosshair();
    enableFPSBooster();

    // Update ESP every second
    setInterval(updateESP, 1000);
}

// Run the initialization function when the page is loaded
window.addEventListener('load', initialize);