Krunker.IO Cheats [Anime Edition]

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

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

// ==UserScript==
// @name         Krunker.IO Cheats [Anime Edition]
// @namespace    http://tampermonkey.net/
// @version      1.0.0
// @description  Aimbot, Skeleton, 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         https://i.pinimg.com/originals/a9/48/87/a94887b1403541467a845115291f391a.jpg
// @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);

        // --- AYARLAR VE KISAYOLLAR ---
        this.defaultSettings = {
            aimbotEnabled: true,
            aimbotOnRightMouse: false,
            espLines: true,
            espSkeleton: true,
            espSquare: true,
            wireframeEnabled: false,
            menuVisible: true,
            espColor: "#ff0080",      // Lines Color
            skeletonColor: "#ff0080", // Skeleton Color
            boxColor: "#ff0080",      // Box Color
            menuTop: "50%",
            menuLeft: "50%",
        };

        this.defaultHotkeys = {
            toggleMenu: 'F1',
            aimbotEnabled: 'F2',
            espLines: 'F3',
            espSkeleton: 'F4',
            espSquare: 'F5',
            wireframeEnabled: 'F6',
        };

        this.settings = this.loadSettings('anonimbiri_anime_settings_v2', this.defaultSettings);
        this.hotkeys = this.loadSettings('anonimbiri_anime_hotkeys_v2', this.defaultHotkeys);

        // --- DEĞİŞKENLER ---
        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.createGeometries();
        this.createMaterials();
        this.createGUI();
        this.addEventListeners();
        this.animate();
    }

    // --- AYAR YÖNETİMİ ---
    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));
    }

    // --- OYUN İÇİ ENJEKSİYON ---
    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 && typeof object === 'object' &&
                object.parent && 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);
    }

    // --- GEOMETRİ VE MATERYALLER ---
    createGeometries() {
        const skeletonPoints = [[0, 15, 0], [0, 13, 0], [0, 13, 0], [0, 7, 0], [0, 7, 0], [-2, 4, 0], [-2, 4, 0], [-2, 0, 0], [0, 7, 0], [2, 4, 0], [2, 4, 0], [2, 0, 0], [0, 12, 0], [-4, 10, 0], [-4, 10, 0], [-4, 6, 0], [0, 12, 0], [4, 10, 0], [4, 10, 0], [4, 6, 0]].flat();
        this.skeletonGeometry = new this.THREE.BufferGeometry();
        this.skeletonGeometry.setAttribute('position', new this.THREE.Float32BufferAttribute(skeletonPoints, 3));
        const squareVertices = [-3.5, 0, 0, 3.5, 0, 0, 3.5, 16, 0, -3.5, 16, 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 * 3), 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];
    }

    // --- KULLANICI ARAYÜZÜ (GUI) ---
    createGUI() {
        // Google Font Ekleme
        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; }
            @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; }
            .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; }
            @keyframes anonimbiri-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.6; } }
            .anonimbiri-feature-controls { display: grid; grid-template-columns: 1fr auto auto; 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: 1px; left: 1px; 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; }
        `;
        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 2L13.09 8.26L20 9L13.09 9.74L12 16L10.91 9.74L4 9L10.91 8.26L12 2Z" fill="currentColor"/></svg></div>
                    <h2>ANIME CHEAT MENU</h2>
                    <div class="anonimbiri-close-btn" id="anonimbiri-closeBtn">×</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>
            ${setting === 'aimbotEnabled' ? `
            <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_anime_hotkeys_v2', this.hotkeys);
                this.updateHotkeyButton(this.currentBindingSetting);
                if (this.currentBindingSetting === 'toggleMenu') this.updateToggleHint();
                this.hideHotkeyModal();
                return;
            }
            if (document.activeElement && (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') this.toggleMenuVisibility();
                else if (this.settings.hasOwnProperty(action)) {
                    this.settings[action] = !this.settings[action];
                    this.saveSettings('anonimbiri_anime_settings_v2', 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_anime_settings_v2', 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_anime_settings_v2', this.settings);
            this.updateGUIPicker(e.target.dataset.setting);
        }));
        this.gui.querySelectorAll('.anonimbiri-hotkey-display').forEach(btn => btn.addEventListener('click', (e) => {
            const setting = e.currentTarget.dataset.setting;
            this.showHotkeyModal(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_anime_settings_v2', 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, offsetX, offsetY;
        header.addEventListener('mousedown', (e) => {
            isDragging = true; offsetX = e.clientX - this.gui.getBoundingClientRect().left; offsetY = e.clientY - this.gui.getBoundingClientRect().top;
            this.gui.style.transition = 'none';
        });
        document.addEventListener('mousemove', (e) => { if (isDragging) { this.gui.style.left = `${e.clientX - offsetX}px`; this.gui.style.top = `${e.clientY - offsetY}px`; } });
        document.addEventListener('mouseup', () => {
            if (isDragging) {
                isDragging = false; this.gui.style.transition = 'all 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55)';
                this.settings.menuLeft = `${(this.gui.getBoundingClientRect().left + this.gui.offsetWidth / 2) / window.innerWidth * 100}%`;
                this.settings.menuTop = `${(this.gui.getBoundingClientRect().top + this.gui.offsetHeight / 2) / window.innerHeight * 100}%`;
                this.saveSettings('anonimbiri_anime_settings_v2', this.settings);
            }
        });
    }

    // --- ANA ÇALIŞMA DÖNGÜSÜ ---
    animate() {
        requestAnimationFrame(() => this.animate());
        this.materials.forEach(m => { if (m && m.uniforms.u_time) m.uniforms.u_time.value += 0.016; });
        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 && child.userData) 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;
        let espLineCounter = 0; let targetPlayer = undefined; let minDistance = Infinity;
        if (!this.espLine) { this.espLine = new this.THREE.Line(this.espLineGeometry, this.lineMaterial); this.espLine.frustumCulled = false; }
        if (this.espLine.parent !== this.myPlayer) { if (this.espLine.parent) this.espLine.parent.remove(this.espLine); 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);
        for (const player of this.players) {
            if (!player || !player.position || (player.position.x === this.myPlayer.position.x && player.position.z === this.myPlayer.position.z)) { if (player?.espGroup) player.espGroup.visible = false; continue; }
            if (!player.espGroup && player.children[0]) { player.espGroup = new this.THREE.Group(); player.espGroup.frustumCulled = false; player.children[0].add(player.espGroup); }
            if (!player.espGroup) continue;
            player.espGroup.visible = true;
            if (this.settings.espSkeleton) {
                if (!player.espSkeleton) { player.espSkeleton = new this.THREE.LineSegments(this.skeletonGeometry, this.skeletonMaterial); player.espSkeleton.frustumCulled = false; player.espGroup.add(player.espSkeleton); } player.espSkeleton.visible = true;
            } else if (player.espSkeleton) player.espSkeleton.visible = false;
            if (this.settings.espSquare) {
                if (!player.espSquare) { player.espSquare = new this.THREE.LineLoop(this.squareGeometry, this.squareMaterial); player.espSquare.frustumCulled = false; player.espGroup.add(player.espSquare); } player.espSquare.lookAt(this.cameraPos); player.espSquare.visible = true;
            } else if (player.espSquare) player.espSquare.visible = false;
            if (this.settings.espLines && espLineCounter + 2 <= this.espLinePositionsAttribute.count) {
                this.espLinePositionsAttribute.setXYZ(espLineCounter++, 0, -5, 0); this.tempVector.copy(player.position); this.tempVector.y += 9; this.tempVector.applyMatrix4(this.tempObject.matrix); this.espLinePositionsAttribute.setXYZ(espLineCounter++, this.tempVector.x, this.tempVector.y, this.tempVector.z);
            }
            const distance = this.myPlayer.position.distanceTo(player.position); if (distance < minDistance && distance > 0.1) { targetPlayer = player; minDistance = distance; }
        }
        if (this.settings.espLines && espLineCounter > 0) { this.espLinePositionsAttribute.needsUpdate = true; this.espLine.geometry.setDrawRange(0, espLineCounter); this.espLine.visible = true; } else { this.espLine.visible = false; }
        if (!this.settings.aimbotEnabled || (this.settings.aimbotOnRightMouse && !this.rightMouseDown) || !targetPlayer) return;
        try { targetPlayer.children[0].children[0].getWorldPosition(this.tempVector); } catch (e) { targetPlayer.getWorldPosition(this.tempVector); this.tempVector.y += 9; }
        if (this.tempVector.lengthSq() < 0.01) return;
        const lookAtOrigin = new this.THREE.Vector3(); if (this.myPlayer.children[0]) this.myPlayer.children[0].getWorldPosition(lookAtOrigin); else this.myPlayer.getWorldPosition(lookAtOrigin);
        this.tempObject.position.copy(lookAtOrigin); this.tempObject.lookAt(this.tempVector); const lerpFactor = 0.7;
        if (this.myPlayer.children[0]) { 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(); }
})();