Greasy Fork

MooMoo styles

Gastons moomoo script

目前为 2024-06-26 提交的版本。查看 最新版本

// ==UserScript==
// @name MooMoo styles
// @namespace http://tampermonkey.net/
// @version 2.3
// @description Gastons moomoo script
// @author Gaston
// @match *://moomoo.io/*
// @match *://dev.moomoo.io/*
// @match *://sploop.io/*
// @match *://sandbox.moomoo.io/*
// @match *://tjmoomoo.ml/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=moomoo.io

// @grant GM_getValue
// @grant GM_setValue
// @grant GM_addValueChangeListener
// @license MIT
// ==/UserScript==
//YT: https://www.youtube.com/channel/UCOA8lE9-0XnEIdHqjfQUz1A
//Install the minified version here: https://raw.githubusercontent.com/naquangaston/HostedFiles/main/UserScripts/MooMoo%20styles%20.user.js


///⣿⣿⣿⣿⣿⣿⣟⣷⣿⣿⣿⡀⠹⣟⣾⣟⣆⠹⣯⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡇⢠⡘⣿⣿⡄⠉⢿⣿⣽⡷⣿⣻⣿⣿⣿⣿⡝⣷⣯⢿⣿
///⣿⣿⣿⣿⣿⣿⣯⢿⣾⢿⣿⡄⢄⠘⢿⣞⡿⣧⡈⢷⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡇⢸⣧⠘⣿⣷⠈⣦⠙⢿⣽⣷⣻⣽⣿⣿⣿⣿⣌⢿⣯⢿
///⣿⣿⣿⣿⣿⣿⣟⣯⣿⢿⣿⡆⢸⡷⡈⢻⡽⣷⡷⡄⠻⣽⣿⣿⡿⣿⣿⣿⣿⣿⣿⣷⣿⣿⣿⣿⣏⢰⣯⢷⠈⣿⡆⢹⢷⡌⠻⡾⢋⣱⣯⣿⣿⣿⣿⡆⢻⡿
///⣿⣿⣿⣿⣿⣿⡎⣿⢾⡿⣿⡆⢸⣽⢻⣄⠹⣷⣟⣿⣄⠹⣟⣿⣿⣟⣿⣿⣿⣿⣿⣿⣽⣿⣿⣿⡇⢸⣯⣟⣧⠘⣷⠈⡯⠛⢀⡐⢾⣟⣷⣻⣿⣿⣿⡿⡌⢿
///⣿⣿⣿⣿⣿⣿⣧⢸⡿⣟⣿⡇⢸⣯⣟⣮⢧⡈⢿⣞⡿⣦⠘⠏⣹⣿⣽⢿⣿⣿⣿⣿⣯⣿⣿⣿⡇⢸⣿⣿⣾⡆⠹⢀⣠⣾⣟⣷⡈⢿⣞⣯⢿⣿⣿⣿⢷⠘
///⣿⣿⣿⣿⣿⣿⣿⡈⣿⢿⣽⡇⠘⠛⠛⠛⠓⠓⠈⠛⠛⠟⠇⢀⢿⣻⣿⣯⢿⣿⣿⣿⣷⢿⣿⣿⠁⣾⣿⣿⣿⣧⡄⠇⣹⣿⣾⣯⣿⡄⠻⣽⣯⢿⣻⣿⣿⡇
///⣿⣿⣿⣿⣿⣿⣿⡇⢹⣿⡽⡇⢸⣿⣿⣿⣿⣿⣞⣆⠰⣶⣶⡄⢀⢻⡿⣯⣿⡽⣿⣿⣿⢯⣟⡿⢀⣿⣿⣿⣿⣿⣧⠐⣸⣿⣿⣷⣿⣿⣆⠹⣯⣿⣻⣿⣿⣿
///⣿⣿⣿⣿⣿⣿⣿⣿⠘⣯⡿⡇⢸⣿⣿⣿⣿⣿⣿⣿⣧⡈⢿⣳⠘⡄⠻⣿⢾⣽⣟⡿⣿⢯⣿⡇⢸⣿⣿⣿⣿⣿⣿⡀⢾⣿⣿⣿⣿⣿⣿⣆⠹⣾⣷⣻⣿⡿
///⣿⣿⣿⣿⣿⣿⣿⣿⡇⢹⣿⠇⢸⣿⣿⣿⣿⣿⣿⣿⣿⣷⣄⠻⡇⢹⣆⠹⣟⣾⣽⣻⣟⣿⣽⠁⣾⣿⣿⣿⣿⣿⣿⣇⣿⣿⠿⠛⠛⠉⠙⠋⢀⠁⢘⣯⣿⣿
///⣿⣿⣿⣿⣿⣿⣿⣿⣿⡈⣿⡃⢼⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣦⡙⠌⣿⣆⠘⣿⣞⡿⣞⡿⡞⢠⣿⣿⣿⣿⣿⡿⠛⠉⠁⢀⣀⣠⣤⣤⣶⣶⣶⡆⢻⣽⣞⡿
///⣿⣿⣿⣿⣿⣿⣿⣿⡿⠃⠘⠁⠉⠉⠉⠉⠉⠉⠉⠉⠉⠙⠛⠛⢿⣄⢻⣿⣧⠘⢯⣟⡿⣽⠁⣾⣿⣿⣿⣿⣿⡃⢀⢀⠘⠛⠿⢿⣻⣟⣯⣽⣻⣵⡀⢿⣯⣟
///⣿⣿⣿⣟⣿⣿⣿⣿⣶⣶⡆⢀⣿⣾⣿⣾⣷⣿⣶⠿⠚⠉⢀⢀⣤⣿⣷⣿⣿⣷⡈⢿⣻⢃⣼⣿⣿⣿⣿⣻⣿⣿⣿⡶⣦⣤⣄⣀⡀⠉⠛⠛⠷⣯⣳⠈⣾⡽
///⣿⢿⣿⣿⣻⣿⣿⣿⣿⣿⡿⠐⣿⣿⣿⣿⠿⠋⠁⢀⢀⣤⣾⣿⣿⣿⣿⣿⣿⣿⣿⣌⣥⣾⡿⣿⣿⣷⣿⣿⢿⣷⣿⣿⣟⣾⣽⣳⢯⣟⣶⣦⣤⡾⣟⣦⠘⣿
///⣿⣻⣿⣿⡷⣿⣿⣿⣿⣿⡗⣦⠸⡿⠋⠁⢀⢀⣠⣴⢿⣿⣽⣻⢽⣾⣟⣷⣿⣟⣿⣿⣿⣳⠿⣵⣧⣼⣿⣿⣿⣿⣿⣾⣿⣿⣿⣿⣿⣽⣳⣯⣿⣿⣿⣽⢀⢷
///⣿⢷⣻⣿⣿⣷⣻⣿⣿⣿⡷⠛⣁⢀⣀⣤⣶⣿⣛⡿⣿⣮⣽⡻⣿⣮⣽⣻⢯⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣯⢀⢸
///⠸⣟⣯⣿⣿⣷⢿⣽⣿⣿⣷⣿⣷⣆⠹⣿⣶⣯⠿⣿⣶⣟⣻⢿⣷⣽⣻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⢀⣯
///⣇⠹⣟⣾⣻⣿⣿⢾⡽⣿⣿⣿⣿⣿⣆⢹⣶⣿⣻⣷⣯⣟⣿⣿⣽⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⢀⡿
///⣿⣆⠹⣷⡻⣽⣿⣯⢿⣽⣻⣿⣿⣿⣿⣆⢻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠛⢻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠇⢸⣿
///⡙⠾⣆⠹⣿⣦⠛⣿⢯⣷⢿⡽⣿⣿⣿⣿⣆⠻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠃⠎⢸⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠏⢀⣿⣾
///⣿⣷⡌⢦⠙⣿⣿⣌⠻⣽⢯⣿⣽⣻⣿⣿⣿⣧⠩⢻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡏⢰⢣⠘⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⠃⢀⢀⢿⣞
///⣿⣽⣆⠹⣧⠘⣿⣿⡷⣌⠙⢷⣯⡷⣟⣿⣿⣿⣷⡀⡹⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣈⠃⣸⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠟⢀⣴⡧⢀⠸⣿
///⢻⣽⣿⡄⢻⣷⡈⢿⣿⣿⢧⢀⠙⢿⣻⡾⣽⣻⣿⣿⣄⠌⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠛⢁⣰⣾⣟⡿⢀⡄⢿
///⡄⢿⣿⣷⢀⠹⣟⣆⠻⣿⣿⣆⢀⣀⠉⠻⣿⡽⣯⣿⣿⣷⣈⢻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⠋⢀⣠⠘⣯⣷⣿⡟⢀⢆⠸
///⣷⡈⢿⣿⣇⢱⡘⢿⣷⣬⣙⠿⣧⠘⣆⢀⠈⠻⣷⣟⣾⢿⣿⣆⠹⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⠋⣠⡞⢡⣿⢀⣿⣿⣿⠇⡄⢸⡄
///⣿⣷⡈⢿⣿⡆⢣⡀⠙⢾⣟⣿⣿⣷⡈⠂⠘⣦⡈⠿⣯⣿⢾⣿⣆⠙⠻⠿⠿⠿⠿⡿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠿⠛⢋⣠⣾⡟⢠⣿⣿⢀⣿⣿⡟⢠⣿⢈⣧
///⣿⣿⣿⣄⠻⣿⡄⢳⡄⢆⡙⠾⣽⣿⣿⣆⡀⢹⡷⣄⠙⢿⣿⡾⣿⣆⢀⡀⢀⢀⢀⢀⢀⢀⢀⢀⢀⢀⢀⢀⣀⣠⣴⡿⣯⠏⣠⣿⣿⡏⢸⣿⡿⢁⣿⣿⢀⣿
///⣿⣿⣿⣿⣦⡙⣿⣆⢻⡌⢿⣶⢤⣉⣙⣿⣷⡀⠙⠽⠷⠄⠹⣿⣟⣿⣆⢙⣋⣤⣤⣤⣄⣀⢀⢀⢀⢀⣾⣿⣟⡷⣯⡿⢃⣼⣿⣿⣿⠇⣼⡟⣡⣿⣿⣿⢀⡿
///⣿⣿⣿⣿⣿⣷⣮⣿⣿⣿⡌⠁⢤⣤⣤⣤⣬⣭⣴⣶⣶⣶⣆⠈⢻⣿⣿⣆⢻⣿⣿⣿⣿⣿⣿⣷⣶⣤⣌⣉⡘⠛⠻⠶⣿⣿⣿⣿⡟⣰⣫⣴⣿⣿⣿⣿⠄⣷

/*
*/

// OK OK I KNOW ITS OBFUSCATED BUT I CANT FIND THE ORIGANL ONE I MADE PLS DONT BAN ME
const styleUrl='https://raw.githubusercontent.com/naquangaston/HostedFiles/main/moostyle.js'

// a list of bad word
const wordWurl='https://raw.githubusercontent.com/naquangaston/HostedFiles/main/moomooWords.json'

const useChat=false;
var badWords= GM_getValue('moowords')||[]
var reg=new RegExp(`(${[...new Set(badWords.join(' ').match(/[\w\d]+/gi))].join('|')})`,'gi')

const filter1=s=>s.replaceAll(reg,function(a,b,c){return a.length>1?a.split(/[aeiou]+/gi).join('*'):a})
const filter2 = (s) => {
    return s.toLowerCase().split('l').join('w').replaceAll(/l/g,'w').replaceAll(/(l|e)(?!d)/gi, function(match) {
        const block = {
            "l": 'w',
        };
        return block[match[0]] || match;
    }).replace(/s/g, 'z').replace(/th/g, 'd').replace(/e^d/g, function(match, offset, string) {
        // Check if "ee" is already present in the string
        if (string.slice(offset - 1, offset + 1) === 'ee') {
            return 'e';
        }
        return 'e';
    }).replace(/w{2,}/g, 'wl').replaceAll(/e{2,}/gi,'ee').replaceAll(/.r/gi,e=>e.replace('r','w'))
};
const game_= new class{
    #spawnFunction=function(){}
    #testFunction=function(){}
    #autoSpawn=false
    #timeOut=1000
    #sleep=function(ms){return new Promise(a=>setTimeout(a,ms))}
    #int=0
    #stopped=0
    #start_=async function(){
        while(true){
            let a=this.#sleep
            let b=this.#testFunction
            let c=this.#spawnFunction
            await a(0)
            if(this.#stopped)break;
            b()&&(
                await a(this.#timeOut),
                console.log('Spawning into game'),
                c(),await a(this.#timeOut)
            )
        }
        this.#stopped=false
        console.log('Done',this.#stopped)
    }
    set timeOut(n){
        return this.#timeOut=Number.isNaN(n)?1000:Number(n)
    }
    get timeOut(){
        return this.#timeOut
    }
    start(){
        this.#start_()
    }
    stop(){
        this.#stopped=true
    }
    set autoSpawn(b){
        return this.#autoSpawn=!!b
    }
    get autoSpawn(){
        return this.#autoSpawn
    }
    set testFunction(f){
        return this.#testFunction=f
    }
    get testFunction(){
        return this.#testFunction
    }
    set spawnFunc(f){
        return this.#spawnFunction=f
    }
    get spawnFunc(){
        return this.#spawnFunction
    }
}
class bool{
    #status=false
    toggle(){
        this.#status=!this.#status
    }
    get status(){
        return this.#status
    }
    set status(a){
        this.#status=!!a
    }
}
class element {
    static get br() {
        return new element("br");
    }
    constructor(name, obj) {
        //findhref2(id('skin-message'))[0].constructor.name

        this.element = name.constructor.name.includes('HTML')&&(name)||(function () {
            for (let i in arguments[1]) {
                arguments[0].setAttribute(i, arguments[1][i]);
            }
            return arguments[0];
        })(document.createElement(arguments[0]), arguments[1]);
    }
    style(obj) {
        for (let i in obj) {
            this.element.style[i] = obj[i];
        }
        return this;
    }
    append(target,...targets) {
        this.element.append(target.element || target);
        console.log("T:",{targets,fe:targets&&targets.forEach})
        for(let i=0;i<targets.length;i++){
            let a=targets[i];
            console.log('Appending:',{element:a,target:this})
            this.element.append(a.element || a);
        }
        return this;
    }
    appendTo(target) {
        try{(target.element || typeof target=='string'?document.querySelector(target):target).append(this.element);}
        catch{
            (target.element||target).append(this.element)
        }
        finally{
            console.warn('Failed to appent',{this:this,target})
        }
        return this;
    }
    on(event, a) {
        this.element[`on${event}`] = a;
        return this;
    }
    set(prop, value) {
        this.element[prop] = value;
        return this;
    }
    remove() {
        this.element.remove();
        return this;
    }
    get() {
        return this.element[arguments[0]];
    }
    get children() {
        return new (class $ {
            constructor(arr) {
                for (var i = 0; i < arr.length; i += 1) {
                    this[i] = arr[i];
                }

                // length is readonly
                Object.defineProperty(this, "length", {
                    get: function () {
                        return arr.length;
                    }
                });

                // a HTMLCollection is immutable
                Object.freeze(this);
            }
            item(i) {
                return this[i] != null ? this[i] : null;
            }
            namedItem(name) {
                for (var i = 0; i < this.length; i += 1) {
                    if (this[i].id === name || this[i].name === name) {
                        return this[i];
                    }
                }
                return null;
            }
            get toArray() {
                return [...this];
            }
        })([...this.element.children]);
    }
}
const alt=name.includes('alt')
function isHidden(el) {
    return (el.offsetParent === null)
}
function random(arr){return arr[Math.floor(Math.random() * arr.length)];}
function dispatchAllMouseEvents(target) {
    const mouseEvents = ['click','mouseover', 'mouseenter', 'mousemove', 'mousedown', 'mouseup', 'mouseout', 'mouseleave'];

    mouseEvents.forEach(eventName => {
        let ev=new Event(eventName, { bubbles: true, isTrusted: true })
        if(target[`on${eventName}`])target[`on${eventName}`](ev);
        target.dispatchEvent(ev);
    });
}
function dispatchAllInputEvents(target, value) {
    const inputEvents = ['focus', 'input', 'change', 'blur'];

    inputEvents.forEach(eventName => {
        let ev=new Event(eventName, { bubbles: true, isTrusted: true })
        if(target[`on${eventName}`])target[`on${eventName}`](ev)

        if (eventName === 'input') {
            target.value = value;
        }
        target.dispatchEvent(ev);
    });
}

var _setUp=false
findhref2=function (a,b){
    var res=[];

    function part2(e){
        if(e.tagName.toLowerCase()==(b||'a')){
            res.push(e);
            if(e.children.length){
                e=e.children;
                e.forEach=[].forEach;
                e.forEach(e2=>{
                    part2(e2);
                })
            }
        }else{
            if(e.children.length){
                e=e.children;
                e.forEach=[].forEach;
                e.forEach(e2=>{
                    part2(e2);
                })
            }
        }
    };
    part2(a);
    return res
}

function add_Style(f){
    var[uc,j,p,w]=["\u0063\u0072\u0065\u0061\u0074\u0065\u0045\u006c\u0065\u006d\u0065\u006e\u0074","\u0074\u0065\u0078\u0074\u0043\u006f\u006e\u0074\u0065\u006e\u0074","\u0068\u0065\u0061\u0064","\u0061\u0070\u0070\u0065\u006e\u0064\u0043\u0068\u0069\u006c\u0064"],
        yd={get k(){return document}}
    var d=yd["k"][uc]("style")
    d[j]=f
    yd["k"][p][w](d)
}
function SetUpSploop(){
    const hats={update(){
        [...document.getElementsByClassName('menu-item')].map(e=>({name:e.className,e})).filter(e=>e.name=="menu-item").map(e=>(e.button=findhref2(e.e,'button')[0],e.canBuy=findhref2(e.e,'button')[0].innerText=='BUY',e)).forEach(e=>{
            var n=e.e.children[1].children[0].innerText.split(' ').join('')
            e.bn=findhref2(e.e,'button')[0].innerText;
            e.equiped=e.bn=='UNEQUIP'
            e.buy=function(){
                hats[n].e.scrollIntoView()
                hats.update();
                if(!hats[n].canBuy)return;
                hats[n].button.onmouseup({target:hats[n].button,isTrusted:true})
                hats.update()
            }
            e.equip=function(){
                hats[n].e.scrollIntoView()
                hats.update()
                if(e.equiped)return;
                if(hats[n].canBuy)hats[n].buy();
                hats[n].button.onmouseup({target:hats[n].button,isTrusted:true})
                hats.update()
            }
            hats[n]=e
        })
    }}
    _hats=hats
    const chatFilter=new bool
    const lolFilter=new bool
    const filterF=({target})=>{!chatFilter.status?null:target.value=filter1(target.value)}
    const filterA=({target})=>{!lolFilter.status?null:target.value=filter2(target.value)}
    function copyElm(element) {
        if (!(element instanceof Element)) {
            throw new Error("Provided argument is not a DOM element.");
        }

        // Create a new element of the same type
        const newElement = document.createElement(element.tagName);

        // Copy all attributes
        for (let attr of element.attributes) {
            newElement.setAttribute(attr.name, attr.value);
        }

        // Copy all styles
        newElement.style.cssText = element.style.cssText;

        // Copy class list
        newElement.className = element.className;

        // Copy inner HTML content
        newElement.innerHTML = element.innerHTML;

        return newElement;
    }

    wfs('#chat').then(e => {
        const chat = document.getElementById('chat');
        var c = copyElm(chat);
        function handleChatInput(event) {
            // Log when Enter key is pressed
            if (event.key === 'Enter') {
                console.log('Enter key pressed in chat');
                chat.focus();
                chat.value=c.value;
                const newEvent = new KeyboardEvent(event.type, event);
                chat.dispatchEvent(newEvent);
            }
        }
        c.id = 'chat2';
        chat.parentNode.append(document.createElement('br'));
        chat.parentNode.append(c);

        chat.onfocus = function (e) {
            if(useChat){
                c.focus();
                chat.parentElement.style.display = 'block';
                c.focus();
            }
            //c.focus();
            //chat.parentElement.style.display = 'block';
            //c.focus();
        };

        let onkeyupOld = window.onkeyup;
        let onkeydownOld = window.onkeydown;

        window.onkeyup = function (event) {
            if (chat === document.activeElement || c === document.activeElement) {
                // Chat is focused, do nothing
                return;
            }
            if (onkeyupOld) {
                onkeyupOld(event);
            }
        };

        window.onkeydown = function (event) {
            if (chat === document.activeElement || c === document.activeElement) {
                // Chat is focused, do nothing
                return;
            }
            if (onkeydownOld) {
                onkeydownOld(event);
            }
        };


        function isLetterOrNumberKey(key) {
            return /^[a-zA-Z0-9]$/.test(key);
        }

        // Add event listener to handle chat input
        c.addEventListener('keypress', ({ target, key }) => {
            if (isLetterOrNumberKey(key)) {
                chat.value = target.value;
                [filterF].forEach(f => f({ target }));
            }
            handleChatInput(event);
        });

        ;(useChat?c:chat).addEventListener('keyup', (e) => {
            const { target, key, code } = e;
            console.log(e);
            let i = true; // code != 'KeyL'
            chat.value = target.value;
            isLetterOrNumberKey(key) && i && ([filterF, filterA].forEach(f => f({ target: chat })));
        });

        ;(useChat?c:chat).addEventListener('keydown', ({ target, key }) => {
            if (isLetterOrNumberKey(key)) {
                chat.value = target.value;
                [filterF].forEach(f => f({ target: chat }));
            }
        });
    }).then(console.log,console.warn)

    function isLetterOrNumberKey(key) {
        return /^[0-9a-zA-Z]$/.test(key)&&key.length==1
    }

    if(alt){
        if(typeof GM_getValue('alts')=='number'){GM_setValue('alts',{})}
        var ThisAlt
        for(let i=1;true;i++){
            if(!GM_getValue('alts')[i]){
                ThisAlt=i
                let o=GM_getValue('alts')
                o[i]=true
                GM_setValue('alts',o)
                break;
            }
        }
        console.log('alt:',ThisAlt)
        addEventListener('unload',function(){
            if(alt){
                let o=GM_getValue('alts')
                o[ThisAlt]=false;
                GM_setValue('alts',o)
            }
        })
    }
    console.log('Set called',SetUpSploop.calle)
    var localFit=null
    function loadFit(a=0,b=0,c=0){
        skinIndex(0)
        try{!Number.isNaN(a)&&(findhref2(id('skins-middle-main'),'img').filter(e=>e.src.includes(`skin${a}`))[0].click());}catch(err){
            console.warn('Failed to Skin',a)
        }
        skinIndex(1)
        try{!Number.isNaN(b)&&(findhref2(id('skins-middle-main'),'img').filter(e=>e.src.includes(`accessory${b}`))[0].click());}catch(err){
            console.warn('Failed to accessory$',a)
        }
        skinIndex(2)
        !Number.isNaN(c)&&(findhref2(id('skins-middle-main'),'img').filter(e=>e.src.includes(`back${c}`))[0].click());
        skinIndex(0)
    }
    _loadFit=loadFit
    _GM_setValue=GM_setValue
    _GM_getValue=GM_getValue
    function skinIndex(index){
        findhref2(id('skins-categories'),'img')[index].click()
    }
    new Promise((a,b)=>(b=setInterval(()=>(findhref2(id('skins-middle-main'),'img').length&&(clearInterval(b),a())),100))).then(async e=>{
        await sleep(1000)
        if(!alt){
            loadFit(GM_getValue('skin'),GM_getValue('accessory$'),GM_getValue('BACK'))
        }
    })
    id('game-left-content-main').style.overflow='scroll'
    id('da-right').parentNode.style.overflow='scroll'
    if(_setUp)return;
    var css_=`
#log{
    background-color: rgba(0,0,0,0);
    color: lightgreen;
}
.empty{
    content: attr(value);
}
select,select:focus{
    background-color: rgba(0,0,0,0);
    outline: none;
    border: none;
    color: rgb(255, 136, 0);
}
button{
    background-color: rgba(0,0,0,0);
    outline: none;
    border: 2px solid rgb(208, 255, 0);
    color: rgb(94, 255, 0);
}
button:hover,input:focus{
    background-color: rgba(0,0,0,0);
    outline: none;
    border: 2px solid rgb(255, 0, 0);
    color: rgb(0, 132, 255);
}
#skin-message{
	border: 2px solid red;
    background-color: rgba(0,0,0,0);
}
.green{border: 2px solid green;}
.red{border: 2px solid blue;}
::-webkit-scrollbar{
    display:none;
}
span.first{
    border-top: 1px solid white;
    border-bottom: 1px solid white;
    border-left: 1px solid white;
}
span.middle{
    border-top: 1px solid white;
    border-bottom: 1px solid white;
}
span.last{
    border-top: 1px solid white;
    border-bottom: 1px solid white;
    border-right: 1px solid white;
}
del{
    text-decoration: line-through;
    color: red;
    border-radius: 3px;
    border: 1px solid coral;
    background-color: rgba(111,8,8,1);
}
ins{
    background-color: rgba(7,92,7,1);
    color: rgba(56,233,56,1);
    border-radius: 3px;
    border: 1px solid lightgreen;
}
textarea{
    text-overflow: clip;

}`
    add_Style(css_)
    const AntiKickTOggle=new bool
    const StreamerMode=new bool
    GM_getValue('sm')&&(StreamerMode.toggle())
    let clans=id('clan-menu')
    game_.autoSpawn=true
    game_.timeOut=5000
    game_.testFunction=function(){
        return !isHidden(play)
    }
    game_.spawnFunc=function(){
        if(alt){
            dispatchAllInputEvents(nickname,`alt:${ThisAlt} - ${GM_getValue('nn')}`)
            randomFit.element.click()
            const{skin,back,accessory}=localStorage
            localFit={skin,back,accessory}
            console.log('Got fit',localFit)
        }else{
            const{skin,back,accessory}=localFit
            loadFit(skin,accessory,back)
        }
        play.click()
        setTimeout(resetSkin,200)
    }
    var sleep=(ms)=>new Promise(a=>setTimeout(a,ms));
    async function wfs(s, timeout = 3000) {
        return await new Promise((resolve, reject) => {
            let startTime = performance.now();
            function checkSelector() {
                if (document.querySelector(s)) {
                    resolve(document.querySelector(s));
                } else if (performance.now() - startTime >= timeout) {
                    reject(new Error("Timeout waiting for selector"));
                } else {
                    requestAnimationFrame(checkSelector);
                }
            }
            checkSelector();
        });
    }

    function resetSkin(){
        dispatchAllInputEvents(nickname,GM_getValue('nn'))
        skinIndex(0)
        //await sleep(100)
        !Number.isNaN(GM_getValue('skin'))&&(findhref2(id('skins-middle-main'),'img').filter(e=>e.src.includes(`skin${GM_getValue('skin')}`))[0].click());
        //await sleep(100)
        skinIndex(1)
        //await sleep(200)
        !Number.isNaN(GM_getValue('accessory'))&&(findhref2(id('skins-middle-main'),'img').filter(e=>e.src.includes(`accessory${GM_getValue('accessory')}`))[0].click());
        //await sleep(100)
        skinIndex(2)
        //await sleep(200)
        !Number.isNaN(GM_getValue('back'))&&(findhref2(id('skins-middle-main'),'img').filter(e=>e.src.includes(`back${GM_getValue('back')}`))[0].click());
        //await sleep(100)
        skinIndex(0)
    }
    _game_=game_
    _setUp=true
    let parent=id('game-left-content-main')
    let ad_spots=["#game-bottom-content",'#game-right-content-main']

    !function(){
        var[o,k,z,d,f,j]=["\u006d\u0061\u0070","\u0066\u006f\u0072\u0045\u0061\u0063\u0068","\u006c\u006f\u0067","\u006c\u0065\u006e\u0067\u0074\u0068","\u0063\u0068\u0069\u006c\u0064\u0072\u0065\u006e","\u0072\u0065\u006d\u006f\u0076\u0065"],hu={get sn(){return console}};ad_spots[o]($)[k](s=>{hu["sn"][z]({s});s[d]&&([...s[0][f]][k](x=>x[j]()))})
    }()
    var mainAd=id('da-right')
    // Create script description element
    const scriptDescription = new element('div').style({ padding: '10px', backgroundColor: 'rgba(0, 0, 0, 0)', color: '#000', border: '1px solid #ddd', marginBottom: '10px' }).append(
        new element('h2').set('innerText', 'MooMoo/Sploop styles')
    ).append(
        new element('p').set('innerText', 'This script can:')
    )  .append(
        new element('ul')
        .append(new element('li').set('innerText', 'Change the game\'s look'))
        .append(new element('li').set('innerText', 'Add a built-in YouTube embed video player'))
        .append(new element('li').set('innerText', 'Include a random fit generator button'))
        .append(new element('li').set('innerText', 'Implement anti-kick functionality from being AFK'))
        .append(new element('li').set('innerText', 'Create alts'))
        .append(new element('li').set('innerText', 'Automatically join the game and turn on antikick for alts'))
        .append(new element('li').set('innerText', 'Hat keybinds that are saved locally!'))
    );

    // Append script description to the mainAd parent node
    scriptDescription.appendTo(mainAd);

    // Create disclaimer element with click-to-hide functionality
    const disclaimer = new element('div')
    .style({ padding: '10px', backgroundColor: '#f8d7da', color: '#721c24', border: '1px solid #f5c6cb', borderRadius: '5px', cursor: 'pointer' })
    .set('innerText', 'Using this script may have consequences, including but not limited to account banning. Use at your own risk. Click to hide.')
    .on('click', function () {
        this.remove();
        localStorage.seen=1
    }).appendTo("#game-bottom-content")
    if(localStorage.seen==1)disclaimer.element.remove();

    id('lostworld-io_300x250_2').remove()
    new element('br').appendTo(parent)
    var userName
    async function tsm(){
        await wfs('#player-container')
        var s=id('player-container')
        s.style.display='none'
        if(StreamerMode.status){
            !userName&&(
                userName=(await wfs('#nickname-value')).innerText
            );
            (await wfs('#nickname-value')).innerText='streamerMode';
            (await wfs('#change-username')).style.display='none';
        }else if(userName){
            (await wfs('#nickname-value')).innerText=userName;
            (await wfs('#change-username')).style.display='block';
        }
        s.style.display='flex'
    }
    ! async function (){
        for(;;)(await sleep(0),await tsm())
    }()
    const menu = new element('div',{id:"keybinds"}).style({
        display: 'flex',
        flexDirection: 'column',
        alignItems: 'center'
    }).appendTo(parent);
    var AntiKickButton=new element('button').set('innerText','AntiKick:false').on('click',function(e){AntiKickTOggle.toggle();e.target.innerText=`AntiKick:${AntiKickTOggle.status}`;AntiKickTOggle.status?game_.start():game_.stop()}).appendTo(menu)
    new element('br').appendTo(menu)
    var chatFilterButton=new element('button').set('innerText','chatFilter:false').on('click',function(e){chatFilter.toggle();e.target.innerText=`chatFilter:${chatFilter.status}`;}).appendTo(menu)
    new element('br').appendTo(menu)
    var chatFilterButton2=new element('button').set('innerText','lolFilter:false').on('click',function(e){lolFilter.toggle();e.target.innerText=`lolFilter:${lolFilter.status}`;}).appendTo(menu)
    new element('br').appendTo(menu)
    var StreamerModeToggle=new element('button').set('innerText',`StreamerMode:${StreamerMode.status}`).on('click',function(e){
        StreamerMode.toggle();e.target.innerText=`StreamerMode:${StreamerMode.status}`;
        GM_setValue('sm',StreamerMode.status)
        tsm()
    }).appendTo(menu)
    new element('br').appendTo(menu)
    var SpawnAlt=new element('button').set('innerText','SpawnAlt').on('click',function(e){
        GM_setValue('skin',localStorage.skin||0)
        GM_setValue('accessory',localStorage.accessory||0)
        GM_setValue('back',localStorage.back||0)

        GM_setValue('server',id('server-select').selectedOptions[0].getAttribute('region'))
        GM_setValue('gm',[id('ffa-mode'),id('sandbox-mode'),id('event-mode')].map(e=>[...e.classList].includes('dark-blue-button-3-active')).indexOf(true))
        var create = id('create_clan');
        var leave = id('leave_clan');
        var clanName = id('clan-menu-clan-name-input');
        var inclan = create.style.display == 'none';
        if (!inclan) {
            var createButton = id('create-clan-button');
            var clanNameInput = id('clan-menu-clan-name-input');

            // Dispatch various events on the clan name input element
            clanNameInput.dispatchEvent(new Event('focus', { bubbles: true }));
            clanNameInput.dispatchEvent(new Event('input', { bubbles: true }));
            clanNameInput.dispatchEvent(new Event('change', { bubbles: true }));
            clanNameInput.value = 'Alts';  // Set the value of the input
            clanNameInput.dispatchEvent(new Event('blur', { bubbles: true }));

            // Click the create button
            createButton.click();
            createButton.dispatchEvent(new Event('click'));
            new Promise(a=>{
                var int=setInterval(()=>{
                    if(clans.children[0].innerText!="Clans")(clearInterval(int),a())
                },200)
                }).then(a=>{
                _GM_setValue('clan',clans.children[0].innerText)
            })
        }
        open(location.href,'alt'+Date.now())

    }).appendTo(menu)
    new element('br').appendTo(menu)
    var discordJoinButton=new element(findhref2(id('skin-message'))[0])

    randomFit=new element('button').appendTo(menu).on('click',function(e){var[v,k]=["\u0066\u006f\u0072\u0045\u0061\u0063\u0068","\u0063\u006c\u0069\u0063\u006b"];findhref2(id('skins-categories'),'img')[v]((g,f)=>{g[k]();random(findhref2(id('skins-middle-main'),'img'))[k]()})}).set('innerText','Generate Random Fit')
    new element('br').appendTo(menu)




    !function(){var [j,e,u,l,n,i]=["\u0063\u0068\u0069\u006c\u0064\u0072\u0065\u006e","\u0069\u006e\u0073\u0065\u0072\u0074\u0041\u0064\u006a\u0061\u0063\u0065\u006e\u0074\u0045\u006c\u0065\u006d\u0065\u006e\u0074","\u0073\u0074\u0079\u006c\u0065","\u006f\u006e","\u0073\u0065\u0074","\u0065\u006c\u0065\u006d\u0065\u006e\u0074"];id('skin-message')[j][1][e]('afterend',new element('button',{class:"button-type-1 blue-discord-button text-shadowed-3",})[u]({height:"15%",position:"absolute",top:"15%"})[l]('click',function(m){var[v,k]=["\u0066\u006f\u0072\u0045\u0061\u0063\u0068","\u0063\u006c\u0069\u0063\u006b"];findhref2(id('skins-categories'),'img')[v]((q,s)=>{q[k]();random(findhref2(id('skins-middle-main'),'img'))[k]()})})[n]('innerText','Generate Random Fit')[i])}()

    ! function() {
        var [g, w, p, h, k, v] = ["\u0063\u0068\u0069\u006c\u0064\u0072\u0065\u006e", "\u0069\u006e\u0073\u0065\u0072\u0074\u0041\u0064\u006a\u0061\u0063\u0065\u006e\u0074\u0045\u006c\u0065\u006d\u0065\u006e\u0074", "\u0073\u0074\u0079\u006c\u0065", "\u006f\u006e", "\u0073\u0065\u0074", "\u0065\u006c\u0065\u006d\u0065\u006e\u0074"];
        id('skin-message')[g][1][w]('afterend', new element('button', {
            class: "button-type-1 blue-discord-button text-shadowed-3",id:"reset-button"
        })[p]({
            height: "15%",
            left: "8%",
            position: "absolute"
        })[h]('click', function(a) {
            resetSkin()
        })[k]('innerText', 'Reset Fit')[v])
    }()
    ! function() {
        var [g, w, p, h, k, v] = ["\u0063\u0068\u0069\u006c\u0064\u0072\u0065\u006e", "\u0069\u006e\u0073\u0065\u0072\u0074\u0041\u0064\u006a\u0061\u0063\u0065\u006e\u0074\u0045\u006c\u0065\u006d\u0065\u006e\u0074", "\u0073\u0074\u0079\u006c\u0065", "\u006f\u006e", "\u0073\u0065\u0074", "\u0065\u006c\u0065\u006d\u0065\u006e\u0074"];
        id('skin-message')[g][1][w]('afterend', new element('button', {
            class: "button-type-1 blue-discord-button text-shadowed-3",
        })[p]({
            height: "15%",
            left: "50%",
            position: "absolute"
        })[h]('click', function(a) {
            const{skin,back,accessory}=localStorage
            localFit={skin,back,accessory}
            GM_setValue('skin',localStorage.skin||0)
            GM_setValue('accessory',localStorage.accessory||0)
            GM_setValue('back',localStorage.back||0)
        })[k]('innerText', 'Save Fit')[v])
    }()


    addEventListener('unload',function(){
        GM_setValue('keybinds',keybinds)
        if(GM_getValue('skin')){
            localStorage.skin=GM_getValue('skin')
        }
        if(GM_getValue('accessory')){
            localStorage.accessory=GM_getValue('accessory')
        }
        if(GM_getValue('back')){
            localStorage.accessory=GM_getValue('accessory')
        }
    })
    if(alt){
        let server=GM_getValue('server')
        var s=id('server-select')
        new Promise(a=>{
            var int=setInterval(()=>{
                if(id('small-waiting').style.display=='none')(clearInterval(int),a())
            },200)
            }).then(a=>{
            ;[id('ffa-mode'),id('sandbox-mode'),id('event-mode')][GM_getValue('gm')].click()
            new Promise(a=>{
                var int=setInterval(()=>{
                    if(id('small-waiting').style.display=='none')(clearInterval(int),a())
                },200)
                }).then(e=>{
                let index = s.selectedIndex=[...id('server-select').options].map(e=>e.getAttribute('region')).indexOf(server)
                s.dispatchEvent(new Event('click'));

                // Simulate a change event
                s.selectedIndex = index;
                s.dispatchEvent(new Event('change'));
                AntiKickButton.element.dispatchEvent(new Event('click'));
                new Promise(a=>{
                    var int=setInterval(()=>{
                        if(document.querySelector(sploopMenu).style.display!="flex")(clearInterval(int),a(id('clan-menu')))
                    },200)
                    }).then(j=>{
                    j.style.display='block'
                    let clanName=GM_getValue('clan')
                    let clan=[...id('clan_menu_content').children].filter(e=>e.getElementsByTagName('p')[0].innerText==_GM_getValue('clan'))
                    let clan2=(_GM_getValue('clan_')&&_GM_getValue('clan_').name,[...id('clan_menu_content').children].filter(e=>e.getElementsByTagName('p')[0].innerText==_GM_getValue('clan_').name))
                    if(clan.length){
                        let joinButton=clan[0].children[1].children[0]
                        joinButton.onmouseup({ bubbles: true, isTrusted: true })
                    }else if(clan2.length){
                        let joinButton=clan2[0].children[1].children[0]
                        joinButton.onmouseup({ bubbles: true, isTrusted: true })
                    }else{
                        console.warn('Cant find clan',clanName,'Or',(_GM_getValue('clan_')?_GM_getValue('clan_').name:null))
                    }
                    let c=(ms)=>new Promise(a=>setTimeout(a,ms))
                    async function leaveClan(){
                        dispatchAllMouseEvents(id('leave-clan-button'))
                        while(id('create_clan').style.display!='block'){
                            await c(100)
                        }
                        return true
                    }
                    GM_addValueChangeListener('clan_',function(a,b,c){
                        console.log({c,SelfClan:id('create_clan').style.display!='block'},)
                        if(c.inCLan){
                            if(id('create_clan').style.display!='block'){
                                console.log('Leaving Existing clan')
                                leaveClan().then(async e=>{
                                    while(id('create_clan').style.display=='block'){
                                        let clan=[...id('clan_menu_content').children].filter(e=>e.getElementsByTagName('p')[0].innerText==c.name)
                                        let joinButton=clan[0].children[1].children[0]
                                        joinButton.onmouseup({ bubbles: true, isTrusted: true })
                                        await c(100)
                                    }
                                })
                            }else{
                                console.log('Joining newCLan')
                                ;(async e=>{
                                    while(id('create_clan').style.display=='block'){
                                        let clan=[...id('clan_menu_content').children].filter(e=>e.getElementsByTagName('p')[0].innerText==c.name)
                                        let joinButton=clan[0].children[1].children[0]
                                        joinButton.onmouseup({ bubbles: true, isTrusted: true })
                                        await c(100)
                                    }
                                })()
                            }
                        }
                    })
                })
            })
        })
        id('play').addEventListener('click',function name(params) {
            const{nickname,skin,back,accessory}=localStorage
            !loadFit&&(localFit={skin,back,accessory},console.log('Saved LocalFit'))
            })
        document.title='Sploop.io - Fast Alt'
    }else{
        id('play').addEventListener('click',function name(params) {
            const{nickname,skin,back,accessory}=localStorage
            GM_setValue('skin',localStorage.skin||0)
            GM_setValue('accessory',localStorage.accessory||0)
            GM_setValue('back',localStorage.back||0)
            GM_setValue('nn',localStorage.nickname)
        })
        var oldText=''
        _loop=setInterval(()=>{

            clans.children[0].innerText!=oldText&&(oldText=clans.children[0].innerText,GM_setValue('clan_',{
                inCLan:id('create_clan').style.display!='block',
                name:clans.children[0].innerText
            }))

        })
        document.title='Sploop.io - Fast Main'
        var percentSpeed=50
        setTimeout(()=>{
            id('nav-skins').click()
            setTimeout(()=>{
                id('reset-button').click();
                setTimeout(()=>{
                    //id('nav-game').click()
                    setTimeout(()=>{
                        //id('nav-skins').click()
                        setTimeout(()=>{
                            id('reset-button').click();id('reset-button').click();
                            setTimeout(()=>{
                                id('nav-game').click();
                                id('reset-button').click()

                                hats.update()
                                const hats_  = Object.keys(hats).splice(1);

                                 keybinds = GM_getValue('keybinds')||{}; // Object to store keybinds for each hat

                                hats_.forEach(hat => {
                                    const textElement = new element('span').set('innerText', `Hat ${hat} Key: `)

                                    const input = new element('input',{maxLength:8,id:`${hat}_key`}).set('type', 'text').set('value', '').on('keydown', function(e) {
                                        e.preventDefault();
                                        // Set the input value to the key code of the key that was pressed
                                        this.value = e.code;
                                        // Set the keybind for the hat to the key code
                                        keybinds[hat] = e.code;
                                    })
                                    input.element.value=keybinds[hat]||'Add key'
                                    menu.append(textElement,input)
                                    input.on('blur', function() {
                                        const key = this.value.toLowerCase();
                                        if (key) {
                                            //keybinds[hat] = key;
                                            console.log(`Keybind set for ${hat}: ${key}`);
                                        }
                                    });
                                });

                                // Event listener to handle key presses
                                document.addEventListener('keydown', function(e) {
                                    const key = e.code;
                                    // Check if the pressed key is a keybind for any hat

                                    hats_.forEach(hat => {
                                        if (keybinds[hat] && keybinds[hat] === key) {
                                            // Handle hat equipping logic here
                                            console.log(`Equipping ${hat} with key: ${key}`);
                                            hats[hat].equip()
                                        }
                                    });
                                });


                            },500*(percentSpeed/100))
                        },500*(percentSpeed/100))
                    },500*(percentSpeed/100))
                },500*(percentSpeed/100))
            },500*(percentSpeed/100))
        },1000*(percentSpeed/100))

    }

}
const localStorage_={
    getItem(a){
        return GM_getValue(a)
    },
    setItem(a,b){
        GM_setValue(a,b)
        GM_setValue("LC",this)
        return this.getItem(a)
    }

}

window.once=window.on;
let moomooMenu='#mainMenu'
let sploopMenu='#homepage'
document.addEventListener('keydown', function (e) {
    if (e.key === "`") {
        if($(moomooMenu)&&$(moomooMenu).toggle){$(moomooMenu).toggle();console.log('Toggled MooMoo')}
        if($(sploopMenu)&&$(sploopMenu).toggle){
            document.querySelector(sploopMenu).style.display=document.querySelector(sploopMenu).style.display=="none"?"flex":"none"
            console.log('Toggled Sploop')
        }
    };
}); //spectator mode!
$("#consentBlock").css({display: "none"});
//$("#youtuberOf").css({display: "none"});
$("#mapDisplay").css({background: `url('https://i.imgur.com/fgFsQJp.png')`});
var [info2,myPlayer]=[window.info2||{},window.myPlayer||[]]
window.selects=window.selects||[]
function pingcheck(){
    if(location.href.includes('sploop'))return;
    var ping2=document.createElement('h1');ping2.id='Ping2';topInfoHolder.append(ping2);setInterval(()=>{
        ping2.innerText=pingDisplay.innerText+`DPS:${window.dps} Dir:${myPlayer.dir}`
        pingDisplay.innerText.split(' ')[1].split(' m')[0]*1>window.pchek&&(chat(`Ping:${pingDisplay.innerText.split(' ')[1].split(' m')[0]}`))
    },500)
    window.ping=100;
    setInterval(()=>{
        ping=pingDisplay.innerText.split(' ')[1].split(' m')[0]*1
        ping>window.pchek&&(chat(`Ping:${pingDisplay.innerText.split(' ')[1].split(' m')[0]}`))
    },500);ab=1;i2=80;setInterval(()=>{ping>pckech&&(chat(`ping:${ping}`))},500)
    window.pckech=150
}

var code_=GM_getValue('styles.js')
var excuted=false
if(GM_getValue('styles.js')){eval(code_);excuted=true;}
console.log('Checking for styles updates')
fetch(styleUrl).then(e=>e.text()).then(e=>(GM_setValue('styles.js',e),e!=code_&&(console.log('Styles.js as updated')),!excuted&&(eval(e))))

fetch(wordWurl).then(e=>e.json()).then(e=>(GM_setValue('moowords',e),e.join()!=badWords.join()&&(console.log('Filtered List updated')),e)).then(e=>(badWords=e,reg=new RegExp(`(${[...new Set(badWords.join(' ').match(/[\w\d]+/gi))].join('|')})`,'gi')));