Taming.io Mod Menu Cheat

Mod menu with cheats for Taming.io

// ==UserScript==
// @name         Taming.io Mod Menu Cheat
// @namespace    http://tampermonkey.net/
// @version      1.0
// @description  Mod menu with cheats for Taming.io
// @match        https://taming.io/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    // Mod Menu Class
    class ModMenu {
        constructor() {
            this.createMenuUI();
            this.setupEventListeners();
        }

        createMenuUI() {
            // Create mod menu container
            this.menuContainer = document.createElement('div');
            this.menuContainer.style.cssText = `
                position: fixed;
                top: 20px;
                right: 20px;
                background: rgba(0,0,0,0.7);
                color: white;
                padding: 15px;
                border-radius: 10px;
                z-index: 1000;
            `;

            // Cheat toggles
            this.createToggle('One Hit Kill', this.toggleOneHitKill.bind(this));
            this.createToggle('Invincibility', this.toggleInvincibility.bind(this));
            this.createToggle('Speed Hack', this.toggleSpeedHack.bind(this));

            document.body.appendChild(this.menuContainer);
        }

        createToggle(label, callback) {
            const toggleContainer = document.createElement('div');
            const checkbox = document.createElement('input');
            const labelElement = document.createElement('label');

            checkbox.type = 'checkbox';
            checkbox.addEventListener('change', callback);

            labelElement.appendChild(checkbox);
            labelElement.appendChild(document.createTextNode(label));

            toggleContainer.appendChild(labelElement);
            this.menuContainer.appendChild(toggleContainer);
        }

        toggleOneHitKill(event) {
            const isEnabled = event.target.checked;
            try {
                if (isEnabled) {
                    game.player.attack = function() {
                        const target = this.getCurrentTarget();
                        if (target) {
                            target.health = 0;
                        }
                    };
                } else {
                    // Restore original attack method
                    game.player.attack = game.player.originalAttack;
                }
            } catch (error) {
                console.error('One Hit Kill failed:', error);
            }
        }

        toggleInvincibility(event) {
            const isEnabled = event.target.checked;
            try {
                if (isEnabled) {
                    game.player.takeDamage = () => false;
                    game.player.health = game.player.maxHealth;
                } else {
                    // Restore original damage method
                    game.player.takeDamage = game.player.originalTakeDamage;
                }
            } catch (error) {
                console.error('Invincibility failed:', error);
            }
        }

        toggleSpeedHack(event) {
            const isEnabled = event.target.checked;
            try {
                if (isEnabled) {
                    game.player.speed *= 2; // Double speed
                } else {
                    game.player.speed /= 2; // Restore original speed
                }
            } catch (error) {
                console.error('Speed hack failed:', error);
            }
        }

        setupEventListeners() {
            // Add keyboard shortcut to toggle menu
            document.addEventListener('keydown', (e) => {
                if (e.key === 'M' && e.ctrlKey) {
                    this.menuContainer.style.display = 
                        this.menuContainer.style.display === 'none' ? 'block' : 'none';
                }
            });
        }
    }

    // Initialize mod menu when game loads
    function initModMenu() {
        if (typeof game !== 'undefined') {
            window.modMenu = new ModMenu();
        } else {
            setTimeout(initModMenu, 1000);
        }
    }

    // Start initialization
    initModMenu();
})();