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.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Greasemonkey lub Violentmonkey.

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

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana będzie instalacja rozszerzenia Tampermonkey lub Userscripts.

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

Aby zainstalować ten skrypt, musisz zainstalować rozszerzenie menedżera skryptów użytkownika.

(Mam już menedżera skryptów użytkownika, pozwól mi to zainstalować!)

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.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Musisz zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

(Mam już menedżera stylów użytkownika, pozwól mi to zainstalować!)

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