Kour.io 模組選單4

加入自瞄、透視、鎖頭、加速與模組選單功能

// ==UserScript==
// @name         Kour.io 模組選單4
// @namespace    http://tampermonkey.net/
// @version      1.0
// @description  加入自瞄、透視、鎖頭、加速與模組選單功能
// @author       ChatGPT
// @match        *://kour.io/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    let settings = {
        aimbot: false,
        esp: false,
        headlock: false,
        speedHack: false
    };

    // 監聽按鍵 M 開關選單
    let menuVisible = true;
    document.addEventListener('keydown', (e) => {
        if (e.key.toLowerCase() === 'm') {
            menuVisible = !menuVisible;
            document.getElementById('modMenu').style.display = menuVisible ? 'block' : 'none';
        }
    });

    // 建立模組選單 UI
    const menu = document.createElement('div');
    menu.id = 'modMenu';
    menu.style = `
        position: fixed;
        top: 100px;
        left: 100px;
        width: 200px;
        background: rgba(0,0,0,0.8);
        color: white;
        padding: 10px;
        z-index: 9999;
        border-radius: 10px;
        font-family: monospace;
        cursor: move;
    `;

    menu.innerHTML = `
        <h4>💀 Kour.io 模組</h4>
        <label><input type="checkbox" id="aimbot"> 自瞄</label><br>
        <label><input type="checkbox" id="esp"> 透視</label><br>
        <label><input type="checkbox" id="headlock"> 鎖頭</label><br>
        <label><input type="checkbox" id="speedHack"> 加速</label><br>
        <small>按下 M 顯示/隱藏</small>
    `;
    document.body.appendChild(menu);

    // 拖動功能
    let isDragging = false, offsetX, offsetY;
    menu.addEventListener('mousedown', (e) => {
        isDragging = true;
        offsetX = e.clientX - menu.offsetLeft;
        offsetY = e.clientY - menu.offsetTop;
    });
    document.addEventListener('mouseup', () => isDragging = false);
    document.addEventListener('mousemove', (e) => {
        if (isDragging) {
            menu.style.left = (e.clientX - offsetX) + 'px';
            menu.style.top = (e.clientY - offsetY) + 'px';
        }
    });

    // 選單狀態綁定
    document.getElementById('aimbot').addEventListener('change', (e) => {
        settings.aimbot = e.target.checked;
    });
    document.getElementById('esp').addEventListener('change', (e) => {
        settings.esp = e.target.checked;
    });
    document.getElementById('headlock').addEventListener('change', (e) => {
        settings.headlock = e.target.checked;
    });
    document.getElementById('speedHack').addEventListener('change', (e) => {
        settings.speedHack = e.target.checked;
    });

    // 功能迴圈 (偵測功能是否啟用)
    setInterval(() => {
        if (settings.speedHack) {
            // 修改玩家移動速度(這是範例代碼,需依照 kour.io 實際變數修改)
            if (window.localPlayer) {
                window.localPlayer.speed = 2.0; // 預設可能是 1.0
            }
        }

        if (settings.aimbot || settings.headlock) {
            // 簡易自瞄功能(需實作實際玩家資料抓取)
            // 這裡提供基本邏輯範例
            const enemies = window.getEnemies?.() || [];
            const target = enemies[0]; // 簡單鎖定第一個敵人
            if (target && window.localPlayer) {
                if (settings.aimbot) {
                    window.localPlayer.lookAt(target.position);
                }
                if (settings.headlock) {
                    window.localPlayer.lookAt(target.headPosition);
                }
            }
        }

        if (settings.esp) {
            // 透視功能需配合 canvas 或模型顯示
            // 範例:可用 drawOverlay() 等方式實作
        }
    }, 100); // 每 100ms 執行一次

})();