Skip to content

shinkuan/Akagi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation


Akagi

「死ねば助かるのに………」- 赤木しげる



Ask me anything about this at Discord

中文
Report Bug . Request Feature

About The Project

"The purpose of this project is to provide people with a convenient way to real-time understand their performance in Majsoul game matches and to learn and improve from it. This project is intended for educational purposes only, and the author is not responsible for any actions taken by users using this project. Majsoul officials may detect abnormal behavior, and any consequences such as account suspension are not related to the author."

image

Akagi.mp4

Usage

Flowchart

Flow

Setup

Installation.

YouTube Video for you to follow.

You will need:

  1. A mortal.pth. (Get one from Discord server if you don't have one.)
  2. (Optional, Recommend) Use Windows Terminal to open client.py for a nice looking TUI.
  3. (Optional) If you want to use Steam, Majsoul Plus, or anything other client, proxy the client using tools like proxifier.

Get mortal.pth at Discord

  1. Go to #verify and click the ✅ reaction.
  2. Go to #bot-zip
  3. Download a bot you like.
  4. Extract the zip.
  5. And mortal.pth is there.

Akagi:

Windows

Download install_akagi.ps1 at Release

  1. Put install_akagi.ps1 at the location you want to install Akagi.
  2. Open Powershell as Administrator
  3. cd in to the directory
  4. Run: Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass
  5. Run: install_akagi.ps1
  6. Open mitmproxy if this is your first time using it.
  7. Close it.
  8. Go to your user home directory ~/.mitmproxy
  9. Install the certificate.
  10. Put mortal.pth into ./Akagi/mjai/bot

Mac

Download install_akagi.command from Release

  1. Place install_akagi.command in the location where you want to install Akagi.
  2. Download the latest Python installation package from the Python official website and install it (skip this step if you already have a compatible version of Python installed).
  3. Open Terminal and cd to the directory where install_akagi.command is located.
  4. Execute: bash install_akagi.command
  5. After installation is complete, enter the Akagi folder.
  6. Double-click run_agaki.command to start Akagi.
  7. If you are using mitmproxy for the first time, click on "start mitm".
  8. Close it.
  9. Go to your user home directory ~/.mitmproxy.
  10. Install the certificate.
  11. Put mortal.pth into ./Akagi/mjai/bot.

settings.json

  • Unlocker: Decide to use MajsoulUnlocker or not.
  • v10: If your Majsoul client in still in v0.10.x and you want to use MajsoulUnlocker, set it to true.
  • Autoplay: Autoplay.
  • Helper: To use mahjong-helper or not
  • Autohu: Auto Ron.
  • Port:
    • MITM: The MITM Port, you should redirect Majsoul connection to this port.
    • XMLRPC: The XMLRPC Port.
    • MJAI: The port bind to MJAI bot container.
  • Playwright:
    • enable: Enable the playwright
    • width: width of the viewport of playwright
    • height: height of the viewport of playwright
  • The rest are the setting for MajsoulUnlocker.

Instructions

Main Screen

image

You can see that there are two flows here, usually the top one is the "Lobby" websocket flow, and the bottom one is the "Game" websocket flow which appears after you join a match.

Click on the bottom flow to start. (It can take a while, click once and wait, don't click it for multiple times)

Flow Screen

image

After you are in the Flow Screen, this is what you should see. On top left is the LiqiProto Message we captured using MITM. The LiqiProto Message is then transcribe to mjai format and send to the bot(AI).

On top right is the MJAI Messages, this is the message our bot sent back to us, indicating the action we should do.

Then below is our tehai, it is composed using unicode characters.

Bottom left is the settings.

Bottom right is the bot's action.

How to keep your account safe

Following guide can minimum the probility of account suspension.

  1. Don't use steam, use web instead.
  2. Use safe_code.js from Majsoul Mod Plus
  3. Don't use MajsoulUnlocker as it modifies websocket.
  4. Don't use autoplay, play it yourself.
  5. Try to use stickers often.
  6. Don't completely follow what bot told you to do.
  7. Don't play 24hr a day using autoplay.

There is no way to guarantee 100% no account suspension currently.

TODO

  • 3 Player Mahjong
    • Already done, but not planned to release yet.
  • Change Setting inside application.
  • Autoplay
    • Auto use stickers to make opponent think we are not a bot.
    • Add random time in settings.json to let user choose time they want.
  • Mix multiple AI's decision to make we more like a human but not a perfect bot.
  • Reduce Startup time of the bot. (Maybe start it before match begin?)
  • Intergrade with MajsoulUnlocker
  • Don't use MITM at all for the gameplay, use image recognition.
    • Decide use what model
    • Training data generation
    • Train it
    • Delta Score Recognition.
    • Ryukyoku Recognition.
    • Implement
  • Easier installation.

Need Help!

  1. Any PR is welcomed.
  2. Tell me if the MajsoulUnlocker is working well, is there any trace about we modified the message leaked to Majsoul server?
  3. A stable and safe way to autoplay.
  4. Report any bug you encounter.
  5. Share your bot.zip if it is good.

Authors

Support me

Donating is optional, and the full functionality of this program is avaliable even without a donation.

ETH Mainnet: 0x83095C4355E43bDFe9cEf2e439F371900664D41F

Paypal or Others: Contact me on Discord.

You can find me at Discord.

What can I get after donating?

Firstly, thank you very much for your willingness to support the author.

I will prioritize the opinions of donors, such as feature requests and bug fixes.

Next, you can find me on Discord, where I will assign you a donor role.

See Also

Special Thanks

Equim-chan/Mortal

Majsoul Mod Plus

mahjong-helper

MahjongRepository/mahjong_soul_api

smly/mjai.app

LICENSE

“Commons Clause” License Condition v1.0

The Software is provided to you by the Licensor under the License, as defined below, subject to the following condition.

Without limiting other conditions in the License, the grant of rights under the License will not include, and the License does not grant to you, the right to Sell the Software.

For purposes of the foregoing, “Sell” means practicing any or all of the rights granted to you under the License to provide to third parties, for a fee or other consideration (including without limitation fees for hosting or consulting/ support services related to the Software), a product or service whose value derives, entirely or substantially, from the functionality of the Software. Any license notice or attribution required by the License must also include this Commons Clause License Condition notice.

Software: Akagi

License: GNU Affero General Public License version 3 with Commons Clause

Licensor: shinkuan