Sword Master - 9x Speed Boost

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

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey 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 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.

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

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

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 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);
    };

})();