EvoWorld.io Zoom Hack

Zoom hack for evoworld.io (flyordie.io)

Dovrai installare un'estensione come Tampermonkey, Greasemonkey o Violentmonkey per installare questo script.

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

Dovrai installare un'estensione come Tampermonkey o Violentmonkey per installare questo script.

Dovrai installare un'estensione come Tampermonkey o Userscripts per installare questo script.

Dovrai installare un'estensione come ad esempio Tampermonkey per installare questo script.

Dovrai installare un gestore di script utente per installare questo script.

(Ho già un gestore di script utente, lasciamelo installare!)

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

(Ho già un gestore di stile utente, lasciamelo installare!)

// ==UserScript==
// @name         EvoWorld.io Zoom Hack
// @namespace    evoezsquad
// @version      1.1
// @description  Zoom hack for evoworld.io (flyordie.io)
// @author       evoezsquad
// @match        https://evoworld.io/*
// @match        https://flyordie.io/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=evoworld.io
// @grant        none
// @license      MIT
// ==/UserScript==

(function() {
    'use strict';

    window.customZoom = 1.0;

    function init() {
        if (typeof Engine === 'undefined' || typeof game === 'undefined' || !game) {
            setTimeout(init, 100);
            return;
        }

        try {
            Object.defineProperty(game, 'zoom', {
                get: function() {
                    return window.customZoom;
                },
                set: function(v) {},
                configurable: true
            });
        } catch (e) {}

        Engine.prototype.setZoom = function(t) {
            this.zoom = window.customZoom;
            this.staticCanvasRenderOffset.restX = 0;
            this.staticCanvasRenderOffset.restY = 0;
            this.staticCanvasRenderOffset.x = 0;
            this.staticCanvasRenderOffset.y = 0;
            this.staticCanvasRenderPosition.x = 0;
            this.staticCanvasRenderPosition.y = 0;

            if (this.context) {
                this.context.save();
                this.context.fillStyle = "rgba(0,0,0,1)";
                this.context.fillRect(0, 0, this.canvas.width, this.canvas.height);
                this.context.restore();
            }
            this.clearStaticObjects();
        };

        window.open('https://t.me/evoezsquad', '_blank');
        menu();
    }

    function menu() {
        if (document.getElementById('z-ui')) return;

        const u = document.createElement('div');
        u.id = 'z-ui';
        u.style.cssText = 'position:fixed;top:10px;left:10px;width:180px;background:rgba(0,0,0,0.9);border:1px solid #555;padding:10px;color:#fff;z-index:999999;font-family:monospace;text-align:center;user-select:none;';

        u.innerHTML = `
            <div style="font-size:11px;margin-bottom:5px;">t.me/evoezsquad</div>
            <input type="range" id="z-bar" min="0.15" max="4.30" step="0.01" value="1.0" style="width:100%;cursor:pointer;">
            <div style="margin:5px 0;font-size:16px;font-weight:bold;"><span id="z-val">1.00</span>x</div>
            <div style="font-size:10px;color:#888;">H - Hide</div>
        `;

        document.body.appendChild(u);

        const b = document.getElementById('z-bar');
        const v = document.getElementById('z-val');

        function set(n) {
            let val = parseFloat(n);
            window.customZoom = val;
            v.innerText = val.toFixed(2);
            if (window.game && game.setZoom) game.setZoom(val);
        }

        b.oninput = function() {
            set(this.value);
        };

        window.addEventListener('wheel', () => {
            if (window.game) {
                setTimeout(() => {
                    b.value = window.customZoom;
                    v.innerText = window.customZoom.toFixed(2);
                }, 1);
            }
        }, { passive: true });

        window.addEventListener('keydown', (e) => {
            if (e.code === 'KeyH' && document.activeElement.tagName !== 'INPUT') {
                u.style.display = u.style.display === 'none' ? 'block' : 'none';
            }
        });
    }

    init();
})();