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

doc[(your part)]: bugfix and optimization logic Task.DevRyouToppa(2023.11.26)
feat[(module name)]: Task.DevRyouToppa
perf[(module name)]: None
fix[(module name)]: Task.DevRyouToppa

zhaiyujia 3 лет назад
Родитель
Сommit
bc07a49336

+ 50 - 26
tasks/DevRyouToppa/assets.py

@@ -27,59 +27,83 @@ class DevRyouToppaAssets:
 	C_AREA_7 = RuleClick(roi_front=(538,557,149,71), roi_back=(538,557,149,71), name="area_7")
 	C_AREA_7 = RuleClick(roi_front=(538,557,149,71), roi_back=(538,557,149,71), name="area_7")
 	# area8 
 	# area8 
 	C_AREA_8 = RuleClick(roi_front=(876,562,150,67), roi_back=(876,562,150,67), name="area_8")
 	C_AREA_8 = RuleClick(roi_front=(876,562,150,67), roi_back=(876,562,150,67), name="area_8")
+	# 在点击进攻后如果未进入战斗画面则点击的安全区域 
+	C_SAFE_AREA = RuleClick(roi_front=(182,213,160,229), roi_back=(182,213,160,229), name="safe_area")
 
 
 
 
 	# Image Rule Assets
 	# Image Rule Assets
 	# 区域1攻略失败 
 	# 区域1攻略失败 
-	I_AREA_1_IS_FAILURE = RuleImage(roi_front=(673,146,63,32), roi_back=(421,138,325,123), threshold=0.8, method="Template matching", file="./tasks/DevRyouToppa/res/loser_sign_2.png")
+	I_AREA_1_IS_FAILURE = RuleImage(roi_front=(673,146,63,32), roi_back=(421,127,325,134), threshold=0.8, method="Template matching", file="./tasks/DevRyouToppa/res/loser_sign_1.png")
 	# 区域2攻略失败 
 	# 区域2攻略失败 
-	I_AREA_2_IS_FAILURE = RuleImage(roi_front=(1011,146,63,30), roi_back=(757,137,327,128), threshold=0.8, method="Template matching", file="./tasks/DevRyouToppa/res/loser_sign_2.png")
+	I_AREA_2_IS_FAILURE = RuleImage(roi_front=(1011,146,63,30), roi_back=(757,125,327,140), threshold=0.8, method="Template matching", file="./tasks/DevRyouToppa/res/loser_sign_1.png")
 	# 区域3攻略失败 
 	# 区域3攻略失败 
-	I_AREA_3_IS_FAILURE = RuleImage(roi_front=(665,283,73,40), roi_back=(419,271,327,127), threshold=0.8, method="Template matching", file="./tasks/DevRyouToppa/res/loser_sign_2.png")
+	I_AREA_3_IS_FAILURE = RuleImage(roi_front=(665,283,73,40), roi_back=(419,254,327,144), threshold=0.8, method="Template matching", file="./tasks/DevRyouToppa/res/loser_sign_1.png")
 	# 区域4攻略失败 
 	# 区域4攻略失败 
-	I_AREA_4_IS_FAILURE = RuleImage(roi_front=(1000,283,72,38), roi_back=(756,271,325,128), threshold=0.8, method="Template matching", file="./tasks/DevRyouToppa/res/loser_sign_2.png")
+	I_AREA_4_IS_FAILURE = RuleImage(roi_front=(1000,283,72,38), roi_back=(756,260,325,139), threshold=0.8, method="Template matching", file="./tasks/DevRyouToppa/res/loser_sign_1.png")
 	# 区域5攻略失败 
 	# 区域5攻略失败 
-	I_AREA_5_IS_FAILURE = RuleImage(roi_front=(669,419,65,29), roi_back=(418,406,328,128), threshold=0.8, method="Template matching", file="./tasks/DevRyouToppa/res/loser_sign_2.png")
+	I_AREA_5_IS_FAILURE = RuleImage(roi_front=(669,419,65,29), roi_back=(418,392,328,142), threshold=0.8, method="Template matching", file="./tasks/DevRyouToppa/res/loser_sign_1.png")
 	# 区域6攻略失败 
 	# 区域6攻略失败 
-	I_AREA_6_IS_FAILURE = RuleImage(roi_front=(988,416,84,37), roi_back=(755,405,328,131), threshold=0.8, method="Template matching", file="./tasks/DevRyouToppa/res/loser_sign_2.png")
+	I_AREA_6_IS_FAILURE = RuleImage(roi_front=(988,416,84,37), roi_back=(755,395,328,141), threshold=0.8, method="Template matching", file="./tasks/DevRyouToppa/res/loser_sign_1.png")
 	# 区域7攻略失败 
 	# 区域7攻略失败 
-	I_AREA_7_IS_FAILURE = RuleImage(roi_front=(672,556,61,37), roi_back=(420,543,326,114), threshold=0.8, method="Template matching", file="./tasks/DevRyouToppa/res/loser_sign_2.png")
+	I_AREA_7_IS_FAILURE = RuleImage(roi_front=(672,556,61,37), roi_back=(420,530,326,127), threshold=0.8, method="Template matching", file="./tasks/DevRyouToppa/res/loser_sign_1.png")
 	# 区域8攻略失败 
 	# 区域8攻略失败 
-	I_AREA_8_IS_FAILURE = RuleImage(roi_front=(1004,556,64,29), roi_back=(756,541,327,113), threshold=0.8, method="Template matching", file="./tasks/DevRyouToppa/res/loser_sign_2.png")
+	I_AREA_8_IS_FAILURE = RuleImage(roi_front=(1004,556,64,29), roi_back=(756,530,327,124), threshold=0.8, method="Template matching", file="./tasks/DevRyouToppa/res/loser_sign_1.png")
 	# 区域1攻略失败(最近一次) 
 	# 区域1攻略失败(最近一次) 
-	I_AREA_1_IS_FAILURE_NEW = RuleImage(roi_front=(673,146,63,32), roi_back=(421,138,325,123), threshold=0.8, method="Template matching", file="./tasks/DevRyouToppa/res/loser_sign_1.png")
+	I_AREA_1_IS_FAILURE_NEW = RuleImage(roi_front=(673,146,63,32), roi_back=(421,123,325,138), threshold=0.8, method="Template matching", file="./tasks/DevRyouToppa/res/loser_sign_2.png")
 	# 区域2攻略失败(最近一次) 
 	# 区域2攻略失败(最近一次) 
-	I_AREA_2_IS_FAILURE_NEW = RuleImage(roi_front=(1011,146,63,30), roi_back=(757,137,327,128), threshold=0.8, method="Template matching", file="./tasks/DevRyouToppa/res/loser_sign_1.png")
+	I_AREA_2_IS_FAILURE_NEW = RuleImage(roi_front=(1011,146,63,30), roi_back=(757,126,327,139), threshold=0.8, method="Template matching", file="./tasks/DevRyouToppa/res/loser_sign_2.png")
 	# 区域3攻略失败(最近一次) 
 	# 区域3攻略失败(最近一次) 
-	I_AREA_3_IS_FAILURE_NEW = RuleImage(roi_front=(665,283,73,40), roi_back=(419,271,327,127), threshold=0.8, method="Template matching", file="./tasks/DevRyouToppa/res/loser_sign_1.png")
+	I_AREA_3_IS_FAILURE_NEW = RuleImage(roi_front=(665,283,73,40), roi_back=(419,261,327,137), threshold=0.8, method="Template matching", file="./tasks/DevRyouToppa/res/loser_sign_2.png")
 	# 区4攻略失败(最近一次) 
 	# 区4攻略失败(最近一次) 
-	I_AREA_4_IS_FAILURE_NEW = RuleImage(roi_front=(1000,283,72,38), roi_back=(756,271,325,128), threshold=0.8, method="Template matching", file="./tasks/DevRyouToppa/res/loser_sign_1.png")
+	I_AREA_4_IS_FAILURE_NEW = RuleImage(roi_front=(1000,283,72,38), roi_back=(756,258,325,141), threshold=0.8, method="Template matching", file="./tasks/DevRyouToppa/res/loser_sign_2.png")
 	# 区域5攻略失败(最近一次) 
 	# 区域5攻略失败(最近一次) 
-	I_AREA_5_IS_FAILURE_NEW = RuleImage(roi_front=(669,419,65,29), roi_back=(418,406,328,128), threshold=0.8, method="Template matching", file="./tasks/DevRyouToppa/res/loser_sign_1.png")
+	I_AREA_5_IS_FAILURE_NEW = RuleImage(roi_front=(669,419,65,29), roi_back=(418,394,328,140), threshold=0.8, method="Template matching", file="./tasks/DevRyouToppa/res/loser_sign_2.png")
 	# 区域6攻略失败(最近一次) 
 	# 区域6攻略失败(最近一次) 
-	I_AREA_6_IS_FAILURE_NEW = RuleImage(roi_front=(988,416,84,37), roi_back=(755,405,328,131), threshold=0.8, method="Template matching", file="./tasks/DevRyouToppa/res/loser_sign_1.png")
+	I_AREA_6_IS_FAILURE_NEW = RuleImage(roi_front=(988,416,84,37), roi_back=(755,395,328,141), threshold=0.8, method="Template matching", file="./tasks/DevRyouToppa/res/loser_sign_2.png")
 	# 区域7攻略失败(最近一次) 
 	# 区域7攻略失败(最近一次) 
-	I_AREA_7_IS_FAILURE_NEW = RuleImage(roi_front=(672,556,61,37), roi_back=(420,543,326,114), threshold=0.8, method="Template matching", file="./tasks/DevRyouToppa/res/loser_sign_1.png")
+	I_AREA_7_IS_FAILURE_NEW = RuleImage(roi_front=(672,556,61,37), roi_back=(420,533,326,124), threshold=0.8, method="Template matching", file="./tasks/DevRyouToppa/res/loser_sign_2.png")
 	# 区域8攻略失败(最近一次) 
 	# 区域8攻略失败(最近一次) 
-	I_AREA_8_IS_FAILURE_NEW = RuleImage(roi_front=(1004,556,64,29), roi_back=(756,541,327,113), threshold=0.8, method="Template matching", file="./tasks/DevRyouToppa/res/loser_sign_1.png")
-	# description 
-	I_TOPPA_RECORD = RuleImage(roi_front=(66,628,64,39), roi_back=(66,628,64,39), threshold=0.8, method="Template matching", file="./tasks/DevRyouToppa/res/res_toppa_record.png")
+	I_AREA_8_IS_FAILURE_NEW = RuleImage(roi_front=(1004,556,64,29), roi_back=(756,532,327,122), threshold=0.8, method="Template matching", file="./tasks/DevRyouToppa/res/loser_sign_2.png")
+
+
+	# Image Rule Assets
 	# 区域1已攻破 
 	# 区域1已攻破 
-	I_AREA_1_FINISHED = RuleImage(roi_front=(658,141,93,91), roi_back=(658,141,93,91), threshold=0.8, method="Template matching", file="./tasks/DevRyouToppa/res/finished.png")
+	I_AREA_1_FINISHED = RuleImage(roi_front=(658,141,93,91), roi_back=(421,127,325,134), threshold=0.8, method="Template matching", file="./tasks/DevRyouToppa/res/finished_1.png")
 	# 区域2已攻破 
 	# 区域2已攻破 
-	I_AREA_2_FINISHED = RuleImage(roi_front=(983,137,100,100), roi_back=(983,137,100,100), threshold=0.8, method="Template matching", file="./tasks/DevRyouToppa/res/finished.png")
+	I_AREA_2_FINISHED = RuleImage(roi_front=(983,137,100,100), roi_back=(757,125,327,140), threshold=0.8, method="Template matching", file="./tasks/DevRyouToppa/res/finished_1.png")
 	# 区域3已攻破 
 	# 区域3已攻破 
-	I_AREA_3_FINISHED = RuleImage(roi_front=(650,270,100,100), roi_back=(650,270,100,100), threshold=0.8, method="Template matching", file="./tasks/DevRyouToppa/res/finished.png")
+	I_AREA_3_FINISHED = RuleImage(roi_front=(681,312,47,37), roi_back=(419,254,327,144), threshold=0.8, method="Template matching", file="./tasks/DevRyouToppa/res/finished_1.png")
 	# 区域4已攻破 
 	# 区域4已攻破 
-	I_AREA_4_FINISHED = RuleImage(roi_front=(996,271,100,100), roi_back=(996,271,100,100), threshold=0.8, method="Template matching", file="./tasks/DevRyouToppa/res/finished.png")
+	I_AREA_4_FINISHED = RuleImage(roi_front=(996,271,100,100), roi_back=(756,260,325,139), threshold=0.8, method="Template matching", file="./tasks/DevRyouToppa/res/finished_1.png")
 	# 区域5已攻破 
 	# 区域5已攻破 
-	I_AREA_5_FINISHED = RuleImage(roi_front=(647,404,100,100), roi_back=(647,404,100,100), threshold=0.8, method="Template matching", file="./tasks/DevRyouToppa/res/finished.png")
+	I_AREA_5_FINISHED = RuleImage(roi_front=(647,404,100,100), roi_back=(418,392,328,142), threshold=0.8, method="Template matching", file="./tasks/DevRyouToppa/res/finished_1.png")
 	# 区域6已攻破 
 	# 区域6已攻破 
-	I_AREA_6_FINISHED = RuleImage(roi_front=(982,403,100,100), roi_back=(982,403,100,100), threshold=0.8, method="Template matching", file="./tasks/DevRyouToppa/res/finished.png")
+	I_AREA_6_FINISHED = RuleImage(roi_front=(1015,448,56,35), roi_back=(755,395,328,141), threshold=0.8, method="Template matching", file="./tasks/DevRyouToppa/res/finished_1.png")
 	# 区域7已攻破 
 	# 区域7已攻破 
-	I_AREA_7_FINISHED = RuleImage(roi_front=(643,543,100,100), roi_back=(643,543,100,100), threshold=0.8, method="Template matching", file="./tasks/DevRyouToppa/res/finished.png")
+	I_AREA_7_FINISHED = RuleImage(roi_front=(643,543,100,100), roi_back=(420,530,326,127), threshold=0.8, method="Template matching", file="./tasks/DevRyouToppa/res/finished_1.png")
 	# 区域8已攻破 
 	# 区域8已攻破 
-	I_AREA_8_FINISHED = RuleImage(roi_front=(983,541,100,100), roi_back=(983,541,100,100), threshold=0.8, method="Template matching", file="./tasks/DevRyouToppa/res/finished.png")
+	I_AREA_8_FINISHED = RuleImage(roi_front=(983,541,100,100), roi_back=(756,530,327,124), threshold=0.8, method="Template matching", file="./tasks/DevRyouToppa/res/finished_1.png")
+	# 区域1已攻破新 
+	I_AREA_1_FINISHED_NEW = RuleImage(roi_front=(658,141,93,91), roi_back=(421,127,325,134), threshold=0.8, method="Template matching", file="./tasks/DevRyouToppa/res/finished_2.png")
+	# 区域2已攻破新 
+	I_AREA_2_FINISHED_NEW = RuleImage(roi_front=(983,137,100,100), roi_back=(757,125,327,140), threshold=0.8, method="Template matching", file="./tasks/DevRyouToppa/res/finished_2.png")
+	# 区域3已攻破新 
+	I_AREA_3_FINISHED_NEW = RuleImage(roi_front=(681,312,47,37), roi_back=(419,254,327,144), threshold=0.8, method="Template matching", file="./tasks/DevRyouToppa/res/finished_2.png")
+	# 区域4已攻破新 
+	I_AREA_4_FINISHED_NEW = RuleImage(roi_front=(996,271,100,100), roi_back=(756,260,325,139), threshold=0.8, method="Template matching", file="./tasks/DevRyouToppa/res/finished_2.png")
+	# 区域5已攻破新 
+	I_AREA_5_FINISHED_NEW = RuleImage(roi_front=(647,404,100,100), roi_back=(418,392,328,142), threshold=0.8, method="Template matching", file="./tasks/DevRyouToppa/res/finished_2.png")
+	# 区域6已攻破新 
+	I_AREA_6_FINISHED_NEW = RuleImage(roi_front=(1015,448,56,35), roi_back=(755,395,328,141), threshold=0.8, method="Template matching", file="./tasks/DevRyouToppa/res/finished_2.png")
+	# 区域7已攻破新 
+	I_AREA_7_FINISHED_NEW = RuleImage(roi_front=(643,543,100,100), roi_back=(420,530,326,127), threshold=0.8, method="Template matching", file="./tasks/DevRyouToppa/res/finished_2.png")
+	# 区域8已攻破新 
+	I_AREA_8_FINISHED_NEW = RuleImage(roi_front=(983,541,100,100), roi_back=(756,530,327,124), threshold=0.8, method="Template matching", file="./tasks/DevRyouToppa/res/finished_2.png")
+
+
+	# Image Rule Assets
+	# description 
+	I_TOPPA_RECORD = RuleImage(roi_front=(66,628,64,39), roi_back=(66,628,64,39), threshold=0.8, method="Template matching", file="./tasks/DevRyouToppa/res/res_toppa_record.png")
 
 
 
 
 	# Ocr Rule Assets
 	# Ocr Rule Assets

+ 6 - 0
tasks/DevRyouToppa/res/click.json

@@ -46,5 +46,11 @@
     "roiFront": "876,562,150,67",
     "roiFront": "876,562,150,67",
     "roiBack": "876,562,150,67",
     "roiBack": "876,562,150,67",
     "description": "area8"
     "description": "area8"
+  },
+  {
+    "itemName": "safe_area",
+    "roiFront": "182,213,160,229",
+    "roiBack": "182,213,160,229",
+    "description": "在点击进攻后如果未进入战斗画面则点击的安全区域"
   }
   }
 ]
 ]

+ 146 - 0
tasks/DevRyouToppa/res/failure.json

@@ -0,0 +1,146 @@
+[
+  {
+    "itemName": "area_1_is_failure",
+    "imageName": "loser_sign_1.png",
+    "roiFront": "673,146,63,32",
+    "roiBack": "421,127,325,134",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "区域1攻略失败"
+  },
+  {
+    "itemName": "area_2_is_failure",
+    "imageName": "loser_sign_1.png",
+    "roiFront": "1011,146,63,30",
+    "roiBack": "757,125,327,140",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "区域2攻略失败"
+  },
+  {
+    "itemName": "area_3_is_failure",
+    "imageName": "loser_sign_1.png",
+    "roiFront": "665,283,73,40",
+    "roiBack": "419,254,327,144",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "区域3攻略失败"
+  },
+  {
+    "itemName": "area_4_is_failure",
+    "imageName": "loser_sign_1.png",
+    "roiFront": "1000,283,72,38",
+    "roiBack": "756,260,325,139",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "区域4攻略失败"
+  },
+  {
+    "itemName": "area_5_is_failure",
+    "imageName": "loser_sign_1.png",
+    "roiFront": "669,419,65,29",
+    "roiBack": "418,392,328,142",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "区域5攻略失败"
+  },
+  {
+    "itemName": "area_6_is_failure",
+    "imageName": "loser_sign_1.png",
+    "roiFront": "988,416,84,37",
+    "roiBack": "755,395,328,141",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "区域6攻略失败"
+  },
+  {
+    "itemName": "area_7_is_failure",
+    "imageName": "loser_sign_1.png",
+    "roiFront": "672,556,61,37",
+    "roiBack": "420,530,326,127",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "区域7攻略失败"
+  },
+  {
+    "itemName": "area_8_is_failure",
+    "imageName": "loser_sign_1.png",
+    "roiFront": "1004,556,64,29",
+    "roiBack": "756,530,327,124",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "区域8攻略失败"
+  },
+  {
+    "itemName": "area_1_is_failure_new",
+    "imageName": "loser_sign_2.png",
+    "roiFront": "673,146,63,32",
+    "roiBack": "421,123,325,138",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "区域1攻略失败(最近一次)"
+  },
+  {
+    "itemName": "area_2_is_failure_new",
+    "imageName": "loser_sign_2.png",
+    "roiFront": "1011,146,63,30",
+    "roiBack": "757,126,327,139",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "区域2攻略失败(最近一次)"
+  },
+  {
+    "itemName": "area_3_is_failure_new",
+    "imageName": "loser_sign_2.png",
+    "roiFront": "665,283,73,40",
+    "roiBack": "419,261,327,137",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "区域3攻略失败(最近一次)"
+  },
+  {
+    "itemName": "area_4_is_failure_new",
+    "imageName": "loser_sign_2.png",
+    "roiFront": "1000,283,72,38",
+    "roiBack": "756,258,325,141",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "区4攻略失败(最近一次)"
+  },
+  {
+    "itemName": "area_5_is_failure_new",
+    "imageName": "loser_sign_2.png",
+    "roiFront": "669,419,65,29",
+    "roiBack": "418,394,328,140",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "区域5攻略失败(最近一次)"
+  },
+  {
+    "itemName": "area_6_is_failure_new",
+    "imageName": "loser_sign_2.png",
+    "roiFront": "988,416,84,37",
+    "roiBack": "755,395,328,141",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "区域6攻略失败(最近一次)"
+  },
+  {
+    "itemName": "area_7_is_failure_new",
+    "imageName": "loser_sign_2.png",
+    "roiFront": "672,556,61,37",
+    "roiBack": "420,533,326,124",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "区域7攻略失败(最近一次)"
+  },
+  {
+    "itemName": "area_8_is_failure_new",
+    "imageName": "loser_sign_2.png",
+    "roiFront": "1004,556,64,29",
+    "roiBack": "756,532,327,122",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "区域8攻略失败(最近一次)"
+  }
+]

+ 146 - 0
tasks/DevRyouToppa/res/finished.json

@@ -0,0 +1,146 @@
+[
+  {
+    "itemName": "area_1_finished",
+    "imageName": "finished_1.png",
+    "roiFront": "658,141,93,91",
+    "roiBack": "421,127,325,134",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "区域1已攻破"
+  },
+  {
+    "itemName": "area_2_finished",
+    "imageName": "finished_1.png",
+    "roiFront": "983,137,100,100",
+    "roiBack": "757,125,327,140",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "区域2已攻破"
+  },
+  {
+    "itemName": "area_3_finished",
+    "imageName": "finished_1.png",
+    "roiFront": "681,312,47,37",
+    "roiBack": "419,254,327,144",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "区域3已攻破"
+  },
+  {
+    "itemName": "area_4_finished",
+    "imageName": "finished_1.png",
+    "roiFront": "996,271,100,100",
+    "roiBack": "756,260,325,139",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "区域4已攻破"
+  },
+  {
+    "itemName": "area_5_finished",
+    "imageName": "finished_1.png",
+    "roiFront": "647,404,100,100",
+    "roiBack": "418,392,328,142",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "区域5已攻破"
+  },
+  {
+    "itemName": "area_6_finished",
+    "imageName": "finished_1.png",
+    "roiFront": "1015,448,56,35",
+    "roiBack": "755,395,328,141",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "区域6已攻破"
+  },
+  {
+    "itemName": "area_7_finished",
+    "imageName": "finished_1.png",
+    "roiFront": "643,543,100,100",
+    "roiBack": "420,530,326,127",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "区域7已攻破"
+  },
+  {
+    "itemName": "area_8_finished",
+    "imageName": "finished_1.png",
+    "roiFront": "983,541,100,100",
+    "roiBack": "756,530,327,124",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "区域8已攻破"
+  },
+  {
+    "itemName": "area_1_finished_new",
+    "imageName": "finished_2.png",
+    "roiFront": "658,141,93,91",
+    "roiBack": "421,127,325,134",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "区域1已攻破新"
+  },
+  {
+    "itemName": "area_2_finished_new",
+    "imageName": "finished_2.png",
+    "roiFront": "983,137,100,100",
+    "roiBack": "757,125,327,140",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "区域2已攻破新"
+  },
+  {
+    "itemName": "area_3_finished_new",
+    "imageName": "finished_2.png",
+    "roiFront": "681,312,47,37",
+    "roiBack": "419,254,327,144",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "区域3已攻破新"
+  },
+  {
+    "itemName": "area_4_finished_new",
+    "imageName": "finished_2.png",
+    "roiFront": "996,271,100,100",
+    "roiBack": "756,260,325,139",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "区域4已攻破新"
+  },
+  {
+    "itemName": "area_5_finished_new",
+    "imageName": "finished_2.png",
+    "roiFront": "647,404,100,100",
+    "roiBack": "418,392,328,142",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "区域5已攻破新"
+  },
+  {
+    "itemName": "area_6_finished_new",
+    "imageName": "finished_2.png",
+    "roiFront": "1015,448,56,35",
+    "roiBack": "755,395,328,141",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "区域6已攻破新"
+  },
+  {
+    "itemName": "area_7_finished_new",
+    "imageName": "finished_2.png",
+    "roiFront": "643,543,100,100",
+    "roiBack": "420,530,326,127",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "区域7已攻破新"
+  },
+  {
+    "itemName": "area_8_finished_new",
+    "imageName": "finished_2.png",
+    "roiFront": "983,541,100,100",
+    "roiBack": "756,530,327,124",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "区域8已攻破新"
+  }
+]

BIN
tasks/DevRyouToppa/res/finished.png


BIN
tasks/DevRyouToppa/res/finished_1.png


BIN
tasks/DevRyouToppa/res/finished_2.png


+ 0 - 216
tasks/DevRyouToppa/res/image.json

@@ -1,148 +1,4 @@
 [
 [
-  {
-    "itemName": "area_1_is_failure",
-    "imageName": "loser_sign_2.png",
-    "roiFront": "673,146,63,32",
-    "roiBack": "421,138,325,123",
-    "method": "Template matching",
-    "threshold": 0.8,
-    "description": "区域1攻略失败"
-  },
-  {
-    "itemName": "area_2_is_failure",
-    "imageName": "loser_sign_2.png",
-    "roiFront": "1011,146,63,30",
-    "roiBack": "757,137,327,128",
-    "method": "Template matching",
-    "threshold": 0.8,
-    "description": "区域2攻略失败"
-  },
-  {
-    "itemName": "area_3_is_failure",
-    "imageName": "loser_sign_2.png",
-    "roiFront": "665,283,73,40",
-    "roiBack": "419,271,327,127",
-    "method": "Template matching",
-    "threshold": 0.8,
-    "description": "区域3攻略失败"
-  },
-  {
-    "itemName": "area_4_is_failure",
-    "imageName": "loser_sign_2.png",
-    "roiFront": "1000,283,72,38",
-    "roiBack": "756,271,325,128",
-    "method": "Template matching",
-    "threshold": 0.8,
-    "description": "区域4攻略失败"
-  },
-  {
-    "itemName": "area_5_is_failure",
-    "imageName": "loser_sign_2.png",
-    "roiFront": "669,419,65,29",
-    "roiBack": "418,406,328,128",
-    "method": "Template matching",
-    "threshold": 0.8,
-    "description": "区域5攻略失败"
-  },
-  {
-    "itemName": "area_6_is_failure",
-    "imageName": "loser_sign_2.png",
-    "roiFront": "988,416,84,37",
-    "roiBack": "755,405,328,131",
-    "method": "Template matching",
-    "threshold": 0.8,
-    "description": "区域6攻略失败"
-  },
-  {
-    "itemName": "area_7_is_failure",
-    "imageName": "loser_sign_2.png",
-    "roiFront": "672,556,61,37",
-    "roiBack": "420,543,326,114",
-    "method": "Template matching",
-    "threshold": 0.8,
-    "description": "区域7攻略失败"
-  },
-  {
-    "itemName": "area_8_is_failure",
-    "imageName": "loser_sign_2.png",
-    "roiFront": "1004,556,64,29",
-    "roiBack": "756,541,327,113",
-    "method": "Template matching",
-    "threshold": 0.8,
-    "description": "区域8攻略失败"
-  },
-  {
-    "itemName": "area_1_is_failure_new",
-    "imageName": "loser_sign_1.png",
-    "roiFront": "673,146,63,32",
-    "roiBack": "421,138,325,123",
-    "method": "Template matching",
-    "threshold": 0.8,
-    "description": "区域1攻略失败(最近一次)"
-  },
-  {
-    "itemName": "area_2_is_failure_new",
-    "imageName": "loser_sign_1.png",
-    "roiFront": "1011,146,63,30",
-    "roiBack": "757,137,327,128",
-    "method": "Template matching",
-    "threshold": 0.8,
-    "description": "区域2攻略失败(最近一次)"
-  },
-  {
-    "itemName": "area_3_is_failure_new",
-    "imageName": "loser_sign_1.png",
-    "roiFront": "665,283,73,40",
-    "roiBack": "419,271,327,127",
-    "method": "Template matching",
-    "threshold": 0.8,
-    "description": "区域3攻略失败(最近一次)"
-  },
-  {
-    "itemName": "area_4_is_failure_new",
-    "imageName": "loser_sign_1.png",
-    "roiFront": "1000,283,72,38",
-    "roiBack": "756,271,325,128",
-    "method": "Template matching",
-    "threshold": 0.8,
-    "description": "区4攻略失败(最近一次)"
-  },
-  {
-    "itemName": "area_5_is_failure_new",
-    "imageName": "loser_sign_1.png",
-    "roiFront": "669,419,65,29",
-    "roiBack": "418,406,328,128",
-    "method": "Template matching",
-    "threshold": 0.8,
-    "description": "区域5攻略失败(最近一次)"
-  },
-  {
-    "itemName": "area_6_is_failure_new",
-    "imageName": "loser_sign_1.png",
-    "roiFront": "988,416,84,37",
-    "roiBack": "755,405,328,131",
-    "method": "Template matching",
-    "threshold": 0.8,
-    "description": "区域6攻略失败(最近一次)"
-  },
-  {
-    "itemName": "area_7_is_failure_new",
-    "imageName": "loser_sign_1.png",
-    "roiFront": "672,556,61,37",
-    "roiBack": "420,543,326,114",
-    "method": "Template matching",
-    "threshold": 0.8,
-    "description": "区域7攻略失败(最近一次)"
-  },
-  {
-    "itemName": "area_8_is_failure_new",
-    "imageName": "loser_sign_1.png",
-    "roiFront": "1004,556,64,29",
-    "roiBack": "756,541,327,113",
-    "method": "Template matching",
-    "threshold": 0.8,
-    "description": "区域8攻略失败(最近一次)"
-  },
   {
   {
     "itemName": "toppa_record",
     "itemName": "toppa_record",
     "imageName": "res_toppa_record.png",
     "imageName": "res_toppa_record.png",
@@ -151,77 +7,5 @@
     "method": "Template matching",
     "method": "Template matching",
     "threshold": 0.8,
     "threshold": 0.8,
     "description": "description"
     "description": "description"
-  },
-  {
-    "itemName": "area_1_finished",
-    "imageName": "finished.png",
-    "roiFront": "658,141,93,91",
-    "roiBack": "658,141,93,91",
-    "method": "Template matching",
-    "threshold": 0.8,
-    "description": "区域1已攻破"
-  },
-  {
-    "itemName": "area_2_finished",
-    "imageName": "finished.png",
-    "roiFront": "983,137,100,100",
-    "roiBack": "983,137,100,100",
-    "method": "Template matching",
-    "threshold": 0.8,
-    "description": "区域2已攻破"
-  },
-  {
-    "itemName": "area_3_finished",
-    "imageName": "finished.png",
-    "roiFront": "650,270,100,100",
-    "roiBack": "650,270,100,100",
-    "method": "Template matching",
-    "threshold": 0.8,
-    "description": "区域3已攻破"
-  },
-  {
-    "itemName": "area_4_finished",
-    "imageName": "finished.png",
-    "roiFront": "996,271,100,100",
-    "roiBack": "996,271,100,100",
-    "method": "Template matching",
-    "threshold": 0.8,
-    "description": "区域4已攻破"
-  },
-  {
-    "itemName": "area_5_finished",
-    "imageName": "finished.png",
-    "roiFront": "647,404,100,100",
-    "roiBack": "647,404,100,100",
-    "method": "Template matching",
-    "threshold": 0.8,
-    "description": "区域5已攻破"
-  },
-  {
-    "itemName": "area_6_finished",
-    "imageName": "finished.png",
-    "roiFront": "982,403,100,100",
-    "roiBack": "982,403,100,100",
-    "method": "Template matching",
-    "threshold": 0.8,
-    "description": "区域6已攻破"
-  },
-  {
-    "itemName": "area_7_finished",
-    "imageName": "finished.png",
-    "roiFront": "643,543,100,100",
-    "roiBack": "643,543,100,100",
-    "method": "Template matching",
-    "threshold": 0.8,
-    "description": "区域7已攻破"
-  },
-  {
-    "itemName": "area_8_finished",
-    "imageName": "finished.png",
-    "roiFront": "983,541,100,100",
-    "roiBack": "983,541,100,100",
-    "method": "Template matching",
-    "threshold": 0.8,
-    "description": "区域8已攻破"
   }
   }
 ]
 ]

BIN
tasks/DevRyouToppa/res/res_new.png


+ 53 - 78
tasks/DevRyouToppa/script_task.py

@@ -2,7 +2,7 @@
 
 
 import time
 import time
 import random
 import random
-from datetime import datetime
+from datetime import datetime, timedelta
 from module.base.utils import point2str
 from module.base.utils import point2str
 from module.exception import TaskEnd
 from module.exception import TaskEnd
 from tasks.Component.SwitchSoul.switch_soul import SwitchSoul
 from tasks.Component.SwitchSoul.switch_soul import SwitchSoul
@@ -11,7 +11,6 @@ from tasks.GameUi.game_ui import GameUi
 from tasks.GameUi.page import page_kekkai_toppa
 from tasks.GameUi.page import page_kekkai_toppa
 from tasks.RealmRaid.assets import RealmRaidAssets
 from tasks.RealmRaid.assets import RealmRaidAssets
 from tasks.DevRyouToppa.assets import DevRyouToppaAssets
 from tasks.DevRyouToppa.assets import DevRyouToppaAssets
-from tasks.RyouToppa.assets import RyouToppaAssets
 from module.atom.image_grid import ImageGrid
 from module.atom.image_grid import ImageGrid
 from module.logger import logger
 from module.logger import logger
 from tasks.Secret.assets import SecretAssets
 from tasks.Secret.assets import SecretAssets
@@ -21,42 +20,42 @@ area_map = (
     {
     {
         "fail_sign": (DevRyouToppaAssets.I_AREA_1_IS_FAILURE_NEW, DevRyouToppaAssets.I_AREA_1_IS_FAILURE),
         "fail_sign": (DevRyouToppaAssets.I_AREA_1_IS_FAILURE_NEW, DevRyouToppaAssets.I_AREA_1_IS_FAILURE),
         "rule_click": DevRyouToppaAssets.C_AREA_1,
         "rule_click": DevRyouToppaAssets.C_AREA_1,
-        "finished_sign": DevRyouToppaAssets.I_AREA_1_FINISHED
+        "finished_sign": (DevRyouToppaAssets.I_AREA_1_FINISHED, DevRyouToppaAssets.I_AREA_1_FINISHED_NEW)
     },
     },
     {
     {
         "fail_sign": (DevRyouToppaAssets.I_AREA_2_IS_FAILURE_NEW, DevRyouToppaAssets.I_AREA_2_IS_FAILURE),
         "fail_sign": (DevRyouToppaAssets.I_AREA_2_IS_FAILURE_NEW, DevRyouToppaAssets.I_AREA_2_IS_FAILURE),
         "rule_click": DevRyouToppaAssets.C_AREA_2,
         "rule_click": DevRyouToppaAssets.C_AREA_2,
-        "finished_sign": DevRyouToppaAssets.I_AREA_2_FINISHED
+        "finished_sign": (DevRyouToppaAssets.I_AREA_2_FINISHED, DevRyouToppaAssets.I_AREA_2_FINISHED_NEW)
     },
     },
     {
     {
         "fail_sign": (DevRyouToppaAssets.I_AREA_3_IS_FAILURE_NEW, DevRyouToppaAssets.I_AREA_3_IS_FAILURE),
         "fail_sign": (DevRyouToppaAssets.I_AREA_3_IS_FAILURE_NEW, DevRyouToppaAssets.I_AREA_3_IS_FAILURE),
         "rule_click": DevRyouToppaAssets.C_AREA_3,
         "rule_click": DevRyouToppaAssets.C_AREA_3,
-        "finished_sign": DevRyouToppaAssets.I_AREA_3_FINISHED
+        "finished_sign": (DevRyouToppaAssets.I_AREA_3_FINISHED, DevRyouToppaAssets.I_AREA_3_FINISHED_NEW)
     },
     },
     {
     {
         "fail_sign": (DevRyouToppaAssets.I_AREA_4_IS_FAILURE_NEW, DevRyouToppaAssets.I_AREA_4_IS_FAILURE),
         "fail_sign": (DevRyouToppaAssets.I_AREA_4_IS_FAILURE_NEW, DevRyouToppaAssets.I_AREA_4_IS_FAILURE),
         "rule_click": DevRyouToppaAssets.C_AREA_4,
         "rule_click": DevRyouToppaAssets.C_AREA_4,
-        "finished_sign": DevRyouToppaAssets.I_AREA_4_FINISHED
+        "finished_sign": (DevRyouToppaAssets.I_AREA_4_FINISHED, DevRyouToppaAssets.I_AREA_4_FINISHED_NEW)
     },
     },
     {
     {
         "fail_sign": (DevRyouToppaAssets.I_AREA_5_IS_FAILURE_NEW, DevRyouToppaAssets.I_AREA_5_IS_FAILURE),
         "fail_sign": (DevRyouToppaAssets.I_AREA_5_IS_FAILURE_NEW, DevRyouToppaAssets.I_AREA_5_IS_FAILURE),
         "rule_click": DevRyouToppaAssets.C_AREA_5,
         "rule_click": DevRyouToppaAssets.C_AREA_5,
-        "finished_sign": DevRyouToppaAssets.I_AREA_5_FINISHED
+        "finished_sign": (DevRyouToppaAssets.I_AREA_5_FINISHED, DevRyouToppaAssets.I_AREA_5_FINISHED_NEW)
     },
     },
     {
     {
         "fail_sign": (DevRyouToppaAssets.I_AREA_6_IS_FAILURE_NEW, DevRyouToppaAssets.I_AREA_6_IS_FAILURE),
         "fail_sign": (DevRyouToppaAssets.I_AREA_6_IS_FAILURE_NEW, DevRyouToppaAssets.I_AREA_6_IS_FAILURE),
         "rule_click": DevRyouToppaAssets.C_AREA_6,
         "rule_click": DevRyouToppaAssets.C_AREA_6,
-        "finished_sign": DevRyouToppaAssets.I_AREA_6_FINISHED
+        "finished_sign": (DevRyouToppaAssets.I_AREA_6_FINISHED, DevRyouToppaAssets.I_AREA_6_FINISHED_NEW)
     },
     },
     {
     {
         "fail_sign": (DevRyouToppaAssets.I_AREA_7_IS_FAILURE_NEW, DevRyouToppaAssets.I_AREA_7_IS_FAILURE),
         "fail_sign": (DevRyouToppaAssets.I_AREA_7_IS_FAILURE_NEW, DevRyouToppaAssets.I_AREA_7_IS_FAILURE),
         "rule_click": DevRyouToppaAssets.C_AREA_7,
         "rule_click": DevRyouToppaAssets.C_AREA_7,
-        "finished_sign": DevRyouToppaAssets.I_AREA_7_FINISHED
+        "finished_sign": (DevRyouToppaAssets.I_AREA_7_FINISHED, DevRyouToppaAssets.I_AREA_7_FINISHED_NEW)
     },
     },
     {
     {
         "fail_sign": (DevRyouToppaAssets.I_AREA_8_IS_FAILURE_NEW, DevRyouToppaAssets.I_AREA_8_IS_FAILURE),
         "fail_sign": (DevRyouToppaAssets.I_AREA_8_IS_FAILURE_NEW, DevRyouToppaAssets.I_AREA_8_IS_FAILURE),
         "rule_click": DevRyouToppaAssets.C_AREA_8,
         "rule_click": DevRyouToppaAssets.C_AREA_8,
-        "finished_sign": DevRyouToppaAssets.I_AREA_8_FINISHED
+        "finished_sign": (DevRyouToppaAssets.I_AREA_8_FINISHED, DevRyouToppaAssets.I_AREA_8_FINISHED_NEW)
     }
     }
 )
 )
 
 
@@ -78,51 +77,29 @@ class ScriptTask(GeneralBattle, GameUi, SwitchSoul, DevRyouToppaAssets):
         执行
         执行
         :return:
         :return:
         """
         """
-
         options = self.config.dev_ryou_toppa
         options = self.config.dev_ryou_toppa
         self.ui_get_current_page()
         self.ui_get_current_page()
         self.ui_goto(page_kekkai_toppa)
         self.ui_goto(page_kekkai_toppa)
 
 
-        # 判断阴阳寮是否攻破
-        while True:
-            self.screenshot()
-            if self.appear(RyouToppaAssets.I_RYOU_REWARD_90, threshold=0.8):
-                self.exit()
-            if self.appear(RyouToppaAssets.I_RYOU_REWARD, threshold=0.8):
-                break
-
+        # 确认进入结界突破界面
+        self.wait_until_appear(self.I_TOPPA_RECORD)
         if not self.area_index:
         if not self.area_index:
             self.area_index.extend(default_index)
             self.area_index.extend(default_index)
-
-        index = self.get_available_area()
+        index = 0
 
 
         # 开始突破
         # 开始突破
         while True:
         while True:
-            win = self.attack_area(index)
-            delay = random_delay()
-            time.sleep(delay)
-            if not win:
+            res = self.attack_area(index)
+            # 如果战斗失败或区域不可用,则弹出当前区域索引,开始进攻下一个
+            if not res:
                 try:
                 try:
-                    idx = self.area_index.index(index)
-                    index = self.area_index[idx + 1]
+                    self.area_index.pop(0)
+                    index = self.area_index[0]
                 except IndexError:
                 except IndexError:
+                    # 每次出现 IndexError 说明8个区域都不可用,需要滚动列表。
+                    self.area_index.extend(default_index)
                     self.flush_area_cache()
                     self.flush_area_cache()
-                    index = self.get_available_area()
-
-    def get_available_area(self):
-        """
-        判断突破区域(忽略失败的目标)
-        :return: index
-        """
-        while True:
-            try:
-                index = self.area_index[0]
-                if self.check_area(index):
-                    return index
-                self.area_index.pop(0)
-            except IndexError:
-                # 如果当前页面所有结界都攻破失败,则刷新结界列表。
-                self.flush_area_cache()
+                    index = 0
 
 
     def check_area(self, index: int):
     def check_area(self, index: int):
         """
         """
@@ -130,13 +107,13 @@ class ScriptTask(GeneralBattle, GameUi, SwitchSoul, DevRyouToppaAssets):
         :return:
         :return:
         """
         """
         f1, f2 = area_map[index].get("fail_sign")
         f1, f2 = area_map[index].get("fail_sign")
-        f3 = area_map[index].get("finished_sign")
+        f3, f4 = area_map[index].get("finished_sign")
         self.screenshot()
         self.screenshot()
         # 如果该区域已经被攻破则退出
         # 如果该区域已经被攻破则退出
-        # Ps: 这时候能打过的都打过了,没有能攻打的结界了
-        if self.appear(f3):
-            self.exit()
-
+        # Ps: 这时候能打过的都打过了,没有能攻打的结界了, 代表任务已经完成,set_next_run time=1d
+        if self.appear(f3, threshold=0.8) or self.appear(f4, threshold=0.8):
+            self.set_next_run(task='DevRyouToppa', finish=True, success=True)
+            raise TaskEnd
         # 如果该区域攻略失败返回 False
         # 如果该区域攻略失败返回 False
         if self.appear(f1, threshold=0.8) or self.appear(f2, threshold=0.8):
         if self.appear(f1, threshold=0.8) or self.appear(f2, threshold=0.8):
             logger.info('Area [%s] is futile attack, skip.' % str(index + 1))
             logger.info('Area [%s] is futile attack, skip.' % str(index + 1))
@@ -145,25 +122,24 @@ class ScriptTask(GeneralBattle, GameUi, SwitchSoul, DevRyouToppaAssets):
 
 
     def attack_area(self, index: int):
     def attack_area(self, index: int):
         """
         """
-        检查该区域是否攻略失败
-        :return: 战斗成功(True) 或 战斗失败(False)
+        :return: 战斗成功(True) or 战斗失败(False) or 区域不可用(False) or 没有进攻机会(设定下次运行并退出)
         """
         """
-        while True:
-            if self.has_ticket():
-                break
-            time.sleep(60)
-        self.screenshot()
-        if not self.appear(self.I_TOPPA_RECORD, threshold=0.8):
-            raise Exception("Current page is not RyouToppa.")
-        rcl = area_map[index].get("rule_click")
+        # 先判断是否有进攻机会, 如果没有,set_next_run ,时间等于 (30-60) 分钟后的随机时间
+        if not self.has_ticket():
+            logger.info("We have no chance to attack. Try again after 1 hour.")
+            target = datetime.now() + timedelta(minutes=random.randint(30, 59), seconds=random.randint(1, 59))
+            self.set_next_run(task='DevRyouToppa', success=True, target=target)
+            raise TaskEnd
+        # 每次进攻前检查区域可用性
+        if not self.check_area(index):
+            return False
 
 
+        # 正式进攻会设定 2s - 10s 的随机延迟,避免攻击间隔及其相近被检测为脚本。
+        delay = random_delay()
+        time.sleep(delay)
+        rcl = area_map[index].get("rule_click")
         # 点击攻击区域,等待攻击按钮出现。
         # 点击攻击区域,等待攻击按钮出现。
-        while True:
-            self.screenshot()
-            if self.appear(RealmRaidAssets.I_FIRE, threshold=0.8):
-                break
-            if self.click(rcl, interval=2):
-                continue
+        self.ui_click(rcl, stop=RealmRaidAssets.I_FIRE)
 
 
         # 塔塔开!
         # 塔塔开!
         while True:
         while True:
@@ -172,7 +148,8 @@ class ScriptTask(GeneralBattle, GameUi, SwitchSoul, DevRyouToppaAssets):
             if self.appear(self.I_EXIT, threshold=0.8):
             if self.appear(self.I_EXIT, threshold=0.8):
                 logger.info("Start attach area [%s]" % str(index + 1))
                 logger.info("Start attach area [%s]" % str(index + 1))
                 break
                 break
-            if self.appear_then_click(RealmRaidAssets.I_FIRE, threshold=0.8):
+            if self.appear(RealmRaidAssets.I_FIRE, threshold=0.8):
+                self.appear_then_click(RealmRaidAssets.I_FIRE, threshold=0.8)
                 time.sleep(1.5)
                 time.sleep(1.5)
                 self.screenshot()
                 self.screenshot()
                 self.appear_then_click(RealmRaidAssets.I_FIRE, threshold=0.8)
                 self.appear_then_click(RealmRaidAssets.I_FIRE, threshold=0.8)
@@ -180,9 +157,13 @@ class ScriptTask(GeneralBattle, GameUi, SwitchSoul, DevRyouToppaAssets):
                 self.screenshot()
                 self.screenshot()
                 # 点击两次点击后如果还出现进攻按钮则判断该区域已被攻打过
                 # 点击两次点击后如果还出现进攻按钮则判断该区域已被攻打过
                 # 不使用 ocr 的原因是怕不好识别导致重复点击被检测
                 # 不使用 ocr 的原因是怕不好识别导致重复点击被检测
-                if self.appear(RealmRaidAssets.I_FIRE):
-                    return False
-                continue
+                if self.appear(self.I_EXIT, threshold=0.8):
+                    logger.info("Start attach area [%s]" % str(index + 1))
+                    break
+                else:
+                    self.click(self.C_SAFE_AREA)
+                    time.sleep(2)
+                return False
 
 
         # 等待战斗结束
         # 等待战斗结束
         # TO-DO 后续更改默认值
         # TO-DO 后续更改默认值
@@ -190,10 +171,12 @@ class ScriptTask(GeneralBattle, GameUi, SwitchSoul, DevRyouToppaAssets):
 
 
     def flush_area_cache(self):
     def flush_area_cache(self):
         time.sleep(2)
         time.sleep(2)
-        self.area_index.extend(default_index)
         duration = 0.352
         duration = 0.352
         count = random.randint(1, 3)
         count = random.randint(1, 3)
         for i in range(count):
         for i in range(count):
+            # 测试过很多次 win32api, win32gui 的 MOUSEEVENTF_WHEEL, WM_MOUSEWHEEL
+            # 都出现过很多次离奇的事件,索性放弃了使用以下方法,参数是精心调试的
+            # 每次执行刚好刷新一组(2个)设定随机刷新 1 - 3 次
             safe_pos_x = random.randint(540, 1000)
             safe_pos_x = random.randint(540, 1000)
             safe_pos_y = random.randint(320, 540)
             safe_pos_y = random.randint(320, 540)
             p1 = (safe_pos_x, safe_pos_y)
             p1 = (safe_pos_x, safe_pos_y)
@@ -202,14 +185,6 @@ class ScriptTask(GeneralBattle, GameUi, SwitchSoul, DevRyouToppaAssets):
             self.device.swipe_adb(p1, p2, duration=duration)
             self.device.swipe_adb(p1, p2, duration=duration)
             time.sleep(2)
             time.sleep(2)
 
 
-    def exit(self, status: int = 0):
-        if status == 0:
-            logger.info('DevRyouToppa finished.')
-            self.set_next_run(task='DevRyouToppa', finish=True, success=True)
-        else:
-            logger.error('Task DevRyouToppa exited abnormally.')
-        raise TaskEnd
-
     def battle_wait(self, random_click_swipt_enable: bool) -> bool:
     def battle_wait(self, random_click_swipt_enable: bool) -> bool:
         # 重写
         # 重写
         self.device.stuck_record_add('BATTLE_STATUS_S')
         self.device.stuck_record_add('BATTLE_STATUS_S')
@@ -255,7 +230,7 @@ if __name__ == "__main__":
     from module.config.config import Config
     from module.config.config import Config
     from module.device.device import Device
     from module.device.device import Device
 
 
-    config = Config('oas2')
+    config = Config('oas1')
     device = Device(config)
     device = Device(config)
     t = ScriptTask(config, device)
     t = ScriptTask(config, device)
     t.run()
     t.run()