ChengRanORZ 1 rok temu
rodzic
commit
09bc67cc41

+ 2 - 2
tasks/SoulsTidy/assets.py

@@ -15,8 +15,6 @@ class SoulsTidyAssets:
 	C_ST_DETAIL = RuleClick(roi_front=(1189,321,87,74), roi_back=(1189,321,87,74), name="st_detail")
 	# 出现神赐 
 	C_ST_GOD_PRSENT = RuleClick(roi_front=(717,165,100,48), roi_back=(926,165,100,54), name="st_god_prsent")
-	# 已弃置 
-	C_ST_ABANDONED = RuleClick(roi_front=(40,120,40,80), roi_back=(40,120,40,80), name="st_abandoned")
 
 
 	# Image Rule Assets
@@ -48,6 +46,8 @@ class SoulsTidyAssets:
 	I_ST_ABANDONED_SELECTED = RuleImage(roi_front=(20,110,140,50), roi_back=(20,110,140,50), threshold=0.8, method="Template matching", file="./tasks/SoulsTidy/simple/simple_st_abandoned_selected.png")
 	# 第一个御魂是+0的 
 	I_ST_LEVEL_0 = RuleImage(roi_front=(85,235,45,30), roi_back=(85,235,45,30), threshold=0.9, method="Template matching", file="./tasks/SoulsTidy/simple/simple_st_level_0.png")
+	# 御魂奉纳后获得的金币 
+	I_ST_GOLD = RuleImage(roi_front=(170,100,950,500), roi_back=(170,100,950,500), threshold=0.9, method="Template matching", file="./tasks/SoulsTidy/simple/simple_st_gold.png")
 
 
 	# Long Click Rule Assets

+ 12 - 20
tasks/SoulsTidy/script_task.py

@@ -114,6 +114,10 @@ class ScriptTask(GameUi, SoulsTidyAssets):
         while 1:
             self.wait_until_appear(self.I_ST_LEVEL_0, wait_time=2)
             self.screenshot()
+            # 非+0的不弃置 双保险
+            if not self.appear(self.I_ST_LEVEL_0):
+                logger.info("First Orichi isn't Level 0,quit")
+                break
             firvel = self.O_ST_FIRSET_LEVEL.ocr(self.device.image)
             if firvel is None or firvel == '':
                 logger.info('ocr result is Null')
@@ -122,10 +126,6 @@ class ScriptTask(GameUi, SoulsTidyAssets):
                 # 问就是 把 +0 识别成了 古
                 logger.info('No zero level, bongna done')
                 break
-            # 非+0的不弃置 双保险
-            if not self.appear(self.I_ST_LEVEL_0):
-                logger.info("First Orichi is Level 0,quit")
-                break
 
             # !!!!!!  这里没有检查金币是否足够
             # 长按
@@ -142,6 +142,7 @@ class ScriptTask(GameUi, SoulsTidyAssets):
             if not self.appear(self.I_ST_DONATE):
                 logger.warning('Donate button not appear, skip')
                 continue
+            # 点击奉纳 及收取奖励
             while 1:
                 self.screenshot()
                 if self.appear_then_click(self.I_UI_CONFIRM, interval=0.5):
@@ -152,21 +153,13 @@ class ScriptTask(GameUi, SoulsTidyAssets):
                 # 出现神赐, 就点击然后消失,
                 if self.appear(self.I_ST_GOD_PRESENT):
                     logger.info('God present appear')
-                    sleep(0.5)
-                    self.screenshot()
-                    if not self.appear(self.I_ST_GOD_PRESENT):
-                        continue
-                    while 1:
-                        self.screenshot()
-                        if not self.appear(self.I_ST_GOD_PRESENT):
-                            logger.info('God present disappear')
-                            break
-                        if self.click(self.C_ST_GOD_PRSENT, interval=1):
-                            continue
-                    sleep(0.5)
-                    break
+                    self.click(self.C_ST_GOD_PRSENT, interval=2)
+                    continue
                 if self.appear_then_click(self.I_ST_DONATE, interval=5.5):
+                    self.wait_until_appear(self.I_ST_GOLD, True, wait_time=5)
                     continue
+                if not self.appear(self.I_ST_GOLD):
+                    break
             logger.info('Donate one')
 
         logger.info('Bongna done')
@@ -179,7 +172,6 @@ if __name__ == '__main__':
     c = Config('oas1')
     d = Device(c)
     t = ScriptTask(c, d)
-    t.screenshot()
 
-    # t.greed_maneki()
-    t.run()
+    t.greed_maneki()
+    # t.run()

+ 9 - 0
tasks/SoulsTidy/simple/image.json

@@ -124,5 +124,14 @@
     "method": "Template matching",
     "threshold": 0.9,
     "description": "第一个御魂是+0的"
+  },
+  {
+    "itemName": "st_gold",
+    "imageName": "simple_st_gold.png",
+    "roiFront": "170,100,950,500",
+    "roiBack": "170,100,950,500",
+    "method": "Template matching",
+    "threshold": 0.9,
+    "description": "御魂奉纳后获得的金币"
   }
 ]

BIN
tasks/SoulsTidy/simple/simple_st_gold.png