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.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey, το Greasemonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

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

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Userscripts για να εγκαταστήσετε αυτόν τον κώδικα.

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

Θα χρειαστεί να εγκαταστήσετε μια επέκταση διαχείρισης κώδικα χρήστη για να εγκαταστήσετε αυτόν τον κώδικα.

(Έχω ήδη έναν διαχειριστή κώδικα χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

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.

(Έχω ήδη έναν διαχειριστή στυλ χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

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