Explorar o código

fix(ActivityShikigami): Deal with more cases for "pass mode"

ryland hai 11 meses
pai
achega
2619826a87

+ 20 - 0
tasks/ActivityShikigami/assets.py

@@ -127,6 +127,26 @@ class ActivityShikigamiAssets:
 	I_PASS_1 = RuleImage(roi_front=(359,295,100,53), roi_back=(68,203,1138,369), threshold=0.8, method="Template matching", file="./tasks/ActivityShikigami/fire/fire_pass_1.png")
 	# description 
 	I_PASS_2 = RuleImage(roi_front=(645,224,92,57), roi_back=(98,205,1076,366), threshold=0.8, method="Template matching", file="./tasks/ActivityShikigami/fire/fire_pass_2.png")
+	# description 
+	I_PASS_3 = RuleImage(roi_front=(648,227,91,55), roi_back=(103,162,1077,416), threshold=0.8, method="Template matching", file="./tasks/ActivityShikigami/fire/fire_pass_3.png")
+	# description 
+	I_PASS_4 = RuleImage(roi_front=(586,424,100,58), roi_back=(99,194,1080,398), threshold=0.8, method="Template matching", file="./tasks/ActivityShikigami/fire/fire_pass_4.png")
+	# 箱子 
+	I_PASS_5 = RuleImage(roi_front=(946,415,65,48), roi_back=(97,194,1036,398), threshold=0.8, method="Template matching", file="./tasks/ActivityShikigami/fire/fire_pass_5.png")
+	# 印记 
+	I_PASS_6 = RuleImage(roi_front=(668,221,54,50), roi_back=(107,159,1012,394), threshold=0.8, method="Template matching", file="./tasks/ActivityShikigami/fire/fire_pass_6.png")
+	# description 
+	I_PASS_7 = RuleImage(roi_front=(329,233,51,51), roi_back=(95,180,1056,394), threshold=0.65, method="Template matching", file="./tasks/ActivityShikigami/fire/fire_pass_7.png")
+	# 印记选中间的 
+	I_PASS_8 = RuleImage(roi_front=(579,276,100,100), roi_back=(577,296,100,100), threshold=0.8, method="Template matching", file="./tasks/ActivityShikigami/fire/fire_pass_8.png")
+	# description 
+	I_PASS_9 = RuleImage(roi_front=(558,643,160,44), roi_back=(480,601,306,100), threshold=0.8, method="Template matching", file="./tasks/ActivityShikigami/fire/fire_pass_9.png")
+	# 印记选左边的 
+	I_PASS_10 = RuleImage(roi_front=(279,309,100,100), roi_back=(291,305,100,100), threshold=0.8, method="Template matching", file="./tasks/ActivityShikigami/fire/fire_pass_10.png")
+	# 印记选右边的 
+	I_PASS_11 = RuleImage(roi_front=(918,304,100,100), roi_back=(914,308,100,100), threshold=0.8, method="Template matching", file="./tasks/ActivityShikigami/fire/fire_pass_11.png")
+	# none 
+	I_PASS12 = RuleImage(roi_front=(0,0,100,100), roi_back=(0,0,100,100), threshold=0.8, method="Template matching", file="./tasks/ActivityShikigami/fire/fire_pass12.png")
 
 
 	# Ocr Rule Assets

BIN=BIN
tasks/ActivityShikigami/fire/fire_pass_3.png


BIN=BIN
tasks/ActivityShikigami/fire/fire_pass_4.png


BIN=BIN
tasks/ActivityShikigami/fire/fire_pass_5.png


BIN=BIN
tasks/ActivityShikigami/fire/fire_pass_6.png


BIN=BIN
tasks/ActivityShikigami/fire/fire_pass_7.png


BIN=BIN
tasks/ActivityShikigami/fire/fire_pass_9.png


+ 90 - 0
tasks/ActivityShikigami/fire/image.json

@@ -25,5 +25,95 @@
     "method": "Template matching",
     "threshold": 0.8,
     "description": "description"
+  },
+  {
+    "itemName": "pass_3",
+    "imageName": "fire_pass_3.png",
+    "roiFront": "648,227,91,55",
+    "roiBack": "103,162,1077,416",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "description"
+  },
+  {
+    "itemName": "pass_4",
+    "imageName": "fire_pass_4.png",
+    "roiFront": "586,424,100,58",
+    "roiBack": "99,194,1080,398",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "description"
+  },
+  {
+    "itemName": "pass_5",
+    "imageName": "fire_pass_5.png",
+    "roiFront": "946,415,65,48",
+    "roiBack": "97,194,1036,398",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "箱子"
+  },
+  {
+    "itemName": "pass_6",
+    "imageName": "fire_pass_6.png",
+    "roiFront": "668,221,54,50",
+    "roiBack": "107,159,1012,394",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "印记"
+  },
+  {
+    "itemName": "pass_7",
+    "imageName": "fire_pass_7.png",
+    "roiFront": "329,233,51,51",
+    "roiBack": "95,180,1056,394",
+    "method": "Template matching",
+    "threshold": 0.65,
+    "description": "description"
+  },
+  {
+    "itemName": "pass_8",
+    "imageName": "fire_pass_8.png",
+    "roiFront": "579,276,100,100",
+    "roiBack": "577,296,100,100",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "印记选中间的"
+  },
+  {
+    "itemName": "pass_9",
+    "imageName": "fire_pass_9.png",
+    "roiFront": "558,643,160,44",
+    "roiBack": "480,601,306,100",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "description"
+  },
+  {
+    "itemName": "pass_10",
+    "imageName": "fire_pass_10.png",
+    "roiFront": "279,309,100,100",
+    "roiBack": "291,305,100,100",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "印记选左边的"
+  },
+  {
+    "itemName": "pass_11",
+    "imageName": "fire_pass_11.png",
+    "roiFront": "918,304,100,100",
+    "roiBack": "914,308,100,100",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "印记选右边的"
+  },
+  {
+    "itemName": "pass12",
+    "imageName": "fire_pass12.png",
+    "roiFront": "0,0,100,100",
+    "roiBack": "0,0,100,100",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "none"
   }
 ]

+ 38 - 4
tasks/ActivityShikigami/script_task.py

@@ -176,14 +176,48 @@ class ScriptTask(StateMachine, GameUi, BaseActivity, SwitchSoul, ActivityShikiga
         self.switch_soul(self.I_BATTLE_MAIN_TO_RECORDS, self.I_CHECK_BATTLE_MAIN)
 
         ocr_limit_timer = Timer(1).start()
+        click_limit_timer = Timer(4).start()
         while 1:
             self.screenshot()
             self.put_status()
-            ##
-            if self.appear_then_click(self.I_PASS_1, interval=4):
+            # --------------------------------------------------------------
+            if (self.appear_then_click(self.I_UI_CONFIRM, interval=0.5)
+                    or self.appear_then_click(self.I_UI_CONFIRM_SAMLL, interval=0.5)):
+                continue
+            if self.ui_reward_appear_click():
+                continue
+            # 领箱子
+            if self.appear_then_click(self.I_PASS_5):
+                logger.info('Found箱子')
                 continue
-            if self.appear_then_click(self.I_PASS_1, interval=4):
+            # 印记
+            if self.appear(self.I_PASS_6):
+                logger.info('Found印记')
+                click_index = 0
+                clicks = [self.I_PASS_8, self.I_PASS_10, self.I_PASS_11]
+                while 1:
+                    self.screenshot()
+                    if self.ui_reward_appear_click():
+                        break
+                    if self.appear_then_click(self.I_PASS_9):
+                        logger.info('Select one done')
+                        break
+                    # 按照顺序 间隔点击
+                    if self.click(clicks[click_index], interval=1):
+                        sleep(1)
+                        click_index += 1
+                        click_index = click_index % len(clicks)
+            # 下一层
+            if self.appear_then_click(self.I_PASS_7, interval=1):
+                logger.info('Next layer')
                 continue
+            if click_limit_timer.reached():
+                click_limit_timer.reset()
+                if (self.appear_then_click(self.I_PASS_1)
+                        or self.appear_then_click(self.I_PASS_2)
+                        or self.appear_then_click(self.I_PASS_3)
+                        or self.appear_then_click(self.I_PASS_4)):
+                    continue
             if not ocr_limit_timer.reached():
                 continue
             ocr_limit_timer.reset()
@@ -416,6 +450,6 @@ if __name__ == '__main__':
     d = Device(c)
     t = ScriptTask(c, d)
 
-    t.run()
+    t._run_pass()