فهرست منبع

add: Climb boss act skip btn. Battle information img
refactor: Jump to the activity from the act list to add stabilization

Azure 1 سال پیش
والد
کامیت
9e247599d5

+ 1 - 0
module/base/decorator.py

@@ -192,6 +192,7 @@ def run_once(f):
             action()
     """
 
+    @wraps(f)
     def wrapper(*args, **kwargs):
         if not wrapper.has_run:
             wrapper.has_run = True

BIN
tasks/ActivityShikigami/as/as_skip_button.png


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

@@ -119,8 +119,8 @@
   {
     "itemName": "skip_button",
     "imageName": "as_skip_button.png",
-    "roiFront": "1154,34,64,30",
-    "roiBack": "1154,34,64,30",
+    "roiFront": "1159,37,51,22",
+    "roiBack": "1141,27,86,43",
     "method": "Template matching",
     "threshold": 0.8,
     "description": "右上跳过按钮"

+ 1 - 1
tasks/ActivityShikigami/assets.py

@@ -85,7 +85,7 @@ class ActivityShikigamiAssets:
 	# 增加到最大 
 	I_ADD_MAX = RuleImage(roi_front=(17,24,33,37), roi_back=(974,524,57,54), threshold=0.8, method="Template matching", file="./tasks/ActivityShikigami/as/as_add_max.png")
 	# 右上跳过按钮 
-	I_SKIP_BUTTON = RuleImage(roi_front=(1154,34,64,30), roi_back=(1154,34,64,30), threshold=0.8, method="Template matching", file="./tasks/ActivityShikigami/as/as_skip_button.png")
+	I_SKIP_BUTTON = RuleImage(roi_front=(1159,37,51,22), roi_back=(1141,27,86,43), threshold=0.8, method="Template matching", file="./tasks/ActivityShikigami/as/as_skip_button.png")
 	# 红色退出 
 	I_RED_EXIT = RuleImage(roi_front=(1162,96,39,38), roi_back=(1120,49,110,135), threshold=0.8, method="Template matching", file="./tasks/ActivityShikigami/as/as_red_exit.png")
 	# description 

+ 2 - 0
tasks/Component/GeneralBattle/assets.py

@@ -133,6 +133,8 @@ class GeneralBattleAssets:
 	I_GREEN_MARKER_BOTTOM = RuleImage(roi_front=(0,0,1280,720), roi_back=(0,0,1280,720), threshold=0.8, method="Template matching", file="./tasks/Component/GeneralBattle/gb/gb_green_marker_bottom.png")
 	# 新版本的预设图案带数字 
 	I_PRESET_WIT_NUMBER = RuleImage(roi_front=(40,655,37,37), roi_back=(9,636,100,74), threshold=0.8, method="Template matching", file="./tasks/Component/GeneralBattle/gb/gb_preset_wit_number.png")
+	# 战斗信息标识 
+	I_BATTLE_INFO = RuleImage(roi_front=(230,12,37,39), roi_back=(210,1,147,72), threshold=0.8, method="Template matching", file="./tasks/Component/GeneralBattle/gb/gb_battle_info.png")
 
 
 	# Image Rule Assets

BIN
tasks/Component/GeneralBattle/gb/gb_battle_info.png


+ 9 - 0
tasks/Component/GeneralBattle/gb/image.json

@@ -295,5 +295,14 @@
     "method": "Template matching",
     "threshold": 0.8,
     "description": "新版本的预设图案带数字"
+  },
+  {
+    "itemName": "battle_info",
+    "imageName": "gb_battle_info.png",
+    "roiFront": "230,12,37,39",
+    "roiBack": "210,1,147,72",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "战斗信息标识"
   }
 ]

+ 3 - 1
tasks/Component/GeneralBattle/general_battle.py

@@ -11,6 +11,7 @@ from module.base.utils import get_color, color_similar
 from tasks.base_task import BaseTask
 from tasks.Component.GeneralBattle.config_general_battle import GreenMarkType, GeneralBattleConfig
 from tasks.Component.GeneralBattle.assets import GeneralBattleAssets
+from tasks.Component.GeneralBattle.config_general_battle import GreenMarkType, GeneralBattleConfig
 from tasks.Component.GeneralBuff.config_buff import BuffClass
 from tasks.Component.GeneralBuff.general_buff import GeneralBuff
 
@@ -416,7 +417,8 @@ class GeneralBattle(GeneralBuff, GeneralBattleAssets):
         """
         if is_screenshot:
             self.screenshot()
-        if self.appear(self.I_FRIENDS) or \
+        if self.appear(self.I_BATTLE_INFO) or \
+                self.appear(self.I_FRIENDS) or \
                 self.appear(self.I_WIN) or \
                 self.appear(self.I_FALSE) or \
                 self.appear(self.I_REWARD):

+ 15 - 5
tasks/GameUi/game_ui.py

@@ -16,6 +16,7 @@ from tasks.GameUi.page import *
 from tasks.Restart.assets import RestartAssets
 from tasks.SixRealms.assets import SixRealmsAssets
 from tasks.base_task import BaseTask
+from tasks.ActivityShikigami.assets import ActivityShikigamiAssets
 
 
 class GameUi(BaseTask, GameUiAssets):
@@ -41,7 +42,8 @@ class GameUi(BaseTask, GameUiAssets):
                 BaseTask.I_UI_BACK_RED, BaseTask.I_UI_BACK_YELLOW, BaseTask.I_UI_BACK_BLUE,
                 GameUiAssets.I_BACK_FRIENDS, GameUiAssets.I_BACK_DAILY,
                 GameUiAssets.I_REALM_RAID_GOTO_EXPLORATION,
-                GameUiAssets.I_SIX_GATES_GOTO_EXPLORATION, SixRealmsAssets.I_EXIT_SIXREALMS]
+                GameUiAssets.I_SIX_GATES_GOTO_EXPLORATION, SixRealmsAssets.I_EXIT_SIXREALMS,
+                ActivityShikigamiAssets.I_SKIP_BUTTON, ActivityShikigamiAssets.I_RED_EXIT, ActivityShikigamiAssets.I_RED_EXIT_2]
 
     def home_explore(self) -> bool:
         """
@@ -294,7 +296,11 @@ class GameUi(BaseTask, GameUiAssets):
         self.ui_goto(page_act_list)
         # 获取活动页面在活动列表中的文字和图标
         text, png = act_map[dest_act.name]
+        ok_cnt, max_retry = 0, 3
         while True:
+            # 多次成功才算成功
+            if ok_cnt >= max_retry:
+                break
             self.screenshot()
             # 先尝试文字识别,失败则尝试图像识别,都失败则向下滑动
             result = self.L_ACT_LIST_OCR.ocr_appear(self.device.image, name=text)
@@ -302,10 +308,14 @@ class GameUi(BaseTask, GameUiAssets):
                 result = self.L_ACT_LIST_IMG.image_appear(self.device.image, name=png)
             if isinstance(result, tuple):
                 pos = result
-                break
-            x1, y1, x2, y2 = self.L_ACT_LIST_OCR.swipe_pos(number=1)
-            self.device.swipe(p1=(x1, y1), p2=(x2, y2))
-            sleep(0.5)  # 等待滑动完成
+                ok_cnt += 1
+            else:
+                ok_cnt = 0
+            # 一次都未成功则向下滑动
+            if ok_cnt == 0:
+                x1, y1, x2, y2 = self.L_ACT_LIST_OCR.swipe_pos(number=1)
+                self.device.swipe(p1=(x1, y1), p2=(x2, y2))
+            sleep(0.5)
         if isinstance(pos, tuple):
             x, y = pos
             self.device.click(x, y)

+ 2 - 1
tasks/GameUi/page.py

@@ -210,10 +210,11 @@ page_climb_act_ap.link(button=asa.I_SWITCH, destination=page_climb_act_pass)
 page_climb_act_pass.link(button=asa.I_SWITCH, destination=page_climb_act_ap)
 # 爬塔活动boss战界面
 page_climb_act_boss = Page(asa.I_CHECK_BOSS)
-page_climb_act_boss.additional = [BT.I_UI_BACK_RED]
+page_climb_act_boss.additional = [BT.I_UI_BACK_RED, asa.I_SKIP_BUTTON]
 page_climb_act_boss.link(button=G.I_BACK_Y, destination=page_climb_act)
 page_climb_act.link(button=asa.I_BOSS, destination=page_climb_act_boss)
 # 爬塔活动加成界面
 page_climb_act_buff = Page(asa.I_CHECK_BUFF)
+page_climb_act_buff.additional = [BT.I_UI_BACK_RED, asa.I_SKIP_BUTTON]
 page_climb_act_buff.link(button=G.I_BACK_Y, destination=page_climb_act)
 page_climb_act.link(button=asa.I_BUFF_CHANGE_BUTTON, destination=page_climb_act_buff)