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

Merge branch 'dev' into patch-2

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

+ 1 - 0
tasks/Component/Costume/config.py

@@ -48,6 +48,7 @@ class BattleType(str, Enum):
     COSTUME_BATTLE_6 = 'costume_battle_6'  # 桂馥金秋
     COSTUME_BATTLE_7 = 'costume_battle_7'  # 笼梦之境
     COSTUME_BATTLE_8 = 'costume_battle_8'  # 藏金台阁
+    COSTUME_BATTLE_9 = 'costume_battle_9'  # 莲华圣域
 
 
 

+ 6 - 1
tasks/Component/Costume/costume_base.py

@@ -116,6 +116,11 @@ battle_theme_model = {
         'I_DE_WIN': 'I_DE_WIN_8',
         'I_FALSE': 'I_FALSE_8',
     },
+    BattleType.COSTUME_BATTLE_9: {
+        'I_LOCAL': 'I_LOCAL_9',
+        'I_EXIT': 'I_EXIT_9',
+        'I_FRIENDS': 'I_FRIENDS_9',
+    },
 }
 
 
@@ -176,4 +181,4 @@ class CostumeBase:
 
 if __name__ == '__main__':
     c = CostumeBase()
-    c.check_costume_main(MainType.COSTUME_MAIN_1)
+    c.check_costume_main(MainType.COSTUME_MAIN_2)

+ 9 - 0
tasks/Component/CostumeBattle/assets.py

@@ -88,3 +88,12 @@ class CostumeBattleAssets:
 	I_FALSE_8 = RuleImage(roi_front=(384,106,100,100), roi_back=(346,96,184,120), threshold=0.8, method="Template matching", file="./tasks/Component/CostumeBattle/battle8/battle8_false_8.png")
 
 
+	# Image Rule Assets
+	# 左上角退出 
+	I_EXIT_9 = RuleImage(roi_front=(20,17,35,34), roi_back=(20,17,35,34), threshold=0.8, method="Template matching", file="./tasks/Component/CostumeBattle/battle9/battle9_exit_9.png")
+	# 左上角好友 
+	I_FRIENDS_9 = RuleImage(roi_front=(93,15,31,36), roi_back=(93,15,31,36), threshold=0.8, method="Template matching", file="./tasks/Component/CostumeBattle/battle9/battle9_friends_9.png")
+	# 指针 
+	I_LOCAL_9 = RuleImage(roi_front=(114,489,37,37), roi_back=(114,489,37,37), threshold=0.8, method="Template matching", file="./tasks/Component/CostumeBattle/battle9/battle9_local_9.png")
+
+

BIN
tasks/Component/CostumeBattle/battle9/battle9_exit_9.png


BIN
tasks/Component/CostumeBattle/battle9/battle9_friends_9.png


BIN
tasks/Component/CostumeBattle/battle9/battle9_local_9.png


+ 29 - 0
tasks/Component/CostumeBattle/battle9/image.json

@@ -0,0 +1,29 @@
+[
+  {
+    "itemName": "exit_9",
+    "imageName": "battle9_exit_9.png",
+    "roiFront": "20,17,35,34",
+    "roiBack": "20,17,35,34",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "左上角退出"
+  },
+  {
+    "itemName": "friends_9",
+    "imageName": "battle9_friends_9.png",
+    "roiFront": "93,15,31,36",
+    "roiBack": "93,15,31,36",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "左上角好友"
+  },
+  {
+    "itemName": "local_9",
+    "imageName": "battle9_local_9.png",
+    "roiFront": "114,489,37,37",
+    "roiBack": "114,489,37,37",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "指针"
+  }
+]

+ 1 - 1
tasks/Component/CostumeBattle/costume_test_battle.py

@@ -74,5 +74,5 @@ if __name__ == '__main__':
     c = Config('oas1')
     d = Device(c)
     t = ScriptTask(c, d)
-    t.set_costume(BattleType.COSTUME_BATTLE_1)
+    t.set_costume(BattleType.COSTUME_BATTLE_9)
     t.run()

BIN
tasks/HeroTest/as/as_start_challenge.png


+ 9 - 0
tasks/HeroTest/as/image.json

@@ -187,5 +187,14 @@
     "method": "Template matching",
     "threshold": 0.8,
     "description": "通过兵藏秘境取消重置按钮"
+  },
+  {
+    "itemName": "start_challenge",
+    "imageName": "as_start_challenge.png",
+    "roiFront": "685,407,142,47",
+    "roiBack": "685,407,142,47",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "周一点击确认开始挑战"
   }
 ]

+ 2 - 0
tasks/HeroTest/assets.py

@@ -53,6 +53,8 @@ class HeroTestAssets:
 	I_BCMJ_RESET_CONFIRM = RuleImage(roi_front=(668,399,180,70), roi_back=(668,399,180,70), threshold=0.8, method="Template matching", file="./tasks/HeroTest/as/as_bcmj_reset_confirm.png")
 	# 通过兵藏秘境取消重置按钮 
 	I_BCMJ_RESET_CLOSE = RuleImage(roi_front=(429,397,186,71), roi_back=(429,397,186,71), threshold=0.8, method="Template matching", file="./tasks/HeroTest/as/as_bcmj_reset_close.png")
+	# 周一点击确认开始挑战 
+	I_START_CHALLENGE = RuleImage(roi_front=(685,407,142,47), roi_back=(685,407,142,47), threshold=0.8, method="Template matching", file="./tasks/HeroTest/as/as_start_challenge.png")
 
 
 	# Ocr Rule Assets

+ 25 - 18
tasks/HeroTest/script_task.py

@@ -8,6 +8,7 @@ from tasks.Component.BaseActivity.base_activity import BaseActivity
 from tasks.HeroTest.assets import HeroTestAssets
 from tasks.GameUi.page import page_main, page_shikigami_records
 from tasks.GameUi.game_ui import GameUi
+from tasks.GameUi.page import page_exploration
 from tasks.Component.SwitchSoul.switch_soul import SwitchSoul
 
 from module.logger import logger
@@ -52,6 +53,13 @@ class ScriptTask(GameUi, BaseActivity, HeroTestAssets, SwitchSoul):
 
         self.ui_get_current_page()
         self.ui_goto(page_main)
+        # 启动经验加成
+        if is_update:
+            self.open_buff()
+            self.exp_100(True)
+            self.exp_50(True)
+            self.close_buff()
+        self.ui_goto(page_exploration)
         self.home_main()
         # 设定是否锁定阵容
         if is_update:
@@ -109,7 +117,7 @@ class ScriptTask(GameUi, BaseActivity, HeroTestAssets, SwitchSoul):
             # 如果是兵藏秘境 看看是否有兵道帖
             if is_skill:
                 if not self.check_art_war_card():
-                    logger.info("Art war card is enough")
+                    logger.info("Art war card is not enough")
                     break
             # 点击战斗
             logger.info("Click battle")
@@ -122,6 +130,11 @@ class ScriptTask(GameUi, BaseActivity, HeroTestAssets, SwitchSoul):
                     if not self.appear(self.I_BATTLE):
                         break
                 elif is_skill:
+                    if not self.check_art_war_card():
+                        logger.info("Art war card is not nough")
+                        break
+                    if self.appear_then_click(self.I_START_CHALLENGE, interval=1):
+                        continue
                     if self.appear_then_click(self.I_BCMJ_RESET_CONFIRM, interval=1):
                         continue
                     if self.appear_then_click(self.I_BCMJ_BATTLE, interval=2):
@@ -258,12 +271,6 @@ class ScriptTask(GameUi, BaseActivity, HeroTestAssets, SwitchSoul):
         logger.hr("Enter HeroTest", 2)
         global is_update
         global is_skill
-        # 启动经验加成
-        if is_update:
-            self.open_buff()
-            self.exp_100(True)
-            self.exp_50(True)
-            self.close_buff()
         while 1:
             self.screenshot()
             if is_update:
@@ -272,8 +279,6 @@ class ScriptTask(GameUi, BaseActivity, HeroTestAssets, SwitchSoul):
             if is_skill:
                 if self.appear(self.I_BCMJ_BATTLE):
                     break
-            if self.appear_then_click(self.I_ONE, interval=1):
-                continue
             if self.appear_then_click(self.I_TWO, interval=1):
                 continue
             if is_update:
@@ -292,14 +297,6 @@ class ScriptTask(GameUi, BaseActivity, HeroTestAssets, SwitchSoul):
         global is_update
         while 1:
             self.screenshot()
-            if self.appear(self.I_ONE):
-                if is_update:
-                    # 关闭经验加成
-                    self.open_buff()
-                    self.exp_100(False)
-                    self.exp_50(False)
-                    self.close_buff()
-                break
             if self.appear_then_click(self.I_UI_BACK_RED, interval=2):
                 continue
             if self.appear_then_click(self.I_UI_BACK_YELLOW, interval=2):
@@ -308,13 +305,23 @@ class ScriptTask(GameUi, BaseActivity, HeroTestAssets, SwitchSoul):
                 continue
             if self.appear_then_click(self.I_GBB_BACK, interval=2):
                 continue
+            self.ui_get_current_page()
+            self.ui_goto(page_main)
+            if is_update:
+                # 关闭经验加成
+                self.open_buff()
+                self.exp_100(False)
+                self.exp_50(False)
+                self.close_buff()
+            break
+
 
 
 if __name__ == "__main__":
     from module.config.config import Config
     from module.device.device import Device
 
-    c = Config("oas1")
+    c = Config("oas2")
     d = Device(c)
     t = ScriptTask(c, d)