mirror of
https://github.com/LmeSzinc/StarRailCopilot.git
synced 2024-11-16 14:31:16 +00:00
Fix: Handle randomly missing battle pass entrance
This commit is contained in:
parent
845767d71c
commit
267c1f7387
@ -181,10 +181,32 @@ class BattlePassUI(UI):
|
|||||||
self._claim_rewards()
|
self._claim_rewards()
|
||||||
return current_level
|
return current_level
|
||||||
|
|
||||||
|
def has_battle_pass_entrance(self, skip_first_screenshot=True):
|
||||||
|
"""
|
||||||
|
Pages:
|
||||||
|
in: page_main
|
||||||
|
"""
|
||||||
|
timeout = Timer(0.5, count=2).start()
|
||||||
|
while 1:
|
||||||
|
if skip_first_screenshot:
|
||||||
|
skip_first_screenshot = False
|
||||||
|
else:
|
||||||
|
self.device.screenshot()
|
||||||
|
|
||||||
|
if timeout.reached():
|
||||||
|
break
|
||||||
|
|
||||||
|
if self.appear(MAIN_GOTO_BATTLE_PASS, similarity=0.75):
|
||||||
|
return True
|
||||||
|
else:
|
||||||
|
logger.info('No battle pass entrance, probably a gap between two periods')
|
||||||
|
continue
|
||||||
|
|
||||||
|
return False
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
self.ui_ensure(page_main)
|
self.ui_ensure(page_main)
|
||||||
if not self.appear(MAIN_GOTO_BATTLE_PASS):
|
if not self.has_battle_pass_entrance():
|
||||||
logger.info('No battle pass entrance, probably a gap between two periods')
|
|
||||||
self.config.task_delay(server_update=True)
|
self.config.task_delay(server_update=True)
|
||||||
self.config.task_stop()
|
self.config.task_stop()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user