Преглед изворни кода

fix(Restart): Receive mail

ryland пре 1 година
родитељ
комит
edb6cb4a93

+ 3 - 3
dev_tools/assets_test.py

@@ -34,10 +34,10 @@ def detect_ocr(file: str, target: RuleOcr):
 
 
 # 图片文件路径 可以是相对路径
-IMAGE_FILE = r"D:\Project\OnmyojiAutoScript\log\error\1731668941132\2024-11-15_19-09-00-887294.png"
+IMAGE_FILE = r"C:\Users\Ryland\Desktop\Weixin Screenshot_20241209212253.png"
 if __name__ == '__main__':
-    from tasks.WantedQuests.assets import WantedQuestsAssets
-    targe = WantedQuestsAssets.I_WQ_BOX
+    from tasks.Restart.assets import RestartAssets
+    targe = RestartAssets.I_HARVEST_MAIL_COPY
     print(detect_image(IMAGE_FILE, targe))
 
     # ocr demo

+ 3 - 1
tasks/Restart/assets.py

@@ -50,7 +50,9 @@ class RestartAssets:
 	# 宠物小屋关闭按钮 
 	I_HARVEST_BACK_PET_HOUSE = RuleImage(roi_front=(20,15,70,70), roi_back=(20,15,70,70), threshold=0.8, method="Template matching", file="./tasks/Restart/harvest/harvest_back_pet_house.png")
 	# 点击庭院阴阳师出现的姿度按钮 
-	I_HARVEST_ZIDU = RuleImage(roi_front=(785,475,135,135), roi_back=(785,475,135,135), threshold=0.8, method="Template matching", file="./tasks/Restart/harvest/harvest_zidu.png")
+	I_HARVEST_ZIDU = RuleImage(roi_front=(785,475,135,135), roi_back=(785,475,135,135), threshold=0.8, method="Template matching", file="./tasks/Restart/harvest/harvest_harvest_zidu.png")
+	# description 
+	I_HARVEST_MAIL_COPY = RuleImage(roi_front=(257,509,29,21), roi_back=(192,472,790,100), threshold=0.8, method="Template matching", file="./tasks/Restart/harvest/harvest_harvest_mail_copy.png")
 
 
 	# Click Rule Assets

BIN
tasks/Restart/harvest/harvest_harvest_mail_copy.png


+ 0 - 0
tasks/Restart/harvest/harvest_zidu.png → tasks/Restart/harvest/harvest_harvest_zidu.png


+ 10 - 1
tasks/Restart/harvest/image.json

@@ -172,11 +172,20 @@
   },
   {
     "itemName": "harvest_zidu",
-    "imageName": "harvest_zidu.png",
+    "imageName": "harvest_harvest_zidu.png",
     "roiFront": "785,475,135,135",
     "roiBack": "785,475,135,135",
     "method": "Template matching",
     "threshold": 0.8,
     "description": "点击庭院阴阳师出现的姿度按钮"
+  },
+  {
+    "itemName": "harvest_mail_copy",
+    "imageName": "harvest_harvest_mail_copy.png",
+    "roiFront": "257,509,29,21",
+    "roiBack": "192,472,790,100",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "description"
   }
 ]

+ 2 - 2
tasks/Restart/login.py

@@ -197,8 +197,8 @@ class LoginHandler(BaseTask, RestartAssets):
             # 邮件
             # 判断是否勾选了收取邮件(不收取邮件可以查看每日收获)
             if self.config.restart.harvest_config.enable_mail:
-
-                if self.appear_then_click(self.I_HARVEST_MAIL, interval=3):
+                if self.appear_then_click(self.I_HARVEST_MAIL, interval=3) or\
+                        self.appear_then_click(self.I_HARVEST_MAIL_COPY, interval=3):
                     timer_harvest.reset()
                     self.wait_until_appear(self.I_HARVEST_MAIL_TITLE, wait_time=2)
                     if self.appear(self.I_HARVEST_MAIL_TITLE, interval=2.5):

+ 1 - 1
tasks/Restart/script_task.py

@@ -53,7 +53,7 @@ if __name__ == '__main__':
     config = Config('oas1')
     device = Device(config)
     task = ScriptTask(config, device)
-    task.app_restart()
+    task.harvest()
     # task.screenshot()
     # print(task.appear_then_click(task.I_LOGIN_SCROOLL_CLOSE, threshold=0.9))