Dino Game Hack with GUI, Speed Control, Auto Jump and Point Hack

Hack the Chrome Dino game with a GUI to make the dinosaur invincible, control speed, auto jump over obstacles, and hack points.

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。

您需要先安装用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         Dino Game Hack with GUI, Speed Control, Auto Jump and Point Hack
// @namespace    http://tampermonkey.net/
// @version      0.7
// @description  Hack the Chrome Dino game with a GUI to make the dinosaur invincible, control speed, auto jump over obstacles, and hack points.
// @author       Max Stewie
// @match        *://chromedino.com/*
// @match        chrome://dino
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    let autoJumpEnabled = false;

    // Function to override the gameOver function
    function makeInvincible() {
        Runner.prototype.gameOver = function() {};
    }

    // Function to reset the game to normal
    function resetGame() {
        location.reload();
    }

    // Function to adjust speed
    function setSpeed(value) {
        Runner.instance_.setSpeed(value);
    }

    // Function to enable auto jump
    function enableAutoJump() {
        autoJumpEnabled = true;
        autoJump();
    }

    // Function to disable auto jump
    function disableAutoJump() {
        autoJumpEnabled = false;
    }

    // Function to handle auto jump
    function autoJump() {
        if (autoJumpEnabled) {
            const obstacles = Runner.instance_.horizon.obstacles;
            if (obstacles.length > 0) {
                const obstacle = obstacles[0];
                const obstacleXPos = obstacle.xPos;
                const dinoXPos = Runner.instance_.tRex.xPos;
                const obstacleWidth = obstacle.width;

                // Jump when the obstacle is close to the dinosaur
                if (obstacleXPos < dinoXPos + obstacleWidth + 20 && obstacleXPos > dinoXPos) {
                    Runner.instance_.tRex.startJump(Runner.instance_.currentSpeed);
                }
            }
        }
        requestAnimationFrame(autoJump);
    }

    // Function to set points
    function setPoints(value) {
        Runner.instance_.distanceMeter.setHighScore(value);
        Runner.instance_.distanceRan = value / Runner.instance_.distanceMeter.config.COEFFICIENT;
    }

    // Create GUI
    function createGUI() {
        const guiContainer = document.createElement('div');
        guiContainer.style.position = 'fixed';
        guiContainer.style.top = '10px';
        guiContainer.style.right = '10px';
        guiContainer.style.zIndex = '1000';
        guiContainer.style.backgroundColor = '#fff';
        guiContainer.style.border = '1px solid #ccc';
        guiContainer.style.padding = '10px';
        guiContainer.style.borderRadius = '5px';
        guiContainer.style.boxShadow = '0 0 10px rgba(0,0,0,0.5)';
        guiContainer.style.display = 'flex';
        guiContainer.style.flexDirection = 'column';
        guiContainer.style.gap = '10px';

        const invincibleButton = document.createElement('button');
        invincibleButton.textContent = 'Invincible Mode';
        invincibleButton.onclick = makeInvincible;
        guiContainer.appendChild(invincibleButton);

        const resetButton = document.createElement('button');
        resetButton.textContent = 'Reset Game';
        resetButton.onclick = resetGame;
        guiContainer.appendChild(resetButton);

        const speedLabel = document.createElement('label');
        speedLabel.textContent = 'Set Speed:';
        guiContainer.appendChild(speedLabel);

        const speedSlider = document.createElement('input');
        speedSlider.type = 'range';
        speedSlider.min = '1';
        speedSlider.max = '100';
        speedSlider.value = '10';
        speedSlider.oninput = function() {
            setSpeed(speedSlider.value);
        };
        guiContainer.appendChild(speedSlider);

        const autoJumpButton = document.createElement('button');
        autoJumpButton.textContent = 'Enable Auto Jump';
        autoJumpButton.onclick = function() {
            if (autoJumpEnabled) {
                disableAutoJump();
                autoJumpButton.textContent = 'Enable Auto Jump';
            } else {
                enableAutoJump();
                autoJumpButton.textContent = 'Disable Auto Jump';
            }
        };
        guiContainer.appendChild(autoJumpButton);

        const pointsLabel = document.createElement('label');
        pointsLabel.textContent = 'Set Points:';
        guiContainer.appendChild(pointsLabel);

        const pointsInput = document.createElement('input');
        pointsInput.type = 'number';
        pointsInput.min = '0';
        pointsInput.value = '0';
        pointsInput.oninput = function() {
            setPoints(pointsInput.value);
        };
        guiContainer.appendChild(pointsInput);

        document.body.appendChild(guiContainer);
    }

    // Wait for the game to load
    window.addEventListener('load', createGUI);
})();