Просмотр исходного кода

feat(SoulsTidy): 御魂弃置功能

- 新增已弃置状态的点击规则和识别图像
- 新增第一个御魂是+0的识别图像
- 在脚本中增加进入已弃置界面的逻辑
- 增加检查御魂是否是+0的逻辑,非+0的不弃置
ChengRanORZ 1 год назад
Родитель
Сommit
b732c499a1

+ 6 - 0
tasks/SoulsTidy/assets.py

@@ -15,6 +15,8 @@ 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
@@ -42,6 +44,10 @@ class SoulsTidyAssets:
 	I_ST_DONATE = RuleImage(roi_front=(813,628,126,68), roi_back=(813,628,126,68), threshold=0.8, method="Template matching", file="./tasks/SoulsTidy/simple/simple_st_donate.png")
 	# 神赐 
 	I_ST_GOD_PRESENT = RuleImage(roi_front=(578,234,131,73), roi_back=(542,117,204,219), threshold=0.8, method="Template matching", file="./tasks/SoulsTidy/simple/simple_st_god_present.png")
+	# 已弃置被选中 
+	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")
 
 
 	# Long Click Rule Assets

+ 13 - 9
tasks/SoulsTidy/script_task.py

@@ -14,6 +14,7 @@ from tasks.GameUi.page import page_main, page_shikigami_records
 from tasks.SoulsTidy.assets import SoulsTidyAssets
 from tasks.SoulsTidy.config import SimpleTidy
 
+
 class ScriptTask(GameUi, SoulsTidyAssets):
     def run(self):
         self.ui_get_current_page()
@@ -89,6 +90,12 @@ class ScriptTask(GameUi, SoulsTidyAssets):
             if self.appear_then_click(self.I_ST_BONGNA, interval=1, threshold=0.6):
                 continue
         logger.hr('Enter bongna')
+        # 进入已弃置界面
+        while True:
+            if not self.appear(self.I_ST_ABANDONED_SELECTED):
+                self.click(self.I_ST_ABANDONED_SELECTED, interval=2)
+                continue
+            break
         # 确保是按照等级来排序的
         while 1:
             self.screenshot()
@@ -111,6 +118,11 @@ 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("Level 0 Orichi,quit")
+                break
+
             # !!!!!!  这里没有检查金币是否足够
             # 长按
             while 1:
@@ -156,22 +168,14 @@ class ScriptTask(GameUi, SoulsTidyAssets):
         logger.info('Bongna done')
 
 
-
-
-
-
-
-
-
 if __name__ == '__main__':
     from module.config.config import Config
     from module.device.device import Device
+
     c = Config('oas1')
     d = Device(c)
     t = ScriptTask(c, d)
     t.screenshot()
 
-
     # t.greed_maneki()
     t.run()
-

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

@@ -106,5 +106,23 @@
     "method": "Template matching",
     "threshold": 0.8,
     "description": "神赐"
+  },
+  {
+    "itemName": "st_abandoned_selected",
+    "imageName": "simple_st_abandoned_selected.png",
+    "roiFront": "20,110,140,50",
+    "roiBack": "20,110,140,50",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "已弃置被选中"
+  },
+  {
+    "itemName": "st_level_0",
+    "imageName": "simple_st_level_0.png",
+    "roiFront": "85,235,45,30",
+    "roiBack": "85,235,45,30",
+    "method": "Template matching",
+    "threshold": 0.9,
+    "description": "第一个御魂是+0的"
   }
 ]

BIN
tasks/SoulsTidy/simple/simple_st_abandoned_selected.png


BIN
tasks/SoulsTidy/simple/simple_st_level_0.png