Krunker.IO Cheats [Anime Edition]

Aimbot, Dynamic Skeleton ESP, Box ESP & more with a gorgeous, fully redesigned Anime UI. By anonimbiri.

当前为 2025-06-15 提交的版本,查看 最新版本

// ==UserScript==
// @name         Krunker.IO Cheats [Anime Edition]
// @namespace    http://tampermonkey.net/
// @version      1.0.3
// @description  Aimbot, Dynamic Skeleton ESP, Box ESP & more with a gorgeous, fully redesigned Anime UI. By anonimbiri.
// @author       anonimbiri
// @match        *://krunker.io/*
// @match        *://browserfps.com/*
// @exclude      *://krunker.io/social*
// @exclude      *://krunker.io/editor*
// @icon
// @grant        GM_setValue
// @grant        GM_getValue
// @run-at       document-start
// @license      MIT
// @noframes
// @require      https://unpkg.com/[email protected]/build/three.min.js
// ==/UserScript==

(function() {
    'use strict';

    const KRUNKER_THREE = window.THREE;

    class KrunkerCheats {
        constructor() {
            this.THREE = window.THREE || KRUNKER_THREE;
            if (!this.THREE) {
                console.error("🌸 Anime Cheats: THREE.js not loaded! Waiting...");
                setTimeout(() => this.initializeCheats(), 3000);
                return;
            }
            this.initializeCheats();
        }

        initializeCheats() {
            this.THREE = window.THREE || KRUNKER_THREE;
            if (!this.THREE) { console.error("🌸 Anime Cheats: THREE.js failed to load."); return; }
            console.log("🌸 Anime Cheats: Initializing with THREE.js v" + this.THREE.REVISION);

            this.migrateSettings();

            this.defaultSettings = {
                aimbotEnabled: true, aimbotOnRightMouse: false, espLines: true, espSkeleton: true, espSquare: true,
                wireframeEnabled: false, menuVisible: true, espColor: "#ff0080", skeletonColor: "#ff0080",
                boxColor: "#ff0080", menuTop: "50%", menuLeft: "50%",
            };
            this.defaultHotkeys = {
                toggleMenu: 'F2', aimbotEnabled: 'F3', espLines: 'F4', espSkeleton: 'F5', espSquare: 'F6', wireframeEnabled: 'F7',
            };
            this.settings = this.loadSettings('anonimbiri_settings', this.defaultSettings);
            this.hotkeys = this.loadSettings('anonimbiri_hotkeys', this.defaultHotkeys);

            this.scene = null; this.myPlayer = null; this.players = []; this.rightMouseDown = false;
            this.isBindingHotkey = false; this.currentBindingSetting = null; this.injectTimer = null;
            this.originalArrayPush = Array.prototype.push;
            this.tempVector = new this.THREE.Vector3(); this.tempObject = new this.THREE.Object3D();
            this.tempObject.rotation.order = 'YXZ'; this.cameraPos = new this.THREE.Vector3();
            this.managedESP = new Map();

            this.createGeometries(); this.createMaterials(); this.createGUI(); this.addEventListeners(); this.animate();
        }

        loadSettings(key, defaults) {
            let loaded = GM_getValue(key, null);
            if (loaded) {
                try {
                    const parsed = JSON.parse(loaded);
                    return { ...defaults, ...parsed };
                } catch (e) {
                    console.error("Error parsing settings:", e);
                }
            }
            return defaults;
        }
        saveSettings(key, value) { GM_setValue(key, JSON.stringify(value)); }
        migrateSettings() {
            const oldSettings = GM_getValue('anonimbiri_anime_settings_v2', null);
            const oldHotkeys = GM_getValue('anonimbiri_anime_hotkeys_v2', null);
            if (oldSettings) {
                this.saveSettings('anonimbiri_settings', JSON.parse(oldSettings));
                GM_setValue('anonimbiri_anime_settings_v2', null);
            }
            if (oldHotkeys) {
                this.saveSettings('anonimbiri_hotkeys', JSON.parse(oldHotkeys));
                GM_setValue('anonimbiri_anime_hotkeys_v2', null);
            }
        }

        attemptInjection() {
            if (this.scene) return;
            const loadingBg = document.getElementById('loadingBg');
            if (loadingBg && loadingBg.style.display === 'none' && !this.injectTimer) {
                this.injectTimer = setTimeout(() => { Array.prototype.push = this.proxiedArrayPush.bind(this); }, 2000);
            }
            requestAnimationFrame(() => this.attemptInjection());
        }
        proxiedArrayPush(object) {
            try {
                if (object?.parent?.type === 'Scene' && object.parent.name === 'Main') {
                    console.log('🌸 Anime Cheats: Main Scene found!');
                    this.scene = object.parent;
                    Array.prototype.push = this.originalArrayPush;
                }
            } catch (error) {}
            return this.originalArrayPush.apply(this, arguments);
        }

        createGeometries() {
            const squareVertices = [-3.5, -8, 0, 3.5, -8, 0, 3.5, 8, 0, -3.5, 8, 0];
            this.squareGeometry = new this.THREE.BufferGeometry();
            this.squareGeometry.setAttribute('position', new this.THREE.Float32BufferAttribute(squareVertices, 3));
            this.espLineGeometry = new this.THREE.BufferGeometry();
            this.espLinePositionsAttribute = new this.THREE.BufferAttribute(new Float32Array(100 * 6), 3);
            this.espLineGeometry.setAttribute('position', this.espLinePositionsAttribute);
        }
        createShaderMaterial(color) {
            return new this.THREE.ShaderMaterial({
                uniforms: { u_color: { value: new this.THREE.Color(color) }, u_time: { value: 0.0 } },
                vertexShader: `uniform float u_time; void main() { gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0); gl_Position.z = 0.999; }`,
                fragmentShader: `uniform vec3 u_color; uniform float u_time; void main() { float pulse = 0.8 + 0.2 * sin(u_time * 5.0); gl_FragColor = vec4(u_color * pulse, 1.0); }`,
                depthTest: false, depthWrite: false, transparent: true
            });
        }
        createMaterials() {
            this.lineMaterial = this.createShaderMaterial(this.settings.espColor);
            this.skeletonMaterial = this.createShaderMaterial(this.settings.skeletonColor);
            this.squareMaterial = this.createShaderMaterial(this.settings.boxColor);
            this.materials = [this.lineMaterial, this.skeletonMaterial, this.squareMaterial];
        }

        createGUI() {
            const fontLink = document.createElement('link');
            fontLink.href = 'https://fonts.googleapis.com/css2?family=Orbitron:wght@400;700;900&display=swap';
            fontLink.rel = 'stylesheet';
            document.head.appendChild(fontLink);
            const menuCSS = `
                .anonimbiri-cheat-menu {
                    font-family: 'Orbitron', monospace;
                    position: fixed;
                    top: ${this.settings.menuTop};
                    left: ${this.settings.menuLeft};
                    transform: translate(-50%, -50%) scale(${this.settings.menuVisible?1:0});
                    width: 450px;
                    background: rgba(10, 10, 30, 0.95);
                    backdrop-filter: blur(15px);
                    border: 2px solid rgba(255, 0, 128, 0.3);
                    border-radius: 20px;
                    box-shadow: 0 0 50px rgba(255, 0, 128, 0.3), inset 0 0 50px rgba(128, 0, 255, 0.1);
                    opacity: ${this.settings.menuVisible?1:0};
                    transition: all 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
                    z-index: 1000;
                    user-select: none;
                }
                .anonimbiri-cheat-menu::before {
                    content: '';
                    position: absolute;
                    top: -2px; left: -2px; right: -2px; bottom: -2px;
                    background: linear-gradient(45deg, #ff0080, #8000ff, #00ff80, #ff0080);
                    background-size: 400%;
                    border-radius: 22px;
                    z-index: -1;
                    animation: anonimbiri-borderGlow 3s linear infinite;
                    opacity: 0.5;
                }
                @keyframes anonimbiri-borderGlow {
                    0% { background-position: 0% 50%; }
                    50% { background-position: 100% 50%; }
                    100% { background-position: 0% 50%; }
                }
                .anonimbiri-menu-header {
                    display: flex;
                    align-items: center;
                    justify-content: space-between;
                    padding: 20px;
                    background: linear-gradient(135deg, rgba(255, 0, 128, 0.2), rgba(128, 0, 255, 0.2));
                    border-radius: 18px 18px 0 0;
                    border-bottom: 1px solid rgba(255, 0, 128, 0.3);
                    cursor: move;
                }
                .anonimbiri-header-icon {
                    color: #ff0080;
                    animation: anonimbiri-rotate 3s linear infinite;
                    width: 24px;
                    height: 24px;
                    display: flex;
                    align-items: center;
                    justify-content: center;
                }
                @keyframes anonimbiri-rotate {
                    from { transform: rotate(0deg); }
                    to { transform: rotate(360deg); }
                }
                .anonimbiri-menu-header h2 {
                    color: #fff;
                    font-size: 18px;
                    font-weight: 900;
                    text-shadow: 0 0 10px rgba(255, 0, 128, 0.5);
                    letter-spacing: 2px;
                    margin: 0 auto;
                }
                .anonimbiri-close-btn {
                    width: 30px;
                    height: 30px;
                    border-radius: 50%;
                    background: rgba(255, 0, 128, 0.2);
                    display: flex;
                    align-items: center;
                    justify-content: center;
                    color: #fff;
                    cursor: pointer;
                    font-size: 20px;
                    transition: all 0.3s ease;
                }
                .anonimbiri-close-btn:hover {
                    background: rgba(255, 0, 128, 0.4);
                    transform: scale(1.1);
                }
                .anonimbiri-menu-content {
                    padding: 20px;
                    max-height: 400px;
                    overflow-y: auto;
                }
                .anonimbiri-menu-content::-webkit-scrollbar {
                    width: 6px;
                }
                .anonimbiri-menu-content::-webkit-scrollbar-track {
                    background: rgba(255, 255, 255, 0.1);
                    border-radius: 3px;
                }
                .anonimbiri-menu-content::-webkit-scrollbar-thumb {
                    background: linear-gradient(45deg, #ff0080, #8000ff);
                    border-radius: 3px;
                }
                .anonimbiri-feature-section {
                    margin-bottom: 20px;
                    padding: 15px;
                    background: rgba(255, 255, 255, 0.05);
                    border: 1px solid rgba(255, 0, 128, 0.2);
                    border-radius: 12px;
                    transition: all 0.3s ease;
                }
                .anonimbiri-feature-header {
                    display: flex;
                    align-items: center;
                    margin-bottom: 15px;
                    color: #fff;
                    font-weight: 700;
                }
                .anonimbiri-feature-icon {
                    margin-right: 10px;
                    color: #ff0080;
                    animation: anonimbiri-pulse 2s infinite;
                    width: 20px;
                    height: 20px;
                    display: flex;
                    align-items: center;
                    justify-content: center;
                }
                @keyframes anonimbiri-pulse {
                    0%, 100% { opacity: 1; }
                    50% { opacity: 0.6; }
                }
                .anonimbiri-feature-controls {
                    display: grid;
                    align-items: center;
                    gap: 15px;
                }
                .anonimbiri-checkbox-container {
                    position: relative;
                    display: flex;
                    align-items: center;
                    gap: 10px;
                }
                .anonimbiri-anime-checkbox {
                    display: none;
                }
                .anonimbiri-checkbox-label {
                    width: 50px;
                    height: 25px;
                    background: rgba(255, 255, 255, 0.1);
                    border: 2px solid rgba(255, 0, 128, 0.3);
                    border-radius: 25px;
                    display: block;
                    position: relative;
                    cursor: pointer;
                    transition: all 0.3s ease;
                }
                .anonimbiri-checkbox-label::after {
                    content: '';
                    width: 19px;
                    height: 19px;
                    background: linear-gradient(45deg, #ff0080, #8000ff);
                    border-radius: 50%;
                    position: absolute;
                    top: 2px;
                    left: 2px;
                    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
                    box-shadow: 0 0 10px rgba(255, 0, 128, 0.5);
                }
                .anonimbiri-anime-checkbox:checked + .anonimbiri-checkbox-label {
                    background: rgba(255, 0, 128, 0.3);
                    border-color: #ff0080;
                    box-shadow: 0 0 15px rgba(255, 0, 128, 0.4);
                }
                .anonimbiri-anime-checkbox:checked + .anonimbiri-checkbox-label::after {
                    left: 26px;
                    background: linear-gradient(45deg, #00ff80, #ff0080);
                    box-shadow: 0 0 15px rgba(0, 255, 128, 0.6);
                }
                .anonimbiri-rmb-label {
                    font-size: 10px;
                    color: #ccc;
                }
                .anonimbiri-color-picker-container {
                    position: relative;
                    display: flex;
                    align-items: center;
                    justify-self: end;
                }
                .anonimbiri-color-picker {
                    width: 35px;
                    height: 25px;
                    opacity: 0;
                    position: absolute;
                    cursor: pointer;
                }
                .anonimbiri-color-preview {
                    width: 35px;
                    height: 25px;
                    border-radius: 8px;
                    border: 2px solid rgba(255, 255, 255, 0.3);
                    cursor: pointer;
                    transition: all 0.3s ease;
                    pointer-events: none;
                }
                .anonimbiri-hotkey-display {
                    background: rgba(0, 0, 0, 0.5);
                    border: 1px solid rgba(255, 0, 128, 0.3);
                    border-radius: 8px;
                    padding: 5px 12px;
                    color: #fff;
                    font-size: 12px;
                    font-weight: 700;
                    cursor: pointer;
                    transition: all 0.3s ease;
                    min-width: 50px;
                    text-align: center;
                    justify-self: end;
                }
                .anonimbiri-hotkey-display:hover,
                .anonimbiri-hotkey-display.binding {
                    background: rgba(255, 0, 128, 0.2);
                    border-color: #ff0080;
                    transform: scale(1.05);
                    box-shadow: 0 0 10px rgba(255, 0, 128, 0.3);
                }
                .anonimbiri-menu-footer {
                    padding: 15px 20px;
                    border-top: 1px solid rgba(255, 0, 128, 0.2);
                }
                .anonimbiri-wave-path {
                    animation: anonimbiri-wave 3s ease-in-out infinite;
                }
                @keyframes anonimbiri-wave {
                    0%, 100% { d: path("M0,15 Q50,5 100,15 T200,15"); }
                    50% { d: path("M0,15 Q50,25 100,15 T200,15"); }
                }
                .anonimbiri-menu-toggle-hint {
                    position: fixed;
                    bottom: 30px;
                    right: 30px;
                    background: rgba(10, 10, 30, 0.9);
                    backdrop-filter: blur(10px);
                    border: 1px solid rgba(255, 0, 128, 0.3);
                    border-radius: 10px;
                    padding: 10px 15px;
                    color: #fff;
                    font-size: 12px;
                    font-weight: 700;
                    opacity: 0;
                    visibility: hidden;
                    transition: all 0.3s ease;
                    animation: anonimbiri-float 3s ease-in-out infinite;
                }
                .anonimbiri-menu-toggle-hint.show {
                    opacity: 0.8;
                    visibility: visible;
                }
                @keyframes anonimbiri-float {
                    0%, 100% { transform: translateY(0px); }
                    50% { transform: translateY(-10px); }
                }
                .anonimbiri-key-highlight {
                    color: #ff0080;
                    background: rgba(255, 0, 128, 0.2);
                    padding: 2px 6px;
                    border-radius: 4px;
                    font-weight: 900;
                }
                .anonimbiri-hotkey-modal {
                    position: fixed;
                    top: 0;
                    left: 0;
                    width: 100%;
                    height: 100%;
                    background: rgba(0, 0, 0, 0.8);
                    backdrop-filter: blur(5px);
                    display: flex;
                    align-items: center;
                    justify-content: center;
                    z-index: 2000;
                    opacity: 0;
                    visibility: hidden;
                    transition: all 0.3s ease;
                }
                .anonimbiri-hotkey-modal.active {
                    opacity: 1;
                    visibility: visible;
                }
                .anonimbiri-hotkey-modal-content {
                    background: rgba(10, 10, 30, 0.95);
                    border: 2px solid rgba(255, 0, 128, 0.5);
                    border-radius: 15px;
                    padding: 30px;
                    text-align: center;
                    color: #fff;
                }
                .anonimbiri-hotkey-modal h3 {
                    margin-bottom: 20px;
                    color: #ff0080;
                    font-size: 18px;
                }
                .anonimbiri-hotkey-modal p {
                    margin-bottom: 15px;
                    font-size: 14px;
                    opacity: 0.8;
                }
                .anonimbiri-cheat-menu * {
                    color: #fff !important;
                }
                .anonimbiri-rmb-label,
                .anonimbiri-hotkey-modal p {
                    color: #ccc !important;
                }
                .anonimbiri-key-highlight {
                    color: #ff0080 !important;
                }
            `;
            const style = document.createElement('style');
            style.textContent = menuCSS;
            document.head.appendChild(style);
            const menuHTML = `
                <div class="anonimbiri-cheat-menu" id="anonimbiri-cheatMenu">
                    <div class="anonimbiri-menu-header" id="anonimbiri-menuHeader">
                        <div class="anonimbiri-header-icon">
                            <svg width="24" height="24" viewBox="0 0 24 24" fill="none">
                                <path d="M12 2L15 8.5L22 9L16 13L17 20L12 17L7 20L8 13L2 9L9 8.5L12 2Z" fill="currentColor"/>
                            </svg>
                        </div>
                        <h2>ANIME CHEAT MENU</h2>
                        <div class="anonimbiri-close-btn" id="anonimbiri-closeBtn">
                            <svg width="20" height="20" viewBox="0 0 24 24" fill="none">
                                <path d="M6 6L18 18M18 6L6 18" stroke="currentColor" stroke-width="2"/>
                            </svg>
                        </div>
                    </div>
                    <div class="anonimbiri-menu-content">
                        ${this.createFeatureHTML('aimbotEnabled','Aimbot','M11.99 15.5l-2.3-2.3c-.2-.2-.2-.51 0-.71l.71-.71c.2-.2.51-.2.71 0l2.15 2.15 4.6-4.6c.2-.2.51-.2.71 0l.71.71c.2.2.2.51 0 .71L12.7 15.5c-.2.2-.51.2-.71 0zM12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8z')}
                        ${this.createFeatureHTML('espLines','ESP Lines','M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8zm11-5c-2.76 0-5 2.24-5 5s2.24 5 5 5 5-2.24 5-5-2.24-5-5-5zm0 8c-1.66 0-3-1.34-3-3s1.34-3 3-3 3 1.34 3 3-1.34 3-3 3z','espColor')}
                        ${this.createFeatureHTML('espSkeleton','ESP Skeleton','M12 6c1.1 0 2 .9 2 2s-.9 2-2 2-2-.9-2-2 .9-2 2-2m0 10c2.7 0 5.8 1.29 6 2H6c.23-.72 3.31-2 6-2M12 4C9.79 4 8 5.79 8 8s1.79 4 4 4 4-1.79 4-4-1.79-4-4-4zm0 10c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4z','skeletonColor')}
                        ${this.createFeatureHTML('espSquare','Box ESP','M3 5v14h14V5H3zm12 12H5V7h10v10zM19 1H8v2h11v11h2V1z','boxColor')}
                        ${this.createFeatureHTML('wireframeEnabled','Wireframe','M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16zM12 11L5 7l7-4 7 4-7 4z')}
                    </div>
                    <div class="anonimbiri-menu-footer">
                        <svg width="100%" height="30" viewBox="0 0 200 30">
                            <defs>
                                <linearGradient id="anonimbiri-waveGradient" x1="0%" y1="0%" x2="100%" y2="0%">
                                    <stop offset="0%" style="stop-color:#ff0080;stop-opacity:0.8" />
                                    <stop offset="50%" style="stop-color:#8000ff;stop-opacity:0.8" />
                                    <stop offset="100%" style="stop-color:#00ff80;stop-opacity:0.8" />
                                </linearGradient>
                            </defs>
                            <path d="M0,15 Q50,5 100,15 T200,15" stroke="url(#anonimbiri-waveGradient)" stroke-width="2" fill="none" class="anonimbiri-wave-path"/>
                        </svg>
                    </div>
                </div>
                <div class="anonimbiri-menu-toggle-hint" id="anonimbiri-toggleHint">
                    Press <span class="anonimbiri-key-highlight" id="anonimbiri-toggleKey"></span> to toggle menu
                </div>
                <div class="anonimbiri-hotkey-modal" id="anonimbiri-hotkeyModal">
                    <div class="anonimbiri-hotkey-modal-content">
                        <h3>SET HOTKEY</h3>
                        <p>Press any key for <span id="anonimbiri-hotkeyFeatureName" style="color: #ff0080; font-weight: bold;"></span></p>
                        <p>(Press Escape to cancel)</p>
                    </div>
                </div>
            `;
            const container = document.createElement('div');
            container.innerHTML = menuHTML;
            document.body.appendChild(container);
            this.gui = document.getElementById('anonimbiri-cheatMenu');
            this.hotkeyModal = document.getElementById('anonimbiri-hotkeyModal');
            this.toggleHint = document.getElementById('anonimbiri-toggleHint');
            this.updateAllGUIElements();
            this.makeMenuDraggable();
        }
        createFeatureHTML(setting, label, iconPath, colorSetting = null) {
            let controls = `
                <div class="anonimbiri-checkbox-container">
                    <input type="checkbox" id="anonimbiri-${setting}" data-setting="${setting}" class="anonimbiri-anime-checkbox">
                    <label for="anonimbiri-${setting}" class="anonimbiri-checkbox-label"></label>
                </div>
            `;
            if (setting === 'aimbotEnabled') {
                controls += `
                    <div class="anonimbiri-checkbox-container">
                        <input type="checkbox" id="anonimbiri-aimbotOnRightMouse" data-setting="aimbotOnRightMouse" class="anonimbiri-anime-checkbox">
                        <label for="anonimbiri-aimbotOnRightMouse" class="anonimbiri-checkbox-label"></label>
                        <span class="anonimbiri-rmb-label">RMB</span>
                    </div>
                `;
            }
            let gridLayout = `grid-template-columns: ${setting==='aimbotEnabled'?'auto auto':'auto'} 1fr auto ${colorSetting?'auto':''};`;
            return `
                <div class="anonimbiri-feature-section">
                    <div class="anonimbiri-feature-header">
                        <svg class="anonimbiri-feature-icon" width="20" height="20" viewBox="0 0 24 24" fill="currentColor">
                            <path d="${iconPath}"></path>
                        </svg>
                        <span>${label}</span>
                    </div>
                    <div class="anonimbiri-feature-controls" style="${gridLayout}">
                        ${controls}
                        <span></span>
                        ${colorSetting?`
                            <div class="anonimbiri-color-picker-container">
                                <input type="color" data-setting="${colorSetting}" class="anonimbiri-color-picker">
                                <div class="anonimbiri-color-preview" data-setting="${colorSetting}"></div>
                            </div>
                        `:''}
                        <div class="anonimbiri-hotkey-display" data-setting="${setting}"></div>
                    </div>
                </div>
            `;
        }
        addEventListeners() {
            window.addEventListener('pointerdown', (e) => { if (e.button === 2) this.rightMouseDown = true; });
            window.addEventListener('pointerup', (e) => { if (e.button === 2) this.rightMouseDown = false; });
            window.addEventListener('keyup', (e) => {
                if (this.isBindingHotkey) {
                    e.preventDefault();
                    e.stopPropagation();
                    if (e.code === 'Escape') {
                        this.hideHotkeyModal();
                        return;
                    }
                    this.hotkeys[this.currentBindingSetting] = e.code;
                    this.saveSettings('anonimbiri_hotkeys', this.hotkeys);
                    this.updateHotkeyButton(this.currentBindingSetting);
                    if (this.currentBindingSetting === 'toggleMenu') this.updateToggleHint();
                    this.hideHotkeyModal();
                    return;
                }
                if (document.activeElement?.tagName === "INPUT" || document.activeElement?.tagName === "TEXTAREA") return;
                const action = Object.keys(this.hotkeys).find(key => this.hotkeys[key] === e.code);
                if (action) {
                    if (action === 'toggleMenu') {
                        e.preventDefault();
                        e.stopPropagation();
                        this.toggleMenuVisibility();
                    } else if (this.settings.hasOwnProperty(action)) {
                        this.settings[action] = !this.settings[action];
                        this.saveSettings('anonimbiri_settings', this.settings);
                        this.updateGUIToggle(action);
                    }
                }
            });
            document.getElementById('anonimbiri-closeBtn').addEventListener('click', () => this.toggleMenuVisibility());
            this.gui.querySelectorAll('.anonimbiri-anime-checkbox').forEach(cb => cb.addEventListener('change', (e) => {
                this.settings[e.target.dataset.setting] = e.target.checked;
                this.saveSettings('anonimbiri_settings', this.settings);
            }));
            this.gui.querySelectorAll('.anonimbiri-color-picker').forEach(cp => cp.addEventListener('input', (e) => {
                this.settings[e.target.dataset.setting] = e.target.value;
                this.saveSettings('anonimbiri_settings', this.settings);
                this.updateGUIPicker(e.target.dataset.setting);
            }));
            this.gui.querySelectorAll('.anonimbiri-hotkey-display').forEach(btn => btn.addEventListener('click', (e) => {
                this.showHotkeyModal(e.currentTarget.dataset.setting);
            }));
        }
        updateAllGUIElements() {
            Object.keys(this.settings).forEach(s => {
                this.updateGUIToggle(s);
                this.updateGUIPicker(s);
            });
            Object.keys(this.hotkeys).forEach(h => this.updateHotkeyButton(h));
            this.updateToggleHint();
        }
        updateGUIToggle(settingName) {
            const t = this.gui.querySelector(`input[data-setting="${settingName}"]`);
            if (t) t.checked = this.settings[settingName];
        }
        updateGUIPicker(settingName) {
            if (!settingName.toLowerCase().includes('color')) return;
            const picker = this.gui.querySelector(`input[type="color"][data-setting="${settingName}"]`);
            const preview = this.gui.querySelector(`.anonimbiri-color-preview[data-setting="${settingName}"]`);
            if (picker) picker.value = this.settings[settingName];
            if (preview) preview.style.background = this.settings[settingName];
            const material = {
                espColor: this.lineMaterial,
                skeletonColor: this.skeletonMaterial,
                boxColor: this.squareMaterial
            }[settingName];
            if (material) material.uniforms.u_color.value.set(this.settings[settingName]);
        }
        updateHotkeyButton(settingName) {
            const b = this.gui.querySelector(`.anonimbiri-hotkey-display[data-setting="${settingName}"]`);
            if (b) b.textContent = this.hotkeys[settingName] || 'N/A';
        }
        updateToggleHint() {
            document.getElementById('anonimbiri-toggleKey').textContent = this.hotkeys.toggleMenu;
            setTimeout(() => this.toggleHint.classList.add('show'), 1000);
            setTimeout(() => this.toggleHint.classList.remove('show'), 6000);
        }
        toggleMenuVisibility() {
            this.settings.menuVisible = !this.settings.menuVisible;
            this.gui.style.transform = `translate(-50%, -50%) scale(${this.settings.menuVisible?1:0})`;
            this.gui.style.opacity = this.settings.menuVisible ? 1 : 0;
            this.saveSettings('anonimbiri_settings', this.settings);
            if (!this.settings.menuVisible) this.updateToggleHint();
        }
        showHotkeyModal(settingName) {
            this.isBindingHotkey = true;
            this.currentBindingSetting = settingName;
            const label = this.gui.querySelector(`.anonimbiri-hotkey-display[data-setting="${settingName}"]`).closest('.anonimbiri-feature-section').querySelector('span').textContent;
            document.getElementById('anonimbiri-hotkeyFeatureName').textContent = label;
            this.hotkeyModal.classList.add('active');
        }
        hideHotkeyModal() {
            this.isBindingHotkey = false;
            this.currentBindingSetting = null;
            this.hotkeyModal.classList.remove('active');
        }
        makeMenuDraggable() {
            const header = document.getElementById('anonimbiri-menuHeader');
            let isDragging = false, startX, startY, initialLeft, initialTop;
            header.addEventListener('mousedown', (e) => {
                isDragging = true;
                const rect = this.gui.getBoundingClientRect();
                initialLeft = rect.left;
                initialTop = rect.top;
                startX = e.clientX;
                startY = e.clientY;
                this.gui.style.transition = 'none';
                e.preventDefault();
            });
            document.addEventListener('mousemove', (e) => {
                if (isDragging) {
                    let newLeft = initialLeft + (e.clientX - startX);
                    let newTop = initialTop + (e.clientY - startY);
                    const margin = 5;
                    const menuWidth = this.gui.offsetWidth;
                    const menuHeight = this.gui.offsetHeight;
                    newLeft = Math.max(margin, Math.min(newLeft, window.innerWidth - menuWidth - margin));
                    newTop = Math.max(margin, Math.min(newTop, window.innerHeight - menuHeight - margin));
                    this.gui.style.left = `${newLeft}px`;
                    this.gui.style.top = `${newTop}px`;
                    this.gui.style.transform = 'translate(0, 0)';
                }
            });
            document.addEventListener('mouseup', () => {
                if (isDragging) {
                    isDragging = false;
                    const rect = this.gui.getBoundingClientRect();
                    this.settings.menuLeft = `${(rect.left + rect.width/2) / window.innerWidth * 100}%`;
                    this.settings.menuTop = `${(rect.top+rect.height/2) / window.innerHeight * 100}%`;
                    this.saveSettings('anonimbiri_settings', this.settings);
                    this.gui.style.left = this.settings.menuLeft;
                    this.gui.style.top = this.settings.menuTop;
                    this.gui.style.transform = `translate(-50%, -50%) scale(${this.settings.menuVisible?1:0})`;
                    this.gui.style.transition = 'all 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55)';
                }
            });
        }

        findBodyParts(player) {
            const parts = { head: null, body: null, arms: [], legs: [] };
            const limbs = [];
            if (!player.children[0]?.children) return parts;
            for (const child of player.children[0].children) {
                if (child.name === 'leg') {
                    limbs.push(child);
                } else if (child.type === 'Object3D' && child.children.length > 0) {
                    for (const part of child.children) {
                        if (part.name === 'head') parts.head = part;
                        if (part.name === 'body') parts.body = part;
                    }
                }
            }
            if (limbs.length >= 4) {
                limbs.sort((a, b) => b.position.y - a.position.y);
                parts.arms = limbs.slice(0, 2);
                parts.legs = limbs.slice(2, 4);
                parts.arms.sort((a, b) => a.position.x - b.position.x);
                parts.legs.sort((a, b) => a.position.x - b.position.x);
            }
            return parts;
        }

        getPartCenter(part, targetVector) {
            if (!part?.geometry) return part.getWorldPosition(targetVector);
            const geometry = part.geometry;
            if (!geometry.boundingBox) geometry.computeBoundingBox();
            geometry.boundingBox.getCenter(targetVector);
            targetVector.applyMatrix4(part.matrixWorld);
        }

        createPlayerESP(player) {
            const esp = { skeleton: null, box: null };
            const boneGeo = new this.THREE.BufferGeometry();
            // Increased buffer size for more accurate skeleton lines
            boneGeo.setAttribute('position', new this.THREE.BufferAttribute(new Float32Array(12 * 3), 3));
            const bones = new this.THREE.LineSegments(boneGeo, this.skeletonMaterial);
            const headGeo = new this.THREE.RingGeometry(1.0, 1.2, 16);
            const head = new this.THREE.Mesh(headGeo, this.skeletonMaterial);
            esp.skeleton = new this.THREE.Group();
            esp.skeleton.add(bones, head);
            this.scene.add(esp.skeleton);
            esp.box = new this.THREE.LineLoop(this.squareGeometry, this.squareMaterial);
            this.scene.add(esp.box);
            this.managedESP.set(player.id, { player, esp });
        }

        removePlayerESP(playerId) {
            if (this.managedESP.has(playerId)) {
                const { esp } = this.managedESP.get(playerId);
                if (esp.skeleton) this.scene.remove(esp.skeleton);
                if (esp.box) this.scene.remove(esp.box);
                this.managedESP.delete(playerId);
            }
        }

        updatePlayerESP(player) {
            if (!this.managedESP.has(player.id) || !player.bodyParts) return;
            const { esp } = this.managedESP.get(player.id);
            const parts = player.bodyParts;

            if (esp.skeleton) {
                esp.skeleton.visible = this.settings.espSkeleton;
                if (this.settings.espSkeleton) {
                    const [bones, head] = esp.skeleton.children;
                    const headPos = new this.THREE.Vector3();
                    const bodyPos = new this.THREE.Vector3();
                    const arm1Pos = new this.THREE.Vector3();
                    const arm2Pos = new this.THREE.Vector3();
                    const leg1Pos = new this.THREE.Vector3();
                    const leg2Pos = new this.THREE.Vector3();

                    this.getPartCenter(parts.head, headPos);
                    this.getPartCenter(parts.body, bodyPos);
                    if (parts.arms[0]) this.getPartCenter(parts.arms[0], arm1Pos);
                    if (parts.arms[1]) this.getPartCenter(parts.arms[1], arm2Pos);
                    if (parts.legs[0]) this.getPartCenter(parts.legs[0], leg1Pos);
                    if (parts.legs[1]) this.getPartCenter(parts.legs[1], leg2Pos);

                    head.position.copy(headPos);
                    head.lookAt(this.cameraPos);

                    const positions = bones.geometry.attributes.position.array;
                    let i = 0;
                    const setPos = (p) => {
                        positions[i++] = p.x;
                        positions[i++] = p.y;
                        positions[i++] = p.z;
                    };

                    // Spine (head to body)
                    setPos(headPos);
                    setPos(bodyPos);

                    // Arms (shoulder to elbow approximation)
                    if (parts.arms[0]) {
                        setPos(bodyPos);
                        setPos(arm1Pos);
                    }
                    if (parts.arms[1]) {
                        setPos(bodyPos);
                        setPos(arm2Pos);
                    }

                    // Legs (hip to knee approximation)
                    if (parts.legs[0]) {
                        setPos(bodyPos);
                        setPos(leg1Pos);
                    }
                    if (parts.legs[1]) {
                        setPos(bodyPos);
                        setPos(leg2Pos);
                    }

                    bones.geometry.attributes.position.needsUpdate = true;
                    bones.geometry.computeBoundingSphere();
                }
            }
            if (esp.box) {
                esp.box.visible = this.settings.espSquare;
                if (this.settings.espSquare) {
                    this.getPartCenter(parts.body, esp.box.position);
                    esp.box.lookAt(this.cameraPos);
                }
            }
        }

        animate() {
            requestAnimationFrame(() => this.animate());
            this.materials.forEach(m => { if (m?.uniforms.u_time) m.uniforms.u_time.value += 0.016; });

            if (this.scene && this.myPlayer && !this.scene.children.includes(this.myPlayer)) {
                console.log("🌸 Anime Cheats: Scene reset detected! Re-initializing...");
                for (const playerId of this.managedESP.keys()) { this.removePlayerESP(playerId); }
                this.scene = null;
                this.myPlayer = null;
                this.players = [];
            }

            if (!this.scene) { this.attemptInjection(); return; }

            const players = [];
            let myPlayer = null;
            if (this.scene.children) {
                for (const child of this.scene.children) {
                    if (!child) continue;
                    if (child.type === 'Object3D') {
                        try {
                            if (child.children[0]?.children[0]?.type === 'PerspectiveCamera') myPlayer = child;
                            else if (child.position.x !== 0 || child.position.z !== 0) {
                                if (!child.bodyParts) child.bodyParts = this.findBodyParts(child);
                                if (child.bodyParts.head && child.bodyParts.body && child.bodyParts.legs.length >= 2) {
                                    players.push(child);
                                }
                            }
                        } catch (err) {}
                    } else if (child.material) {
                        child.material.wireframe = this.settings.wireframeEnabled;
                    }
                }
            }
            this.myPlayer = myPlayer;
            this.players = players;
            if (!this.myPlayer) return;

            const currentPlayerIds = new Set(this.players.map(p => p.id));
            for (const playerId of this.managedESP.keys()) {
                if (!currentPlayerIds.has(playerId)) {
                    this.removePlayerESP(playerId);
                }
            }

            let espLineCounter = 0;
            let targetPlayer = undefined;
            let minDistance = Infinity;
            if (!this.espLine) {
                this.espLine = new this.THREE.LineSegments(this.espLineGeometry, this.lineMaterial);
                this.espLine.frustumCulled = false;
                this.myPlayer.add(this.espLine);
            }
            this.tempObject.matrix.copy(this.myPlayer.matrixWorld).invert();
            if (this.myPlayer.children[0]?.children[0]) this.myPlayer.children[0].children[0].getWorldPosition(this.cameraPos);

            const linePositions = this.espLinePositionsAttribute.array;
            for (const player of this.players) {
                if (!this.managedESP.has(player.id)) this.createPlayerESP(player);
                this.updatePlayerESP(player);

                if (this.settings.espLines) {
                    this.getPartCenter(player.bodyParts.body, this.tempVector);
                    this.tempVector.applyMatrix4(this.tempObject.matrix);
                    linePositions[espLineCounter++] = 0;
                    linePositions[espLineCounter++] = -5;
                    linePositions[espLineCounter++] = 0;
                    linePositions[espLineCounter++] = this.tempVector.x;
                    linePositions[espLineCounter++] = this.tempVector.y;
                    linePositions[espLineCounter++] = this.tempVector.z;
                }
                const distance = this.myPlayer.position.distanceTo(player.position);
                if (distance < minDistance) {
                    targetPlayer = player;
                    minDistance = distance;
                }
            }
            if (this.settings.espLines) {
                this.espLinePositionsAttribute.needsUpdate = true;
                this.espLine.geometry.setDrawRange(0, espLineCounter / 3);
                this.espLine.visible = espLineCounter > 0;
            } else {
                this.espLine.visible = false;
            }

            if (!this.settings.aimbotEnabled || (this.settings.aimbotOnRightMouse && !this.rightMouseDown) || !targetPlayer) return;
            try {
                if (targetPlayer.bodyParts?.head) {
                    this.getPartCenter(targetPlayer.bodyParts.head, this.tempVector);
                    this.tempVector.y -= 2; // Aim 2 units lower
                } else {
                    targetPlayer.getWorldPosition(this.tempVector);
                    this.tempVector.y += 7; // Adjusted fallback
                }
            } catch (e) {
                targetPlayer.getWorldPosition(this.tempVector);
                this.tempVector.y += 7;
            }
            if (this.tempVector.lengthSq() < 0.01) return;

            const lookAtOrigin = new this.THREE.Vector3();
            this.myPlayer.children[0].getWorldPosition(lookAtOrigin);
            this.tempObject.position.copy(lookAtOrigin);
            this.tempObject.lookAt(this.tempVector);
            const lerpFactor = 0.7;
            this.myPlayer.children[0].rotation.x = this.lerpAngle(this.myPlayer.children[0].rotation.x, -this.tempObject.rotation.x, lerpFactor);
            this.myPlayer.rotation.y = this.lerpAngle(this.myPlayer.rotation.y, this.tempObject.rotation.y + Math.PI, lerpFactor);
        }
        lerpAngle(start, end, t) {
            let d = (end - start) % (2 * Math.PI);
            return start + (d > Math.PI ? d - 2 * Math.PI : d < -Math.PI ? d + 2 * Math.PI : d) * t;
        }
    }
    if (document.readyState === 'loading') {
        window.addEventListener('DOMContentLoaded', () => new KrunkerCheats());
    } else {
        new KrunkerCheats();
    }
})();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址