Fix: Entered wrong sub-page in meowfficer (fixed #1513)

This commit is contained in:
LmeSzinc 2022-08-21 00:05:42 +08:00
parent eb1e43dd52
commit 190d934538
4 changed files with 36 additions and 10 deletions

View File

@ -21,6 +21,38 @@ class MeowfficerBase(UI):
return False
def meow_enter(self, click_button, check_button, skip_first_screenshot=True):
"""
Enters sub-page, handle MEOWFFICER_INFO and mistaken clicks
Pages:
in: page_meowfficer
out: check_button
"""
accident_page = [MEOWFFICER_TRAIN_START, MEOWFFICER_BUY, MEOWFFICER_FORT_CHECK]
accident_page = [page for page in accident_page if page != check_button]
while 1:
if skip_first_screenshot:
skip_first_screenshot = False
else:
self.device.screenshot()
self.appear_then_click(MEOWFFICER_TRAIN_ENTER, offset=(20, 20), interval=5)
# End
if self.appear(check_button, offset=(20, 20)):
break
# Click
if self.appear_then_click(click_button, offset=(20, 20), interval=3):
continue
# Accident click
if self.meow_additional():
continue
for button in accident_page:
if self.appear(button, offset=(20, 20), interval=3):
self.device.click(MEOWFFICER_CHECK)
self.interval_clear(click_button)
break
def meow_menu_close(self, skip_first_screenshot=True):
"""
Exit from any meowfficer menu popups

View File

@ -1,5 +1,3 @@
import inflection
from module.combat.assets import GET_ITEMS_1
from module.logger import logger
from module.meowfficer.assets import *
@ -52,8 +50,7 @@ class MeowfficerBuy(MeowfficerBase):
count = coins // BUY_PRIZE + int(remain == total)
logger.info(f'Current coins only enough to buy {count}')
self.ui_click(MEOWFFICER_BUY_ENTER, check_button=MEOWFFICER_BUY, additional=self.meow_additional,
retry_wait=3, confirm_wait=0, skip_first_screenshot=True)
self.meow_enter(MEOWFFICER_BUY_ENTER, check_button=MEOWFFICER_BUY)
self.ui_ensure_index(count, letter=MEOWFFICER_CHOOSE, prev_button=MEOWFFICER_BUY_PREV,
next_button=MEOWFFICER_BUY_NEXT, skip_first_screenshot=True)
return True

View File

@ -72,8 +72,7 @@ class MeowfficerFort(MeowfficerBase):
logger.hr('Meowfficer fort', level=1)
# Enter MEOWFFICER_FORT window
self.ui_click(MEOWFFICER_FORT_ENTER, check_button=MEOWFFICER_FORT_CHECK, additional=self.meow_additional,
retry_wait=3, confirm_wait=0, skip_first_screenshot=True)
self.meow_enter(MEOWFFICER_FORT_ENTER, check_button=MEOWFFICER_FORT_CHECK)
# Perform fort chore operations
self.meow_chores()

View File

@ -208,8 +208,7 @@ class MeowfficerTrain(MeowfficerCollect, MeowfficerEnhance):
collected = False
if self.config.MeowfficerTrain_Mode == 'seamlessly':
# Enter
self.ui_click(MEOWFFICER_TRAIN_ENTER, check_button=MEOWFFICER_TRAIN_START, additional=self.meow_additional,
retry_wait=3, confirm_wait=0, skip_first_screenshot=True)
self.meow_enter(MEOWFFICER_TRAIN_ENTER, check_button=MEOWFFICER_TRAIN_START)
# Collect
if remain > 0:
collected = self.meow_collect(collect_all=True)
@ -219,8 +218,7 @@ class MeowfficerTrain(MeowfficerCollect, MeowfficerEnhance):
self.meow_menu_close()
else:
# Enter
self.ui_click(MEOWFFICER_TRAIN_ENTER, check_button=MEOWFFICER_TRAIN_START, additional=self.meow_additional,
retry_wait=3, confirm_wait=0, skip_first_screenshot=True)
self.meow_enter(MEOWFFICER_TRAIN_ENTER, check_button=MEOWFFICER_TRAIN_START)
# Collect
if remain > 0:
collected = self.meow_collect(collect_all=self.meow_is_sunday())