Skip to content

Commit

Permalink
Merge pull request #42 from shinkuan/dev
Browse files Browse the repository at this point in the history
v1.6.0
  • Loading branch information
shinkuan authored Apr 8, 2024
2 parents f31cfaf + ce5c7f8 commit 028c175
Show file tree
Hide file tree
Showing 13 changed files with 1,145 additions and 121 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,5 @@
/mjai/bot/mortal.pth
/mjai/bot/libriichi.*
/mjai/bot_3p
.DS_Store
.DS_Store
/mitmconfig
16 changes: 9 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,13 +76,15 @@ Download `install_akagi.command` from [Release](https://github.com/shinkuan/Akag

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`.
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

Expand Down
8 changes: 5 additions & 3 deletions README_CH.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,11 @@ https://github.com/shinkuan/RandomStuff/assets/35415788/ce1b598d-b1d7-49fe-a175-

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。
3. 打开终端,cd到`install_akagi.command`所在的目录。
4. 执行:bash install_akagi.command
5. 安装完成之后,进入Akagi文件夹。
6. 双击run_agaki.command启动agaki。
7. 如果您是第一次使用mitmproxy,请点击start mitm。
5. 关闭它。
6. 到使用者主目录 `~/.mitmproxy`
7. 安装证书。
Expand Down
35 changes: 34 additions & 1 deletion action.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@
from loguru import logger
from xmlrpc.client import ServerProxy

YAOJIU = ('1p','1m','1s','9p','9m','9s','E','S','W','N','P','F','C')
TWOEIGHT = ('2p','2m','2s','8p','8m','8s')
TFFSS = ('3p','3m','3s','4p','4m','4s','5p','5m','5s','6p','6m','6s','7p','7m','7s')
REDFIVE = ('5pr','5mr','5sr')


# Coordinates here is on the resolution of 16x9
LOCATION = {
"tiles": [
Expand Down Expand Up @@ -106,6 +112,7 @@ def __init__(self, rpc_server: ServerProxy):
self.new_max = settings['RandomTime']['new_max']
self.min = settings['RandomTime']['min']
self.max = settings['RandomTime']['max']
self.moqiedelay = settings['RandomTime']['moqiedelay']
pass

def page_clicker(self, coord: tuple[float, float]):
Expand Down Expand Up @@ -279,15 +286,41 @@ def click_dahai(self, mjai_msg: dict | None, tehai: list[str], tsumohai: str | N
break


def mjai2action(self, mjai_msg: dict | None, tehai: list[str], tsumohai: str | None):
def mjai2action(self, mjai_msg: dict | None, tehai: list[str], tsumohai: str | None, isliqi: bool | None, NoOver: bool | None):
dahai_delay = self.decide_random_time()
if mjai_msg is None:
return
if mjai_msg['type'] == 'dahai' and not self.reached:
if NoOver:
self.click_dahai(mjai_msg, tehai, tsumohai)
return

if self.moqiedelay:
if isliqi:
# if someone reached
dahai_delay = dahai_delay # Change value here
elif not mjai_msg['tsumogiri']:
if mjai_msg['pai'] in YAOJIU:
dahai_delay = dahai_delay
elif mjai_msg['pai'] in TWOEIGHT:
dahai_delay = dahai_delay
elif mjai_msg['pai'] in TFFSS:
dahai_delay = dahai_delay
elif mjai_msg['pai'] in REDFIVE:
dahai_delay = dahai_delay
else:
# tsumogiri
dahai_delay = dahai_delay
else:
dahai_delay = dahai_delay

time.sleep(dahai_delay)
self.click_dahai(mjai_msg, tehai, tsumohai)
return
if mjai_msg['type'] in ['none', 'chi', 'pon', 'daiminkan', 'ankan', 'kakan', 'hora', 'reach', 'ryukyoku', 'nukidora']:
if NoOver:
self.click_chiponkan(mjai_msg, tehai, tsumohai)
return
time.sleep(2)
self.click_chiponkan(mjai_msg, tehai, tsumohai)
# kan can have multiple candidates too! ex: tehai=1111m 1111p 111s 11z, tsumohai=1s
Expand Down
Loading

0 comments on commit 028c175

Please sign in to comment.