moomoo.js has a part that changes (the loader) and a part that doesn’t (the runtime). in between them is a small translation layer i call the binding. that split is pretty much the whole point, so it’s worth getting.
the loader runs in the page at document-start, before the game’s own client. it:
window.WebSocket for a Proxy of the real
constructor (see the loader and anti-cheat for the
details).io-init handshake it works out the
same per-connection packet tables and masks the real client uses, then decodes
incoming frames and encodes outgoing ones. it grabs the per-deploy key material
from the page’s moomoo-protocol module the same way the client does, so it
keeps working across redeploys.window.MooMoo and injects the Mods menu.anything that can change when i update the server — packet letters, argument order, key mixing, the telemetry format — lives in here.
window.MooMoo is the API mods call. events, actions, game state, the mod
registry: none of it knows anything about the wire. it’s a fixed thing you can
rely on.health, chat,
spawn, …) and the shape of each one. it doesn’t change.ctx.the binding is one file in the loader:
incoming["O"] = { event: "health", parse: (a) => ({ sid: a[0], value: a[1] }) };
outgoing["chat"] = { wire: "6", build: (d) => [d.message] };
when the server renames O to something else, you change that one line and
rebuild the loader. every mod anyone ever wrote keeps working, because the name
health on the left side never moves.
coming in (server → mod):
frame → [loader] decode → "O" → [binding] → health {sid, value} → [runtime] → on health(...)
going out (mod → server):
send.chat("gg") → [runtime] → chat {message} → [binding] → "6" ["gg"] → [loader] encode → frame
the loader owns the client→server stream. it re-encodes every outgoing frame with its own gap-free sequence number, and that’s what makes it possible for mods to inject packets at all, and what lets the loader scrub the anti-tamper telemetry.
| piece | form | who installs it | changes? |
|---|---|---|---|
| loader | moomoo-loader.user.js |
everyone, once | when the server updates |
| a mod | a tiny userscript that @requires the loader |
per mod | never |
| MooMoo Lite | mods/lite.user.js (built) |
you, once | with the loader |
since every mod @requires the one loader, updating the loader updates every mod
in one go.