Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: interval for MISSION_OVERVIEW_ACCEPT(_SINGLE) too short #4143

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added assets/cn/os_handler/MISSION_OVERVIEW_EMPTY.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions module/os_handler/assets.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
MISSION_OVERVIEW_ACCEPT = Button(area={'cn': (1072, 12, 1130, 40), 'en': (1082, 16, 1123, 54), 'jp': (1069, 5, 1132, 43), 'tw': (1069, 10, 1131, 42)}, color={'cn': (230, 193, 168), 'en': (228, 174, 128), 'jp': (224, 166, 120), 'tw': (227, 180, 146)}, button={'cn': (1072, 12, 1130, 40), 'en': (1082, 16, 1123, 54), 'jp': (1069, 5, 1132, 43), 'tw': (1069, 10, 1131, 42)}, file={'cn': './assets/cn/os_handler/MISSION_OVERVIEW_ACCEPT.png', 'en': './assets/en/os_handler/MISSION_OVERVIEW_ACCEPT.png', 'jp': './assets/jp/os_handler/MISSION_OVERVIEW_ACCEPT.png', 'tw': './assets/tw/os_handler/MISSION_OVERVIEW_ACCEPT.png'})
MISSION_OVERVIEW_ACCEPT_SINGLE = Button(area={'cn': (1066, 121, 1138, 149), 'en': (1068, 127, 1138, 149), 'jp': (1067, 121, 1138, 149), 'tw': (1066, 121, 1138, 149)}, color={'cn': (145, 182, 231), 'en': (156, 196, 237), 'jp': (133, 173, 227), 'tw': (145, 182, 231)}, button={'cn': (1066, 121, 1138, 149), 'en': (1068, 127, 1138, 149), 'jp': (1067, 121, 1138, 149), 'tw': (1066, 121, 1138, 149)}, file={'cn': './assets/cn/os_handler/MISSION_OVERVIEW_ACCEPT_SINGLE.png', 'en': './assets/en/os_handler/MISSION_OVERVIEW_ACCEPT_SINGLE.png', 'jp': './assets/jp/os_handler/MISSION_OVERVIEW_ACCEPT_SINGLE.png', 'tw': './assets/cn/os_handler/MISSION_OVERVIEW_ACCEPT_SINGLE.png'})
MISSION_OVERVIEW_CHECK = Button(area={'cn': (127, 17, 262, 42), 'en': (128, 18, 300, 37), 'jp': (126, 16, 263, 42), 'tw': (126, 16, 263, 42)}, color={'cn': (148, 165, 209), 'en': (120, 136, 182), 'jp': (95, 109, 148), 'tw': (147, 164, 208)}, button={'cn': (127, 17, 262, 42), 'en': (128, 18, 300, 37), 'jp': (126, 16, 263, 42), 'tw': (126, 16, 263, 42)}, file={'cn': './assets/cn/os_handler/MISSION_OVERVIEW_CHECK.png', 'en': './assets/en/os_handler/MISSION_OVERVIEW_CHECK.png', 'jp': './assets/jp/os_handler/MISSION_OVERVIEW_CHECK.png', 'tw': './assets/tw/os_handler/MISSION_OVERVIEW_CHECK.png'})
MISSION_OVERVIEW_EMPTY = Button(area={'cn': (1052, 320, 1067, 390), 'en': (1052, 320, 1067, 390), 'jp': (1052, 320, 1067, 390), 'tw': (1052, 320, 1067, 390)}, color={'cn': (144, 91, 99), 'en': (144, 91, 99), 'jp': (144, 91, 99), 'tw': (144, 91, 99)}, button={'cn': (1052, 320, 1067, 390), 'en': (1052, 320, 1067, 390), 'jp': (1052, 320, 1067, 390), 'tw': (1052, 320, 1067, 390)}, file={'cn': './assets/cn/os_handler/MISSION_OVERVIEW_EMPTY.png', 'en': './assets/cn/os_handler/MISSION_OVERVIEW_EMPTY.png', 'jp': './assets/cn/os_handler/MISSION_OVERVIEW_EMPTY.png', 'tw': './assets/cn/os_handler/MISSION_OVERVIEW_EMPTY.png'})
MISSION_OVERVIEW_ENTER = Button(area={'cn': (1111, 672, 1207, 690), 'en': (1112, 662, 1183, 689), 'jp': (1108, 670, 1224, 691), 'tw': (1110, 671, 1207, 690)}, color={'cn': (66, 68, 72), 'en': (60, 67, 78), 'jp': (38, 43, 50), 'tw': (67, 70, 75)}, button={'cn': (1105, 629, 1255, 693), 'en': (1105, 629, 1254, 693), 'jp': (1105, 629, 1254, 693), 'tw': (1105, 629, 1255, 693)}, file={'cn': './assets/cn/os_handler/MISSION_OVERVIEW_ENTER.png', 'en': './assets/en/os_handler/MISSION_OVERVIEW_ENTER.png', 'jp': './assets/jp/os_handler/MISSION_OVERVIEW_ENTER.png', 'tw': './assets/tw/os_handler/MISSION_OVERVIEW_ENTER.png'})
MISSION_QUIT = Button(area={'cn': (1086, 111, 1152, 155), 'en': (1086, 111, 1152, 155), 'jp': (1086, 111, 1152, 155), 'tw': (1086, 111, 1152, 155)}, color={'cn': (152, 38, 35), 'en': (152, 38, 35), 'jp': (152, 38, 35), 'tw': (152, 38, 35)}, button={'cn': (1086, 111, 1152, 155), 'en': (1086, 111, 1152, 155), 'jp': (1086, 111, 1152, 155), 'tw': (1086, 111, 1152, 155)}, file={'cn': './assets/cn/os_handler/MISSION_QUIT.png', 'en': './assets/en/os_handler/MISSION_QUIT.png', 'jp': './assets/jp/os_handler/MISSION_QUIT.png', 'tw': './assets/tw/os_handler/MISSION_QUIT.png'})
ORDER_CHECK = Button(area={'cn': (60, 623, 98, 659), 'en': (60, 623, 98, 659), 'jp': (60, 623, 98, 659), 'tw': (60, 623, 98, 659)}, color={'cn': (60, 77, 122), 'en': (60, 77, 122), 'jp': (60, 77, 122), 'tw': (60, 77, 122)}, button={'cn': (106, 77, 224, 94), 'en': (101, 79, 306, 93), 'jp': (65, 64, 147, 95), 'tw': (106, 76, 226, 95)}, file={'cn': './assets/cn/os_handler/ORDER_CHECK.png', 'en': './assets/en/os_handler/ORDER_CHECK.png', 'jp': './assets/jp/os_handler/ORDER_CHECK.png', 'tw': './assets/tw/os_handler/ORDER_CHECK.png'})
Expand Down
23 changes: 11 additions & 12 deletions module/os_handler/mission.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ def os_get_next_mission(self):
logger.info('Already at mission zone')
return 'already_at_mission_zone'

def os_mission_overview_accept(self):
def os_mission_overview_accept(self, skip_first_screenshot=True):
"""
Accept all missions in mission overview.

Expand All @@ -181,29 +181,28 @@ def os_mission_overview_accept(self):
offset=(200, 20), retry_wait=3, skip_first_screenshot=True)

# MISSION_OVERVIEW_CHECK
confirm_timer = Timer(1, count=3).start()
skip_first_screenshot = True
success = True
while 1:
if skip_first_screenshot:
skip_first_screenshot = False
else:
self.device.screenshot()

# End
if self.info_bar_count():
logger.info('Unable to accept missions, because reached the maximum number of missions')
success = False
break
if self.appear_then_click(MISSION_OVERVIEW_ACCEPT, offset=(20, 20), interval=0.2):
confirm_timer.reset()
if self.appear(MISSION_OVERVIEW_EMPTY, offset=(20, 20)):
logger.info('No more missions to accept')
success = True
break

if self.appear_then_click(MISSION_OVERVIEW_ACCEPT, offset=(20, 20), interval=2):
self.interval_reset(MISSION_OVERVIEW_ACCEPT_SINGLE)
continue
else:
# End
if confirm_timer.reached():
success = True
break
if self.appear_then_click(MISSION_OVERVIEW_ACCEPT_SINGLE, offset=(20, 20), interval=0.2):
confirm_timer.reset()
if self.appear_then_click(MISSION_OVERVIEW_ACCEPT_SINGLE, offset=(20, 20), interval=2):
self.interval_reset(MISSION_OVERVIEW_ACCEPT)
continue

# is_in_globe
Expand Down