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.

Du musst eine Erweiterung wie Tampermonkey, Greasemonkey oder Violentmonkey installieren, um dieses Skript zu installieren.

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

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

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

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

Sie müssten eine Skript Manager Erweiterung installieren damit sie dieses Skript installieren können

(Ich habe schon ein Skript Manager, Lass mich es installieren!)

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.

(I already have a user style manager, let me install it!)

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