Greasy Fork

Greasy Fork is available in English.

Anhnonle

Tăng tốc độ animation trong trò chơi X-Dogs

此脚本不应直接安装。它是供其他脚本使用的外部库,要使用该库请加入元指令 // @require https://update.greasyfork.icu/scripts/543478/1629362/Anhnonle.js

// ==UserScript==

// @name        Hack Tốc Độ X-Dogs

// @namespace   http://tampermonkey.net/

// @version     0.2

// @description Tăng tốc độ animation trong trò chơi X-Dogs

// @author      duongtank

// @match       https://web.xdogstth.com/

// @icon        https://www.google.com/s2/favicons?sz=64&domain=xdogstth.com

// @grant       none

// ==/UserScript==


(function () {

    "use strict";


    const speedControlId = "speedControl";

    let cooldown = false;

    let currentSpeed = 2;


    const speedControl = document.createElement("input");

    speedControl.type = "range";

    speedControl.id = speedControlId;

    speedControl.min = "2";

    speedControl.max = "10";

    speedControl.step = "0.1";

    speedControl.value = "2";


    speedControl.style.position = "fixed";

    speedControl.style.top = "10px";

    speedControl.style.left = "10px";


    document.body.appendChild(speedControl);


    const animatedElement = document.getElementById("circle");


    speedControl.addEventListener("input", () => {

        if (!cooldown) {

            const newSpeed = parseFloat(speedControl.value);

            if (newSpeed !== currentSpeed) {

                setAnimationSpeed(newSpeed);

                currentSpeed = newSpeed;

                cooldown = true;

                setTimeout(() => {

                    cooldown = false;

                }, 100); // Điều chỉnh thời gian cooldown nếu cần

            }

        }

    });


    function setAnimationSpeed(speed) {

        if (cc.js._registeredClassIds['8569cGbzX5L3qZM+cZRy1Ij']) {

            const originalSetTimeScale = cc.js._registeredClassIds['8569cGbzX5L3qZM+cZRy1Ij'].prototype.setTimeScale;


            cc.js._registeredClassIds['8569cGbzX5L3qZM+cZRy1Ij'].prototype.setTimeScale = function () {

                this._speed = speed;

                if (this._isEnable && this._battleUUID !== "") {

                    this.blackboard.setTimeScale(this._speed * 1.2 * this._loaclSpeedMul);

                    if (this.battleAI) {

                        this.battleAI.setTimeScale(this._speed * 1.2 * this._loaclSpeedMul);

                    }

                }

            };

        } else {

            console.error("Không tìm thấy lớp. Vui lòng cập nhật ID lớp.");

        }

    }

})();