Gats.IO Enhanced

zoom hack (use mouse wheel), anti-camo, anti-silencer, anti-landmine and more

// ==UserScript==
// @name Gats.IO Enhanced
// @namespace -
// @version 1.2.0
// @description zoom hack (use mouse wheel), anti-camo, anti-silencer, anti-landmine and more
// @author NotYou
// @match *://gats.io/*
// @match *://gats2.com/*
// @match *://www.gats.io/*
// @match *://www.gats2.com/*
// @run-at document-end
// @license GPL-3.0-or-later
// @grant none
// @icon data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAAACXBIWXMAABYlAAAWJQFJUiTwAAAKT2lDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAHjanVNnVFPpFj333vRCS4iAlEtvUhUIIFJCi4AUkSYqIQkQSoghodkVUcERRUUEG8igiAOOjoCMFVEsDIoK2AfkIaKOg6OIisr74Xuja9a89+bN/rXXPues852zzwfACAyWSDNRNYAMqUIeEeCDx8TG4eQuQIEKJHAAEAizZCFz/SMBAPh+PDwrIsAHvgABeNMLCADATZvAMByH/w/qQplcAYCEAcB0kThLCIAUAEB6jkKmAEBGAYCdmCZTAKAEAGDLY2LjAFAtAGAnf+bTAICd+Jl7AQBblCEVAaCRACATZYhEAGg7AKzPVopFAFgwABRmS8Q5ANgtADBJV2ZIALC3AMDOEAuyAAgMADBRiIUpAAR7AGDIIyN4AISZABRG8lc88SuuEOcqAAB4mbI8uSQ5RYFbCC1xB1dXLh4ozkkXKxQ2YQJhmkAuwnmZGTKBNA/g88wAAKCRFRHgg/P9eM4Ors7ONo62Dl8t6r8G/yJiYuP+5c+rcEAAAOF0ftH+LC+zGoA7BoBt/qIl7gRoXgugdfeLZrIPQLUAoOnaV/Nw+H48PEWhkLnZ2eXk5NhKxEJbYcpXff5nwl/AV/1s+X48/Pf14L7iJIEyXYFHBPjgwsz0TKUcz5IJhGLc5o9H/LcL//wd0yLESWK5WCoU41EScY5EmozzMqUiiUKSKcUl0v9k4t8s+wM+3zUAsGo+AXuRLahdYwP2SycQWHT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dp6IawAwu6ZyIjt7ErYkie0HP/nbxIvrfjV7z/uuNNOctHXiAOjMz49/feeKvcV3NTzlLSw66ugJBgClWYHxQ7qG45AVBb1dZ7/X99bOX+Zs3nhV2ZkzRJmk6TUkCGj9iwUd0VUPrp06f8G/edPSNccaOUrkTeT9SPdwHIIgQLMsT9+RxtsSWzb+dtb+/cHsaHRSICcLCtB2x4+/yLjr7jVZOXkfSqKopV6/FUzkPNLeNwxCCIgoIhwKTT31+989mrv15TtmfPFFIHCBEd2iiKalS3u0O1esK6iesSknNz8quVwsBcmfyJn9TM/gyAlREGAyTvv6+2aHdr/124I3Xl9YffIkvBcI0SfJaF248Kz+47ve9V92xWYFOKZ6vBAEYezMXpqdNn5IW+9Q6pcAUYQjiqS9/cwKbdeOh/PeenNWeXsHvIYx7tNiEsBQMIhv6ua1D95ww7bsxUveLSie+nUyocXZ6J1YqrFUFWZfAMjoLbPJGVyKonacOvVAaO+7D+Z/uC+3tKnJlRWNUZEx0PNoAnz0nssUBHRmZjjt8xcMOLfcup1Z1tPBkindmdU1sI3//e6ysiDrwkIIIbAdpygxMFCXaD4x19z/uwfSDh0O5n/TikzThPT/QGIAQmlp6JlWgfg11zZ7r1/8TG71zE9FQWi2bNuyz30PM5kQzhyIkgzDMFxD3d15RIstp6dbq3Hks9li81dzleEw3EPDcGsxUMsCpwS2JMPy+ZAIpkPLKwCfdck7Yl1dq5WX/4Xg87w/tbwqJskurkU1xOPxkfcukw7hDJQKSEYiiIb6ECyvcCdi0Uzt7NkraXj4Rqe3p5B0dsri0CAVTBOcUsdWFOZkZDqsoMDhuXlRIZjxVH5ldZOlxeLhzjaUzpwNlyQhkUhANwxQQi4iJBpFtLcHgfwCxLu74JZlObdqRk5kaCAnOtDvS8Y1CYxxQkiSuFyW5PGa3vSgIblcWm9zU2daQaFtA4gN9KG05pIJQ/57AIaPpwagw0+HAAAAAElFTkSuQmCC
// ==/UserScript==

(function() {
    let funModifications = {
        fatPlayers: false,
        alwaysDashing: false,
    }

    let forcedPremiumEnabled = true
    let zoomHackEnabled = true

    // Fun Modifications

    init(() => {
        Object.keys(funModifications).forEach(e => {
            let value = funModifications[e]
            let propName
            let props

            switch(e) {
                case 'fatPlayers':
                    propName = 'radius'
                    props = {
                        set(value) {
                            this._radius = value + 2.5

                            if(value === 0) {
                                this._radius = 0
                            }
                        },

                        get() {
                            return this._radius
                        }
                    }
                    break
                case 'alwaysDashing':
                    propName = 'dashing'
                    props = {
                        get() {
                            if(this.c2) {
                                return 1
                            }
                        }
                    }
            }

            if(value) {
                Object.defineProperty(Object.prototype, propName, props)
            }
        })
    })

    // Right Click for Spacebar

    init(() => {
        let events = ['down', 'up']

        events.forEach(e => {
            window.addEventListener('mouse' + e, onClick)
        })

        function onClick(e) {
            let list = window.RF.list

            if((e.button === 2 || e.which === 3) && list && list.length) {
                let socket = list[0].socket
                let type = e.type === 'mouseup' ? 0 : 1

                socket.send('k,5,' + type)
            }
        }
    })

    // Ad Block

    init(() => {
        let classes = ['ad', 'ads', 'ad-group', 'ad-placement', 'adsbox', 'ad-unit-container'].map(e => '.' + e)
        let ids = ['adHome', 'adRespawnLeft', 'adRespawnRight', 'adRespawnTop', 'adTopLeft'].map(e => '#' + e)
        let ads = classes.concat(ids)
        let adsCss = ads + '{display:none !important;}'

        let styleNode = document.createElement('style')
        styleNode.appendChild(document.createTextNode(adsCss))
        document.head.appendChild(styleNode)
    })

    // Force Premium

    init(() => {
        if(forcedPremiumEnabled) {
            Object.defineProperty(Object.prototype, 'isPremiumMember', {
                get() {
                    if(this.c2) {
                        return 1
                    }
                }
            })
        }
    })

    // Anti-Landmine (Visible Landmines)

    init(() => {
        Object.defineProperty(Object.prototype, 'pool', {
            set(value) {
                let landMine = window.landMine

                if(landMine) {
                    landMine[0].map(e => {
                        let final = e.concat()
                        final[1][3] = '#000000'
                        return final
                    })
                }

                this._pool = value
            },

            get() {
                return this._pool
            }
        })
    })

    init(() => {
        defineProps([
            // Anti-Camo

            ['ghillie', 0],

            // Anti-Silencer (No Invisible Bullets)

            ['silenced', 0],
        ])
    })

    // Zoom Hack

    init(() => {
        if(zoomHackEnabled) {
            window.addEventListener('wheel', function(e) {
                let reRender = window.a1

                if(reRender) {
                    for (let i = 0; i < 2; i++) {
                        let prop = 'j' + (i === 0 ? 7 : 8)
                        let value = e.deltaY < 0 ? .95 : 1.1

                        window[prop] *= value
                        window[prop] = Math.min(3e3, Math.max(1e3, window[prop]))
                    }

                    reRender()
                }
            })
        }
    })

    function init(fn) {
        try {
            fn()
        } catch(e) {
            let error = new Error('Gats.IO Enchanced: ' + e)
            console.dir(error.message + '\n' + error.stack)
        }
    }

    function defineProps(structure) {
        structure.forEach(e => {
            defineProp(e[0], e[1])
        })
    }

    function defineProp(propName, returnValue) {
        return Object.defineProperty(Object.prototype, propName, {
            get() {
                return returnValue
            }
        })
    }
})()