diff --git a/assets/share/base/daemon/CHAT_CLOSE.png b/assets/share/base/daemon/CHAT_CLOSE.png new file mode 100644 index 000000000..6d177e680 Binary files /dev/null and b/assets/share/base/daemon/CHAT_CLOSE.png differ diff --git a/assets/share/base/daemon/CHAT_OPTION.BUTTON.png b/assets/share/base/daemon/CHAT_OPTION.BUTTON.png new file mode 100644 index 000000000..4a0f42558 Binary files /dev/null and b/assets/share/base/daemon/CHAT_OPTION.BUTTON.png differ diff --git a/assets/share/base/daemon/CHAT_OPTION.png b/assets/share/base/daemon/CHAT_OPTION.png new file mode 100644 index 000000000..2b2fe3e94 Binary files /dev/null and b/assets/share/base/daemon/CHAT_OPTION.png differ diff --git a/assets/share/base/daemon/STORY_NEXT.BUTTON.png b/assets/share/base/daemon/STORY_NEXT.BUTTON.png new file mode 100644 index 000000000..4b4a8e0d6 Binary files /dev/null and b/assets/share/base/daemon/STORY_NEXT.BUTTON.png differ diff --git a/assets/share/base/daemon/STORY_NEXT.png b/assets/share/base/daemon/STORY_NEXT.png new file mode 100644 index 000000000..d5c2d5b24 Binary files /dev/null and b/assets/share/base/daemon/STORY_NEXT.png differ diff --git a/assets/share/base/daemon/STORY_OPTION.BUTTON.png b/assets/share/base/daemon/STORY_OPTION.BUTTON.png new file mode 100644 index 000000000..045bfc589 Binary files /dev/null and b/assets/share/base/daemon/STORY_OPTION.BUTTON.png differ diff --git a/assets/share/base/daemon/STORY_OPTION.png b/assets/share/base/daemon/STORY_OPTION.png new file mode 100644 index 000000000..2a2c50ccd Binary files /dev/null and b/assets/share/base/daemon/STORY_OPTION.png differ diff --git a/tasks/base/assets/assets_base_daemon.py b/tasks/base/assets/assets_base_daemon.py new file mode 100644 index 000000000..390624613 --- /dev/null +++ b/tasks/base/assets/assets_base_daemon.py @@ -0,0 +1,45 @@ +from module.base.button import Button, ButtonWrapper + +# This file was auto-generated, do not modify it manually. To generate: +# ``` python -m dev_tools.button_extract ``` + +CHAT_CLOSE = ButtonWrapper( + name='CHAT_CLOSE', + share=Button( + file='./assets/share/base/daemon/CHAT_CLOSE.png', + area=(1115, 96, 1145, 126), + search=(1095, 76, 1165, 146), + color=(180, 180, 180), + button=(1115, 96, 1145, 126), + ), +) +CHAT_OPTION = ButtonWrapper( + name='CHAT_OPTION', + share=Button( + file='./assets/share/base/daemon/CHAT_OPTION.png', + area=(628, 483, 648, 537), + search=(608, 463, 668, 557), + color=(217, 215, 214), + button=(649, 496, 1129, 525), + ), +) +STORY_NEXT = ButtonWrapper( + name='STORY_NEXT', + share=Button( + file='./assets/share/base/daemon/STORY_NEXT.png', + area=(631, 673, 649, 682), + search=(611, 653, 669, 702), + color=(124, 108, 83), + button=(927, 606, 1219, 693), + ), +) +STORY_OPTION = ButtonWrapper( + name='STORY_OPTION', + share=Button( + file='./assets/share/base/daemon/STORY_OPTION.png', + area=(783, 456, 795, 485), + search=(763, 436, 815, 505), + color=(158, 167, 171), + button=(813, 453, 1069, 488), + ), +) diff --git a/tasks/base/daemon.py b/tasks/base/daemon.py new file mode 100644 index 000000000..6379692c7 --- /dev/null +++ b/tasks/base/daemon.py @@ -0,0 +1,58 @@ +from module.base.timer import Timer +from module.logger import logger +from tasks.base.assets.assets_base_daemon import * +from tasks.base.main_page import MainPage +from tasks.base.page import page_main, page_rogue +from tasks.daily.assets.assets_daily_camera import PICTURE_TAKEN +from tasks.map.assets.assets_map_bigmap import TELEPORT_RIGHT +from tasks.rogue.route.base import RouteBase + + +class Daemon(RouteBase): + def run(self): + # Rebind daemon settings along with rogue settings + self.config.bind('Daemon', func_list=['Rogue']) + self.device.disable_stuck_detection() + + teleport_confirm = Timer(1, count=5) + while 1: + self.device.screenshot() + + # Check lang + if not MainPage._lang_checked and self.ui_page_appear(page_main, interval=5): + self.handle_lang_check(page=page_main) + # Check again + if not MainPage._lang_check_success: + MainPage._lang_checked = False + # Story + if self.appear_then_click(STORY_NEXT, interval=0.7): + self.interval_reset(STORY_OPTION) + continue + if self.appear_then_click(STORY_OPTION, interval=1): + continue + # Story teleport + if self.appear_then_click(TELEPORT_RIGHT, interval=3): + teleport_confirm.reset() + continue + if teleport_confirm.started() and not teleport_confirm.reached(): + if self.handle_popup_confirm(): + logger.info(f'{TELEPORT_RIGHT} -> popup') + continue + # Chat + if self.appear_then_click(CHAT_OPTION, interval=3): + continue + if self.appear_then_click(CHAT_CLOSE, interval=3): + continue + # Popup + if self.handle_reward(interval=1.5): + continue + if self.handle_ui_close(PICTURE_TAKEN, interval=1): + continue + # Rogue + if self.handle_blessing(): + continue + if self.ui_page_appear(page_rogue): + if self.handle_event_continue(): + continue + if self.handle_event_option(): + continue diff --git a/tasks/base/ui.py b/tasks/base/ui.py index 2bf5ed385..09d18db42 100644 --- a/tasks/base/ui.py +++ b/tasks/base/ui.py @@ -18,12 +18,13 @@ class UI(MainPage): ui_current: Page ui_main_confirm_timer = Timer(0.2, count=0) - def ui_page_appear(self, page): + def ui_page_appear(self, page, interval=0): """ Args: page (Page): + interval: """ - return self.appear(page.check_button) + return self.appear(page.check_button, interval=interval) def ui_get_current_page(self, skip_first_screenshot=True): """