Sfoglia il codice sorgente

优化契灵组队

liujx54704 1 anno fa
parent
commit
c7dfe39e25

+ 6 - 1
tasks/BondlingFairyland/assets.py

@@ -51,7 +51,12 @@ class BondlingFairylandAssets:
 	I_BALL_HELP = RuleImage(roi_front=(963,571,100,100), roi_back=(963,571,100,100), threshold=0.8, method="Template matching", file="./tasks/BondlingFairyland/ball/ball_ball_help.png")
 	# 契灵创建队伍 
 	I_CREATE_TEAM = RuleImage(roi_front=(569,491,141,50), roi_back=(569,491,141,50), threshold=0.8, method="Template matching", file="./tasks/BondlingFairyland/ball/create_team.png")
-
+	# 点击邀请
+	I_INVITE_ENSURE = RuleImage(roi_front=(500,541,132,60),roi_back=(478,523,378,92),threshold=0.8,method="模板匹配",file="./tasks/Component/GeneralInvite/gi/gi_invite_ensure.png")
+	# 判断是否点中好友了
+	I_SELECTED = RuleImage(roi_front=(895,373,33,32),roi_back=(380,157,568,350),threshold=0.8,method="模板匹配",file="./tasks/Component/GeneralInvite/gi/gi_selected.png")
+	# 用来判断当前的列表是哪儿的
+	I_FLAG_1_ON = RuleImage(roi_front=(373,127,22,21),roi_back=(373,127,22,21),threshold=0.7,method="模板匹配",file="./tasks/BondlingFairyland/ball/gi_flag_1_on.png")
 
 	# Image Rule Assets
 	# description 

+ 29 - 2
tasks/BondlingFairyland/ball/image.json

@@ -44,7 +44,7 @@
     "threshold": 0.8,
     "description": "求援"
   },
-    {
+  {
     "itemName": "create_team",
     "imageName": "create_team.png",
     "roiFront": "569,491,141,50",
@@ -52,5 +52,32 @@
     "method": "Template matching",
     "threshold": 0.8,
     "description": "契灵创建队伍"
-    }
+  },
+  {
+    "itemName": "invite_ensure",
+    "imageName": "gi_invite_ensure.png",
+    "roiFront": "500,541,132,60",
+    "roiBack": "478,523,378,92",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "点击邀请"
+  },
+  {
+    "itemName": "selected",
+    "imageName": "gi_selected.png",
+    "roiFront": "895,373,33,32",
+    "roiBack": "380,157,568,350",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "判断是否点中好友了"
+  },
+  {
+    "itemName": "flag_1_on",
+    "imageName": "gi_flag_1_on.png",
+    "roiFront": "373,127,22,21",
+    "roiBack": "3373,127,22,21",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "用来判断当前的列表是哪儿的"
+  }
 ]

+ 8 - 6
tasks/BondlingFairyland/general_invite.py

@@ -13,6 +13,8 @@ from tasks.base_task import BaseTask
 from tasks.Component.GeneralInvite.assets import GeneralInviteAssets
 from tasks.Component.GeneralInvite.config_invite import InviteConfig, InviteNumber, FindMode
 from tasks.Component.GeneralBattle.assets import GeneralBattleAssets
+from tasks.BondlingFairyland.assets import BondlingFairylandAssets
+
 from module.logger import logger
 
 
@@ -317,7 +319,7 @@ class GeneralInvite(BaseTask, GeneralInviteAssets):
 
         while appear_1 or appear_2:
             self.screenshot()
-            if self.appear(self.I_SELECTED):
+            if self.appear(BondlingFairylandAssets.I_SELECTED):
                 break
             appear_1 = self.ocr_appear_click(self.O_FRIEND_NAME_1, interval=2)
             appear_2 = self.ocr_appear_click(self.O_FRIEND_NAME_2, interval=2)
@@ -337,7 +339,7 @@ class GeneralInvite(BaseTask, GeneralInviteAssets):
             self.screenshot()
             if self.appear(self.I_LOAD_FRIEND):
                 break
-            if self.appear(self.I_INVITE_ENSURE):
+            if self.appear(BondlingFairylandAssets.I_INVITE_ENSURE):
                 break
             if self.appear_then_click(self.I_ADD_2, interval=1):
                 continue
@@ -410,7 +412,7 @@ class GeneralInvite(BaseTask, GeneralInviteAssets):
             # 首先切换到不同的好友列表
             while index == 0:
                 self.screenshot()
-                if self.appear(self.I_FLAG_1_ON):
+                if self.appear(BondlingFairylandAssets.I_FLAG_1_ON):
                     break
                 if self.appear_then_click(self.I_FLAG_1_OFF, interval=1):
                     continue
@@ -447,13 +449,13 @@ class GeneralInvite(BaseTask, GeneralInviteAssets):
 
         # 点击确定
         logger.info('Click invite ensure')
-        if not self.appear(self.I_INVITE_ENSURE):
+        if not self.appear(BondlingFairylandAssets.I_INVITE_ENSURE):
             logger.warning('No appear invite ensure while invite friend')
         while 1:
             self.screenshot()
-            if not self.appear(self.I_INVITE_ENSURE):
+            if not self.appear(BondlingFairylandAssets.I_INVITE_ENSURE):
                 break
-            if self.appear_then_click(self.I_INVITE_ENSURE):
+            if self.appear_then_click(BondlingFairylandAssets.I_INVITE_ENSURE):
                 continue
         # 哪怕没有找到好友也有点击 确认 以退出好友列表
         if not is_select:

+ 3 - 3
tasks/Component/GeneralInvite/assets.py

@@ -46,11 +46,11 @@ class GeneralInviteAssets:
 	# 左上角退出 
 	I_BACK_YELLOW = RuleImage(roi_front=(19,13,58,55), roi_back=(19,13,58,55), threshold=0.8, method="Template matching", file="./tasks/Component/GeneralInvite/gi/gi_back_yellow.png")
 	# 点击邀请 
-	I_INVITE_ENSURE = RuleImage(roi_front=(500,541,132,60), roi_back=(478,523,378,92), threshold=0.8, method="Template matching", file="./tasks/Component/GeneralInvite/gi/gi_invite_ensure.png")
+	I_INVITE_ENSURE = RuleImage(roi_front=(710,544,132,60), roi_back=(710,544,132,60), threshold=0.8, method="Template matching", file="./tasks/Component/GeneralInvite/gi/gi_invite_ensure.png")
 	# 判断是否点中好友了 
-	I_SELECTED = RuleImage(roi_front=(895,373,33,32), roi_back=(380,157,568,350), threshold=0.8, method="Template matching", file="./tasks/Component/GeneralInvite/gi/gi_selected.png")
+	I_SELECTED = RuleImage(roi_front=(895,373,33,32), roi_back=(895,373,33,32), threshold=0.8, method="Template matching", file="./tasks/Component/GeneralInvite/gi/gi_selected.png")
 	# 用来判断当前的列表是哪儿的 
-	I_FLAG_1_ON = RuleImage(roi_front=(373,127,22,21), roi_back=(373,127,22,21), threshold=0.7, method="Template matching", file="./tasks/Component/GeneralInvite/gi/gi_flag_1_on_new.png")
+	I_FLAG_1_ON = RuleImage(roi_front=(354,126,62,21), roi_back=(354,126,62,21), threshold=0.8, method="Template matching", file="./tasks/Component/GeneralInvite/gi/gi_flag_1_on.png")
 	# description 
 	I_FLAG_1_OFF = RuleImage(roi_front=(353,126,58,22), roi_back=(353,126,58,22), threshold=0.8, method="Template matching", file="./tasks/Component/GeneralInvite/gi/gi_flag_1_off.png")
 	# description 

BIN
tasks/Component/GeneralInvite/gi/gi_flag_1_on_new.png


+ 5 - 5
tasks/Component/GeneralInvite/gi/image.json

@@ -155,8 +155,8 @@
   {
     "itemName": "invite_ensure",
     "imageName": "gi_invite_ensure.png",
-    "roiFront": "500,541,132,60",
-    "roiBack": "478,523,378,92",
+    "roiFront": "710,544,132,60",
+    "roiBack": "710,544,132,60",
     "method": "Template matching",
     "threshold": 0.8,
     "description": "点击邀请"
@@ -165,7 +165,7 @@
     "itemName": "selected",
     "imageName": "gi_selected.png",
     "roiFront": "895,373,33,32",
-    "roiBack": "380,157,568,350",
+    "roiBack": "895,373,33,32",
     "method": "Template matching",
     "threshold": 0.8,
     "description": "判断是否点中好友了"
@@ -173,8 +173,8 @@
   {
     "itemName": "flag_1_on",
     "imageName": "gi_flag_1_on.png",
-    "roiFront": "373,127,22,21",
-    "roiBack": "3373,127,22,21",
+    "roiFront": "354,126,62,21",
+    "roiBack": "354,126,62,21",
     "method": "Template matching",
     "threshold": 0.8,
     "description": "用来判断当前的列表是哪儿的"