Wolf_ tools

Scripts for smoother gameplay on Kour.io

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         Wolf_ tools
// @namespace    http://tampermonkey.net
// @version      1.4
// @description  Scripts for smoother gameplay on Kour.io
// @author       Wolf_
// @match        *://kour.io/*
// @grant        none
// ==/UserScript==

(function () {
    'use strict';

    if (document.getElementById('wolf-menu')) return;

    const getStored = (key, def) => {
        const v = localStorage.getItem(key);
        return v === null ? def : v;
    };

    let savedTop = getStored('wolf_top', '20px');
    let savedLeft = getStored('wolf_left', '20px');

    let states = {
        arms: getStored('wolf_hide_arms', 'false') === 'true',
        weapon: getStored('wolf_hide_weapon', 'false') === 'true',
        crossVisible: getStored('wolf_cross_visible', 'true') === 'true',
        glow: getStored('wolf_glow', 'true') === 'true',
        customCross: getStored('wolf_custom_cross', 'myrrr'),
        crossColor: getStored('wolf_cross_color', '#ffffff')
    };

    const weaponAssetPaths = ["/StreamingAssets/awp", "/StreamingAssets/usps", "/StreamingAssets/deagle", "/StreamingAssets/uzi", "/StreamingAssets/pkm", "/StreamingAssets/revolver", "/StreamingAssets/mp5", "/StreamingAssets/scar", "/StreamingAssets/minigun", "/StreamingAssets/famas", "/StreamingAssets/vector1", "/StreamingAssets/vector2", "/StreamingAssets/vector3", "/StreamingAssets/flamethrower", "/StreamingAssets/kar98", "/StreamingAssets/m4a4", "/StreamingAssets/tec9", "/StreamingAssets/beretta", "/StreamingAssets/cz", "/StreamingAssets/ak109", "/StreamingAssets/p90", "/StreamingAssets/thompson", "/StreamingAssets/ump45", "/StreamingAssets/xm1014", "/StreamingAssets/lasergun1", "/StreamingAssets/lasergun2", "/StreamingAssets/grenade", "/StreamingAssets/knife", "/StreamingAssets/butterfly", "/StreamingAssets/bayonet", "/StreamingAssets/karambit"];

    const isWeaponAsset = (url) => {
        return weaponAssetPaths.some(path => url.includes(path));
    };

    const originalFetch = window.fetch;
    window.fetch = function (url, options) {
        const requestUrl = typeof url === "string" ? url : url.url;
        if (states.weapon && isWeaponAsset(requestUrl)) {
            return Promise.resolve(new Response("", { status: 200 }));
        }
        return originalFetch.apply(this, arguments);
    };

    const WebGL = WebGL2RenderingContext.prototype;
    const drawHandler = {
        apply(target, thisArgs, args) {
            const count = args[1] || args[0];
            const armsIDs = [1098];
            if (states.crossVisible && count === 300) return;
            if (states.arms && armsIDs.includes(count)) return;
            return Reflect.apply(target, thisArgs, args);
        }
    };

    WebGL.drawElements = new Proxy(WebGL.drawElements, drawHandler);
    WebGL.drawElementsInstanced = new Proxy(WebGL.drawElementsInstanced, drawHandler);

    const crossContainer = document.createElement('div');
    Object.assign(crossContainer.style, {
        position: 'fixed', top: '50%', left: '50%', transform: 'translate(-50%, -50%)',
        zIndex: '10000', pointerEvents: 'none', display: 'none'
    });
    document.body.appendChild(crossContainer);

    function applyCross() {
        crossContainer.innerHTML = '';
        if (!states.crossVisible || states.customCross === 'none') {
            crossContainer.style.display = 'none';
            return;
        }
        crossContainer.style.display = 'flex';
        crossContainer.style.alignItems = 'center';
        crossContainer.style.justifyContent = 'center';

        const color = states.crossColor;
        const style = states.customCross;
        const glowStyle = states.glow ? `0 0 8px ${color}` : 'none';

        if (style === 'myrrr') {
            const h = document.createElement('div');
            const v = document.createElement('div');
            const css = { position: 'absolute', background: color, borderRadius: '1px', boxShadow: glowStyle };
            Object.assign(h.style, css, { width: '18px', height: '3px' });
            Object.assign(v.style, css, { width: '3px', height: '18px' });
            crossContainer.append(h, v);
        } else if (style === 'dot') {
            const dot = document.createElement('div');
            Object.assign(dot.style, { width: '7px', height: '7px', borderRadius: '50%', background: color, boxShadow: glowStyle });
            crossContainer.appendChild(dot);
        } else if (style === 'shotgun') {
            const circle = document.createElement('div');
            Object.assign(circle.style, { width: '40px', height: '40px', border: `4px solid ${color}`, borderRadius: '50%', boxShadow: glowStyle });
            crossContainer.appendChild(circle);
        }
    }

    const menu = document.createElement("div");
    menu.id = "wolf-menu";
    Object.assign(menu.style, {
        position: 'fixed', top: savedTop, left: savedLeft,
        width: '220px', background: 'linear-gradient(135deg, #bf953f, #fcf6ba, #b38728)',
        border: '2px solid #5d4037', borderRadius: '10px', zIndex: '10001',
        fontFamily: 'Arial', textAlign: 'center', userSelect: 'none', boxShadow: '0 8px 24px rgba(0,0,0,0.5)'
    });

    const header = document.createElement("div");
    header.innerText = "Wolf_ tools";
    Object.assign(header.style, { padding: '12px', cursor: 'move', fontWeight: 'bold', color: '#5d4037' });
    menu.appendChild(header);

    const content = document.createElement("div");
    content.style.padding = "12px";
    menu.appendChild(content);

    function createRow(text, key, storageKey) {
        const row = document.createElement("div");
        Object.assign(row.style, { display: 'flex', justifyContent: 'space-between', alignItems: 'center', marginBottom: '8px' });
        const btn = document.createElement("button");
        const dot = document.createElement("div");
        Object.assign(dot.style, { width: '10px', height: '10px', borderRadius: '50%', background: states[key] ? '#00ff00' : '#ff0000' });

        let buttonText = key === 'glow' ? "Make the crosshair glow" : (states[key] ? "Show " : "Hide ") + text;
        btn.innerText = buttonText;

        Object.assign(btn.style, { flex: '1', padding: '8px', backgroundColor: '#5d4037', color: '#fcf6ba', border: 'none', borderRadius: '4px', cursor: 'pointer', fontWeight: 'bold', fontSize: '11px', marginRight: '8px' });

        btn.onclick = () => {
            states[key] = !states[key];
            localStorage.setItem(storageKey, states[key]);
            btn.innerText = key === 'glow' ? "Make the crosshair glow" : (states[key] ? "Show " : "Hide ") + text;
            dot.style.background = states[key] ? '#00ff00' : '#ff0000';
            applyCross();
            if (key === 'weapon') location.reload();
        };
        row.append(btn, dot);
        return row;
    }

    content.append(createRow("arms", "arms", "wolf_hide_arms"));
    content.append(createRow("weapon", "weapon", "wolf_hide_weapon"));
    content.append(createRow("crosshair", "crossVisible", "wolf_cross_visible"));
    content.append(createRow("glow", "glow", "wolf_glow"));

    const sel = document.createElement("select");
    Object.assign(sel.style, { width: '100%', padding: '5px', marginTop: '5px', background: '#5d4037', color: '#fcf6ba', border: 'none', borderRadius: '4px' });
    ['myrrr', 'dot', 'shotgun', 'none'].forEach(v => {
        const o = document.createElement("option");
        o.value = v; o.innerText = v;
        if (states.customCross === v) o.selected = true;
        sel.appendChild(o);
    });
    sel.onchange = () => { states.customCross = sel.value; localStorage.setItem('wolf_custom_cross', sel.value); applyCross(); };
    content.appendChild(sel);

    const colorRow = document.createElement("div");
    Object.assign(colorRow.style, { display: 'flex', alignItems: 'center', justifyContent: 'space-between', marginTop: '8px' });
    const colorLabel = document.createElement("span");
    colorLabel.innerText = "Crosshair Colors";
    Object.assign(colorLabel.style, { color: '#555', fontSize: '11px', fontWeight: 'bold' });
    const colorPicker = document.createElement("input");
    colorPicker.type = "color"; colorPicker.value = states.crossColor;
    Object.assign(colorPicker.style, { width: '40px', height: '25px', border: 'none', background: 'transparent', cursor: 'pointer' });
    colorPicker.oninput = (e) => { states.crossColor = e.target.value; localStorage.setItem('wolf_cross_color', states.crossColor); applyCross(); };
    colorRow.append(colorLabel, colorPicker);
    content.appendChild(colorRow);

    const instructions = document.createElement("div");
    instructions.innerText = "Open/close menu with the button 'M'";
    Object.assign(instructions.style, { marginTop: "12px", fontSize: "10px", color: "#5d4037", fontWeight: "bold", opacity: "0.8" });
    content.appendChild(instructions);

    document.body.appendChild(menu);

    let drag = false, sx, sy, ix, iy;
    header.addEventListener("mousedown", (e) => {
        drag = true; sx = e.clientX; sy = e.clientY;
        ix = menu.offsetLeft; iy = menu.offsetTop;
    });

    window.addEventListener("mousemove", (e) => {
        if (!drag) return;
        let nx = ix + (e.clientX - sx);
        let ny = iy + (e.clientY - sy);
        const maxX = window.innerWidth - menu.offsetWidth;
        const maxY = window.innerHeight - menu.offsetHeight;
        nx = Math.max(0, Math.min(nx, maxX));
        ny = Math.max(0, Math.min(ny, maxY));
        menu.style.left = nx + "px";
        menu.style.top = ny + "px";
        localStorage.setItem('wolf_left', menu.style.left);
        localStorage.setItem('wolf_top', menu.style.top);
    });

    window.addEventListener("mouseup", () => drag = false);

    window.addEventListener("keydown", (e) => {
        if (e.key.toLowerCase() === 'm' && !e.target.matches("input, textarea, select")) {
            menu.style.display = menu.style.display === 'none' ? 'block' : 'none';
        }
    });

    applyCross();
})();