A userscript that sends the MahjongSoul 4-player game you're watching to NAGA (https://naga.dmv.nico/) for AI analysis — entirely in your browser.
Open a replay, press s, done.
- Install Tampermonkey.
- Install the userscript (Tampermonkey opens an install page; it auto-updates from the repo afterwards).
- Stay logged in to NAGA (https://naga.dmv.nico/) in the same browser.
- In MahjongSoul, open a 4-player replay.
- Press
s.
The script captures the game, converts it, splits it into rounds, and POSTs it to
NAGA's custom analysis. A toast shows progress; the finished report shows up in
your NAGA reports. The first time, Tampermonkey will ask to allow a connection to
naga.dmv.nico — allow it.
Edit PLAYER_TYPES near the top of the script. Model ids:
0=オメガ 1=ガンマ 2=ニシキ 3=ヒバカリ 4=カガシ (comma-join for multi-select; default 2).
Custom analysis costs ≈ 10 NP × rounds per model.
- Hooks
window.WebSocketat page load and grabs the rawfetchGameRecordresponse frame when you open a replay. - Decodes the MahjongSoul protobuf with a tiny generic wire-decoder keyed by field numbers — no exposed globals, no bundled schema.
- Converts MahjongSoul → tenhou.net/6 (tiles, melds, riichi, pao/sekinin-barai, multi-ron, yaku names, scoring).
- Submits via
GM_xmlhttpRequestwith your NAGAcsrftoken+ session cookie.
The whole thing is one self-contained file: majsoul-naga.user.js.
npm install
npm run check # lint + format check + testIndividual scripts: npm test, npm run lint, npm run format. See
CONTRIBUTING.md.
The test loads the userscript's pure converter and runs it on a real serialized
record fixture (test/fixtures/), asserting the tenhou log matches the frozen
expected output. The fixture exercises chi/pon/ankan/kakan,
riichi, a dealer ron with yaku, a tsumo with honba, and an exhaustive draw with
negative score deltas.
- honvl/Majsoul-to-NAGA — the original
press-
s-to-NAGA userscript (broken by MahjongSoul removing its globals). - ssttkkl/tensoul-py & Equim-chan/tensoul — MahjongSoul → tenhou.net/6 conversion, the basis for this script's converter and its test oracle.
- Diving-Fish/auto-naga — NAGA API.
Issues and PRs welcome — see CONTRIBUTING.md. Keep
npm run check green.
MIT © AsaChiri