Эх сурвалжийг харах

Merge branch 'runhey:dev' into dev

migsmiku 1 жил өмнө
parent
commit
99c908fe64

+ 7 - 1
module/atom/animate.py

@@ -47,10 +47,11 @@ class RuleAnimate(RuleImage):
     def name(self) -> str:
         return self._name.upper()
 
-    def stable(self, image) -> bool:
+    def stable(self, image, refresh_after_stable: bool = False) -> bool:
         """
         用于判断连续的两张截图,的目标区域是否一致
         @param image:
+        @param refresh_after_stable:
         @return:
         """
         if self._last_image is None:
@@ -62,10 +63,15 @@ class RuleAnimate(RuleImage):
         self._last_image = self.corp(image, self.roi_front)
 
         if matched:
+            if refresh_after_stable:
+                self.refresh()
             logger.info(f'Animation Stable @ {self.name}')
             return True
         return False
 
+    def refresh(self):
+        self._last_image = None
+
 
 if __name__ == '__main__':
     from module.base.utils import load_image

BIN
tasks/ActivityShikigami/as/as_back_green.png


BIN
tasks/ActivityShikigami/as/as_battle.png


BIN
tasks/ActivityShikigami/as/as_fire.png


BIN
tasks/ActivityShikigami/as/as_shi.png


+ 5 - 5
tasks/ActivityShikigami/as/image.json

@@ -2,7 +2,7 @@
   {
     "itemName": "shi",
     "imageName": "as_shi.png",
-    "roiFront": "186,255,33,34",
+    "roiFront": "519,165,33,34",
     "roiBack": "64,115,1110,427",
     "method": "Template matching",
     "threshold": 0.7,
@@ -11,8 +11,8 @@
   {
     "itemName": "back_green",
     "imageName": "as_back_green.png",
-    "roiFront": "23,27,44,44",
-    "roiBack": "23,27,44,44",
+    "roiFront": "27,19,34,38",
+    "roiBack": "2,1,170,75",
     "method": "Template matching",
     "threshold": 0.8,
     "description": "左上角返回"
@@ -20,8 +20,8 @@
   {
     "itemName": "battle",
     "imageName": "as_battle.png",
-    "roiFront": "285,282,35,135",
-    "roiBack": "223,196,153,315",
+    "roiFront": "1081,301,35,135",
+    "roiBack": "1042,208,153,315",
     "method": "Template matching",
     "threshold": 0.7,
     "description": "进入爬塔"

+ 11 - 2
tasks/ActivityShikigami/as/ocr.json

@@ -1,8 +1,8 @@
 [
   {
     "itemName": "remain_ap",
-    "roiFront": "131,572,42,25",
-    "roiBack": "131,572,42,25",
+    "roiFront": "98,583,42,25",
+    "roiBack": "98,583,42,25",
     "mode": "DigitCounter",
     "method": "Default",
     "keyword": "",
@@ -34,5 +34,14 @@
     "method": "Default",
     "keyword": "",
     "description": "活动票数(没有百分比)"
+  },
+  {
+    "itemName": "entry_activity",
+    "roiFront": "71,241,98,32",
+    "roiBack": "71,241,98,32",
+    "mode": "Single",
+    "method": "Default",
+    "keyword": "阵练演武",
+    "description": "Ocr-description"
   }
 ]

+ 6 - 4
tasks/ActivityShikigami/assets.py

@@ -45,11 +45,11 @@ class ActivityShikigamiAssets:
 
 	# Image Rule Assets
 	# 进入活动 
-	I_SHI = RuleImage(roi_front=(186,255,33,34), roi_back=(64,115,1110,427), threshold=0.7, method="Template matching", file="./tasks/ActivityShikigami/as/as_shi.png")
+	I_SHI = RuleImage(roi_front=(519,165,33,34), roi_back=(64,115,1110,427), threshold=0.7, method="Template matching", file="./tasks/ActivityShikigami/as/as_shi.png")
 	# 左上角返回 
-	I_BACK_GREEN = RuleImage(roi_front=(23,27,44,44), roi_back=(23,27,44,44), threshold=0.8, method="Template matching", file="./tasks/ActivityShikigami/as/as_back_green.png")
+	I_BACK_GREEN = RuleImage(roi_front=(27,19,34,38), roi_back=(2,1,170,75), threshold=0.8, method="Template matching", file="./tasks/ActivityShikigami/as/as_back_green.png")
 	# 进入爬塔 
-	I_BATTLE = RuleImage(roi_front=(285,282,35,135), roi_back=(223,196,153,315), threshold=0.7, method="Template matching", file="./tasks/ActivityShikigami/as/as_battle.png")
+	I_BATTLE = RuleImage(roi_front=(1081,301,35,135), roi_back=(1042,208,153,315), threshold=0.7, method="Template matching", file="./tasks/ActivityShikigami/as/as_battle.png")
 	# 归鹿之途 
 	I_DRUM = RuleImage(roi_front=(327,627,145,28), roi_back=(256,462,301,232), threshold=0.8, method="Template matching", file="./tasks/ActivityShikigami/as/as_drum.png")
 	# 上锁图标 
@@ -74,12 +74,14 @@ class ActivityShikigamiAssets:
 
 	# Ocr Rule Assets
 	# 体力的数量检测 
-	O_REMAIN_AP = RuleOcr(roi=(131,572,42,25), area=(131,572,42,25), mode="DigitCounter", method="Default", keyword="", name="remain_ap")
+	O_REMAIN_AP = RuleOcr(roi=(98,583,42,25), area=(98,583,42,25), mode="DigitCounter", method="Default", keyword="", name="remain_ap")
 	# 活动体力的剩余检测 
 	O_REMAIN_AP_ACTIVITY = RuleOcr(roi=(715,18,95,28), area=(715,18,95,28), mode="DigitCounter", method="Default", keyword="", name="remain_ap_activity")
 	# 还有多少次购买体力的机会 
 	O_REMAIN_BUY = RuleOcr(roi=(808,531,39,42), area=(808,531,39,42), mode="DigitCounter", method="Default", keyword="", name="remain_buy")
 	# 活动票数(没有百分比) 
 	O_REMAIN_AP_ACTIVITY2 = RuleOcr(roi=(756,17,52,29), area=(756,17,52,29), mode="Digit", method="Default", keyword="", name="remain_ap_activity2")
+	# Ocr-description 
+	O_ENTRY_ACTIVITY = RuleOcr(roi=(71,241,98,32), area=(71,241,98,32), mode="Single", method="Default", keyword="阵练演武", name="entry_activity")
 
 

+ 4 - 1
tasks/ActivityShikigami/script_task.py

@@ -149,7 +149,8 @@ class ScriptTask(GameUi, BaseActivity, SwitchSoul, ActivityShikigamiAssets):
                 break
             if self.appear_then_click(self.I_SHI, interval=1):
                 continue
-
+            if self.ocr_appear_click(self.O_ENTRY_ACTIVITY, interval=1):
+                continue
             if self.appear_then_click(self.I_BATTLE, interval=1):
                 continue
 
@@ -169,6 +170,8 @@ class ScriptTask(GameUi, BaseActivity, SwitchSoul, ActivityShikigamiAssets):
                 continue
             if self.appear_then_click(self.I_BACK_GREEN, interval=2):
                 continue
+            if self.appear_then_click(self.I_EXIT, interval=2.2, threshold=0.6):
+                continue
 
     def check_ap_remain(self, current_ap: ApMode) -> bool:
         """

+ 3 - 3
tasks/Component/BaseActivity/config_activity.py

@@ -65,6 +65,6 @@ class GeneralClimb(ConfigBase):
             return def_value
         return def_value
 
-    # @field_validator('ap_mode', mode='after')
-    # def check_mode(cls, value):
-    #     return ApMode.AP_GAME
+    @field_validator('ap_mode', mode='after')
+    def check_mode(cls, value):
+        return ApMode.AP_GAME

+ 6 - 2
tasks/Exploration/solo.py

@@ -80,7 +80,9 @@ class SoloExploration(BaseExploration):
                 # 向后拉,寻找怪
                 if search_fail_cnt >= 4:
                     search_fail_cnt = 0
-                    if (self._config.exploration_config.exploration_level == ExplorationLevel.EXPLORATION_28 and self.appear(self.I_SWIPE_END)) or self._match_end.stable(self.device.image):
+                    if (self._config.exploration_config.exploration_level == ExplorationLevel.EXPLORATION_28\
+                        and self.appear(self.I_SWIPE_END))\
+                            or self._match_end.stable(self.device.image, refresh_after_stable=True):
                         self.quit_explore()
                         continue
                     if self.swipe(self.S_SWIPE_BACKGROUND_RIGHT, interval=3):
@@ -210,7 +212,9 @@ class SoloExploration(BaseExploration):
                 # 向后拉,寻找怪
                 if search_fail_cnt >= 4:
                     search_fail_cnt = 0
-                    if (self._config.exploration_config.exploration_level == ExplorationLevel.EXPLORATION_28 and self.appear(self.I_SWIPE_END)) or self._match_end.stable(self.device.image):
+                    if (self._config.exploration_config.exploration_level == ExplorationLevel.EXPLORATION_28\
+                        and self.appear(self.I_SWIPE_END))\
+                            or self._match_end.stable(self.device.image, refresh_after_stable=True):
                         self.quit_explore()
                         continue
                     if self.swipe(self.S_SWIPE_BACKGROUND_RIGHT, interval=4.5):

+ 1 - 1
tasks/GameUi/assets.py

@@ -90,7 +90,7 @@ class GameUiAssets:
 
 	# Image Rule Assets
 	# description 
-	I_MAIN_GOTO_TOWN = RuleImage(roi_front=(706,249,61,57), roi_back=(200,120,951,298), threshold=0.8, method="Template matching", file="./tasks/GameUi/page/page_main_goto_town.png")
+	I_MAIN_GOTO_TOWN = RuleImage(roi_front=(706,249,61,57), roi_back=(200,120,951,298), threshold=0.6, method="Template matching", file="./tasks/GameUi/page/page_main_goto_town.png")
 	# description 
 	I_CHECK_TOWN = RuleImage(roi_front=(1026,106,68,82), roi_back=(765,98,402,96), threshold=0.8, method="Template matching", file="./tasks/GameUi/page/page_check_town.png")
 	# description 

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

@@ -5,7 +5,7 @@
     "roiFront": "706,249,61,57",
     "roiBack": "200,120,951,298",
     "method": "Template matching",
-    "threshold": 0.8,
+    "threshold": 0.6,
     "description": "description"
   },
   {

+ 7 - 3
tasks/Hunt/script_task.py

@@ -52,7 +52,7 @@ class ScriptTask(GameUi, GeneralBattle, GeneralInvite, SwitchSoul, HuntAssets):
     def check_datetime(self) -> bool:
         """
         检查日期和时间, 会设置是麒麟还是阴界之门
-        :return: 符合19:00-21:00的时间返回True, 否则返回False
+        :return: 符合麒麟19:00-21:00、阴界19:00-23:00的时间返回True, 否则返回False
         """
         now = datetime.now()
         day_of_week = now.weekday()
@@ -76,8 +76,12 @@ class ScriptTask(GameUi, GeneralBattle, GeneralInvite, SwitchSoul, HuntAssets):
                 logger.info('Today is the Netherworld day')
                 self.custom_next_run(task='Hunt', custom_time=self.con_time.netherworld_time, time_delta=0)
             raise TaskEnd('Hunt')
-        # 如果是在21:00-23:59之间则设定时间为明天的自定义时间,返回False
-        elif now.time() > time(21, 0):
+        # 如果是麒麟日在21:00-23:59之间则设定时间为明天的自定义时间,返回False
+        elif now.time() > time(21, 0) and self.kirin_day:
+            self.plan_tomorrow_hunt()
+            raise TaskEnd('Hunt')
+        # 如果是阴界日在23:00-23:59之间则设定时间为明天的自定义时间,返回False
+        elif now.time() > time(23, 0) and not self.kirin_day:
             self.plan_tomorrow_hunt()
             raise TaskEnd('Hunt')
         # 如果是在19:00-21:00之间则返回True

BIN
tasks/Hyakkiyakou/hya/hya_ensure_recall.png


+ 1 - 1
tasks/WeeklyTrifles/assets.py

@@ -74,7 +74,7 @@ class WeeklyTriflesAssets:
 	# 微信 
 	I_WT_SE_WECHAT = RuleImage(roi_front=(786,627,45,37), roi_back=(786,627,45,37), threshold=0.8, method="Template matching", file="./tasks/WeeklyTrifles/secret/secret_wt_se_wechat.png")
 	# 勾玉 
-	I_WT_SE_JADE = RuleImage(roi_front=(1123,532,35,39), roi_back=(1123,532,35,39), threshold=0.8, method="Template matching", file="./tasks/WeeklyTrifles/secret/secret_wt_se_jade.png")
+	I_WT_SE_JADE = RuleImage(roi_front=(1129,527,35,39), roi_back=(1129,527,35,39), threshold=0.8, method="Template matching", file="./tasks/WeeklyTrifles/secret/secret_wt_se_jade.png")
 	# 排行 
 	I_WT_SE_RANK = RuleImage(roi_front=(1017,572,45,44), roi_back=(989,556,103,81), threshold=0.8, method="Template matching", file="./tasks/WeeklyTrifles/secret/secret_wt_se_rank.png")
 

+ 2 - 2
tasks/WeeklyTrifles/secret/image.json

@@ -29,8 +29,8 @@
   {
     "itemName": "wt_se_jade",
     "imageName": "secret_wt_se_jade.png",
-    "roiFront": "1123,532,35,39",
-    "roiBack": "1123,532,35,39",
+    "roiFront": "1129,527,35,39",
+    "roiBack": "1129,527,35,39",
     "method": "Template matching",
     "threshold": 0.8,
     "description": "勾玉"

BIN
tasks/WeeklyTrifles/secret/secret_wt_se_jade.png