Kour.io 模組選單1

模組選單

// ==UserScript==
// @name        Kour.io 模組選單1
// @namespace   Violentmonkey
// @match       *://kour.io/*
// @license     MIT
// @grant       none
// @version     1.2
// @author      HUANG WEI-LUN HUANG WEI-LUN
// @description 模組選單
// ==/UserScript==
(function() {
    console.clear();
    console.log("🛠️ [Kour.io 模組選單(含 M 鍵開關)載入中]");

    if (document.getElementById("modMenu")) return;

    // 建立主選單容器
    const menu = document.createElement("div");
    menu.id = "modMenu";
    menu.style.position = "fixed";
    menu.style.top = "80px";
    menu.style.right = "20px";
    menu.style.width = "200px";
    menu.style.background = "rgba(0,0,0,0.8)";
    menu.style.color = "#00ff88";
    menu.style.padding = "15px";
    menu.style.borderRadius = "8px";
    menu.style.fontFamily = "monospace";
    menu.style.zIndex = 9999;
    menu.style.boxShadow = "0 0 10px lime";
    menu.style.transition = "opacity 0.2s ease";
    menu.innerHTML = `<h3 style="margin-top:0;">⚙️ 模組選單</h3>`;
    document.body.appendChild(menu);

    let menuVisible = true;

    // 熱鍵:按 M 切換選單可見
    document.addEventListener("keydown", e => {
        if (e.key.toLowerCase() === "m") {
            menuVisible = !menuVisible;
            menu.style.display = menuVisible ? "block" : "none";
            console.log(menuVisible ? "🟢 模組選單已顯示" : "🔴 模組選單已隱藏");
        }
    });

    // 模組功能列表
    const modules = [
        { name: "FPS 顯示", enabled: false },
        { name: "十字準星", enabled: false },
        { name: "夜視模式", enabled: false },
        { name: "跳躍強化", enabled: false }
    ];

    // 建立模組切換按鈕
    modules.forEach(mod => {
        const btn = document.createElement("button");
        btn.textContent = `[OFF] ${mod.name}`;
        btn.style.display = "block";
        btn.style.width = "100%";
        btn.style.margin = "5px 0";
        btn.style.padding = "5px";
        btn.style.background = "black";
        btn.style.color = "#00ff88";
        btn.style.border = "1px solid #00ff88";
        btn.style.cursor = "pointer";
        btn.style.fontFamily = "monospace";
        btn.onclick = () => {
            mod.enabled = !mod.enabled;
            btn.textContent = `${mod.enabled ? "[ON] ✅" : "[OFF] ❌"} ${mod.name}`;
            handleModule(mod.name, mod.enabled);
        };
        menu.appendChild(btn);
    });

    // 功能模擬
    function handleModule(name, enabled) {
        switch (name) {
            case "FPS 顯示":
                toggleFPS(enabled);
                break;
            case "十字準星":
                toggleCrosshair(enabled);
                break;
            case "夜視模式":
                document.body.style.filter = enabled ? "brightness(1.5)" : "";
                break;
            case "跳躍強化":
                console.log(enabled ? "模擬啟用跳躍強化" : "模擬關閉跳躍強化");
                break;
        }
    }

    // FPS 顯示
    let fpsDisplay = null;
    function toggleFPS(enabled) {
        if (enabled) {
            fpsDisplay = document.createElement("div");
            fpsDisplay.style.position = "fixed";
            fpsDisplay.style.left = "10px";
            fpsDisplay.style.bottom = "10px";
            fpsDisplay.style.color = "lime";
            fpsDisplay.style.fontFamily = "monospace";
            fpsDisplay.style.fontSize = "14px";
            fpsDisplay.style.zIndex = 9999;
            document.body.appendChild(fpsDisplay);

            let lastTime = performance.now();
            function updateFPS() {
                const now = performance.now();
                const fps = Math.round(1000 / (now - lastTime));
                lastTime = now;
                if (fpsDisplay) fpsDisplay.textContent = `FPS: ${fps}`;
                if (fpsDisplay) requestAnimationFrame(updateFPS);
            }
            requestAnimationFrame(updateFPS);
        } else {
            if (fpsDisplay) {
                fpsDisplay.remove();
                fpsDisplay = null;
            }
        }
    }

    // 十字準星
    let crosshair = null;
    function toggleCrosshair(enabled) {
        if (enabled) {
            crosshair = document.createElement("div");
            crosshair.style.position = "fixed";
            crosshair.style.left = "50%";
            crosshair.style.top = "50%";
            crosshair.style.width = "10px";
            crosshair.style.height = "10px";
            crosshair.style.background = "red";
            crosshair.style.borderRadius = "50%";
            crosshair.style.marginLeft = "-5px";
            crosshair.style.marginTop = "-5px";
            crosshair.style.zIndex = 9999;
            document.body.appendChild(crosshair);
        } else {
            if (crosshair) {
                crosshair.remove();
                crosshair = null;
            }
        }
    }

})();