☰

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.

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 or Violentmonkey 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        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;
        }
    });
})();