Explorar o código

feat(task): update hunt

runhey %!s(int64=3) %!d(string=hai) anos
pai
achega
bc549a1ff3

+ 2 - 2
tasks/GameUi/assets.py

@@ -98,7 +98,7 @@ class GameUiAssets:
 	# description 
 	# description 
 	I_TOWN_GOTO_DEMON_ENCOUNTER = RuleImage(roi_front=(617,135,51,75), roi_back=(232,121,873,100), threshold=0.7, method="Template matching", file="./tasks/GameUi/page/page_town_goto_demon_encounter.png")
 	I_TOWN_GOTO_DEMON_ENCOUNTER = RuleImage(roi_front=(617,135,51,75), roi_back=(232,121,873,100), threshold=0.7, method="Template matching", file="./tasks/GameUi/page/page_town_goto_demon_encounter.png")
 	# description 
 	# description 
-	I_TOWN_GOTO_HUNT = RuleImage(roi_front=(475,138,46,69), roi_back=(275,122,520,100), threshold=0.8, method="Template matching", file="./tasks/GameUi/page/page_town_goto_hunt.png")
+	I_TOWN_GOTO_HUNT = RuleImage(roi_front=(475,138,46,69), roi_back=(275,122,520,100), threshold=0.7, method="Template matching", file="./tasks/GameUi/page/page_town_goto_hunt.png")
 	# 协同对弈 
 	# 协同对弈 
 	I_TOWN_GOTO_DRAFT_DUEL = RuleImage(roi_front=(335,159,55,72), roi_back=(170,145,567,100), threshold=0.8, method="Template matching", file="./tasks/GameUi/page/page_town_goto_draft_duel.png")
 	I_TOWN_GOTO_DRAFT_DUEL = RuleImage(roi_front=(335,159,55,72), roi_back=(170,145,567,100), threshold=0.8, method="Template matching", file="./tasks/GameUi/page/page_town_goto_draft_duel.png")
 	# 百鬼奕 
 	# 百鬼奕 
@@ -108,7 +108,7 @@ class GameUiAssets:
 	# description 
 	# description 
 	I_CHECK_DEMON_ENCOUNTER = RuleImage(roi_front=(26,658,42,43), roi_back=(2,619,100,100), threshold=0.8, method="Template matching", file="./tasks/GameUi/page/page_check_demon_encounter.png")
 	I_CHECK_DEMON_ENCOUNTER = RuleImage(roi_front=(26,658,42,43), roi_back=(2,619,100,100), threshold=0.8, method="Template matching", file="./tasks/GameUi/page/page_check_demon_encounter.png")
 	# description 
 	# description 
-	I_CHECK_HUNT = RuleImage(roi_front=(1071,605,81,85), roi_back=(1026,558,152,156), threshold=0.8, method="Template matching", file="./tasks/GameUi/page/page_check_hunt.png")
+	I_CHECK_HUNT = RuleImage(roi_front=(575,30,46,25), roi_back=(553,1,81,68), threshold=0.7, method="Template matching", file="./tasks/GameUi/page/page_check_hunt.png")
 	# description 
 	# description 
 	I_CHECK_HYAKKISEN = RuleImage(roi_front=(1014,607,53,55), roi_back=(986,587,100,100), threshold=0.8, method="Template matching", file="./tasks/GameUi/page/page_check_hyakkisen.png")
 	I_CHECK_HYAKKISEN = RuleImage(roi_front=(1014,607,53,55), roi_back=(986,587,100,100), threshold=0.8, method="Template matching", file="./tasks/GameUi/page/page_check_hyakkisen.png")
 	# description 
 	# description 

BIN=BIN
tasks/GameUi/page/page_check_hunt.png


+ 4 - 4
tasks/GameUi/page/page_img_2.json

@@ -50,7 +50,7 @@
     "roiFront": "475,138,46,69",
     "roiFront": "475,138,46,69",
     "roiBack": "275,122,520,100",
     "roiBack": "275,122,520,100",
     "method": "Template matching",
     "method": "Template matching",
-    "threshold": 0.8,
+    "threshold": 0.7,
     "description": "description"
     "description": "description"
   },
   },
   {
   {
@@ -92,10 +92,10 @@
   {
   {
     "itemName": "check_hunt",
     "itemName": "check_hunt",
     "imageName": "page_check_hunt.png",
     "imageName": "page_check_hunt.png",
-    "roiFront": "1071,605,81,85",
-    "roiBack": "1026,558,152,156",
+    "roiFront": "575,30,46,25",
+    "roiBack": "553,1,81,68",
     "method": "Template matching",
     "method": "Template matching",
-    "threshold": 0.8,
+    "threshold": 0.7,
     "description": "description"
     "description": "description"
   },
   },
   {
   {

+ 1 - 0
tasks/Hunt/config.py

@@ -15,3 +15,4 @@ class HuntConfig(BaseModel):
 class Hunt(ConfigBase):
 class Hunt(ConfigBase):
     scheduler: Scheduler = Field(default_factory=Scheduler)
     scheduler: Scheduler = Field(default_factory=Scheduler)
     hunt_config: HuntConfig = Field(default_factory=HuntConfig)
     hunt_config: HuntConfig = Field(default_factory=HuntConfig)
+    exit_battle: bool = Field(default=False, description='exit_battle_help')

+ 11 - 2
tasks/base_task.py

@@ -170,20 +170,29 @@ class BaseTask(GlobalGameAssets):
 
 
     def wait_until_appear(self,
     def wait_until_appear(self,
                           target: RuleImage,
                           target: RuleImage,
-                          skip_first_screenshot=False) -> None:
+                          skip_first_screenshot=False,
+                          wait_time: int=None) -> bool:
         """
         """
         等待直到出现目标
         等待直到出现目标
+        :param wait_time: 等待时间,单位秒
         :param target:
         :param target:
         :param skip_first_screenshot:
         :param skip_first_screenshot:
         :return:
         :return:
         """
         """
+        wait_timer = None
+        if wait_time:
+            wait_timer = Timer(wait_time)
+            wait_timer.start()
         while 1:
         while 1:
             if skip_first_screenshot:
             if skip_first_screenshot:
                 skip_first_screenshot = False
                 skip_first_screenshot = False
             else:
             else:
                 self.screenshot()
                 self.screenshot()
+            if wait_timer and wait_timer.reached():
+                logger.warning(f"Wait until appear {target.name} timeout")
+                return False
             if self.appear(target):
             if self.appear(target):
-                break
+                return True
 
 
     def wait_until_appear_then_click(self,
     def wait_until_appear_then_click(self,
                                      target: RuleImage,
                                      target: RuleImage,