Minefun Fast Attack & Normal Mining

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

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

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

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

Advertisement:

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

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

})();