Skip to content

Commit

Permalink
Merge pull request #29 from shinkuan/dev
Browse files Browse the repository at this point in the history
v1.5.0
  • Loading branch information
shinkuan authored Mar 7, 2024
2 parents a6d79f2 + 539dd67 commit 8702017
Show file tree
Hide file tree
Showing 22 changed files with 736 additions and 240 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
/mitm_playwright.bat
/playwright_test.py
/unlocker_test.py
/unlocker_passthrough.py
/objects
/players/bot
/players/docker
Expand All @@ -28,4 +29,5 @@
/config.json
/mjai/bot/mortal.pth
/mjai/bot/libriichi.*
/mjai/bot_3p
/mjai/bot_3p
.DS_Store
91 changes: 55 additions & 36 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,13 @@ https://github.com/shinkuan/RandomStuff/assets/35415788/ce1b598d-b1d7-49fe-a175-
[YouTube Video for you to follow.](https://youtu.be/V7NMNsZ3Ut8)

### You will need:

1. A `mortal.pth`. [(Get one from Discord server if you don't have one.)](https://discord.gg/Z2wjXUK8bN)
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](https://discord.gg/Z2wjXUK8bN)__
**Get mortal.pth at [Discord](https://discord.gg/Z2wjXUK8bN)**

1. Go to #verify and click the ✅ reaction.
2. Go to #bot-zip
3. Download a bot you like.
Expand All @@ -53,6 +55,8 @@ __Get mortal.pth at [Discord](https://discord.gg/Z2wjXUK8bN)__

### Akagi:

#### Windows

Download `install_akagi.ps1` at [Release](https://github.com/shinkuan/Akagi/releases/latest)

1. Put `install_akagi.ps1` at the location you want to install Akagi.
Expand All @@ -66,22 +70,36 @@ Download `install_akagi.ps1` at [Release](https://github.com/shinkuan/Akagi/rele
9. Install the certificate.
10. Put `mortal.pth` into `./Akagi/mjai/bot`

#### Mac

Download `install_akagi.command` from [Release](https://github.com/shinkuan/Akagi/releases/latest)

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](https://www.python.org/downloads/) and install it (skip this step if you already have a compatible version of Python installed).
3. Double-click `install_akagi.command` to automatically install the required dependencies.
4. Double-click `run_agaki.command` to start Akagi.
5. If you are using mitmproxy for the first time, click on "start mitm".
6. Close it.
7. Go to your user home directory `~/.mitmproxy`.
8. Install the certificate.
9. Put `mortal.pth` into `./Akagi/mjai/bot`.

### settings.json

- `Unlocker`: Decide to use [MajsoulUnlocker](https://github.com/shinkuan/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](https://github.com/EndlessCheng/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.
- `Unlocker`: Decide to use [MajsoulUnlocker](https://github.com/shinkuan/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](https://github.com/EndlessCheng/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

Expand All @@ -105,7 +123,7 @@ On top right is the MJAI Messages, this is the message our bot sent back to us,

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

Bottom left is the settings.
Bottom left is the settings.

Bottom right is the bot's action.

Expand All @@ -124,23 +142,24 @@ Following guide can minimum the probility of account suspension.
### There is no way to guarantee 100% no account suspension currently.

# TODO
- [x] 3 Player Mahjong
- Already done, but not planned to release yet.
- [x] Change Setting inside application.
- [x] 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.
- [x] Reduce Startup time of the bot. (Maybe start it before match begin?)
- [x] Intergrade with [MajsoulUnlocker](https://github.com/shinkuan/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
- [x] Easier installation.

- [x] 3 Player Mahjong
- Already done, but not planned to release yet.
- [x] Change Setting inside application.
- [x] 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.
- [x] Reduce Startup time of the bot. (Maybe start it before match begin?)
- [x] Intergrade with [MajsoulUnlocker](https://github.com/shinkuan/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
- [x] Easier installation.

## Need Help!

Expand All @@ -152,7 +171,7 @@ Following guide can minimum the probility of account suspension.

# Authors

* **Shinkuan** - [Shinkuan](https://github.com/shinkuan/)
- **Shinkuan** - [Shinkuan](https://github.com/shinkuan/)

## Support me

Expand All @@ -166,7 +185,7 @@ You can find me at [Discord](https://discord.gg/Z2wjXUK8bN).

### What can I get after donating?

Firstly, thank you very much for your willingness to support the author.
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.

Expand Down Expand Up @@ -211,4 +230,4 @@ Software: Akagi
License: GNU Affero General Public License version 3 with Commons Clause
Licensor: shinkuan
```
```
129 changes: 74 additions & 55 deletions README_CH.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,58 +35,76 @@ https://github.com/shinkuan/RandomStuff/assets/35415788/ce1b598d-b1d7-49fe-a175-

### 安裝

[點我到Youtube觀看安裝影片](https://youtu.be/V7NMNsZ3Ut8)
[點我到 Youtube 觀看安裝影片](https://youtu.be/V7NMNsZ3Ut8)

在開始前,你需要以下東西:
1. `mortal.pth` [(如果你沒有的話,到Discord去下載)](https://discord.gg/Z2wjXUK8bN)
2. (Optional) 推薦使用Windows Terminal,以獲得預期中的UI效果。
3. (Optional) 如果你要使用Steam或Majsoul Plus之類的,請使用類似Proxifier的軟體將連線導向至MITM

__[Discord](https://discord.gg/Z2wjXUK8bN)下載我提供的mortal.pth__
1. `mortal.pth` [(如果你沒有的話,到 Discord 去下載)](https://discord.gg/Z2wjXUK8bN)
2. (Optional) 推薦使用 Windows Terminal,以獲得預期中的 UI 效果。
3. (Optional) 如果你要使用 Steam 或 Majsoul Plus 之類的,請使用類似 Proxifier 的軟體將連線導向至 MITM

**[Discord](https://discord.gg/Z2wjXUK8bN)下載我提供的 mortal.pth**

1. 到 #verify 頻道點擊 ✅ 驗證身分.
2. 到 #bot-zip
3. 選一個你喜歡的bot下載
3. 選一個你喜歡的 bot 下載
4. 解壓縮

### Akagi:

[Release](https://github.com/shinkuan/Akagi/releases/latest)下載`install_akagi.ps1`
#### Windows

1.`install_akagi.ps1` 放在您想安裝Akagi的位置。
[Release](https://github.com/shinkuan/Akagi/releases/latest)下載`install_akagi.ps1`

1.`install_akagi.ps1` 放在您想安裝 Akagi 的位置。
2.**管理員**身份打開 **Powershell**
3. cd 到該目錄
4. 執行: `Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass`
5. 執行: `install_akagi.ps1`
6. 如果這是您第一次使用mitmproxy,請打開它。
6. 如果這是您第一次使用 mitmproxy,請打開它。
7. 關閉它。
8. 到使用者主目錄 `~/.mitmproxy`
9. 安裝證書。
10.`mortal.pth` 放入 `./Akagi/mjai/bot`

#### Mac

[Release](https://github.com/shinkuan/Akagi/releases/latest)下載`install_akagi.command`

1.`install_akagi.command` 放在您想安裝 Akagi 的位置。
2.[Python 官方网站](https://www.python.org/downloads/)下载最新的 Python 安装包并安装(如已安装其他兼容版本的 Python 可以跳过这一步)。
3. 双击`install_akagi.command`自动安装所需的依赖项。
4. 双击run_agaki.command启动agaki。
5. 如果您是第一次使用mitmproxy,请点击start mitm。
5. 关闭它。
6. 到使用者主目录 `~/.mitmproxy`
7. 安装证书。
8.`mortal.pth` 放入 `./Akagi/mjai/bot`

### settings.json

- `Unlocker`: 使用 [MajsoulUnlocker](https://github.com/shinkuan/MajsoulUnlocker)
- `v10`: 如果你的客戶端還在v0.10.x版本而且你想要使用MajsoulUnlocker,設為true
- `Autoplay`: 自動打牌.
- `Helper`: [mahjong-helper](https://github.com/EndlessCheng/mahjong-helper)
- `Autohu`: Auto Ron.
- `Port`:
- `MITM`: MITM Port, 你應該將雀魂連線導向到這個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.
- `Unlocker`: 使用 [MajsoulUnlocker](https://github.com/shinkuan/MajsoulUnlocker)
- `v10`: 如果你的客戶端還在 v0.10.x 版本而且你想要使用 MajsoulUnlocker,設為 true
- `Autoplay`: 自動打牌.
- `Helper`: [mahjong-helper](https://github.com/EndlessCheng/mahjong-helper)
- `Autohu`: Auto Ron.
- `Port`:
- `MITM`: MITM Port, 你應該將雀魂連線導向到這個 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.

## 如何使用

### 主畫面

![image](https://github.com/shinkuan/RandomStuff/assets/35415788/6b66a48b-48fe-4e12-b3cc-18b582410f9a)

可以看到這裡有兩個流程,通常上面的是「大廳」的Websocket流程,而下面的是「遊戲」的Websocket流程,這個會在加入對局後出現。
可以看到這裡有兩個流程,通常上面的是「大廳」的 Websocket 流程,而下面的是「遊戲」的 Websocket 流程,這個會在加入對局後出現。

點擊下方的流程以開始。(這可能需要一些時間,點擊一次並等待,不要多次點擊)

Expand All @@ -95,12 +113,12 @@ __到[Discord](https://discord.gg/Z2wjXUK8bN)下載我提供的mortal.pth__
![image](https://github.com/shinkuan/RandomStuff/assets/35415788/17ae8275-4499-4788-a91b-ecafbac33512)

在進入遊戲流程畫面後,應該會看到這些內容。
左上角是我們使用MITM捕獲的LiqiProto訊息
LiqiProto訊息隨後被轉錄為mjai格式並發送給機器人
左上角是我們使用 MITM 捕獲的 LiqiProto 訊息
LiqiProto 訊息隨後被轉錄為 mjai 格式並發送給機器人

右上角是MJAI訊息,這是我們的機器人發回給我們的訊息,指示我們應該採取的動作。
右上角是 MJAI 訊息,這是我們的機器人發回給我們的訊息,指示我們應該採取的動作。

然後下方是我們的手牌,它是使用Unicode字符組成的
然後下方是我們的手牌,它是使用 Unicode 字符組成的

左下角是設置。

Expand All @@ -112,54 +130,55 @@ LiqiProto訊息隨後被轉錄為mjai格式並發送給機器人。

以下是一些你可以採取的措施。

1. 不要使用Steam版,因為它可能會監測你電腦上正在執行的程式。改用web版
1. 不要使用 Steam 版,因為它可能會監測你電腦上正在執行的程式。改用 web 版
2. 使用[Majsoul Mod Plus](https://github.com/Avenshy/majsoul_mod_plus)`safe_code.js`
3. 不要開MajsoulUnlocker,因為它會竄改websocket數據
4. 乖乖手打,不要使用Autoplay
3. 不要開 MajsoulUnlocker,因為它會竄改 websocket 數據
4. 乖乖手打,不要使用 Autoplay
5. 使用貼圖與你的對手交流。
6. 不要完全照著機器人的指示打牌
7. 不要使用Autoplay功能掛機24h打牌
7. 不要使用 Autoplay 功能掛機 24h 打牌

### 目前沒有任何辦法保證完全不封號。

# TODO
- [x] 三麻模式
- 已完成,但尚未決定公布。
- [x] 在應用程式內更改Setting。
- [x] 自動打牌
- [ ] 自動使用貼圖,讓對手認為我們不是機器人。
- [ ] 在settings.json中添加隨機時間,讓用戶選擇他們想要的時間。
- [ ] 混合多個AI的決策,讓我們看起來更像人類,而不是完美的機器人。
- [x] 縮短機器人的啟動時間。(也許在遊戲開始前就啟動?)
- [x][MajsoulUnlocker](https://github.com/shinkuan/MajsoulUnlocker)整合
- [ ] 完全不使用MITM進行遊戲,使用圖像識別。
- [ ] 決定使用哪種模型
- [ ] 訓練數據生成
- [ ] 進行訓練
- [ ] 得分差異識別。
- [ ] 流局識別。
- [ ] 實施
- [x] 更簡單的安裝流程

- [x] 三麻模式
- 已完成,但尚未決定公布。
- [x] 在應用程式內更改 Setting。
- [x] 自動打牌
- [ ] 自動使用貼圖,讓對手認為我們不是機器人。
- [ ] 在 settings.json 中添加隨機時間,讓用戶選擇他們想要的時間。
- [ ] 混合多個 AI 的決策,讓我們看起來更像人類,而不是完美的機器人。
- [x] 縮短機器人的啟動時間。(也許在遊戲開始前就啟動?)
- [x][MajsoulUnlocker](https://github.com/shinkuan/MajsoulUnlocker)整合
- [ ] 完全不使用 MITM 進行遊戲,使用圖像識別。
- [ ] 決定使用哪種模型
- [ ] 訓練數據生成
- [ ] 進行訓練
- [ ] 得分差異識別。
- [ ] 流局識別。
- [ ] 實施
- [x] 更簡單的安裝流程

## Need Help!

1. 歡迎任何人提交PR(Pull Request)。
2. 如果你有使用MajsoulUnlocker,請告訴我它運行得是否順暢,有沒有關於我們修改訊息的痕跡洩露給Majsoul伺服器
1. 歡迎任何人提交 PR(Pull Request)。
2. 如果你有使用 MajsoulUnlocker,請告訴我它運行得是否順暢,有沒有關於我們修改訊息的痕跡洩露給 Majsoul 伺服器
3. 尋找一種穩定且安全的自動打牌方式。
4. 如果遇到任何錯誤,請回報。
5. 如果你的機器人很好用,可以考慮分享你的bot.zip檔案
5. 如果你的機器人很好用,可以考慮分享你的 bot.zip 檔案

# Authors

* **Shinkuan** - [Shinkuan](https://github.com/shinkuan/)
- **Shinkuan** - [Shinkuan](https://github.com/shinkuan/)

## 支持作者

### 斗內是自願的,即使不斗內,這個程式的全部功能也是可用的。 <3

ETH Mainnet: 0x83095C4355E43bDFe9cEf2e439F371900664D41F

Paypal或其他: 到Discord找我
Paypal 或其他: 到 Discord 找我

You can find me at [Discord](https://discord.gg/Z2wjXUK8bN).

Expand Down Expand Up @@ -205,4 +224,4 @@ Software: Akagi
License: GNU Affero General Public License version 3 with Commons Clause
Licensor: shinkuan
```
```
Loading

0 comments on commit 8702017

Please sign in to comment.