Minefun Fast Attack & Normal Mining

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

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 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.

(Tôi đã có Trình quản lý tập lệnh người dùng, hãy cài đặt nó!)

Advertisement:

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

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

})();