Add: Dialogue clicker

This commit is contained in:
LmeSzinc 2023-12-26 23:44:20 +08:00
parent 5efeb13728
commit ff60964a0d
10 changed files with 106 additions and 2 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 KiB

View File

@ -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),
),
)

58
tasks/base/daemon.py Normal file
View File

@ -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

View File

@ -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):
"""