Coco Client v3.7

Smart Neural AI Grinder with Script Executor & Anti-Spam Logic

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         Coco Client v3.7
// @namespace    http://tampermonkey.net/
// @version      3.7
// @description  Smart Neural AI Grinder with Script Executor & Anti-Spam Logic
// @author       Coco
// @license      MIT
// @match        *://*/*
// @grant        none
// @run-at       document-end
// ==/UserScript==

/* MIT License
  Copyright (c) 2026 Coco
  Permission is hereby granted, free of charge, to any person obtaining a copy of this software...
*/

(function() {
    'use strict';
    if (window.self !== window.top) return;

    const MINT = '#00ffaa';
    const BG = '#1a1a1a';
    const MEM_KEY = 'coco_v37_brain';
    let state = JSON.parse(sessionStorage.getItem(MEM_KEY) || '{"ai":false, "open":false, "code":"", "speed":1000, "px":20, "py":20, "wx":250, "wy":20}');
    const save = () => sessionStorage.setItem(MEM_KEY, JSON.stringify(state));

    // --- UI ELEMENTS ---
    const laser = document.createElement('div');
    laser.style.cssText = `position:fixed; width:20px; height:20px; border:2px solid red; border-radius:50%; z-index:2147483647; pointer-events:none; display:none; box-shadow:0 0 10px red; transition: 0.1s;`;
    
    const pill = document.createElement('div');
    pill.style.cssText = `position:fixed; top:${state.py}px; left:${state.px}px; width:200px; height:50px; background:${BG}; border-radius:25px; z-index:2147483646; display:flex; align-items:center; padding:0 15px; border:1px solid #333; cursor:move; font-family: sans-serif;`;
    pill.innerHTML = `
        <div style="display:flex; gap:8px; margin-right:15px;">
            <div id="coco-red" style="width:12px; height:12px; background:#ff5f57; border-radius:50%; cursor:pointer;"></div>
            <div id="coco-yel" style="width:12px; height:12px; background:#febc2e; border-radius:50%; cursor:pointer;"></div>
            <div style="width:12px; height:12px; background:#28c840; border-radius:50%;"></div>
        </div>
        <div style="display:flex; flex-direction:column; pointer-events:none; user-select:none;">
            <span style="color:${MINT}; font-weight:900; font-size:10px; letter-spacing:1px;">COCO CLIENT</span>
            <span style="color:white; font-size:9px; opacity:0.5;">v3.7 OFFICIAL</span>
        </div>
    `;

    const menu = document.createElement('div');
    menu.style.cssText = `position:fixed; top:${state.wy}px; left:${state.wx}px; width:650px; height:350px; background:${BG}; border-radius:12px; z-index:2147483645; border:1px solid #333; display:${state.open ? 'flex' : 'none'}; padding:15px; gap:15px; box-shadow:0 20px 60px rgba(0,0,0,0.8); font-family:sans-serif;`;
    menu.innerHTML = `
        <div style="flex:1; display:flex; flex-direction:column; gap:10px; border-right:1px solid #333; padding-right:15px;">
            <div id="menu-hdr" style="color:${MINT}; font-size:10px; font-weight:bold; cursor:move;">AI CORE CONTROL</div>
            <div style="background:#111; padding:10px; border-radius:8px; border:1px solid #222;">
                <label style="color:#888; font-size:9px;">SPEED: <span id="speed-val" style="color:${MINT}">${state.speed}ms</span></label>
                <input type="range" id="ai-speed" min="1" max="2000" value="${state.speed}" style="width:100%; accent-color:${MINT}; cursor:pointer;">
            </div>
            <button id="ai-toggle" style="height:45px; background:${state.ai ? '#333' : '#ff3b30'}; color:white; border:none; border-radius:8px; font-weight:900; cursor:pointer;">${state.ai ? 'SHUTDOWN' : 'START AI'}</button>
            <div id="ai-log" style="flex:1; background:#000; font-family:monospace; font-size:9px; color:#00ff88; padding:8px; overflow-y:auto; border:1px solid #222;">> System Initialized.</div>
        </div>
        <div style="flex:2; display:flex; flex-direction:column; gap:10px;">
            <div style="display:flex; justify-content:space-between; align-items:center;">
                <label style="color:${MINT}; font-size:10px; font-weight:bold;">SCRIPT EXECUTOR</label>
                <select id="coco-lib" style="background:#000; color:${MINT}; border:1px solid #444; font-size:10px; padding:2px 5px; border-radius:4px; cursor:pointer;">
                    <option value="">-- SCRIPTS --</option>
                    <option value="disco">Smooth Disco</option>
                    <option value="xray">Hitbox X-Ray</option>
                </select>
            </div>
            <textarea id="coco-code" style="flex:1; background:#000; color:${MINT}; border:1px solid #333; border-radius:6px; padding:10px; font-family:monospace; font-size:11px; resize:none; outline:none; border-left:2px solid ${MINT};">${state.code}</textarea>
            <button id="coco-run" style="background:${MINT}; color:black; border:none; padding:12px; border-radius:6px; font-weight:900; cursor:pointer;">EXECUTE</button>
        </div>
    `;

    document.body.append(laser, pill, menu);

    // --- SMART AI BRAIN ---
    let ticker = null;
    let clickMemory = new Map();
    const NEGATIVE_KEYWORDS = ['end', 'quit', 'no', 'exit', 'leave', 'stop', 'cancel', 'close', 'restart'];

    const log = (msg) => {
        const logger = menu.querySelector('#ai-log');
        logger.innerHTML += `<br>> ${msg}`;
        if(logger.innerHTML.split('<br>').length > 8) logger.innerHTML = logger.innerHTML.split('<br>').slice(1).join('<br>');
        logger.scrollTop = logger.scrollHeight;
    };

    const runAI = () => {
        if (!state.ai) return;
        laser.style.display = 'block';

        let targets = Array.from(document.querySelectorAll('canvas, button, [role="button"], a, span, .btn'))
            .filter(el => {
                const r = el.getBoundingClientRect();
                const text = (el.innerText || el.value || "").toLowerCase();
                const isClient = pill.contains(el) || menu.contains(el);
                const isBad = NEGATIVE_KEYWORDS.some(word => text.includes(word));
                const recentlyHit = (clickMemory.get(el) || 0) > Date.now() - 2000;

                return r.width > 5 && r.height > 5 && !isClient && !isBad && !recentlyHit && r.top >= 0;
            });

        if (targets.length > 0) {
            const best = targets.sort((a,b) => (b.tagName === 'CANVAS' ? 1 : -1))[0];
            const r = best.getBoundingClientRect();
            const cx = r.left + r.width/2;
            const cy = r.top + r.height/2;

            laser.style.left = (cx - 10) + 'px';
            laser.style.top = (cy - 10) + 'px';

            clickMemory.set(best, Date.now());
            const opts = { bubbles: true, cancelable: true, clientX: cx, clientY: cy };
            ['mousedown', 'click', 'mouseup'].forEach(ev => best.dispatchEvent(new MouseEvent(ev, opts)));
            log(`Hitting ${best.tagName}`);
        }
    };

    // --- UI LOGIC ---
    const setupDrag = (el, handle, prefix) => {
        let isD = false, sx, sy;
        handle.onmousedown = (e) => { isD = true; sx = e.clientX - el.offsetLeft; sy = e.clientY - el.offsetTop; };
        document.addEventListener('mousemove', (e) => {
            if (isD) {
                el.style.left = (e.clientX - sx) + 'px';
                el.style.top = (e.clientY - sy) + 'px';
                state[prefix + 'x'] = parseInt(el.style.left);
                state[prefix + 'y'] = parseInt(el.style.top);
                save();
            }
        });
        document.addEventListener('mouseup', () => isD = false);
    };
    setupDrag(pill, pill, 'p');
    setupDrag(menu, menu.querySelector('#menu-hdr'), 'w');

    menu.querySelector('#ai-speed').oninput = (e) => {
        state.speed = e.target.value;
        menu.querySelector('#speed-val').innerText = state.speed + 'ms';
        if(state.ai) { clearInterval(ticker); ticker = setInterval(runAI, state.speed); }
        save();
    };

    menu.querySelector('#ai-toggle').onclick = (e) => {
        state.ai = !state.ai;
        e.target.style.background = state.ai ? '#333' : '#ff3b30';
        if (state.ai) { ticker = setInterval(runAI, state.speed); runAI(); } 
        else { clearInterval(ticker); laser.style.display = 'none'; }
        save();
    };

    menu.querySelector('#coco-run').onclick = () => { try { eval(menu.querySelector('#coco-code').value); } catch(err) { log("Error: " + err.message); } };
    
    menu.querySelector('#coco-lib').onchange = (e) => {
        const lib = {
            disco: "const d=document.createElement('div');d.style.cssText='position:fixed;top:0;left:0;width:100vw;height:100vh;z-index:-1;transition:background 0.5s;';document.body.appendChild(d);setInterval(()=>d.style.background=`linear-gradient(${Math.random()*360}deg, hsl(${Math.random()*360},70%,50%), hsl(${Math.random()*360},70%,50%))`,1000);",
            xray: "document.querySelectorAll('*').forEach(el=>{if(el.offsetWidth>0)el.style.outline='1px solid #00ffaa'});"
        };
        menu.querySelector('#coco-code').value = lib[e.target.value] || "";
        state.code = menu.querySelector('#coco-code').value;
        save();
    };

    pill.querySelector('#coco-yel').onclick = () => { state.open = !state.open; menu.style.display = state.open ? 'flex' : 'none'; save(); };
    pill.querySelector('#coco-red').onclick = () => { if(confirm("Close Client?")) { sessionStorage.removeItem(MEM_KEY); location.reload(); } };

    if(state.ai) ticker = setInterval(runAI, state.speed);
})();