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

perf(Hyakkiyakou): Remove option #819

huangrunheng 1 год назад
Родитель
Сommit
2a677aadaa

+ 12 - 10
tasks/Hyakkiyakou/assets.py

@@ -29,17 +29,17 @@ class HyakkiyakouAssets:
 	C_FRIEND_5 = RuleClick(roi_front=(449,394,178,61), roi_back=(449,394,178,61), name="friend_5")
 	# description 
 	C_FRIEND_6 = RuleClick(roi_front=(714,397,182,62), roi_back=(714,397,182,62), name="friend_6")
-	# 回归活动使用
+	# 回归活动使用 
 	C_FRIEND_1_RECALL = RuleClick(roi_front=(254,223,161,67), roi_back=(254,223,161,67), name="friend_1_recall")
-	# 回归活动使用
+	# 回归活动使用 
 	C_FRIEND_2_RECALL = RuleClick(roi_front=(532,226,158,64), roi_back=(532,226,158,64), name="friend_2_recall")
-	# 回归活动使用
+	# 回归活动使用 
 	C_FRIEND_3_RECALL = RuleClick(roi_front=(240,310,183,66), roi_back=(240,310,183,66), name="friend_3_recall")
-	# 回归活动使用
+	# 回归活动使用 
 	C_FRIEND_4_RECALL = RuleClick(roi_front=(504,311,184,62), roi_back=(504,311,184,62), name="friend_4_recall")
-	# 回归活动使用
+	# 回归活动使用 
 	C_FRIEND_5_RECALL = RuleClick(roi_front=(241,395,178,61), roi_back=(241,395,178,61), name="friend_5_recall")
-	# 回归活动使用
+	# 回归活动使用 
 	C_FRIEND_6_RECALL = RuleClick(roi_front=(508,394,182,62), roi_back=(508,394,182,62), name="friend_6_recall")
 
 
@@ -60,6 +60,8 @@ class HyakkiyakouAssets:
 	I_HTITLE = RuleImage(roi_front=(578,21,134,48), roi_back=(578,21,134,48), threshold=0.8, method="Template matching", file="./tasks/Hyakkiyakou/hya/hya_htitle.png")
 	# description 
 	I_HCLOSE_RED = RuleImage(roi_front=(1056,177,54,54), roi_back=(1056,177,54,54), threshold=0.8, method="Template matching", file="./tasks/Hyakkiyakou/hya/hya_hclose_red.png")
+	# 回归任务 
+	I_ENSURE_RECALL = RuleImage(roi_front=(1060,145,66,62), roi_back=(877,72,307,211), threshold=0.8, method="Template matching", file="./tasks/Hyakkiyakou/hya/hya_ensure_recall.png")
 
 
 	# Image Rule Assets
@@ -154,13 +156,13 @@ class HyakkiyakouAssets:
 	I_FRIEND_SAME_2 = RuleImage(roi_front=(377,126,100,60), roi_back=(377,126,100,60), threshold=0.8, method="Template matching", file="./tasks/Hyakkiyakou/hya/hya_friend_same_2.png")
 	# description 
 	I_FRIEND_REMOTE_2 = RuleImage(roi_front=(504,127,100,56), roi_back=(504,127,100,56), threshold=0.8, method="Template matching", file="./tasks/Hyakkiyakou/hya/hya_friend_remote_2.png")
-	# 回归活动使用
+	# 回归活动使用 
 	I_FRIEND_SAME_1_RECALL = RuleImage(roi_front=(167,123,106,62), roi_back=(154,105,132,94), threshold=0.8, method="Template matching", file="./tasks/Hyakkiyakou/hya/hya_friend_same_1.png")
-	# 回归活动使用
+	# 回归活动使用 
 	I_FRIEND_REMOTE_1_RECALL = RuleImage(roi_front=(288,123,106,56), roi_back=(269,106,159,91), threshold=0.8, method="Template matching", file="./tasks/Hyakkiyakou/hya/hya_friend_remote_1.png")
-	# 回归活动使用
+	# 回归活动使用 
 	I_FRIEND_SAME_2_RECALL = RuleImage(roi_front=(168,126,100,60), roi_back=(152,112,133,80), threshold=0.8, method="Template matching", file="./tasks/Hyakkiyakou/hya/hya_friend_same_2.png")
-	# 回归活动使用
+	# 回归活动使用 
 	I_FRIEND_REMOTE_2_RECALL = RuleImage(roi_front=(296,122,100,56), roi_back=(278,115,131,81), threshold=0.8, method="Template matching", file="./tasks/Hyakkiyakou/hya/hya_friend_remote_2.png")
 
 

+ 0 - 1
tasks/Hyakkiyakou/config.py

@@ -26,7 +26,6 @@ class HyakkiyakouConfig(ConfigBase):
     hya_limit_time: Time = Field(default=Time(minute=20), description='hya_limit_time_help')
     hya_limit_count: int = Field(default=10, description='hya_limit_count_help')
     hya_invite_friend: bool = Field(default=False, description='hya_invite_friend_help')
-    hya_recall_activity: bool = Field(default=False, description='星重聚召回活动')
     # 自动调整豆子数量
     hya_auto_bean: bool = Field(default=False, description='hya_auto_bean_help')
     hya_priorities: str = Field(default='', description='hya_priorities_help')

+ 9 - 0
tasks/Hyakkiyakou/hya/image1.json

@@ -70,5 +70,14 @@
     "method": "Template matching",
     "threshold": 0.8,
     "description": "description"
+  },
+  {
+    "itemName": "ensure_recall",
+    "imageName": "hya_ensure_recall.png",
+    "roiFront": "1060,145,66,62",
+    "roiBack": "877,72,307,211",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "回归任务"
   }
 ]

+ 0 - 1
tasks/Hyakkiyakou/script_task.py

@@ -102,7 +102,6 @@ class ScriptTask(GameUi, HyaSlave):
             'weights': weights,
             'priorities': priorities,
             'invite_friend': hya_config.hya_invite_friend,
-            'recall_activity': hya_config.hya_recall_activity,
             'auto_bean': hya_config.hya_auto_bean
         }
         return Agent(strategy=strategy)

+ 10 - 7
tasks/Hyakkiyakou/slave/hya_slave.py

@@ -216,10 +216,13 @@ class HyaSlave(HyaDevice, HyaColor, HyakkiyakouAssets):
 
     def invite_friend(self, same: bool = True):
         logger.hr('Invite friend', 2)
+        hya_recall_activity = False
         while 1:
             self.screenshot()
-            # 是否有召回活动
-            if self.config.hyakkiyakou.hyakkiyakou_config.hya_recall_activity:
+            # 是否有召回活动(星重聚阴阳师)
+            if self.appear(self.I_ENSURE_RECALL):
+                hya_recall_activity = True
+            if hya_recall_activity:
                 if self.appear(self.I_FRIEND_SAME_1_RECALL) or self.appear(self.I_FRIEND_SAME_2_RECALL):
                     break
             else:
@@ -227,15 +230,15 @@ class HyaSlave(HyaDevice, HyaColor, HyakkiyakouAssets):
                     break
             if self.appear_then_click(self.I_HINVITE, interval=4):
                 continue
-        if not self._invite_friend(True):
-            if not self._invite_friend(False):
+        if not self._invite_friend(same=True, hya_recall_activity=hya_recall_activity):
+            if not self._invite_friend(same=False, hya_recall_activity=hya_recall_activity):
                 raise RequestHumanTakeover('Invite friend failed')
 
-    def _invite_friend(self, same: bool = True) -> bool:
+    def _invite_friend(self, same: bool = True, hya_recall_activity: bool = False) -> bool:
         if not same:
             logger.info('Invite different server friend')
             # 是否有召回活动
-            if self.config.hyakkiyakou.hyakkiyakou_config.hya_recall_activity:
+            if hya_recall_activity:
                 self.ui_click(self.I_FRIEND_REMOTE_1_RECALL, self.I_FRIEND_REMOTE_2_RECALL)
             else:
                 self.ui_click(self.I_FRIEND_REMOTE_1, self.I_FRIEND_REMOTE_2)
@@ -246,7 +249,7 @@ class HyaSlave(HyaDevice, HyaColor, HyakkiyakouAssets):
             if not self.appear(self.I_HINVITE):
                 break
             # 是否有召回活动
-            if self.config.hyakkiyakou.hyakkiyakou_config.hya_recall_activity:
+            if hya_recall_activity:
                 if self.click(self.C_FRIEND_1_RECALL, interval=2):
                     continue
                 if self.click(self.C_FRIEND_2_RECALL, interval=3):