Lag Reducer Mod Menu

Adjust lag reduction level with a stylish mod menu, with saved progress, lazy load, FPS booster, and ping reducer options. Open/close with Ctrl key. Performance monitoring added.

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

// ==UserScript==
// @name         Lag Reducer Mod Menu
// @namespace    http://tampermonkey.net/
// @version      1.9
// @description  Adjust lag reduction level with a stylish mod menu, with saved progress, lazy load, FPS booster, and ping reducer options. Open/close with Ctrl key. Performance monitoring added.
// @author       You
// @include      *
// @license      none
// @grant        GM_addStyle
// ==/UserScript==

(function(){"use strict";const modMenuId="lagReducerModMenu";const defaultLanguage="en";const translations={en:{title:"MultiHelper",lagLevelLabel:"Select Lag Reduction Level:",lazyLoadLabel:"Lazy Load:",targetFPSLabel:"Target FPS for Booster:",targetPingLabel:"Target Ping for Reducer:",performanceInfoLabel:"Last execution time:",resetSettings:"Reset Settings"},es:{title:"Menú de Modificación de Reducción de Lag",lagLevelLabel:"Seleccionar Nivel de Reducción de Lag:",lazyLoadLabel:"Carga Perezosa:",targetFPSLabel:"Objetivo de FPS para el Impulsor:",targetPingLabel:"Objetivo de Ping para el Reductor:",performanceInfoLabel:"Tiempo de ejecución:",resetSettings:"Restablecer Configuración"}};function applyLagReduction(lagLevel,lazyLoad,targetFPS,targetPing){const startTime=performance.now();const lagReductionFactor=lagLevel/100;if(lazyLoad){setTimeout(()=>{console.log(`Lazy load applied: lag reduction ${lagReductionFactor}`)},1e3)}const currentFPS=detectCurrentFPS();console.log(`Current FPS: ${currentFPS}`);if(currentFPS<=targetFPS){const newLagReduction=lagReductionFactor*(targetFPS/currentFPS);console.log(`Adjusted lag reduction for better FPS: ${newLagReduction}`)}const currentPing=detectCurrentPing();console.log(`Current Ping: ${currentPing}`);if(currentPing>=targetPing){const newLagReduction=lagReductionFactor*(targetPing/currentPing);console.log(`Adjusted lag reduction for better Ping: ${newLagReduction}`)}setTimeout(()=>{console.log(`Lag reduction applied: ${lagReductionFactor}`);const endTime=performance.now();const executionTime=endTime-startTime;updatePerformanceInfo("lagReduction",executionTime)},1e3*lagReductionFactor)}function detectCurrentFPS(){return Math.random()*60}function detectCurrentPing(){return Math.random()*100}function applyLazyLoad(){const startTime=performance.now();setTimeout(()=>{console.log("Lazy load applied");const endTime=performance.now();const executionTime=endTime-startTime;updatePerformanceInfo("lazyLoad",executionTime)},1e3)}function applyFPSBooster(targetFPS){const startTime=performance.now();const currentFPS=detectCurrentFPS();console.log(`Current FPS: ${currentFPS}`);if(currentFPS<=targetFPS){console.log(`Adjusted for better FPS`)}setTimeout(()=>{const endTime=performance.now();const executionTime=endTime-startTime;updatePerformanceInfo("fpsBooster",executionTime)},1e3)}function applyPingReducer(targetPing){const startTime=performance.now();const currentPing=detectCurrentPing();console.log(`Current Ping: ${currentPing}`);if(currentPing>=targetPing){console.log(`Adjusted for better Ping`)}setTimeout(()=>{const endTime=performance.now();const executionTime=endTime-startTime;updatePerformanceInfo("pingReducer",executionTime)},1e3)}function updatePerformanceInfo(operation,executionTime){const performanceInfoElement=document.getElementById("performanceInfo");if(performanceInfoElement){const operationLabel=translations[getLanguage()].performanceInfoLabel+` (${operation}):`;performanceInfoElement.innerHTML=`<div>${operationLabel}</div><div>${executionTime.toFixed(2)} ms</div>`}}function saveLagLevel(lagLevel){localStorage.setItem("lagLevel",lagLevel)}function loadLagLevel(){return localStorage.getItem("lagLevel")||50}function saveLazyLoadState(lazyLoad){localStorage.setItem("lazyLoad",lazyLoad)}function loadLazyLoadState(){return localStorage.getItem("lazyLoad")==="true"}function saveTargetFPS(targetFPS){localStorage.setItem("targetFPS",targetFPS)}function loadTargetFPS(){return parseInt(localStorage.getItem("targetFPS"))||30}function saveTargetPing(targetPing){localStorage.setItem("targetPing",targetPing)}function loadTargetPing(){return parseInt(localStorage.getItem("targetPing"))||50}function setLanguage(language){localStorage.setItem("userLanguage",language)}function getLanguage(){return localStorage.getItem("userLanguage")||defaultLanguage}function resetSettings(){localStorage.removeItem("lagLevel");localStorage.removeItem("lazyLoad");localStorage.removeItem("targetFPS");localStorage.removeItem("targetPing");location.reload()}function createModMenu(){const existingMenu=document.getElementById(modMenuId);if(existingMenu){existingMenu.remove()}const modMenu=document.createElement("div");modMenu.id=modMenuId;modMenu.style.cssText=`
            position: fixed;
            top: 10px;
            left: 10px;
            padding: 10px;
            background: #333;
            border: 1px solid #ccc;
            color: #fff;
            z-index: 9999;
            font-family: Arial, sans-serif;
        `;modMenu.innerHTML=`
            <h2>${translations[getLanguage()].title}</h2>
            <label for="lagLevel">${translations[getLanguage()].lagLevelLabel}</label>
            <input type="range" id="lagLevel" min="1" max="100" value="${loadLagLevel()}">
            <span id="lagValue">${loadLagLevel()}</span>
            <br>
            <label for="lazyLoad">${translations[getLanguage()].lazyLoadLabel}</label>
            <input type="checkbox" id="lazyLoad" ${loadLazyLoadState()?"checked":""}>
            <br>
            <label for="targetFPS">${translations[getLanguage()].targetFPSLabel}</label>
            <input type="number" id="targetFPS" min="1" max="60" value="${loadTargetFPS()}" style="margin-right: 20px;">
            <label for="targetPing">${translations[getLanguage()].targetPingLabel}</label>
            <input type="number" id="targetPing" min="1" max="200" value="${loadTargetPing()}">
            <br>
            <button id="resetSettings">${translations[getLanguage()].resetSettings}</button>
            <div id="performanceInfo" style="margin-top: 10px;"></div>
        `;document.body.appendChild(modMenu);const lagLevelInput=document.getElementById("lagLevel");const lagValueSpan=document.getElementById("lagValue");const lazyLoadCheckbox=document.getElementById("lazyLoad");const targetFPSInput=document.getElementById("targetFPS");const targetPingInput=document.getElementById("targetPing");lagLevelInput.addEventListener("input",()=>{const lagValue=lagLevelInput.value;lagValueSpan.textContent=lagValue;saveLagLevel(lagValue);applyLagReduction(parseInt(lagValue,10),lazyLoadCheckbox.checked,parseInt(targetFPSInput.value,10),parseInt(targetPingInput.value,10))});lazyLoadCheckbox.addEventListener("change",()=>{saveLazyLoadState(lazyLoadCheckbox.checked);if(lazyLoadCheckbox.checked){applyLazyLoad()}});targetFPSInput.addEventListener("input",()=>{saveTargetFPS(targetFPSInput.value);applyFPSBooster(parseInt(targetFPSInput.value,10))});targetPingInput.addEventListener("input",()=>{saveTargetPing(targetPingInput.value);applyPingReducer(parseInt(targetPingInput.value,10))});const resetSettingsButton=document.getElementById("resetSettings");if(resetSettingsButton){resetSettingsButton.addEventListener("click",resetSettings)}}document.addEventListener("keydown",event=>{if(event.ctrlKey&&event.key==="Control"){const modMenu=document.getElementById(modMenuId);if(modMenu){modMenu.style.display=modMenu.style.display==="none"?"block":"none"}else{createModMenu()}}});createModMenu()})();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址