Fix: Handle map events in interrupt_auto_search() (fixed #2219)

This commit is contained in:
LmeSzinc 2023-02-08 12:32:56 +08:00
parent b128375a22
commit 702297d1c2

View File

@ -528,10 +528,18 @@ class OSMap(OSFleet, Map, GlobeCamera, StrategicSearchHandler):
# Auto search can not handle siren searching device. # Auto search can not handle siren searching device.
continue continue
def interrupt_auto_search(self): def interrupt_auto_search(self, skip_first_screenshot=True):
logger.info('Interrupting auto search') logger.info('Interrupting auto search')
while 1: while 1:
self.device.screenshot() if skip_first_screenshot:
skip_first_screenshot = False
else:
self.device.screenshot()
# End
if self.ui_page_appear(page_main):
logger.info('Auto search interrupted')
self.config.task_stop()
if self.appear_then_click(AUTO_SEARCH_REWARD, offset=(50, 50), interval=3): if self.appear_then_click(AUTO_SEARCH_REWARD, offset=(50, 50), interval=3):
continue continue
@ -546,10 +554,12 @@ class OSMap(OSFleet, Map, GlobeCamera, StrategicSearchHandler):
continue continue
if self.ui_additional(): if self.ui_additional():
continue continue
# End if self.handle_map_event():
if self.ui_page_appear(page_main): continue
logger.info('Auto search interrupted') if self.handle_battle_status():
self.config.task_stop() continue
if self.handle_exp_info():
continue
def os_auto_search_run(self, drop=None, strategic=False): def os_auto_search_run(self, drop=None, strategic=False):
for _ in range(5): for _ in range(5):