Minefun.io High Jump (Optimized)

Nhảy cao 15 đơn vị, menu nhỏ gọn, sửa lỗi không nhận biến game

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Greasemonkey lub Violentmonkey.

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

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana będzie instalacja rozszerzenia Tampermonkey lub Userscripts.

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

Aby zainstalować ten skrypt, musisz zainstalować rozszerzenie menedżera skryptów użytkownika.

(Mam już menedżera skryptów użytkownika, pozwól mi to zainstalować!)

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.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Musisz zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

(Mam już menedżera stylów użytkownika, pozwól mi to zainstalować!)

// ==UserScript==
// @name         Minefun.io High Jump (Optimized)
// @namespace    http://tampermonkey.net/
// @version      1.1
// @description  Nhảy cao 15 đơn vị, menu nhỏ gọn, sửa lỗi không nhận biến game
// @author       Gemini
// @match        *://minefun.io/*
// @grant        unsafeWindow
// @run-at       document-end
// ==/UserScript==

(function() {
    'use strict';

    let highJumpEnabled = false;
    const NORMAL_JUMP = 8;
    const HIGH_JUMP = 15;

    // --- TẠO GIAO DIỆN MENU NHỎ GỌN ---
    const menu = document.createElement('div');
    menu.id = 'hj-container';
    menu.innerHTML = `
        <div id="hj-menu" style="position: fixed; top: 10px; right: 10px;
            background: rgba(0, 0, 0, 0.7); color: white; padding: 10px; border-radius: 5px;
            border: 1px solid #4CAF50; font-family: Arial, sans-serif; z-index: 10000;
            display: none; font-size: 12px; min-width: 120px; box-shadow: 0px 0px 10px rgba(0,0,0,0.5);">
            <div style="font-weight: bold; margin-bottom: 5px; border-bottom: 1px solid #444; padding-bottom: 3px;">High Jump</div>
            <label style="display: flex; align-items: center; cursor: pointer;">
                <input type="checkbox" id="hj-toggle" style="margin-right: 8px; cursor: pointer;">
                <span>Kích hoạt (15)</span>
            </label>
            <div style="font-size: 10px; color: #ccc; margin-top: 8px;">Phím nóng: <b style="color: #4CAF50;">[ , ]</b></div>
        </div>
    `;
    document.body.appendChild(menu);

    const menuEl = document.getElementById('hj-menu');
    const toggleInput = document.getElementById('hj-toggle');

    // --- ĐIỀU KHIỂN MENU ---
    window.addEventListener('keydown', (e) => {
        if (e.key === ',') {
            menuEl.style.display = menuEl.style.display === 'none' ? 'block' : 'none';
        }
    });

    toggleInput.addEventListener('change', (e) => {
        highJumpEnabled = e.target.checked;
    });

    // --- HÀM TRUY CẬP VÀO ENGINE GAME ---
    function applyPhysicsHack() {
        try {
            // Minefun thường lưu thông số trong đối tượng người chơi hoặc world
            // Sử dụng unsafeWindow để "vượt rào" vào biến của game
            const game = unsafeWindow.game || (unsafeWindow.App && unsafeWindow.App.game);
            
            if (game && game.player) {
                // Thay đổi thuộc tính jump trực tiếp trong physics engine
                // Tùy theo phiên bản, nó có thể là jumpHeight, jumpForce hoặc jumpVelocity
                const p = game.player;
                const targetValue = highJumpEnabled ? HIGH_JUMP : NORMAL_JUMP;

                if (p.jumpHeight !== undefined) p.jumpHeight = targetValue;
                if (p.jumpForce !== undefined) p.jumpForce = targetValue;
                if (p.physics && p.physics.jumpValue) p.physics.jumpValue = targetValue;
            }
        } catch (err) {
            // Chặn lỗi nếu game chưa load xong
        }
    }

    // Kiểm tra và cập nhật liên tục để đảm bảo game không tự reset thông số
    setInterval(applyPhysicsHack, 200);

})();