Sword Masters - 9x Speed Boost

Tăng tốc game Sword Masters lên 9 lần. Nhấn phím 'B' để Bật/Tắt.

Dovrai installare un'estensione come Tampermonkey, Greasemonkey o Violentmonkey per installare questo script.

You will need to install an extension such as Tampermonkey to install this script.

Dovrai installare un'estensione come Tampermonkey o Violentmonkey per installare questo script.

Dovrai installare un'estensione come Tampermonkey o Userscripts per installare questo script.

Dovrai installare un'estensione come ad esempio Tampermonkey per installare questo script.

Dovrai installare un gestore di script utente per installare questo script.

(Ho già un gestore di script utente, lasciamelo installare!)

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

(Ho già un gestore di stile utente, lasciamelo installare!)

// ==UserScript==
// @name         Sword Masters - 9x Speed Boost
// @namespace    http://tampermonkey.net/
// @version      8.1
// @description  Tăng tốc game Sword Masters lên 9 lần. Nhấn phím 'B' để Bật/Tắt.
// @author       Gemini
// @match        *://*.swordmasters.io/*
// @match        *://swordmasters.io/*
// @run-at       document-start
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    const SPEED_MULTIPLIER = 9;
    let isBoostActive = false; 

    let baseDate = Date.now();
    let fakeDate = baseDate;
    let basePerf = performance.now();
    let fakePerf = basePerf;

    const originalDateNow = Date.now;
    const originalPerfNow = performance.now.bind(performance);

    Date.now = function() {
        let now = originalDateNow();
        let diff = now - baseDate;
        baseDate = now;
        fakeDate += diff * (isBoostActive ? SPEED_MULTIPLIER : 1);
        return fakeDate;
    };

    performance.now = function() {
        let now = originalPerfNow();
        let diff = now - basePerf;
        basePerf = now;
        fakePerf += diff * (isBoostActive ? SPEED_MULTIPLIER : 1);
        return fakePerf;
    };

    // UI thông báo
    window.addEventListener('DOMContentLoaded', () => {
        const ui = document.createElement('div');
        ui.style.cssText = `
            position: fixed; top: 10px; left: 50%; transform: translateX(-50%);
            padding: 8px 15px; background: rgba(0, 0, 0, 0.8); color: #fff;
            font-family: sans-serif; font-size: 14px; border-radius: 5px;
            z-index: 9999999; border: 1px solid #444; pointer-events: none;
        `;
        ui.innerHTML = `Sword Masters Speed: <span id="boostStatus" style="color: #ff4444;">OFF</span> (Phím B)`;
        document.body.appendChild(ui);

        window.addEventListener('keydown', (e) => {
            if (e.key.toLowerCase() === 'b') {
                isBoostActive = !isBoostActive;
                const statusSpan = document.getElementById('boostStatus');
                statusSpan.innerText = isBoostActive ? "ON (9x)" : "OFF";
                statusSpan.style.color = isBoostActive ? "#00ff00" : "#ff4444";
            }
        });
    });
})();