Parcourir la source

Merge remote-tracking branch 'origin/dev' into dev

runhey il y a 3 ans
Parent
commit
c1f0045633

+ 1 - 1
tasks/ActivityShikigami/assets.py

@@ -5,7 +5,7 @@ from module.atom.swipe import RuleSwipe
 from module.atom.ocr import RuleOcr
 from module.atom.list import RuleList
 
-# This file was automatically generated by module/dev_tools/assets_extract.py.
+# This file was automatically generated by ./dev_tools/assets_extract.py.
 # Don't modify it manually.
 class ActivityShikigamiAssets: 
 

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

@@ -101,6 +101,8 @@ class GeneralBattleAssets:
 	I_EXIT = RuleImage(roi_front=(14,12,43,41), roi_back=(14,12,43,41), threshold=0.8, method="Template matching", file="./tasks/Component/GeneralBattle/gb/gb_exit.png")
 	# 退出确认 
 	I_EXIT_ENSURE = RuleImage(roi_front=(674,388,135,63), roi_back=(674,388,135,63), threshold=0.8, method="Template matching", file="./tasks/Component/GeneralBattle/gb/gb_exit_ensure.png")
+	# 左上角好友图标 
+	I_FRIENDS = RuleImage(roi_front=(89,14,36,36), roi_back=(89,14,36,36), threshold=0.8, method="Template matching", file="./tasks/Component/GeneralBattle/gb/gb_friends.png")
 
 
 	# Image Rule Assets

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


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

@@ -160,5 +160,14 @@
     "method": "Template matching",
     "threshold": 0.8,
     "description": "退出确认"
+  },
+  {
+    "itemName": "friends",
+    "imageName": "gb_friends.png",
+    "roiFront": "89,14,36,36",
+    "roiBack": "89,14,36,36",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "左上角好友图标"
   }
 ]

+ 31 - 0
tasks/Component/GeneralBattle/general_battle.py

@@ -36,6 +36,20 @@ class GeneralBattle(BaseTask, GeneralBattleAssets):
             if self.current_count == 1:
                 self.switch_preset_team(config.preset_enable, config.preset_group, config.preset_team)
 
+            # 检测是否已经在战斗中
+            if self.is_in_battle():
+                while 1:
+                    self.screenshot()
+                    if self.appear_then_click(self.I_PREPARE_HIGHLIGHT, interval=1.5):
+                        continue
+                    if not self.appear(self.I_BUFF):
+                        break
+                win = self.battle_wait(config.random_click_swipt_enable)
+                if win:
+                    return True
+                else:
+                    return False
+
             # 点击准备按钮
             self.wait_until_appear(self.I_PREPARE_HIGHLIGHT)
             while 1:
@@ -334,6 +348,23 @@ class GeneralBattle(BaseTask, GeneralBattleAssets):
             # 重新设置为长战斗
             self.device.stuck_record_add('BATTLE_STATUS_S')
 
+    # 判断是否在战斗中
+    def is_in_battle(self, is_screenshot: bool = True) -> bool:
+        """
+        判断是否在战斗中
+        :return:
+        """
+        if is_screenshot:
+            self.screenshot()
+        if self.appear(self.I_FRIENDS) or \
+                        self.appear(self.I_WIN) or \
+                        self.appear(self.I_FALSE) or \
+                        self.appear(self.I_REWARD):
+            return True
+        else:
+            return False
+
+
 
 
 

+ 4 - 2
tasks/Component/GeneralInvite/general_invite.py

@@ -197,11 +197,13 @@ class GeneralInvite(BaseTask, GeneralInviteAssets):
         logger.info('Exit room')
         while 1:
             self.screenshot()
-            if not self.is_in_room():
+            if not self.is_in_room() and \
+                    not self.appear_then_click(self.I_GI_SURE, interval=0.5) and \
+                    not self.appear(self.I_BACK_YELLOW):
                 break
             if self.appear_then_click(self.I_GI_SURE, interval=0.5):
                 continue
-            if self.appear_then_click(self.I_BACK_YELLOW, interval=0.5):
+            if not self.appear(self.I_GI_SURE) and self.appear_then_click(self.I_BACK_YELLOW, interval=0.5):
                 continue
         return True
 

+ 5 - 0
tasks/GameUi/assets.py

@@ -161,6 +161,11 @@ class GameUiAssets:
 	I_REALM_RAID_GOTO_EXPLORATION = RuleImage(roi_front=(1192,107,36,43), roi_back=(1192,107,36,43), threshold=0.8, method="Template matching", file="./tasks/GameUi/page/page_realm_raid_goto_exploration.png")
 
 
+	# Image Rule Assets
+	# 寮结界突破右上角 
+	I_KEKKAI_TOPPA = RuleImage(roi_front=(1065,3,203,61), roi_back=(1065,3,203,61), threshold=0.8, method="Template matching", file="./tasks/GameUi/page/page_kekkai_toppa.png")
+
+
 	# Image Rule Assets
 	# 左上角蓝色的返回 
 	I_BACK_BL = RuleImage(roi_front=(32,31,50,53), roi_back=(1,2,139,120), threshold=0.8, method="Template matching", file="./tasks/GameUi/res/res_back_blue.png")

+ 1 - 1
tasks/GameUi/game_ui.py

@@ -20,7 +20,7 @@ class GameUi(BaseTask, GameUiAssets):
     ui_current: Page = None
     ui_pages = [page_main, page_summon, page_exploration, page_town,
                 # 探索的
-                page_awake_zones, page_soul_zones, page_realm_raid, page_goryou_realm, page_delegation, page_secret_zones, page_area_boss, page_heian_kitan, page_six_gates, page_bondling_fairyland,
+                page_awake_zones, page_soul_zones, page_realm_raid, page_goryou_realm, page_delegation, page_secret_zones, page_area_boss, page_heian_kitan, page_six_gates, page_bondling_fairyland, page_kekkai_toppa,
                 # 町中的
                 page_duel, page_demon_encounter, page_hunt, page_draft_duel, page_hyakkisen,
                 # 庭院里面的

+ 5 - 0
tasks/GameUi/page.py

@@ -1,6 +1,7 @@
 import traceback
 
 from tasks.GameUi.assets import GameUiAssets as G
+from tasks.RyouToppa.assets import RyouToppaAssets
 
 
 class Page:
@@ -59,6 +60,10 @@ page_exploration.link(button=G.I_EXPLORATION_GOTO_SOUL_ZONE, destination=page_so
 page_realm_raid = Page(G.I_CHECK_REALM_RAID)
 page_realm_raid.link(button=G.I_REALM_RAID_GOTO_EXPLORATION, destination=page_exploration)
 page_exploration.link(button=G.I_EXPLORATION_GOTO_REALM_RAID, destination=page_realm_raid)
+# 寮结界突破右上角 kekkai toppa
+page_kekkai_toppa = Page(G.I_KEKKAI_TOPPA)
+page_kekkai_toppa.link(button=G.I_REALM_RAID_GOTO_EXPLORATION, destination=page_exploration)
+page_realm_raid.link(button=RyouToppaAssets.I_RYOU_TOPPA, destination=page_kekkai_toppa)
 # 御灵 goryou realm
 page_goryou_realm = Page(G.I_CHECK_GORYOU)
 page_goryou_realm.link(button=G.I_BACK_BLUE, destination=page_exploration)

+ 11 - 0
tasks/GameUi/page/page_img_supplement_RyouToppa.json

@@ -0,0 +1,11 @@
+[
+  {
+    "itemName": "kekkai_toppa",
+    "imageName": "page_kekkai_toppa.png",
+    "roiFront": "1065,3,203,61",
+    "roiBack": "1065,3,203,61",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "寮结界突破右上角"
+  }
+]

BIN
tasks/GameUi/page/page_kekkai_toppa.png


+ 17 - 12
tasks/Orochi/script_task.py

@@ -122,7 +122,6 @@ class ScriptTask(GeneralBattle, GeneralInvite, GeneralBuff, GeneralRoom, GameUi,
         layer = self.config.orochi.orochi_config.layer[0]
         self.check_layer(layer)
         self.check_lock(self.config.orochi.general_battle_config.lock_team_enable)
-
         # 创建队伍
         logger.info('Create team')
         while 1:
@@ -147,26 +146,29 @@ class ScriptTask(GeneralBattle, GeneralInvite, GeneralBuff, GeneralRoom, GameUi,
             if self.check_and_invite(self.config.orochi.invite_config.default_invite):
                 continue
 
-            # 如果在探索界面或者是出现在组队界面, 那就是可能房间死了
-            # 要结束任务
-            if self.appear(self.I_MATCHING) or self.appear(self.I_CHECK_EXPLORATION):
-                sleep(0.5)
-                if self.appear(self.I_MATCHING) or self.appear(self.I_CHECK_EXPLORATION):
-                    logger.warning('Orochi task failed')
-                    success = False
-                    break
             if self.current_count >= self.limit_count:
                 if self.is_in_room():
                     logger.info('Orochi count limit out')
                     break
+
             if datetime.now() - self.start_time >= self.limit_time:
                 if self.is_in_room():
                     logger.info('Orochi time limit out')
                     break
 
 
+
             # 如果没有进入房间那就不需要后面的邀请
             if not self.is_in_room():
+                # 如果在探索界面或者是出现在组队界面, 那就是可能房间死了
+                # 要结束任务
+                sleep(0.5)
+                if self.appear(self.I_MATCHING) or self.appear(self.I_CHECK_EXPLORATION):
+                    sleep(0.5)
+                    if self.appear(self.I_MATCHING) or self.appear(self.I_CHECK_EXPLORATION):
+                        logger.warning('Orochi task failed')
+                        success = False
+                        break
                 continue
 
             # 点击挑战
@@ -207,9 +209,9 @@ class ScriptTask(GeneralBattle, GeneralInvite, GeneralBuff, GeneralRoom, GameUi,
     def run_member(self):
         logger.info('Start run member')
         self.ui_get_current_page()
-        self.ui_goto(page_soul_zones)
-        self.orochi_enter()
-        self.check_lock(self.config.orochi.general_battle_config.lock_team_enable)
+        # self.ui_goto(page_soul_zones)
+        # self.orochi_enter()
+        # self.check_lock(self.config.orochi.general_battle_config.lock_team_enable)
 
         # 进入战斗流程
         while 1:
@@ -230,6 +232,9 @@ class ScriptTask(GeneralBattle, GeneralInvite, GeneralBuff, GeneralRoom, GameUi,
                     self.run_general_battle(config=self.config.orochi.general_battle_config)
                 else:
                     break
+            # 队长秒开的时候,检测是否进入到战斗中
+            elif self.is_in_battle():
+                self.run_general_battle(config=self.config.orochi.general_battle_config)
 
         while 1:
             # 有一种情况是本来要退出的,但是队长邀请了进入的战斗的加载界面

+ 10 - 6
tasks/RealmRaid/assets.py

@@ -14,17 +14,17 @@ class RealmRaidAssets:
 	# 点击结界突破的图片 
 	I_REALM_RAID = RuleImage(roi_front=(246,628,63,64), roi_back=(246,628,63,64), threshold=0.8, method="Template matching", file="./tasks/RealmRaid/res/res_realm_raid.png")
 	# 五个勋章 
-	I_MEDAL_5 = RuleImage(roi_front=(238,205,212,53), roi_back=(216,187,919,364), threshold=0.9, method="Template matching", file="./tasks/RealmRaid/res/res_medal_5.png")
+	I_MEDAL_5 = RuleImage(roi_front=(238,205,212,53), roi_back=(216,187,919,364), threshold=0.8, method="Template matching", file="./tasks/RealmRaid/res/res_medal_5.png")
 	# description 
-	I_MEDAL_4 = RuleImage(roi_front=(241,483,193,46), roi_back=(228,178,899,362), threshold=0.9, method="Template matching", file="./tasks/RealmRaid/res/res_medal_4.png")
+	I_MEDAL_4 = RuleImage(roi_front=(241,483,193,46), roi_back=(228,178,899,362), threshold=0.8, method="Template matching", file="./tasks/RealmRaid/res/res_medal_4.png")
 	# description 
-	I_MEDAL_3 = RuleImage(roi_front=(240,210,193,41), roi_back=(229,189,894,345), threshold=0.9, method="Template matching", file="./tasks/RealmRaid/res/res_medal_3.png")
+	I_MEDAL_3 = RuleImage(roi_front=(240,210,193,41), roi_back=(229,189,894,345), threshold=0.8, method="Template matching", file="./tasks/RealmRaid/res/res_medal_3.png")
 	# description 
-	I_MEDAL_2 = RuleImage(roi_front=(572,478,198,48), roi_back=(217,193,923,354), threshold=0.9, method="Template matching", file="./tasks/RealmRaid/res/res_medal_2.png")
+	I_MEDAL_2 = RuleImage(roi_front=(572,478,198,48), roi_back=(217,193,923,354), threshold=0.8, method="Template matching", file="./tasks/RealmRaid/res/res_medal_2.png")
 	# description 
-	I_MEDAL_1 = RuleImage(roi_front=(570,206,199,52), roi_back=(237,198,892,336), threshold=0.9, method="Template matching", file="./tasks/RealmRaid/res/res_medal_1.png")
+	I_MEDAL_1 = RuleImage(roi_front=(570,206,199,52), roi_back=(237,198,892,336), threshold=0.8, method="Template matching", file="./tasks/RealmRaid/res/res_medal_1.png")
 	# 没有勋章的 
-	I_MEDAL_0 = RuleImage(roi_front=(510,336,202,51), roi_back=(231,200,898,336), threshold=0.9, method="Template matching", file="./tasks/RealmRaid/res/res_medal_0.png")
+	I_MEDAL_0 = RuleImage(roi_front=(510,336,202,51), roi_back=(231,200,898,336), threshold=0.8, method="Template matching", file="./tasks/RealmRaid/res/res_medal_0.png")
 	# 右上角红色的关闭 
 	I_BACK_RED = RuleImage(roi_front=(1178,101,57,64), roi_back=(1178,101,57,64), threshold=0.8, method="Template matching", file="./tasks/RealmRaid/res/res_back_red.png")
 	# 没有锁的状态图标 
@@ -47,6 +47,10 @@ class RealmRaidAssets:
 	I_LOCK_2 = RuleImage(roi_front=(1002,645,34,38), roi_back=(1002,645,34,38), threshold=0.9, method="Template matching", file="./tasks/RealmRaid/res/res_lock_2.png")
 	# description 
 	I_MEDAL_5_FROG = RuleImage(roi_front=(903,479,201,49), roi_back=(189,182,967,376), threshold=0.8, method="Template matching", file="./tasks/RealmRaid/res/res_medal_5_frog.png")
+	# 3徽章新图2号 
+	I_MEDAL_3_2 = RuleImage(roi_front=(575,489,188,32), roi_back=(575,489,188,32), threshold=0.8, method="Template matching", file="./tasks/RealmRaid/res/res_medal_3_2.png")
+	# description 
+	I_MEDAL_3_3 = RuleImage(roi_front=(902,479,201,50), roi_back=(902,479,201,50), threshold=0.8, method="Template matching", file="./tasks/RealmRaid/res/res_medal_3_3.png")
 
 
 	# Ocr Rule Assets

+ 24 - 6
tasks/RealmRaid/res/image.json

@@ -14,7 +14,7 @@
     "roiFront": "238,205,212,53",
     "roiBack": "216,187,919,364",
     "method": "Template matching",
-    "threshold": 0.9,
+    "threshold": 0.8,
     "description": "五个勋章"
   },
   {
@@ -23,7 +23,7 @@
     "roiFront": "241,483,193,46",
     "roiBack": "228,178,899,362",
     "method": "Template matching",
-    "threshold": 0.9,
+    "threshold": 0.8,
     "description": "description"
   },
   {
@@ -32,7 +32,7 @@
     "roiFront": "240,210,193,41",
     "roiBack": "229,189,894,345",
     "method": "Template matching",
-    "threshold": 0.9,
+    "threshold": 0.8,
     "description": "description"
   },
   {
@@ -41,7 +41,7 @@
     "roiFront": "572,478,198,48",
     "roiBack": "217,193,923,354",
     "method": "Template matching",
-    "threshold": 0.9,
+    "threshold": 0.8,
     "description": "description"
   },
   {
@@ -50,7 +50,7 @@
     "roiFront": "570,206,199,52",
     "roiBack": "237,198,892,336",
     "method": "Template matching",
-    "threshold": 0.9,
+    "threshold": 0.8,
     "description": "description"
   },
   {
@@ -59,7 +59,7 @@
     "roiFront": "510,336,202,51",
     "roiBack": "231,200,898,336",
     "method": "Template matching",
-    "threshold": 0.9,
+    "threshold": 0.8,
     "description": "没有勋章的"
   },
   {
@@ -160,5 +160,23 @@
     "method": "Template matching",
     "threshold": 0.8,
     "description": "description"
+  },
+  {
+    "itemName": "medal_3_2",
+    "imageName": "res_medal_3_2.png",
+    "roiFront": "575,489,188,32",
+    "roiBack": "575,489,188,32",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "3徽章新图2号"
+  },
+  {
+    "itemName": "medal_3_3",
+    "imageName": "res_medal_3_3.png",
+    "roiFront": "902,479,201,50",
+    "roiBack": "902,479,201,50",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "description"
   }
 ]

BIN
tasks/RealmRaid/res/res_medal_3_2.png


BIN
tasks/RealmRaid/res/res_medal_3_3.png


+ 1 - 1
tasks/RealmRaid/script_task.py

@@ -23,7 +23,7 @@ class ScriptTask(GeneralBattle, GameUi, RealmRaidAssets):
         :return:
         """
         config = self.config.realm_raid
-        self.medal_grid = ImageGrid([self.I_MEDAL_5, self.I_MEDAL_4, self.I_MEDAL_3,
+        self.medal_grid = ImageGrid([self.I_MEDAL_5, self.I_MEDAL_4, self.I_MEDAL_3, self.I_MEDAL_3_2, self.I_MEDAL_3_3,
                                      self.I_MEDAL_2, self.I_MEDAL_1, self.I_MEDAL_0])
         self.ui_get_current_page()
         self.ui_goto(page_realm_raid)

+ 3 - 3
tasks/RyouToppa/script_task.py

@@ -6,7 +6,7 @@ import time
 from tasks.RyouToppa.assets import RyouToppaAssets
 from tasks.Component.GeneralBattle.general_battle import GeneralBattle
 from tasks.GameUi.game_ui import GameUi
-from tasks.GameUi.page import page_realm_raid, page_main
+from tasks.GameUi.page import page_realm_raid, page_main, page_kekkai_toppa
 from tasks.RealmRaid.assets import RealmRaidAssets
 from module.logger import logger
 from module.exception import TaskEnd
@@ -27,7 +27,7 @@ class ScriptTask(GeneralBattle, GameUi, RyouToppaAssets):
         self.medal_grid = ImageGrid([RealmRaidAssets.I_MEDAL_5, RealmRaidAssets.I_MEDAL_4, RealmRaidAssets.I_MEDAL_3,
                                      RealmRaidAssets.I_MEDAL_2, RealmRaidAssets.I_MEDAL_1, RealmRaidAssets.I_MEDAL_0])
         self.ui_get_current_page()
-        self.ui_goto(page_realm_raid)
+        self.ui_goto(page_kekkai_toppa)
         ryou_toppa_start_flag = True
         # 点击突破
         while 1:
@@ -191,7 +191,7 @@ class ScriptTask(GeneralBattle, GameUi, RyouToppaAssets):
         #     self.run_general_battle_back(config.general_battle_config)
 
         # 打20次
-        for i in range(20):
+        for i in range(30):
             if not self.is_ticket():
                 return False
             if not self.is_target_available():