☰

craft quick (press left mouse to use)

Giữ Chuột Phải vào nút Chế tạo để tự động click chuột trái liên tục, nhả ra để dừng.

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

(I already have a user script manager, let me install it!)

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

// ==UserScript==
// @name        craft quick (press left mouse to use)
// @namespace    http://tampermonkey.net/
// @version      5.0
// @description  Giữ Chuột Phải vào nút Chế tạo để tự động click chuột trái liên tục, nhả ra để dừng.
// @author       Gemini
// @match        *://minefun.io/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    let mouseX = 0;
    let mouseY = 0;
    let clickInterval = null;
    
    // Tốc độ click: 40ms = 25 click/giây
    const CLICK_SPEED = 40;

    // Liên tục cập nhật tọa độ của con trỏ chuột
    window.addEventListener('mousemove', (e) => {
        mouseX = e.clientX;
        mouseY = e.clientY;
    });

    // Khi nhấn giữ CHUỘT PHẢI (button = 2)
    window.addEventListener('mousedown', (e) => {
        if (e.button === 2 && !clickInterval) {
            
            clickInterval = setInterval(() => {
                // Xác định phần tử UI nằm ngay dưới con trỏ chuột
                const element = document.elementFromPoint(mouseX, mouseY);
                
                if (element) {
                    // Giả lập hành động click CHUỘT PHẢI để chế đồ
                    const mouseDown = new MouseEvent('mousedown', { bubbles: true, cancelable: true, view: window, button: 0 });
                    const mouseUp = new MouseEvent('mouseup', { bubbles: true, cancelable: true, view: window, button: 0 });
                    const clickEvent = new MouseEvent('click', { bubbles: true, cancelable: true, view: window, button: 0 });
                    
                    element.dispatchEvent(mouseDown);
                    element.dispatchEvent(mouseUp);
                    element.click();
                }
            }, CLICK_SPEED);
        }
    });

    // Khi thả Chuột trái ra thì lập tức dừng click
    window.addEventListener('mouseup', (e) => {
        if (e.button === 2 && clickInterval) {
            clearInterval(clickInterval);
            clickInterval = null;
        }
    });

    // Chặn menu chuột trái (Context Menu) của trình duyệt để màn hình game không bị vướng
    window.addEventListener('contextmenu', (e) => {
        e.preventDefault();
    });

    // Tự động dừng nếu bạn tab ra ngoài màn hình
    window.addEventListener('blur', () => {
        if (clickInterval) {
            clearInterval(clickInterval);
            clickInterval = null;
        }
    });
})();