killaura for minefun

Killaura giả lập: tự click khi trỏ vào player + nút toggle kéo + resize

이 스크립트를 설치하려면 Tampermonkey, Greasemonkey 또는 Violentmonkey와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 Tampermonkey와 같은 확장 프로그램을 설치해야 합니다.

이 스크립트를 설치하려면 Tampermonkey 또는 Violentmonkey와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 Tampermonkey 또는 Userscripts와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 Tampermonkey와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 유저 스크립트 관리자 확장 프로그램이 필요합니다.

(이미 유저 스크립트 관리자가 설치되어 있습니다. 설치를 진행합니다!)

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

(이미 유저 스타일 관리자가 설치되어 있습니다. 설치를 진행합니다!)

// ==UserScript==
// @name         killaura for minefun
// @namespace    http://tampermonkey.net/
// @version      0.6
// @description  Killaura giả lập: tự click khi trỏ vào player + nút toggle kéo + resize
// @author       You
// @match        https://minefun.io/*
// @match        https://*.minefun.io/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    let killauraEnabled = false;
    let lastAttackTime = 0;
    const ATTACK_COOLDOWN = 120; // ms - chỉnh thấp hơn sẽ bị server kick hoặc lag

    // Tạo nút toggle
    const btn = document.createElement('button');
    btn.innerText = "Killaura: OFF";
    btn.style.position = "fixed";
    btn.style.zIndex = "999999";
    btn.style.left = "20px";
    btn.style.top = "20px";
    btn.style.padding = "12px 18px";
    btn.style.fontSize = "16px";
    btn.style.background = "#e74c3c";
    btn.style.color = "white";
    btn.style.border = "none";
    btn.style.borderRadius = "8px";
    btn.style.cursor = "move";
    btn.style.userSelect = "none";
    btn.style.boxShadow = "0 4px 12px rgba(0,0,0,0.5)";
    document.body.appendChild(btn);

    // Resize nút bằng phím +/- (focus nút trước)
    let fontSize = 16;
    btn.addEventListener('wheel', e => {
        if (document.activeElement === btn) {
            e.preventDefault();
            fontSize += e.deltaY > 0 ? -1 : 1;
            fontSize = Math.max(10, Math.min(40, fontSize));
            btn.style.fontSize = fontSize + "px";
            btn.style.padding = (fontSize/1.3) + "px " + (fontSize/0.9) + "px";
        }
    });

    // Toggle bằng cách trỏ chuột vào nút rồi click
    btn.addEventListener('click', () => {
        killauraEnabled = !killauraEnabled;
        btn.innerText = `Killaura: ${killauraEnabled ? "ON" : "OFF"}`;
        btn.style.background = killauraEnabled ? "#2ecc71" : "#e74c3c";
    });

    // Kéo thả nút
    let isDragging = false;
    let currentX, currentY, initialX, initialY;

    btn.addEventListener('mousedown', e => {
        if (e.button === 0) {
            initialX = e.clientX - currentX;
            initialY = e.clientY - currentY;
            isDragging = true;
        }
    });

    document.addEventListener('mousemove', e => {
        if (isDragging) {
            e.preventDefault();
            currentX = e.clientX - initialX;
            currentY = e.clientY - initialY;
            btn.style.left = currentX + "px";
            btn.style.top = currentY + "px";
        }
    });

    document.addEventListener('mouseup', () => {
        isDragging = false;
    });

    currentX = 20; currentY = 20; // vị trí ban đầu

    // ===================== KILLAURA LOGIC =====================
    // Tìm canvas chính (thường là canvas WebGL)
    let canvas = null;
    const tryFindCanvas = () => {
        canvas = document.querySelector('canvas');
        if (!canvas) setTimeout(tryFindCanvas, 500);
    };
    tryFindCanvas();

    // Tự động click khi trỏ vào player (giả lập MouseEvent)
    function simulateClick(x, y) {
        if (!canvas) return;

        const rect = canvas.getBoundingClientRect();
        const mx = x - rect.left;
        const my = y - rect.top;

        if (mx < 0 || my < 0 || mx > rect.width || my > rect.height) return;

        const now = Date.now();
        if (now - lastAttackTime < ATTACK_COOLDOWN) return;
        lastAttackTime = now;

        const down = new MouseEvent('mousedown', {
            bubbles: true,
            cancelable: true,
            clientX: x,
            clientY: y,
            button: 0
        });

        const up = new MouseEvent('mouseup', {
            bubbles: true,
            cancelable: true,
            clientX: x,
            clientY: y,
            button: 0
        });

        canvas.dispatchEvent(down);
        setTimeout(() => canvas.dispatchEvent(up), 16); // ~60fps
    }

    // Kiểm tra xem chuột có đang trỏ vào player không
    // Cách này rất thô - chỉ dựa vào việc game có thay đổi cursor hoặc có element overlay nào
    // (MineFun thường không có cursor đổi khi trỏ player → cách này kém hiệu quả)
    let lastCursorPos = {x:0, y:0};

    document.addEventListener('mousemove', e => {
        lastCursorPos.x = e.clientX;
        lastCursorPos.y = e.clientY;

        if (!killauraEnabled || !canvas) return;

        // Cách 1: giả sử game dùng cursor "crosshair" hoặc pointer khi trỏ enemy
        if (document.body.style.cursor === "crosshair" ||
            document.elementFromPoint(e.clientX, e.clientY)?.tagName === "CANVAS") {
            simulateClick(e.clientX, e.clientY);
        }
    });

    // Cách 2: hook requestAnimationFrame để check liên tục (nặng hơn)
    const originalRAF = window.requestAnimationFrame;
    window.requestAnimationFrame = function(callback) {
        if (killauraEnabled) {
            // Bạn có thể thử inject logic tìm entity ở đây nếu biết cách đọc WebGL scene
            // Nhưng 99% người không làm được vì obfuscated
        }
        return originalRAF(callback);
    };

    console.log("[Killaura Toggle] Đã load. Kéo nút để di chuyển, +/- để resize (focus nút), trỏ chuột vào người chơi + bật ON để auto attack.");
})();