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.

K instalaci tototo skriptu si budete muset nainstalovat rozšíření jako Tampermonkey, Greasemonkey nebo Violentmonkey.

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

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Userscripts.

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

K instalaci tohoto skriptu si budete muset nainstalovat manažer uživatelských skriptů.

(Už mám manažer uživatelských skriptů, nechte mě ho nainstalovat!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Už mám manažer uživatelských stylů, nechte mě ho nainstalovat!)

// ==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";
            }
        });
    });
})();