From f669130e334e95cee5a91448e8cbc96715073d18 Mon Sep 17 00:00:00 2001 From: YoursFunny Date: Sat, 10 Aug 2024 17:10:46 +0800 Subject: [PATCH] fix(cafe): improve stability of closing reward window --- tasks/cafe/cafe.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/tasks/cafe/cafe.py b/tasks/cafe/cafe.py index 75f973a..519334b 100644 --- a/tasks/cafe/cafe.py +++ b/tasks/cafe/cafe.py @@ -63,9 +63,10 @@ class Cafe(CafeUI): self.click_with_interval(GET_REWARD) case CafeStatus.GOT: logger.info('Cafe reward have been got') - self.appear_then_click(GET_REWARD_CLOSE) - if not self.appear(GET_REWARD_CLOSE): - return CafeStatus.INVITATION + if self.appear(GET_REWARD_CLOSE): + self.click_with_interval(GET_REWARD_CLOSE, 1) + return status + return CafeStatus.INVITATION case CafeStatus.INVITATION: if handle_invitation(self): return CafeStatus.CLICK @@ -77,6 +78,8 @@ class Cafe(CafeUI): return CafeStatus.CHECK self.click_with_interval(buttons[0], interval=1) case CafeStatus.CHECK: + if self.appear_then_click(GET_REWARD_CLOSE): + return status buttons = self.get_clickable_buttons() if not self.is_adjust_on: if not buttons: