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

fix(DailyTrifles): Improve store sign navigation and mall detection

- retry gift recommendation clicks until the store sign appears\n- update mall recognition region and template image\n- run the full task from the script entry point
blylana 1 неделя назад
Родитель
Сommit
ad778fba73

+ 10 - 3
tasks/DailyTrifles/script_task.py

@@ -222,8 +222,15 @@ class ScriptTask(GameUi, Summon, DailyTriflesAssets):
     def run_store_sign(self):
 
         self.goto_page(page_store_gift_room)
-        self.screenshot()
-        self.appear_then_click(self.I_GIFT_RECOMMEND, interval=1)
+
+        cnt = 0
+        while 1:
+            self.screenshot()
+            if self.appear(self.I_GIFT_SIGN) or cnt >=4:
+                break
+            if self.appear_then_click(self.I_GIFT_RECOMMEND, interval=1):
+                cnt += 1
+                continue
         logger.info('Enter store sign')
         sleep(1)  # 等个动画
         self.screenshot()
@@ -302,4 +309,4 @@ if __name__ == '__main__':
     d = Device(c)
     t = ScriptTask(c, d)
 
-    t.run_friend_love()
+    t.run()

+ 1 - 1
tasks/GameUi/assets.py

@@ -144,7 +144,7 @@ class GameUiAssets:
 	# 花合战页面标志 
 	I_CHECK_DAILY = RuleImage(roi_front=(28,515,58,62), roi_back=(1,487,154,145), threshold=0.8, method="Template matching", file="./tasks/GameUi/page/page_check_daily.png")
 	# 商店页面标志 
-	I_CHECK_MALL = RuleImage(roi_front=(231,455,131,78), roi_back=(201,432,185,121), threshold=0.8, method="Template matching", file="./tasks/GameUi/page/page_check_mall.png")
+	I_CHECK_MALL = RuleImage(roi_front=(1087,413,47,114), roi_back=(1043,397,116,155), threshold=0.8, method="Template matching", file="./tasks/GameUi/page/page_check_mall.png")
 	# 商店页面标志(紫色招牌) 
 	I_CHECK_MALL_PURPLE = RuleImage(roi_front=(231,455,131,78), roi_back=(201,432,185,121), threshold=0.8, method="Template matching", file="./tasks/GameUi/page/page_check_mall_purple.png")
 	# 商店推荐页面标志 

+ 2 - 2
tasks/GameUi/page/image_main.json

@@ -164,8 +164,8 @@
   {
     "itemName": "check_mall",
     "imageName": "page_check_mall.png",
-    "roiFront": "231,455,131,78",
-    "roiBack": "201,432,185,121",
+    "roiFront": "1087,413,47,114",
+    "roiBack": "1043,397,116,155",
     "method": "Template matching",
     "threshold": 0.8,
     "description": "商店页面标志"

BIN
tasks/GameUi/page/page_check_mall.png