Skip to content

Commit

Permalink
Merge branch 'release/2.0.4' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
Konano committed Mar 11, 2022
2 parents 7370ee5 + 098b813 commit baf6485
Show file tree
Hide file tree
Showing 10 changed files with 31 additions and 14 deletions.
2 changes: 1 addition & 1 deletion arknights_mower/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@
__cli__ = not (__pyinstall__ and not sys.argv[1:])

__system__ = platform.system().lower()
__version__ = '2.0.3'
__version__ = '2.0.4'
1 change: 1 addition & 0 deletions arknights_mower/data/scene.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
[104, 'LOGIN_LOADING', '登陆中'],
[105, 'LOGIN_START', '启动'],
[106, 'LOGIN_ANNOUNCE', '启动界面公告'],
[107, 'LOGIN_REGISTER', '注册'],
[201, 'INFRA_MAIN', '基建全局视角'],
[202, 'INFRA_TODOLIST', '基建待办事项'],
[203, 'INFRA_CONFIDENTIAL', '线索主界面'],
Expand Down
12 changes: 6 additions & 6 deletions arknights_mower/data/zone.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,37 +27,37 @@
"type": "MAINLINE",
"name": "急性衰竭",
"chapterIndex": 1,
"zoneIndex": 0
"zoneIndex": 4
},
"main_5": {
"type": "MAINLINE",
"name": "靶向药物",
"chapterIndex": 1,
"zoneIndex": 1
"zoneIndex": 5
},
"main_6": {
"type": "MAINLINE",
"name": "局部坏死",
"chapterIndex": 1,
"zoneIndex": 2
"zoneIndex": 6
},
"main_7": {
"type": "MAINLINE",
"name": "苦难摇篮",
"chapterIndex": 1,
"zoneIndex": 3
"zoneIndex": 7
},
"main_8": {
"type": "MAINLINE",
"name": "怒号光明",
"chapterIndex": 1,
"zoneIndex": 4
"zoneIndex": 8
},
"main_9": {
"type": "MAINLINE",
"name": "风暴瞭望",
"chapterIndex": 2,
"zoneIndex": 0
"zoneIndex": 9
},
"weekly_1": {
"type": "WEEKLY",
Expand Down
Binary file added arknights_mower/resources/register.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions arknights_mower/templates/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,11 @@ device:
# minitouch 兼容模式,当打开时, 用于处理在某些模拟器下无法正确处理分辨率和旋转的情况, 默认关闭
# compatibility_mode: false

account:
# 账户以及密码
# username: 15088888888
# password: PassWord

app:
package_name: com.hypergryph.arknights # 官服
# package_name: com.hypergryph.arknights.bilibili # Bilibili 服
Expand Down
4 changes: 4 additions & 0 deletions arknights_mower/utils/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,10 @@ def init_config() -> None:
global ADB_MNT_PORT
ADB_MNT_PORT = __get('device/adb_mnt_port', 20937)

global USERNAME, PASSWORD
USERNAME = __get('account/username', None)
PASSWORD = __get('account/password', None)

global APPNAME
APPNAME = __get('app/package_name', 'com.hypergryph.arknights') + \
'/' + __get('app/activity_name', 'com.u8.sdk.U8UnityContext')
Expand Down
2 changes: 2 additions & 0 deletions arknights_mower/utils/recognize.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,8 @@ def get_scene(self) -> int:
self.scene = Scene.LOGIN_QUICKLY
elif self.find('login_account') is not None:
self.scene = Scene.LOGIN_MAIN
elif self.find('register') is not None:
self.scene = Scene.LOGIN_REGISTER
elif self.find('login_loading') is not None:
self.scene = Scene.LOGIN_LOADING
elif self.find('login_iknow') is not None:
Expand Down
2 changes: 1 addition & 1 deletion arknights_mower/utils/segment.py
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ def worker(img: tp.Image, draw: bool = False) -> tuple[list[tp.Rectangle], tp.Re
remove_mode = False
pre, st = int(img[0, x0, 1]), 0
for y in range(1, height):
remove_mode |= img[y, x0, 0] - img[y, x0, 1] > 40
remove_mode |= int(img[y, x0, 0]) - int(img[y, x0, 1]) > 40
if np.ptp(img[y, x0]) <= 1 or int(img[y, x0, 0]) - int(img[y, x0, 1]) > 40:
now = int(img[y, x0, 1])
if abs(now - pre) > 20:
Expand Down
15 changes: 10 additions & 5 deletions arknights_mower/utils/solver.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,14 @@ def sleep(self, interval: float = 1, rebuild: bool = True) -> None:
time.sleep(interval)
self.recog.update(rebuild=rebuild)

def input(self, referent: str, input_area: tp.Scope) -> None:
def input(self, referent: str, input_area: tp.Scope, text: str = None) -> None:
""" input text """
logger.debug(f'input: {referent} {input_area}')
self.device.tap(self.get_pos(input_area))
self.device.send_text(input(referent).strip())
time.sleep(0.5)
if text is None:
text = input(referent).strip()
self.device.send_text(str(text))
self.device.tap((0, 0))

def find(self, res: str, draw: bool = False, scope: tp.Scope = None, thres: int = None, judge: bool = True, strict: bool = False) -> tp.Scope:
Expand Down Expand Up @@ -175,14 +178,16 @@ def login(self):
elif self.scene() == Scene.LOGIN_QUICKLY:
self.tap_element('login_awake')
elif self.scene() == Scene.LOGIN_MAIN:
self.tap_element('login_account')
self.tap_element('login_account', 0.25)
elif self.scene() == Scene.LOGIN_REGISTER:
self.back(2)
elif self.scene() == Scene.LOGIN_INPUT:
input_area = self.find('login_username')
if input_area is not None:
self.input('Enter username: ', input_area)
self.input('Enter username: ', input_area, config.USERNAME)
input_area = self.find('login_password')
if input_area is not None:
self.input('Enter password: ', input_area)
self.input('Enter password: ', input_area, config.PASSWORD)
self.tap_element('login_button')
elif self.scene() == Scene.LOGIN_ANNOUNCE:
self.tap_element('login_iknow')
Expand Down
2 changes: 1 addition & 1 deletion data_update.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def requests_get(path):
'type': x['type'],
'name': x['zoneNameSecond'],
'chapterIndex': chapterIndex,
'zoneIndex': x['zoneIndex']
'zoneIndex': int(x['zoneID'].split('_')[1])
}
elif x['type'] == 'WEEKLY':
zone[x['zoneID']] = {
Expand Down

0 comments on commit baf6485

Please sign in to comment.