Kour.io Zeph Menu

Speed Hack, Set KP (Work In Progress) Invisibility, Set Secondary and Melee Weapons

目前為 2025-04-06 提交的版本,檢視 最新版本

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         Kour.io Zeph Menu
// @match        *://kour.io/*
// @version      1.2
// @author       Happyjeffery
// @icon         https://i.imgur.com/11sYWVM.png
// @description  Speed Hack, Set KP (Work In Progress) Invisibility, Set Secondary and Melee Weapons
// @run-at       document-start
// @grant        unsafeWindow
// @namespace    https://greasyfork.org/users/1369586
// ==/UserScript==

(function() {
    'use strict';

    /***************************************
     * Performance.now Speed Hack
     ***************************************/
    const originalPerfNow = performance.now.bind(performance);
    function updatePerformanceNow(multiplier) {
        if (multiplier === 1) {
            performance.now = originalPerfNow;
        } else {
            performance.now = new Proxy(originalPerfNow, {
                apply: function(target, thisArg, argArray) {
                    try {
                        throw new Error();
                    } catch (e) {
                        if (!e.stack.includes("invoke_")) {
                            return target.apply(thisArg, argArray) * multiplier;
                        }
                    }
                    return target.apply(thisArg, argArray);
                }
            });
        }
    }
    updatePerformanceNow(1);

    /***************************************
     * Invisibility WebSocket Hook
     ***************************************/
    const wsInstances = [];  // Store all open WebSocket instances.
    const OriginalWebSocket = unsafeWindow.WebSocket;
    function hookOnMessage(ws) {
        const originalAddEventListener = ws.addEventListener;
        ws.addEventListener = function(type, listener, options) {
            if (type === "message") {
                const wrappedListener = function(event) {
                    try {
                        if (event.data && typeof event.data !== "string") {
                            const data = new Uint8Array(event.data);
                            const hexString = Array.from(data)
                                .map(b => b.toString(16).padStart(2, '0'))
                                .join(" ");
                            const damageSignature = "f3 04 c8 02 f5 15 04";
                            if (hexString.startsWith(damageSignature) && kourInstance.config.Invisible) {
                                return; // Block this damage packet.
                            }
                        }
                    } catch (e) { }
                    listener.call(this, event);
                };
                return originalAddEventListener.call(this, type, wrappedListener, options);
            } else {
                return originalAddEventListener.call(this, type, listener, options);
            }
        };

        const descriptor = Object.getOwnPropertyDescriptor(Object.getPrototypeOf(ws), 'onmessage');
        Object.defineProperty(ws, 'onmessage', {
            set: function(fn) {
                const wrapped = function(event) {
                    try {
                        if (event.data && typeof event.data !== "string") {
                            const data = new Uint8Array(event.data);
                            const hexString = Array.from(data)
                                .map(b => b.toString(16).padStart(2, '0'))
                                .join(" ");
                            const damageSignature = "f3 04 c8 02 f5 15 04";
                            if (hexString.startsWith(damageSignature) && kourInstance.config.Invisible) {
                                return;
                            }
                        }
                    } catch (e) { }
                    fn(event);
                };
                descriptor.set.call(this, wrapped);
            },
            get: function() {
                return descriptor.get.call(this);
            }
        });
    }
    unsafeWindow.WebSocket = function(...args) {
        const ws = new OriginalWebSocket(...args);
        wsInstances.push(ws);
        hookOnMessage(ws);
        return ws;
    };
    unsafeWindow.WebSocket.prototype = OriginalWebSocket.prototype;


    class Kour {
        constructor() {
            this.config = {
                Invisible: true
            };
        }
    }
    const kourInstance = new Kour();
    unsafeWindow.kourInstance = kourInstance;

    const weapons = [
        { name: "AK-47", id: "00" },
        { name: "Deagle", id: "01" },
        { name: "AWP", id: "02" },
        { name: "Bayonet", id: "03" },
        { name: "Uzi", id: "04" },
        { name: "PKM", id: "05" },
        { name: "Revolver", id: "06" },
        { name: "RPG", id: "07" },
        { name: "USPS", id: "08" },
        { name: "MP5", id: "09" },
        { name: "Shotgun", id: "10" },
        { name: "Glock", id: "11" },
        { name: "Karambit", id: "12" },
        { name: "Knife", id: "13" },
        { name: "Scar", id: "14" },
        { name: "Minigun", id: "15" },
        { name: "Famas", id: "16" },
        { name: "Vector", id: "17" },
        { name: "Flamethrower", id: "18" },
        { name: "Kar98k", id: "19" },
        { name: "M4A4", id: "20" },
        { name: "Tec-9", id: "21" },
        { name: "CZ", id: "22" },
        { name: "Berretta92fs", id: "23" },
        { name: "AK-109", id: "24" },
        { name: "P90", id: "25" },
        { name: "Thompson", id: "26" },
        { name: "UMP45", id: "27" },
        { name: "XM1014", id: "28" },
        { name: "Butterfly", id: "29" },
        { name: "Laser Gun", id: "30" },
        { name: "Bomb", id: "31" },
        { name: "Smoke Grenade", id: "32" },
        { name: "Molotov", id: "33" },
        { name: "Grenade", id: "34" },
        { name: "Flashbang", id: "35" },
        { name: "Glizzy", id: "36" },
        { name: "Axe", id: "37" },
        { name: "Bare Fists", id: "38" }
    ];

    function setSecondaryWeapon(weaponID) {
        firebase.database().goOffline();
        firebase.database().ref('users/' + firebase.auth().currentUser.uid).child('overrideWeaponIndexes1').set(weaponID);
        firebase.database().goOnline();


        showReloadMessage();
        setTimeout(() => location.reload(), 5000); // Auto-reload after 3 seconds
    }

    function setMeleeWeapon(weaponID) {
        firebase.database().goOffline();
        firebase.database().ref('users/' + firebase.auth().currentUser.uid).child('overrideWeaponIndexes2').set(weaponID);
        firebase.database().goOnline();

        showReloadMessage();
        setTimeout(() => location.reload(), 5000); // Auto-reload after 3 seconds
    }

function showReloadMessage() {
    setTimeout(function () {
        const reloadMessage = document.createElement("div");
        reloadMessage.innerHTML = `Changes applying in <span id="countdown" style="color: #FF3C3C; font-weight: bold;">5</span> seconds`;

        Object.assign(reloadMessage.style, {
            position: "fixed",
            bottom: "60px",
            left: "50%",
            transform: "translateX(-50%)",
            backgroundColor: "#8F00FF",
            color: "#FFFFFF",
            padding: "10px 18px",
            borderRadius: "5px",
            fontSize: "16px",
            fontFamily: "'Burbank Big Condensed', 'Arial Black', sans-serif",
            zIndex: "10001",
            textAlign: "center",
            animation: "fadeInOut 5s forwards"
        });

        document.body.appendChild(reloadMessage);

        const countdownSpan = reloadMessage.querySelector("#countdown");
        let secondsLeft = 5;

        const interval = setInterval(() => {
            secondsLeft--;
            if (secondsLeft > 0) {
                countdownSpan.textContent = secondsLeft;
                countdownSpan.style.animation = "flashRed 0.5s";
                countdownSpan.addEventListener("animationend", () => {
                    countdownSpan.style.animation = ""; // Reset
                }, { once: true });
            } else {
                clearInterval(interval);
                countdownSpan.textContent = "1";
                countdownSpan.style.animation = "flashRed 0.5s";
                countdownSpan.addEventListener("animationend", () => {
                    countdownSpan.style.animation = "";
                }, { once: true });

                setTimeout(() => {
                    reloadMessage.remove();
                    location.reload();
                }, 1000);
            }
        }, 1000);
    }, 500);
}




    function setKP() {
        let kpValue = prompt("Enter KP value:", "35");
        if (!kpValue) return;
        const numKP = Number(kpValue);
        if (isNaN(numKP)) {
            console.error("Invalid KP value entered.");
            return;
        }
        if (typeof unityInstance !== 'undefined' && typeof unityInstance.SendMessage === 'function') {
            try {
                unityInstance.SendMessage('MainManager', 'OnReceivedIsAdmin', numKP);
                console.log(`[Zeph Menu] Sent KP value ${numKP} via SendMessage.`);

                const notification = document.createElement("div");
                notification.textContent = `KP set to: ${numKP}`;
                Object.assign(notification.style, {
                    position: "fixed",
                    bottom: "20px",
                    left: "50%",
                    transform: "translateX(-50%)",
                    backgroundColor: "#9b3e9f",
                    color: "#fff",
                    padding: "10px 20px",
                    borderRadius: "5px",
                    zIndex: "10001",
                    fontSize: "14px",
                    boxShadow: "0 2px 5px rgba(0,0,0,0.2)",
                    animation: "fadeInOut 3s forwards"
                });
                document.body.appendChild(notification);

                setTimeout(() => {
                    notification.style.animation = "fadeOut 0.5s forwards";
                    setTimeout(() => notification.remove(), 500);
                }, 2500);
            } catch (e) {
                console.error("[Zeph Menu] SendMessage failed:", e);
            }
        } else {
            console.error("[Zeph Menu] unityInstance not found.");
        }
        unsafeWindow.kpValue = numKP;
    }

    function refreshWebSocketHandlers() {
        wsInstances.forEach(ws => {
            try {
                let current = ws.onmessage;
                ws.onmessage = current;
            } catch (e) { /* ignore errors */ }
        });
    }

function createUI() {
    // Create main menu
    const menu = document.createElement('div');
    menu.id = "zephMenu";
    Object.assign(menu.style, {
        position: "fixed",
        top: "50px",
        right: "50px",
        width: "250px",
        backgroundColor: "#5a2d72",
        color: "#fff",
        padding: "15px",
        zIndex: "10000",
        fontFamily: "Arial, sans-serif",
        fontSize: "16px",
        borderRadius: "8px",
        boxShadow: "0 4px 8px rgba(0,0,0,0.2)",
        display: "none",
        transition: "all 0.3s ease-in-out"
    });

    // Create weapon selection submenus
    const secondaryWeaponMenu = createWeaponMenu("Secondary Weapon", false);
    const meleeWeaponMenu = createWeaponMenu("Melee Weapon", true);

    // Create header container
    const headerContainer = document.createElement("div");
    headerContainer.style.marginBottom = "15px";
    headerContainer.style.position = "relative";

    // Add "Made by" text with RGB animation
    const madeByText = document.createElement("div");
    madeByText.textContent = "Made by: Happyjeffery & Rasperiiii";
    madeByText.style.fontSize = "10px";
    madeByText.style.textAlign = "center";
    madeByText.style.marginBottom = "5px";
    madeByText.style.fontWeight = "bold";
    madeByText.style.letterSpacing = "0.5px";

    // Smooth RGB color cycling animation
    let hue = 0;
    function updateRGB() {
        hue = (hue + 1) % 360;
        madeByText.style.color = `hsl(${hue}, 100%, 70%)`;
        requestAnimationFrame(updateRGB);
    }
    updateRGB();

    headerContainer.appendChild(madeByText);

    // Create title with Discord logo
    const titleContainer = document.createElement("div");
    titleContainer.style.display = "flex";
    titleContainer.style.alignItems = "center";
    titleContainer.style.justifyContent = "center";
    titleContainer.style.gap = "8px";

    const header = document.createElement("div");
    header.textContent = "Zeph Menu";
    header.style.fontWeight = "bold";
    header.style.fontSize = "20px";

    // Create Discord logo using your ImgBB image
    const discordLogo = document.createElement("img");
    discordLogo.src = "https://i.ibb.co/sJV6y56H/Zeph-Menu-Discordlogo.png";
    discordLogo.alt = "Discord Logo";
    discordLogo.style.width = "22px";
    discordLogo.style.height = "22px";
    discordLogo.style.cursor = "pointer";
    discordLogo.style.transition = "all 0.2s ease";
    discordLogo.style.borderRadius = "4px";
    discordLogo.addEventListener("click", () => window.open("https://discord.gg/3XCAwXdRUh", "_blank"));
    discordLogo.addEventListener("mouseover", () => {
        discordLogo.style.transform = "scale(1.1) rotate(2deg)";
        discordLogo.style.filter = "brightness(1.2) drop-shadow(0 0 2px rgba(255,255,255,0.3))";
    });
    discordLogo.addEventListener("mouseout", () => {
        discordLogo.style.transform = "scale(1) rotate(0deg)";
        discordLogo.style.filter = "none";
    });

    titleContainer.appendChild(header);
    titleContainer.appendChild(discordLogo);
    headerContainer.appendChild(titleContainer);

    menu.appendChild(headerContainer);

    // Set KP Button
    const adminBtn = document.createElement("button");
    adminBtn.textContent = "Set KP (Work in progress)";
    Object.assign(adminBtn.style, {
        width: "100%",
        margin: "8px 0",
        padding: "8px",
        cursor: "pointer",
        backgroundColor: "#9b3e9f",
        border: "none",
        borderRadius: "5px",
        fontSize: "14px",
        color: "#fff",
        transition: "background-color 0.3s",
    });
    adminBtn.addEventListener("click", setKP);
    adminBtn.addEventListener("mouseover", () => adminBtn.style.backgroundColor = "#a74cbf");
    adminBtn.addEventListener("mouseout", () => adminBtn.style.backgroundColor = "#9b3e9f");
    menu.appendChild(adminBtn);

    // Set Secondary Weapon Button
    const secondaryWeaponBtn = document.createElement("button");
    secondaryWeaponBtn.textContent = "Set Secondary Weapon";
    Object.assign(secondaryWeaponBtn.style, {
        width: "100%",
        margin: "8px 0",
        padding: "8px",
        cursor: "pointer",
        backgroundColor: "#53277E",
        border: "none",
        borderRadius: "5px",
        fontSize: "14px",
        color: "#fff",
        transition: "background-color 0.3s",
    });
    secondaryWeaponBtn.addEventListener("click", () => {
        secondaryWeaponMenu.style.display = secondaryWeaponMenu.style.display === "none" ? "block" : "none";
        meleeWeaponMenu.style.display = "none";
    });
    secondaryWeaponBtn.addEventListener("mouseover", () => secondaryWeaponBtn.style.backgroundColor = "#6a359c");
    secondaryWeaponBtn.addEventListener("mouseout", () => secondaryWeaponBtn.style.backgroundColor = "#53277E");
    menu.appendChild(secondaryWeaponBtn);

    // Set Melee Weapon Button
    const meleeWeaponBtn = document.createElement("button");
    meleeWeaponBtn.textContent = "Set Melee Weapon";
    Object.assign(meleeWeaponBtn.style, {
        width: "100%",
        margin: "8px 0",
        padding: "8px",
        cursor: "pointer",
        backgroundColor: "#53277E",
        border: "none",
        borderRadius: "5px",
        fontSize: "14px",
        color: "#fff",
        transition: "background-color 0.3s",
    });
    meleeWeaponBtn.addEventListener("click", () => {
        meleeWeaponMenu.style.display = meleeWeaponMenu.style.display === "none" ? "block" : "none";
        secondaryWeaponMenu.style.display = "none";
    });
    meleeWeaponBtn.addEventListener("mouseover", () => meleeWeaponBtn.style.backgroundColor = "#6a359c");
    meleeWeaponBtn.addEventListener("mouseout", () => meleeWeaponBtn.style.backgroundColor = "#53277E");
    menu.appendChild(meleeWeaponBtn);

    // Speed Hack Slider
    const speedContainer = document.createElement("div");
    speedContainer.style.margin = "15px 0";
    const speedLabel = document.createElement("label");
    speedLabel.textContent = "Speed Hack Multiplier: ";
    speedContainer.appendChild(speedLabel);
    const speedValue = document.createElement("span");
    speedValue.textContent = "1x";
    speedContainer.appendChild(speedValue);
    const speedSlider = document.createElement("input");
    speedSlider.type = "range";
    speedSlider.min = "1";
    speedSlider.max = "6";
    speedSlider.step = "0.5";
    speedSlider.value = "1";
    speedSlider.style.width = "100%";
    speedSlider.addEventListener("input", function() {
        let multiplier = parseFloat(speedSlider.value);
        speedValue.textContent = multiplier.toFixed(1) + "x";
        updatePerformanceNow(multiplier);
    });
    speedContainer.appendChild(speedSlider);
    menu.appendChild(speedContainer);

    // Invisibility Checkbox
    const invisContainer = document.createElement("div");
    const invisCheckbox = document.createElement("input");
    invisCheckbox.type = "checkbox";
    invisCheckbox.id = "invisToggle";
    invisCheckbox.checked = kourInstance.config.Invisible;
    invisCheckbox.addEventListener("change", function() {
        kourInstance.config.Invisible = this.checked;
        console.log("Invisibility set to " + this.checked);
        refreshWebSocketHandlers();
    });
    const invisLabel = document.createElement("label");
    invisLabel.htmlFor = "invisToggle";
    invisLabel.textContent = " Invisible";
    invisContainer.appendChild(invisCheckbox);
    invisContainer.appendChild(invisLabel);
    menu.appendChild(invisContainer);

    // Add CSS for animations
    const style = document.createElement("style");
    style.textContent = `
        @keyframes fadeInOut {
            0% { opacity: 0; }
            10% { opacity: 1; }
            90% { opacity: 1; }
            100% { opacity: 0; }
        }
        @keyframes fadeOut {
            from { opacity: 1; }
            to { opacity: 0; }
        }
    `;
    document.head.appendChild(style);

    document.body.appendChild(menu);
    document.body.appendChild(secondaryWeaponMenu);
    document.body.appendChild(meleeWeaponMenu);
}

    function createWeaponMenu(title, isMelee) {
        const weaponMenu = document.createElement('div');
        weaponMenu.id = `zeph${isMelee ? "Melee" : "Secondary"}WeaponMenu`;
        Object.assign(weaponMenu.style, {
            position: "fixed",
            top: "50px",
            right: "320px",
            width: "250px",
            maxHeight: "400px",
            overflowY: "auto",
            backgroundColor: "#5a2d72",
            color: "#fff",
            padding: "15px",
            zIndex: "10000",
            fontFamily: "Arial, sans-serif",
            fontSize: "14px",
            borderRadius: "8px",
            boxShadow: "0 4px 8px rgba(0,0,0,0.2)",
            display: "none",
            transition: "all 0.3s ease-in-out"
        });

        const weaponHeader = document.createElement("div");
        weaponHeader.textContent = title;
        weaponHeader.style.textAlign = "center";
        weaponHeader.style.fontWeight = "bold";
        weaponHeader.style.marginBottom = "10px";
        weaponMenu.appendChild(weaponHeader);

        weapons.forEach(weapon => {
            const btn = document.createElement("button");
            btn.textContent = `${weapon.name} (${weapon.id})`;
            Object.assign(btn.style, {
                width: "100%",
                margin: "5px 0",
                padding: "5px",
                cursor: "pointer",
                backgroundColor: "#9b3e9f",
                border: "none",
                borderRadius: "5px",
                fontSize: "12px",
                color: "#fff",
                transition: "background-color 0.3s",
            });
            btn.addEventListener("click", () => {
                if (isMelee) {
                    setMeleeWeapon(weapon.id);
                } else {
                    setSecondaryWeapon(weapon.id);
                }
                weaponMenu.style.display = "none";
            });
            btn.addEventListener("mouseover", () => btn.style.backgroundColor = "#a74cbf");
            btn.addEventListener("mouseout", () => btn.style.backgroundColor = "#9b3e9f");
            weaponMenu.appendChild(btn);
        });

        return weaponMenu;
    }

    document.addEventListener("keydown", function(e) {
        if (e.key === "o" && !e.target.matches("input, textarea")) {
            const menu = document.getElementById("zephMenu");
            if (menu) {
                menu.style.display = (menu.style.display === "none" ? "block" : "none");
                // Hide weapon menus when main menu is closed
                if (menu.style.display === "none") {
                    document.getElementById("zephSecondaryWeaponMenu").style.display = "none";
                    document.getElementById("zephMeleeWeaponMenu").style.display = "none";
                }
            }
        }
    });

    window.addEventListener("load", createUI);
})();