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

Merge pull request #1002 from runhey/dev

Automated PR 2025.08.21
huangrunheng 1 год назад
Родитель
Сommit
5d7c333c9c

+ 9 - 4
tasks/KekkaiUtilize/assets.py

@@ -19,14 +19,19 @@ class KekkaiUtilizeAssets:
 	I_GUILD_WISH = RuleImage(roi_front=(965,622,60,63), roi_back=(965,622,60,63), threshold=0.8, method="Template matching", file="./tasks/KekkaiUtilize/ku/ku_guild_wish.png")
 	# 神灶 
 	I_GUILD_SHIRNE = RuleImage(roi_front=(872,624,60,62), roi_back=(872,624,60,62), threshold=0.8, method="Template matching", file="./tasks/KekkaiUtilize/ku/ku_guild_shirne.png")
-	# description 
-	I_GUILD_AP = RuleImage(roi_front=(483,314,22,22), roi_back=(225,224,301,167), threshold=0.8, method="Template matching", file="./tasks/KekkaiUtilize/ku/ku_guild_ap.png")
-	# description 
-	I_GUILD_ASSETS = RuleImage(roi_front=(315,311,23,28), roi_back=(227,262,354,136), threshold=0.8, method="Template matching", file="./tasks/KekkaiUtilize/ku/ku_guild_assets.png")
+	# 寮体力 
+	I_GUILD_AP = RuleImage(roi_front=(483,314,22,22), roi_back=(290,224,393,218), threshold=0.8, method="Template matching", file="./tasks/KekkaiUtilize/ku/ku_guild_ap.png")
+	# 寮资金 
+	I_GUILD_ASSETS = RuleImage(roi_front=(315,311,23,28), roi_back=(290,224,393,218), threshold=0.8, method="Template matching", file="./tasks/KekkaiUtilize/ku/ku_guild_assets.png")
 	# 领取寮资金 
 	I_GUILD_ASSETS_RECEIVE = RuleImage(roi_front=(565,426,144,63), roi_back=(565,426,144,63), threshold=0.8, method="Template matching", file="./tasks/KekkaiUtilize/ku/ku_guild_assets_receive.png")
 
 
+	# Swipe Rule Assets
+	# 移动寻找寮体力 
+	S_GUILD_FIND_AP = RuleSwipe(roi_front=(420,546,40,40), roi_back=(8,546,40,40), mode="default", name="guild_find_ap")
+
+
 	# Image Rule Assets
 	# 育成 
 	I_SHI_GROWN = RuleImage(roi_front=(595,291,35,38), roi_back=(530,254,181,198), threshold=0.7, method="Template matching", file="./tasks/KekkaiUtilize/realm/realm_shi_grown.png")

+ 4 - 4
tasks/KekkaiUtilize/ku/image.json

@@ -39,19 +39,19 @@
     "itemName": "guild_ap",
     "imageName": "ku_guild_ap.png",
     "roiFront": "483,314,22,22",
-    "roiBack": "225,224,301,167",
+    "roiBack": "290,224,393,218",
     "method": "Template matching",
     "threshold": 0.8,
-    "description": "description"
+    "description": "寮体力"
   },
   {
     "itemName": "guild_assets",
     "imageName": "ku_guild_assets.png",
     "roiFront": "315,311,23,28",
-    "roiBack": "227,262,354,136",
+    "roiBack": "290,224,393,218",
     "method": "Template matching",
     "threshold": 0.8,
-    "description": "description"
+    "description": "寮资金"
   },
   {
     "itemName": "guild_assets_receive",

+ 9 - 0
tasks/KekkaiUtilize/ku/swipe.json

@@ -0,0 +1,9 @@
+[
+  {
+    "itemName": "guild_find_ap",
+    "roiFront": "420,546,40,40",
+    "roiBack": "8,546,40,40",
+    "mode": "default",
+    "description": "移动寻找寮体力"
+  }
+]

+ 12 - 1
tasks/KekkaiUtilize/script_task.py

@@ -76,7 +76,18 @@ class ScriptTask(GameUi, ReplaceShikigami, KekkaiUtilizeAssets):
         :return:
         """
         if ap_enable or assets_enable:
-            self.screenshot()
+            # 尝试移动寻找体力或资金
+            try_find_ap = 0
+            while try_find_ap < 3:
+                self.screenshot()
+                try_find_ap += 1
+                if self.appear(self.I_GUILD_AP) or self.appear(self.I_GUILD_ASSETS):
+                    logger.info('Find ap or assets')
+                    break
+                else:
+                    logger.info('Try find ap or assets')
+                    self.swipe(self.S_GUILD_FIND_AP)
+            # 如果未找到则返回False
             if not self.appear(self.I_GUILD_AP) and not self.appear(self.I_GUILD_ASSETS):
                 logger.info('No ap or assets to collect')
                 return False

+ 2 - 0
tasks/Restart/assets.py

@@ -53,6 +53,8 @@ class RestartAssets:
 	I_HARVEST_ZIDU = RuleImage(roi_front=(785,475,135,135), roi_back=(785,475,135,135), threshold=0.8, method="Template matching", file="./tasks/Restart/harvest/harvest_harvest_zidu.png")
 	# description 
 	I_HARVEST_MAIL_COPY = RuleImage(roi_front=(257,509,29,21), roi_back=(192,472,790,100), threshold=0.8, method="Template matching", file="./tasks/Restart/harvest/harvest_harvest_mail_copy.png")
+	# description 
+	I_HARVEST_MAIL_2 = RuleImage(roi_front=(156,125,65,60), roi_back=(120,94,290,536), threshold=0.8, method="Template matching", file="./tasks/Restart/harvest/harvest_harvest_mail_2.png")
 
 
 	# Click Rule Assets

BIN
tasks/Restart/harvest/harvest_harvest_mail_2.png


+ 9 - 0
tasks/Restart/harvest/image.json

@@ -187,5 +187,14 @@
     "method": "Template matching",
     "threshold": 0.8,
     "description": "description"
+  },
+  {
+    "itemName": "harvest_mail_2",
+    "imageName": "harvest_harvest_mail_2.png",
+    "roiFront": "156,125,65,60",
+    "roiBack": "120,94,290,536",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "description"
   }
 ]

BIN
tasks/Restart/harvest/image_name.png


+ 5 - 1
tasks/Restart/login.py

@@ -260,11 +260,15 @@ class LoginHandler(BaseTask, RestartAssets):
                     self.wait_until_appear(self.I_HARVEST_MAIL_CONFIRM, wait_time=1)
                     timer_harvest.reset()
                     continue
-                #threshold如果是0.9,可能会导致有邮件但无法识别永久卡住
+                # threshold如果是0.9,可能会导致有邮件但无法识别永久卡住
                 if self.appear(self.I_HARVEST_MAIL_OPEN, threshold=0.8):
                     self.click(self.I_HARVEST_MAIL_OPEN, interval=0.8)
                     timer_harvest.reset()
                     continue
+                if self.appear(self.I_HARVEST_MAIL_2):
+                    self.click(self.I_HARVEST_MAIL_2, interval=0.8)
+                    timer_harvest.reset()
+                    continue
                 if ((self.appear(self.I_HARVEST_MAIL) or self.appear(self.I_HARVEST_MAIL_COPY))
                         and not self.appear(self.I_LOGIN_RED_CLOSE)):
                     self.click(self.I_HARVEST_MAIL, interval=2)

+ 2 - 2
tasks/WeeklyTrifles/assets.py

@@ -70,11 +70,11 @@ class WeeklyTriflesAssets:
 	# 秘闻进入 
 	I_WT_ENTER_SE = RuleImage(roi_front=(1145,598,100,100), roi_back=(1145,598,100,100), threshold=0.8, method="Template matching", file="./tasks/WeeklyTrifles/secret/secret_wt_enter_se.png")
 	# 秘闻分享 
-	I_WT_SE_SHARE = RuleImage(roi_front=(911,570,46,43), roi_back=(911,570,46,43), threshold=0.8, method="Template matching", file="./tasks/WeeklyTrifles/secret/secret_wt_se_share.png")
+	I_WT_SE_SHARE = RuleImage(roi_front=(911,570,46,43), roi_back=(886,547,92,95), threshold=0.8, method="Template matching", file="./tasks/WeeklyTrifles/secret/secret_wt_se_share.png")
 	# 微信 
 	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=(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_JADE = RuleImage(roi_front=(1126,533,35,39), roi_back=(1118,525,50,55), 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")
 

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

@@ -12,7 +12,7 @@
     "itemName": "wt_se_share",
     "imageName": "secret_wt_se_share.png",
     "roiFront": "911,570,46,43",
-    "roiBack": "911,570,46,43",
+    "roiBack": "886,547,92,95",
     "method": "Template matching",
     "threshold": 0.8,
     "description": "秘闻分享"
@@ -29,8 +29,8 @@
   {
     "itemName": "wt_se_jade",
     "imageName": "secret_wt_se_jade.png",
-    "roiFront": "1129,527,35,39",
-    "roiBack": "1129,527,35,39",
+    "roiFront": "1126,533,35,39",
+    "roiBack": "1118,525,50,55",
     "method": "Template matching",
     "threshold": 0.8,
     "description": "勾玉"