1
0
mirror of https://github.com/TheFunny/ArisuAutoSweeper synced 2025-12-16 19:55:12 +00:00

fix(tc): improve stability of reward

This commit is contained in:
YoursFunny 2024-08-10 17:49:26 +08:00
parent 6e3d5fc4c5
commit 34af75245e
Signed by: YoursFunny
GPG Key ID: 207EDC3CD5B40F9C
2 changed files with 10 additions and 3 deletions

View File

@ -41,8 +41,6 @@ class TacticalChallenge(TacticalChallengeUI):
def _handle_challenge(self, status):
match status:
case TCStatus.REWARD:
if self.ui_additional():
return status
if self.get_reward():
return TCStatus.OCR
case TCStatus.OCR:

View File

@ -26,17 +26,26 @@ class TacticalChallengeUI(UI):
def get_reward(self):
timer = Timer(10, 10).start()
action_timer = Timer(0.5, 1)
while 1:
self.device.screenshot()
self.ui_additional()
if not action_timer.reached_and_reset():
continue
if self.handle_insufficient_inventory():
logger.warning('Insufficient inventory, skip reward')
return True
if self.ui_additional():
continue
if self.match_color(GOT_REWARD_DAILY) and self.match_color(GOT_REWARD_CREDIT):
return True
if self.match_color(GET_REWARD_DAILY):
self.click_with_interval(GET_REWARD_DAILY, 0.3)
logger.info('Get daily reward')
continue
if self.match_color(GET_REWARD_CREDIT):
self.click_with_interval(GET_REWARD_CREDIT, 0.3)
logger.info('Get credit reward')
continue
if timer.reached():
return False