Browse Source

fix(Restart): Bound mail page wait during harvest #44

- Skip mail harvest when its page does not open within 15 seconds
- Include the other current workspace changes

(cherry picked from commit 12afdc079e51e89ec78032666e8a1174ef4cd819)
blylana 14 hours ago
parent
commit
c138439f28
4 changed files with 7 additions and 2 deletions
  1. 2 0
      .gitignore
  2. 0 1
      module/atom/image.py
  3. 1 1
      tasks/EternitySea/script_task.py
  4. 4 0
      tasks/Restart/login.py

+ 2 - 0
.gitignore

@@ -275,3 +275,5 @@ oas.bat
 
 # Per-instance FrogBoss prediction and result history
 data/frog_oas/
+
+.workbuddy

+ 0 - 1
module/atom/image.py

@@ -558,7 +558,6 @@ class RuleImage(RuleImageMallResourceMixin):
         """
         image = self.corp(image, self.roi_front)
         average_color = cv2.mean(image)
-        self.debug_mode = True
         if self.debug_mode:
             logger.info(f'{self.name} average_color: {average_color}, template: {color}, bias: {bias}')
         for i in range(3):

+ 1 - 1
tasks/EternitySea/script_task.py

@@ -333,4 +333,4 @@ if __name__ == "__main__":
     c = Config("oas1")
     d = Device(c)
     t = ScriptTask(c, d)
-    t.screenshot()
+    t.run()

+ 4 - 0
tasks/Restart/login.py

@@ -330,10 +330,14 @@ class LoginHandler(BaseTask, RestartAssets, GameUiAssets, GeneralBuffAssets):
             if not self.appear(self.I_READ_ALL_MAIL):
                 return False
         logger.info('Harvest mail')
+        open_mail_timer = Timer(15).start()
         while 1:
             self.screenshot()
             if self.appear(self.I_READ_ALL_MAIL):
                 break
+            if open_mail_timer.reached():
+                logger.warning('Harvest mail page did not open within 15 seconds, skip mail harvest')
+                return False
             if self.appear_then_click_multi_scale(self.I_HARVEST_MAIL, interval=1.5, scale_range=(0.8, 1.1)):
                 continue
             if self.appear_then_click(self.I_HARVEST_MAIL_COPY, interval=1.5):