Explorar o código

perf: Delete Useless code

ryland %!s(int64=2) %!d(string=hai) anos
pai
achega
200d94d910

+ 0 - 113
tasks/DevRyouToppa/assets.py

@@ -1,113 +0,0 @@
-from module.atom.image import RuleImage
-from module.atom.click import RuleClick
-from module.atom.long_click import RuleLongClick
-from module.atom.swipe import RuleSwipe
-from module.atom.ocr import RuleOcr
-from module.atom.list import RuleList
-
-# This file was automatically generated by ./dev_tools/assets_extract.py.
-# Don't modify it manually.
-class DevRyouToppaAssets: 
-
-
-	# Click Rule Assets
-	# area1 
-	C_AREA_1 = RuleClick(roi_front=(533,162,177,74), roi_back=(533,162,177,74), name="area_1")
-	# area2 
-	C_AREA_2 = RuleClick(roi_front=(863,164,181,71), roi_back=(863,164,181,71), name="area_2")
-	# area3 
-	C_AREA_3 = RuleClick(roi_front=(532,292,181,87), roi_back=(532,292,181,87), name="area_3")
-	# area4 
-	C_AREA_4 = RuleClick(roi_front=(863,301,171,62), roi_back=(863,301,171,62), name="area_4")
-	# area5 
-	C_AREA_5 = RuleClick(roi_front=(540,432,169,68), roi_back=(540,432,169,68), name="area_5")
-	# area6 
-	C_AREA_6 = RuleClick(roi_front=(876,432,165,74), roi_back=(876,432,165,74), name="area_6")
-	# area7 
-	C_AREA_7 = RuleClick(roi_front=(538,557,149,71), roi_back=(538,557,149,71), name="area_7")
-	# area8 
-	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
-	# 区域1攻略失败 
-	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攻略失败 
-	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攻略失败 
-	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攻略失败 
-	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攻略失败 
-	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攻略失败 
-	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攻略失败 
-	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攻略失败 
-	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攻略失败(最近一次) 
-	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攻略失败(最近一次) 
-	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攻略失败(最近一次) 
-	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攻略失败(最近一次) 
-	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攻略失败(最近一次) 
-	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攻略失败(最近一次) 
-	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攻略失败(最近一次) 
-	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攻略失败(最近一次) 
-	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已攻破 
-	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已攻破 
-	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已攻破 
-	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已攻破 
-	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已攻破 
-	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已攻破 
-	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已攻破 
-	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已攻破 
-	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
-	# 进攻回合数 
-	O_NUMBER = RuleOcr(roi=(271,560,48,31), area=(271,560,48,31), mode="DigitCounter", method="Default", keyword="", name="number")
-
-

+ 0 - 14
tasks/DevRyouToppa/config.py

@@ -1,14 +0,0 @@
-from pydantic import BaseModel, Field
-from tasks.Component.GeneralBattle.config_general_battle import GeneralBattleConfig
-from tasks.Component.config_base import ConfigBase
-from tasks.Component.config_scheduler import Scheduler
-
-
-class RaidConfig(BaseModel):
-    is_skip_difficult: bool = Field(default=True, description='是否跳过难度较高的结界,失败后不再攻打该结界')
-
-
-class DevRyouToppa(ConfigBase):
-    scheduler: Scheduler = Field(default_factory=Scheduler)
-    raid_config: RaidConfig = Field(default_factory=RaidConfig)
-    general_battle_config: GeneralBattleConfig = Field(default_factory=GeneralBattleConfig)

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

@@ -1,56 +0,0 @@
-[
-  {
-    "itemName": "area_1",
-    "roiFront": "533,162,177,74",
-    "roiBack": "533,162,177,74",
-    "description": "area1"
-  },
-  {
-    "itemName": "area_2",
-    "roiFront": "863,164,181,71",
-    "roiBack": "863,164,181,71",
-    "description": "area2"
-  },
-  {
-    "itemName": "area_3",
-    "roiFront": "532,292,181,87",
-    "roiBack": "532,292,181,87",
-    "description": "area3"
-  },
-  {
-    "itemName": "area_4",
-    "roiFront": "863,301,171,62",
-    "roiBack": "863,301,171,62",
-    "description": "area4"
-  },
-  {
-    "itemName": "area_5",
-    "roiFront": "540,432,169,68",
-    "roiBack": "540,432,169,68",
-    "description": "area5"
-  },
-  {
-    "itemName": "area_6",
-    "roiFront": "876,432,165,74",
-    "roiBack": "876,432,165,74",
-    "description": "area6"
-  },
-  {
-    "itemName": "area_7",
-    "roiFront": "538,557,149,71",
-    "roiBack": "538,557,149,71",
-    "description": "area7"
-  },
-  {
-    "itemName": "area_8",
-    "roiFront": "876,562,150,67",
-    "roiBack": "876,562,150,67",
-    "description": "area8"
-  },
-  {
-    "itemName": "safe_area",
-    "roiFront": "182,213,160,229",
-    "roiBack": "182,213,160,229",
-    "description": "在点击进攻后如果未进入战斗画面则点击的安全区域"
-  }
-]

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

@@ -1,146 +0,0 @@
-[
-  {
-    "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攻略失败(最近一次)"
-  }
-]

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

@@ -1,146 +0,0 @@
-[
-  {
-    "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=BIN
tasks/DevRyouToppa/res/finished_1.png


BIN=BIN
tasks/DevRyouToppa/res/finished_2.png


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

@@ -1,11 +0,0 @@
-[
-  {
-    "itemName": "toppa_record",
-    "imageName": "res_toppa_record.png",
-    "roiFront": "66,628,64,39",
-    "roiBack": "66,628,64,39",
-    "method": "Template matching",
-    "threshold": 0.8,
-    "description": "description"
-  }
-]

BIN=BIN
tasks/DevRyouToppa/res/loser_sign_1.png


BIN=BIN
tasks/DevRyouToppa/res/loser_sign_2.png


+ 0 - 11
tasks/DevRyouToppa/res/ocr.json

@@ -1,11 +0,0 @@
-[
-  {
-    "itemName": "number",
-    "roiFront": "271,560,48,31",
-    "roiBack": "271,560,48,31",
-    "mode": "DigitCounter",
-    "method": "Default",
-    "keyword": "",
-    "description": "进攻回合数"
-  }
-]

BIN=BIN
tasks/DevRyouToppa/res/res_toppa_record.png


+ 0 - 236
tasks/DevRyouToppa/script_task.py

@@ -1,236 +0,0 @@
-# This Python file uses the following encoding: utf-8
-
-import time
-import random
-from datetime import datetime, timedelta
-from module.base.utils import point2str
-from module.exception import TaskEnd
-from tasks.Component.SwitchSoul.switch_soul import SwitchSoul
-from tasks.Component.GeneralBattle.general_battle import GeneralBattle
-from tasks.GameUi.game_ui import GameUi
-from tasks.GameUi.page import page_kekkai_toppa
-from tasks.RealmRaid.assets import RealmRaidAssets
-from tasks.DevRyouToppa.assets import DevRyouToppaAssets
-from module.atom.image_grid import ImageGrid
-from module.logger import logger
-from tasks.Secret.assets import SecretAssets
-
-default_index = [0, 1, 2, 3, 4, 5, 6, 7]
-area_map = (
-    {
-        "fail_sign": (DevRyouToppaAssets.I_AREA_1_IS_FAILURE_NEW, DevRyouToppaAssets.I_AREA_1_IS_FAILURE),
-        "rule_click": DevRyouToppaAssets.C_AREA_1,
-        "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),
-        "rule_click": DevRyouToppaAssets.C_AREA_2,
-        "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),
-        "rule_click": DevRyouToppaAssets.C_AREA_3,
-        "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),
-        "rule_click": DevRyouToppaAssets.C_AREA_4,
-        "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),
-        "rule_click": DevRyouToppaAssets.C_AREA_5,
-        "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),
-        "rule_click": DevRyouToppaAssets.C_AREA_6,
-        "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),
-        "rule_click": DevRyouToppaAssets.C_AREA_7,
-        "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),
-        "rule_click": DevRyouToppaAssets.C_AREA_8,
-        "finished_sign": (DevRyouToppaAssets.I_AREA_8_FINISHED, DevRyouToppaAssets.I_AREA_8_FINISHED_NEW)
-    }
-)
-
-
-def random_delay(min_value: float = 1.0, max_value: float = 2.0, decimal: int = 1):
-    """
-    生成一个指定范围内的随机小数
-    """
-    random_float_in_range = random.uniform(min_value, max_value)
-    return (round(random_float_in_range, decimal))
-
-
-class ScriptTask(GeneralBattle, GameUi, SwitchSoul, DevRyouToppaAssets):
-    medal_grid: ImageGrid = None
-    area_index: list = []
-
-    def run(self):
-        """
-        执行
-        :return:
-        """
-        options = self.config.dev_ryou_toppa
-        self.ui_get_current_page()
-        self.ui_goto(page_kekkai_toppa)
-
-        # 确认进入结界突破界面
-        self.wait_until_appear(self.I_TOPPA_RECORD)
-        if not self.area_index:
-            self.area_index.extend(default_index)
-        index = 0
-
-        # 开始突破
-        while True:
-            res = self.attack_area(index)
-            # 如果战斗失败或区域不可用,则弹出当前区域索引,开始进攻下一个
-            if not res:
-                try:
-                    self.area_index.pop(0)
-                    index = self.area_index[0]
-                except IndexError:
-                    # 每次出现 IndexError 说明8个区域都不可用,需要滚动列表。
-                    self.area_index.extend(default_index)
-                    self.flush_area_cache()
-                    index = 0
-
-    def check_area(self, index: int) -> bool:
-        """
-        检查该区域是否攻略失败
-        :return:
-        """
-        f1, f2 = area_map[index].get("fail_sign")
-        f3, f4 = area_map[index].get("finished_sign")
-        self.screenshot()
-        # 如果该区域已经被攻破则退出
-        # 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
-        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))
-            return False
-        return True
-
-    def attack_area(self, index: int):
-        """
-        :return: 战斗成功(True) or 战斗失败(False) or 区域不可用(False) or 没有进攻机会(设定下次运行并退出)
-        """
-        # 先判断是否有进攻机会, 如果没有,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")
-        # 点击攻击区域,等待攻击按钮出现。
-        self.ui_click(rcl, stop=RealmRaidAssets.I_FIRE)
-
-        # 塔塔开!
-        while True:
-            self.screenshot()
-            # 如果进入战斗
-            if self.appear(self.I_EXIT, threshold=0.8):
-                logger.info("Start attach area [%s]" % str(index + 1))
-                break
-            if self.appear(RealmRaidAssets.I_FIRE, threshold=0.8):
-                self.appear_then_click(RealmRaidAssets.I_FIRE, threshold=0.8)
-                time.sleep(1.5)
-                self.screenshot()
-                self.appear_then_click(RealmRaidAssets.I_FIRE, threshold=0.8)
-                time.sleep(1.5)
-                self.screenshot()
-                # 点击两次点击后如果还出现进攻按钮则判断该区域已被攻打过
-                # 不使用 ocr 的原因是怕不好识别导致重复点击被检测
-                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 后续更改默认值
-        return self.battle_wait(random_click_swipt_enable=True)
-
-    def flush_area_cache(self):
-        time.sleep(2)
-        duration = 0.352
-        count = random.randint(1, 3)
-        for i in range(count):
-            # 测试过很多次 win32api, win32gui 的 MOUSEEVENTF_WHEEL, WM_MOUSEWHEEL
-            # 都出现过很多次离奇的事件,索性放弃了使用以下方法,参数是精心调试的
-            # 每次执行刚好刷新一组(2个)设定随机刷新 1 - 3 次
-            safe_pos_x = random.randint(540, 1000)
-            safe_pos_y = random.randint(320, 540)
-            p1 = (safe_pos_x, safe_pos_y)
-            p2 = (safe_pos_x, safe_pos_y - 101)
-            logger.info('Swipe %s -> %s, %s ' % (point2str(*p1), point2str(*p2), duration))
-            self.device.swipe_adb(p1, p2, duration=duration)
-            time.sleep(2)
-
-    def battle_wait(self, random_click_swipt_enable: bool) -> bool:
-        # 重写
-        self.device.stuck_record_add('BATTLE_STATUS_S')
-        self.device.click_record_clear()
-        # 战斗过程 随机点击和滑动 防封
-        logger.info("Start battle process")
-        while 1:
-            self.screenshot()
-            if self.appear(SecretAssets.I_SE_BATTLE_WIN):
-                logger.info('Win battle')
-                self.ui_click_until_disappear(SecretAssets.I_SE_BATTLE_WIN)
-                return True
-            if self.appear_then_click(self.I_WIN, interval=1):
-                continue
-            if self.appear(self.I_REWARD):
-                logger.info('Win battle')
-                self.ui_click_until_disappear(self.I_REWARD)
-                return True
-
-            if self.appear(self.I_FALSE):
-                logger.warning('False battle')
-                self.ui_click_until_disappear(self.I_FALSE)
-                return False
-
-    def has_ticket(self) -> bool:
-        """
-        如果没有票了,那么就返回False
-        :return:
-        """
-        # 21点后无限进攻机会
-        if datetime.now().hour >= 21:
-            return True
-        self.wait_until_appear(self.I_TOPPA_RECORD)
-        self.screenshot()
-        cu, res, total = self.O_NUMBER.ocr(self.device.image)
-        if cu == 0 and cu + res == total:
-            logger.warning(f'Execute round failed, no ticket')
-            return False
-        return True
-
-
-if __name__ == "__main__":
-    from module.config.config import Config
-    from module.device.device import Device
-
-    config = Config('oas1')
-    device = Device(config)
-    t = ScriptTask(config, device)
-    t.run()