Sleazy Fork is available in English.

Sword Master - 9x Speed Boost

Tăng tốc độ di chuyển và hoạt ảnh game lên 9 lần.

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

You will need to install an extension such as Tampermonkey or Violentmonkey 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 Master - 9x Speed Boost
// @namespace    http://tampermonkey.net/
// @version      1.0
// @description  Tăng tốc độ di chuyển và hoạt ảnh game lên 9 lần.
// @author       You
// @match        *://*.swordmaster.io/*
// @match        *://*swordmasters.io/*
// @grant        none
// @run-at       document-start
// ==/UserScript==

(function() {
    'use strict';

    // Cài đặt hệ số nhân tốc độ
    const SPEED_MULTIPLIER = 9.0;
    console.log(`[Speed Boost] Đang tiêm mã thao túng thời gian x${SPEED_MULTIPLIER}...`);

    // ==========================================
    // KỸ THUẬT 1: THAO TÚNG ENGINE THỜI GIAN
    // ==========================================
    // Ghi đè hàm performance.now() mà WebGL/Canvas thường dùng để tính toán physics
    let lastTime = performance.now();
    let fakeTime = lastTime;
    const originalPerfNow = performance.now;

    performance.now = function() {
        let realTime = originalPerfNow.call(this);
        let dt = realTime - lastTime;
        lastTime = realTime;
        // Nhân khoảng thời gian trôi qua lên 9 lần
        fakeTime += dt * SPEED_MULTIPLIER;
        return fakeTime;
    };

    // Ghi đè Date.now() dự phòng cho các game dùng hàm cũ
    const originalDateNow = Date.now;
    let lastDate = originalDateNow.call(Date);
    let fakeDate = lastDate;

    Date.now = function() {
        let realDate = originalDateNow.call(Date);
        let dt = realDate - lastDate;
        lastDate = realDate;
        fakeDate += dt * SPEED_MULTIPLIER;
        return Math.floor(fakeDate);
    };

    // ==========================================
    // KỸ THUẬT 2: CAN THIỆP GÓI TIN DI CHUYỂN
    // ==========================================
    const originalSend = WebSocket.prototype.send;
    WebSocket.prototype.send = function(data) {
        try {
            let payload = JSON.parse(data);
            
            // Tìm kiếm các gói tin gửi tọa độ hoặc vector hướng di chuyển
            if (payload.action === "move" || payload.type === "movement") {
                // Nếu game quản lý theo vector velocity (vận tốc)
                if (payload.velocity) {
                    payload.velocity.x *= SPEED_MULTIPLIER;
                    payload.velocity.y *= SPEED_MULTIPLIER;
                }
                // Nếu game quản lý theo Delta X / Delta Y
                if (payload.dx !== undefined && payload.dy !== undefined) {
                    payload.dx *= SPEED_MULTIPLIER;
                    payload.dy *= SPEED_MULTIPLIER;
                }
                
                // Đóng gói lại dữ liệu đã hack trước khi gửi lên server
                data = JSON.stringify(payload);
            }
        } catch (e) {
            // Bỏ qua nếu là gói tin nhị phân (Binary Data)
        }
        originalSend.apply(this, arguments);
    };

})();