Fix: Entered _claim_rewards() but no rewards to claim

This commit is contained in:
LmeSzinc 2023-11-17 21:54:35 +08:00
parent 10e4f49d90
commit 74cf112cbc

View File

@ -180,6 +180,7 @@ class BattlePassUI(UI):
def _claim_rewards(self, skip_first_screenshot=True): def _claim_rewards(self, skip_first_screenshot=True):
logger.hr('Claim rewards', level=1) logger.hr('Claim rewards', level=1)
self.battle_pass_goto(KEYWORD_BATTLE_PASS_TAB.Rewards) self.battle_pass_goto(KEYWORD_BATTLE_PASS_TAB.Rewards)
timeout = Timer(5, count=15).start()
while 1: while 1:
if skip_first_screenshot: if skip_first_screenshot:
skip_first_screenshot = False skip_first_screenshot = False
@ -192,9 +193,14 @@ class BattlePassUI(UI):
if self.appear(CLOSE_CHOOSE_GIFT): if self.appear(CLOSE_CHOOSE_GIFT):
logger.info('Got reward but have gift to choose') logger.info('Got reward but have gift to choose')
break break
if timeout.reached():
logger.warning('Claim reward timeout, no rewards to claim')
break
if self.appear_then_click(REWARDS_CLAIM_ALL, interval=2): if self.appear_then_click(REWARDS_CLAIM_ALL, interval=2):
timeout.reset()
continue continue
logger.info('Close reward popup')
skip_first_screenshot = True skip_first_screenshot = True
while 1: while 1:
if skip_first_screenshot: if skip_first_screenshot: