Minefun Fast Attack & Normal Mining

Tốc độ đánh siêu nhanh khi giữ chuột, không lỗi đập block

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

You will need to install an extension such as Tampermonkey 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!)

Advertisement:

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!)

Advertisement:

// ==UserScript==
// @name         Minefun Fast Attack & Normal Mining
// @namespace    http://tampermonkey.net/
// @version      2.0
// @description  Tốc độ đánh siêu nhanh khi giữ chuột, không lỗi đập block
// @author       Gemini
// @match        *://minefun.io/*
// @grant        none
// @run-at       document-start
// ==/UserScript==

(function() {
    'use strict';

    let isMouseDown = false;
    let attackInterval = null;
    
    // Tốc độ đánh siêu nhanh: Cứ mỗi 15 mili-giây ra 1 đòn (khoảng ~65 đòn/giây)
    // Bạn có thể giảm xuống 10 nếu muốn nhanh hơn nữa, nhưng <10 dễ bị server kick vì spam packet
    const ATTACK_SPEED = 15; 

    // Hàm thực hiện đòn đánh bằng cách mô phỏng click thuần cho hệ thống combat
    function performFastAttack() {
        const canvas = document.querySelector('canvas') || document.body;
        
        // Tạo sự kiện click độc lập với luồng giữ chuột đập block
        const clickEvent = new MouseEvent('click', {
            bubbles: true,
            cancelable: true,
            view: window,
            button: 0
        });
        canvas.dispatchEvent(clickEvent);
    }

    // Theo dõi trạng thái nhấn giữ chuột
    window.addEventListener('mousedown', (e) => {
        if (e.button === 0) { // Chuột trái
            isMouseDown = true;
            
            // Kích hoạt chuỗi đánh siêu nhanh ngay lập tức
            if (!attackInterval) {
                attackInterval = setInterval(() => {
                    if (isMouseDown) {
                        performFastAttack();
                    }
                }, ATTACK_SPEED);
            }
        }
    }, true);

    // Khi thả chuột ra thì ngừng đánh
    window.addEventListener('mouseup', (e) => {
        if (e.button === 0) {
            isMouseDown = false;
            clearInterval(attackInterval);
            attackInterval = null;
        }
    }, true);

    // Đề phòng trường hợp tab ra ngoài hoặc mất tiêu điểm chuột
    window.addEventListener('blur', () => {
        isMouseDown = false;
        clearInterval(attackInterval);
        attackInterval = null;
    });

    // --- ĐOẠN CODE PHỤ TRỢ: CHỐNG XUNG ĐỘT WEBOCKET (Nếu game dùng Packet) ---
    // Đoạn này giúp tách biệt lệnh click tấn công liên tục mà không chặn lệnh giữ chuột đập block của game
    const originalSend = WebSocket.prototype.send;
    WebSocket.prototype.send = function(data) {
        // Giữ nguyên tất cả các dữ liệu đập block và di chuyển gửi lên server
        return originalSend.apply(this, arguments);
    };

})();