MooMoo Warrior (better moomoo.io with no hacks whatsoever)

Play MooMoo Warrior: A thrilling 2D survival game. Join fast-paced multiplayer battles and dominate the server!

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         MooMoo Warrior (better moomoo.io with no hacks whatsoever)
// @version      1
// @description  Play MooMoo Warrior: A thrilling 2D survival game. Join fast-paced multiplayer battles and dominate the server!
// @author       ENERGIZER
// @match        *://*.moomoo.io/*
// @grant        unsafeWindow
// @run-at       document-start
// @namespace https://greasyfork.org/users/1367183
// ==/UserScript==

;(async () => {
	unsafeWindow.stop()

	const LINK = "https://kookywarrior.github.io/moomoowarrior-sources"
	let customHTML = ""

	try {
		const response = await fetch(`${LINK}/game.html`)
		customHTML = await response.text()
		customHTML = customHTML.replaceAll(`href="./`, `href="${LINK}/`)
		customHTML = customHTML.replace(`src/js/loader.js`, `${LINK}/src/js/build.js`)
	} catch (error) {
		console.error(error)
		return
	}

	try {
		const response = await fetch(`${LINK}/config.json`)
		unsafeWindow.config = await response.json()
	} catch (error) {
		console.error(error)
		return
	}

	try {
		const response = await fetch(`${LINK}/info.json`)
		unsafeWindow.info = await response.json()
	} catch (error) {
		console.error(error)
		return
	}

	document.documentElement.innerHTML = customHTML

	const styles = document.querySelectorAll("link[rel=stylesheet]")
	Array.from(styles).forEach(async (style) => {
		style.remove()

		const newStyle = document.createElement("style")
		try {
			const response = await fetch(style.href)
			newStyle.innerHTML = await response.text()
			newStyle.innerHTML = newStyle.innerHTML.replaceAll(`url(../..`, `url(${LINK}`)
		} catch (error) {
			console.error(error)
			return
		}
		document.body.appendChild(newStyle)
	})

	const scripts = document.getElementsByTagName("script")
	Array.from(scripts).forEach(async (script) => {
		if (script.src == "") return
		script.remove()

		const newScript = document.createElement("script")
		try {
			const response = await fetch(script.src)
			newScript.innerHTML = await response.text()
		} catch (error) {
			console.error(error)
			return
		}
		document.body.appendChild(newScript)
	})
})()