Browse Source

Merge pull request #145 from runhey/master

Merge master to def-flutter branch
huangrunheng 2 years ago
parent
commit
7d938c6b01

+ 1 - 0
module/gui/qml.qrc

@@ -35,5 +35,6 @@
         <file>qml/Component/RuleFile2.qml</file>
         <file>qml/Content/NotifyTest.qml</file>
         <file>qml/Content/TaskList.qml</file>
+        <file>qml/Component/Notity.qml</file>
     </qresource>
 </RCC>

+ 15 - 0
module/gui/qml/Component/Notity.qml

@@ -0,0 +1,15 @@
+import QtQuick
+import QtQuick.Layouts
+import QtQuick.Window
+import QtQuick.Controls
+import FluentUI
+
+FluContentDialog{
+    title:"全新GUI"
+    message:"我们打算在2024.1.1全面切换新到GUI: OASX"
+    negativeText:"了解"
+    positiveText:"详情"
+    onPositiveClicked:{
+        Qt.openUrlExternally('https://github.com/runhey/OASX')
+    }
+}

+ 5 - 0
module/gui/qml/MainWindow.qml

@@ -68,6 +68,9 @@ FluWindow {
 //            process_manager.create_all()
         }
     }
+    Notity{
+        id: notity
+    }
 
     FluNavigationView{
         id:nav_view
@@ -83,6 +86,8 @@ FluWindow {
             footerItems.navigationView = nav_view
             nav_view.setCurrentIndex(0)
             items.addFluPaneItems()
+
+            notity.open()
         }
     }
     Component.onCompleted:{

BIN
tasks/ActivityShikigami/as/as_ap.png


BIN
tasks/ActivityShikigami/as/as_ap_activity.png


BIN
tasks/ActivityShikigami/as/as_back_green.png


BIN
tasks/ActivityShikigami/as/as_battle.png


BIN
tasks/ActivityShikigami/as/as_fire.png


BIN
tasks/ActivityShikigami/as/as_shi.png


BIN
tasks/ActivityShikigami/as/as_switch.png


BIN
tasks/ActivityShikigami/as/as_unlock.png


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

@@ -2,8 +2,8 @@
   {
     "itemName": "shi",
     "imageName": "as_shi.png",
-    "roiFront": "434,268,49,39",
-    "roiBack": "85,170,1029,142",
+    "roiFront": "437,348,49,39",
+    "roiBack": "64,280,1029,142",
     "method": "Template matching",
     "threshold": 0.7,
     "description": "进入活动"
@@ -11,7 +11,7 @@
   {
     "itemName": "back_green",
     "imageName": "as_back_green.png",
-    "roiFront": "13,18,44,44",
+    "roiFront": "16,21,44,44",
     "roiBack": "13,18,49,49",
     "method": "Template matching",
     "threshold": 0.8,
@@ -20,8 +20,8 @@
   {
     "itemName": "battle",
     "imageName": "as_battle.png",
-    "roiFront": "1010,189,47,172",
-    "roiBack": "1010,189,52,177",
+    "roiFront": "642,173,47,172",
+    "roiBack": "618,151,105,220",
     "method": "Template matching",
     "threshold": 0.8,
     "description": "进入爬塔"
@@ -47,8 +47,8 @@
   {
     "itemName": "unlock",
     "imageName": "as_unlock.png",
-    "roiFront": "1135,483,27,27",
-    "roiBack": "795,654,27,27",
+    "roiFront": "795,656,28,28",
+    "roiBack": "795,656,28,28",
     "method": "Template matching",
     "threshold": 0.8,
     "description": "还未上锁图片"
@@ -56,8 +56,8 @@
   {
     "itemName": "fire",
     "imageName": "as_fire.png",
-    "roiFront": "1135,483,22,22",
-    "roiBack": "1104,551,138,130",
+    "roiFront": "1130,575,70,79",
+    "roiBack": "1130,575,70,79",
     "method": "Template matching",
     "threshold": 0.8,
     "description": "点击战斗"
@@ -65,8 +65,8 @@
   {
     "itemName": "ap",
     "imageName": "as_ap.png",
-    "roiFront": "1136,488,20,22",
-    "roiBack": "1133,481,27,37",
+    "roiFront": "1107,497,32,34",
+    "roiBack": "1107,497,32,34",
     "method": "Template matching",
     "threshold": 0.8,
     "description": "体力按钮"
@@ -74,8 +74,8 @@
   {
     "itemName": "ap_activity",
     "imageName": "as_ap_activity.png",
-    "roiFront": "1132,485,27,31",
-    "roiBack": "1127,479,37,44",
+    "roiFront": "1108,498,27,31",
+    "roiBack": "1108,498,27,31",
     "method": "Template matching",
     "threshold": 0.8,
     "description": "活动体力"
@@ -83,8 +83,8 @@
   {
     "itemName": "switch",
     "imageName": "as_switch.png",
-    "roiFront": "1211,486,33,30",
-    "roiBack": "1211,486,33,30",
+    "roiFront": "1198,502,33,30",
+    "roiBack": "1198,502,33,30",
     "method": "Template matching",
     "threshold": 0.8,
     "description": "切换按键"

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

@@ -1,8 +1,8 @@
 [
   {
     "itemName": "remain_ap",
-    "roiFront": "1180,682,80,25",
-    "roiBack": "1180,682,80,25",
+    "roiFront": "1177,674,80,25",
+    "roiBack": "1177,674,80,25",
     "mode": "DigitCounter",
     "method": "Default",
     "keyword": "",

+ 9 - 9
tasks/ActivityShikigami/assets.py

@@ -25,25 +25,25 @@ class ActivityShikigamiAssets:
 
 	# Image Rule Assets
 	# 进入活动 
-	I_SHI = RuleImage(roi_front=(434,268,49,39), roi_back=(85,170,1029,142), threshold=0.7, method="Template matching", file="./tasks/ActivityShikigami/as/as_shi.png")
+	I_SHI = RuleImage(roi_front=(437,348,49,39), roi_back=(64,280,1029,142), threshold=0.7, method="Template matching", file="./tasks/ActivityShikigami/as/as_shi.png")
 	# 左上角返回 
-	I_BACK_GREEN = RuleImage(roi_front=(13,18,44,44), roi_back=(13,18,49,49), threshold=0.8, method="Template matching", file="./tasks/ActivityShikigami/as/as_back_green.png")
+	I_BACK_GREEN = RuleImage(roi_front=(16,21,44,44), roi_back=(13,18,49,49), threshold=0.8, method="Template matching", file="./tasks/ActivityShikigami/as/as_back_green.png")
 	# 进入爬塔 
-	I_BATTLE = RuleImage(roi_front=(1010,189,47,172), roi_back=(1010,189,52,177), threshold=0.8, method="Template matching", file="./tasks/ActivityShikigami/as/as_battle.png")
+	I_BATTLE = RuleImage(roi_front=(642,173,47,172), roi_back=(618,151,105,220), threshold=0.8, method="Template matching", file="./tasks/ActivityShikigami/as/as_battle.png")
 	# 归鹿之途 
 	I_DRUM = RuleImage(roi_front=(1011,114,29,31), roi_back=(1011,114,29,31), threshold=0.8, method="Template matching", file="./tasks/ActivityShikigami/as/as_drum.png")
 	# 上锁图标 
 	I_LOCK = RuleImage(roi_front=(795,654,25,32), roi_back=(795,654,25,32), threshold=0.8, method="Template matching", file="./tasks/ActivityShikigami/as/as_lock.png")
 	# 还未上锁图片 
-	I_UNLOCK = RuleImage(roi_front=(1135,483,27,27), roi_back=(795,654,27,27), threshold=0.8, method="Template matching", file="./tasks/ActivityShikigami/as/as_unlock.png")
+	I_UNLOCK = RuleImage(roi_front=(795,656,28,28), roi_back=(795,656,28,28), threshold=0.8, method="Template matching", file="./tasks/ActivityShikigami/as/as_unlock.png")
 	# 点击战斗 
-	I_FIRE = RuleImage(roi_front=(1135,483,22,22), roi_back=(1104,551,138,130), threshold=0.8, method="Template matching", file="./tasks/ActivityShikigami/as/as_fire.png")
+	I_FIRE = RuleImage(roi_front=(1130,575,70,79), roi_back=(1130,575,70,79), threshold=0.8, method="Template matching", file="./tasks/ActivityShikigami/as/as_fire.png")
 	# 体力按钮 
-	I_AP = RuleImage(roi_front=(1136,488,20,22), roi_back=(1133,481,27,37), threshold=0.8, method="Template matching", file="./tasks/ActivityShikigami/as/as_ap.png")
+	I_AP = RuleImage(roi_front=(1107,497,32,34), roi_back=(1107,497,32,34), threshold=0.8, method="Template matching", file="./tasks/ActivityShikigami/as/as_ap.png")
 	# 活动体力 
-	I_AP_ACTIVITY = RuleImage(roi_front=(1132,485,27,31), roi_back=(1127,479,37,44), threshold=0.8, method="Template matching", file="./tasks/ActivityShikigami/as/as_ap_activity.png")
+	I_AP_ACTIVITY = RuleImage(roi_front=(1108,498,27,31), roi_back=(1108,498,27,31), threshold=0.8, method="Template matching", file="./tasks/ActivityShikigami/as/as_ap_activity.png")
 	# 切换按键 
-	I_SWITCH = RuleImage(roi_front=(1211,486,33,30), roi_back=(1211,486,33,30), threshold=0.8, method="Template matching", file="./tasks/ActivityShikigami/as/as_switch.png")
+	I_SWITCH = RuleImage(roi_front=(1198,502,33,30), roi_back=(1198,502,33,30), threshold=0.8, method="Template matching", file="./tasks/ActivityShikigami/as/as_switch.png")
 	# 购买活动的体力 
 	I_BUY_JADE = RuleImage(roi_front=(1004,192,38,42), roi_back=(836,619,38,42), threshold=0.8, method="Template matching", file="./tasks/ActivityShikigami/as/as_buy_jade.png")
 	# 增加到最大 
@@ -54,7 +54,7 @@ class ActivityShikigamiAssets:
 
 	# Ocr Rule Assets
 	# 体力的数量检测 
-	O_REMAIN_AP = RuleOcr(roi=(1180,682,80,25), area=(1180,682,80,25), mode="DigitCounter", method="Default", keyword="", name="remain_ap")
+	O_REMAIN_AP = RuleOcr(roi=(1177,674,80,25), area=(1177,674,80,25), mode="DigitCounter", method="Default", keyword="", name="remain_ap")
 	# 活动体力的剩余检测 
 	O_REMAIN_AP_ACTIVITY = RuleOcr(roi=(707,24,106,34), area=(707,24,106,34), mode="DigitCounter", method="Default", keyword="", name="remain_ap_activity")
 	# 还有多少次购买体力的机会 

+ 33 - 34
tasks/ActivityShikigami/script_task.py

@@ -180,45 +180,44 @@ class ScriptTask(BaseActivity, ActivityShikigamiAssets):
                 if self.appear(self.I_AP_ACTIVITY, interval=1):
                     self.appear_then_click(self.I_SWITCH, interval=2)
 
-    def battle_wait(self, random_click_swipt_enable: bool) -> bool:
-        # 重写
-        self.device.stuck_record_add('BATTLE_STATUS_S')
-        self.device.click_record_clear()
-        logger.info("Start battle process")
-        self.C_RANDOM_LEFT.name = "BATTLE_RANDOM"
-        self.C_RANDOM_RIGHT.name = "BATTLE_RANDOM"
-        self.C_RANDOM_TOP.name = "BATTLE_RANDOM"
-        self.C_RANDOM_BOTTOM.name = "BATTLE_RANDOM"
-        while 1:
-            self.screenshot()
-            # 如果出现了 “获得奖励”
-            reward_click = random.choice([self.C_RANDOM_LEFT, self.C_RANDOM_RIGHT, self.C_RANDOM_TOP, self.C_RANDOM_BOTTOM])
-            if self.appear_then_click(self.I_UI_REWARD, action=reward_click, interval=1.3):
-                continue
-            # 如果出现了 “鼓”
-            if self.appear(self.I_WIN):
-                logger.info("Win")
-                while 1:
-                    self.screenshot()
-                    if not self.appear(self.I_WIN):
-                        break
-                    if self.appear_then_click(self.I_WIN, action=self.C_RANDOM_ALL, interval=1.1):
-                        continue
-                return True
-            # 失败 -> 正常人不会失败
-            if self.appear(self.I_FALSE):
-                logger.warning('False battle')
-                self.ui_click_until_disappear(self.I_FALSE)
-                return False
-            # 如果开启战斗过程随机滑动
-            if random_click_swipt_enable:
-                self.random_click_swipt()
+    # def battle_wait(self, random_click_swipt_enable: bool) -> bool:
+    #     # 重写
+    #     self.device.stuck_record_add('BATTLE_STATUS_S')
+    #     self.device.click_record_clear()
+    #     logger.info("Start battle process")
+    #     self.C_RANDOM_LEFT.name = "BATTLE_RANDOM"
+    #     self.C_RANDOM_RIGHT.name = "BATTLE_RANDOM"
+    #     self.C_RANDOM_TOP.name = "BATTLE_RANDOM"
+    #     self.C_RANDOM_BOTTOM.name = "BATTLE_RANDOM"
+    #     while 1:
+    #         self.screenshot()
+    #         # 如果出现了 “获得奖励”
+    #         reward_click = random.choice([self.C_RANDOM_LEFT, self.C_RANDOM_RIGHT, self.C_RANDOM_TOP, self.C_RANDOM_BOTTOM])
+    #         if self.appear_then_click(self.I_UI_REWARD, action=reward_click, interval=1.3):
+    #             continue
+    #         # 如果出现了 “鼓”
+    #         if self.appear(self.I_WIN):
+    #             logger.info("Win")
+    #             while 1:
+    #                 self.screenshot()
+    #                 if not self.appear(self.I_WIN):
+    #                     break
+    #                 if self.appear_then_click(self.I_WIN, action=self.C_RANDOM_ALL, interval=1.1):
+    #                     continue
+    #             return True
+    #         # 失败 -> 正常人不会失败
+    #         if self.appear(self.I_FALSE):
+    #             logger.warning('False battle')
+    #             self.ui_click_until_disappear(self.I_FALSE)
+    #             return False
+    #         # 如果开启战斗过程随机滑动
+    #         if random_click_swipt_enable:
+    #             self.random_click_swipt()
 
 
 if __name__ == '__main__':
     from module.config.config import Config
     from module.device.device import Device
-    from memory_profiler import profile
     c = Config('oas1')
     d = Device(c)
     t = ScriptTask(c, d)

+ 1 - 1
tasks/Component/BaseActivity/config_activity.py

@@ -50,7 +50,7 @@ class GeneralClimb(ConfigBase):
 
     @validator('ap_game_max', pre=True, always=True)
     def reset_game_max(cls, value):
-        def_value = int(999)
+        def_value = int(300)
         if isinstance(value, str):
             try:
                 return int(value)

+ 1 - 1
tasks/Component/GeneralBattle/assets.py

@@ -12,7 +12,7 @@ class GeneralBattleAssets:
 
 	# Click Rule Assets
 	# description 
-	C_WIN_1 = RuleClick(roi_front=(175,40,1054,161), roi_back=(175,40,1054,161), name="win_1")
+	C_WIN_1 = RuleClick(roi_front=(175,102,1054,99), roi_back=(175,102,1054,99), name="win_1")
 	# description 
 	C_WIN_2 = RuleClick(roi_front=(22,112,210,496), roi_back=(22,112,210,496), name="win_2")
 	# description 

+ 2 - 2
tasks/Component/GeneralBattle/finish_click.json

@@ -1,8 +1,8 @@
 [
   {
     "itemName": "win_1",
-    "roiFront": "175,40,1054,161",
-    "roiBack": "175,40,1054,161",
+    "roiFront": "175,102,1054,99",
+    "roiBack": "175,102,1054,99",
     "description": "description"
   },
   {

+ 4 - 0
tasks/Exploration/assets.py

@@ -60,6 +60,10 @@ class ExplorationAssets:
 	I_BATTLE_REWARD = RuleImage(roi_front=(647,395,31,21), roi_back=(1,1,1278,718), threshold=0.8, method="Template matching", file="./tasks/Exploration/res/res_battle_reward.png")
 	# 妖 
 	I_EXPLORATION_TITLE = RuleImage(roi_front=(1133,124,47,43), roi_back=(1133,124,47,43), threshold=0.8, method="Template matching", file="./tasks/Exploration/res/res_exploration_title.png")
+	# description 
+	I_BATTLE_START = RuleImage(roi_front=(555,688,39,27.5), roi_back=(221,677,561,41), threshold=0.8, method="Template matching", file="./tasks/Exploration/res/res_battle_start.png")
+	# description 
+	I_GET_REWARD = RuleImage(roi_front=(464,231,339,44), roi_back=(464,231,339,44), threshold=0.8, method="Template matching", file="./tasks/Exploration/res/res_get_reward.png")
 
 
 	# Ocr Rule Assets

+ 18 - 0
tasks/Exploration/res/image.json

@@ -133,5 +133,23 @@
     "method": "Template matching",
     "threshold": 0.8,
     "description": "妖"
+  },
+  {
+    "itemName": "battle_start",
+    "imageName": "res_battle_start.png",
+    "roiFront": "555,688,39,27.5",
+    "roiBack": "221,677,561,41",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "description"
+  },
+  {
+    "itemName": "get_reward",
+    "imageName": "res_get_reward.png",
+    "roiFront": "464,231,339,44",
+    "roiBack": "464,231,339,44",
+    "method": "Template matching",
+    "threshold": 0.8,
+    "description": "description"
   }
 ]

BIN
tasks/Exploration/res/res_battle_start.png


BIN
tasks/Exploration/res/res_e_exploration_click.png


BIN
tasks/Exploration/res/res_exploration_title.png


BIN
tasks/Exploration/res/res_get_reward.png


+ 14 - 16
tasks/Exploration/script_task.py

@@ -66,9 +66,8 @@ class ScriptTask(GeneralBattle, GameUi, SwitchSoul, ExplorationAssets):
         if explorationConfig.exploration_config.attack_number == AttackNumber.SEVEN:
             count = 0
             while count < 7:
-                self.screenshot()
-                time.sleep(0.5)
-                if self.appear_then_click(self.I_E_EXPLORATION_CLICK):
+                if self.wait_until_appear(self.I_E_EXPLORATION_CLICK, wait_time=1):
+                    self.click(self.I_E_EXPLORATION_CLICK)
                     count += 1
                     # 进入战斗环节
                     self.battle_process()
@@ -90,7 +89,7 @@ class ScriptTask(GeneralBattle, GameUi, SwitchSoul, ExplorationAssets):
             # 判断当前章节有无目标章节
             result = set(text1).intersection({explorationConfig.exploration_config.exploration_level})
             # 有则跳出检测
-            if result and len(result) > 0:
+            if self.appear(self.I_E_EXPLORATION_CLICK) or result and len(result) > 0:
                 break
             self.device.click_record_clear()
             self.swipe(self.S_SWIPE_LEVEL_UP)
@@ -103,7 +102,7 @@ class ScriptTask(GeneralBattle, GameUi, SwitchSoul, ExplorationAssets):
             self.screenshot()
             self.O_E_EXPLORATION_LEVEL_NUMBER.keyword = explorationConfig.exploration_config.exploration_level
             if self.ocr_appear_click(self.O_E_EXPLORATION_LEVEL_NUMBER):
-                self.wait_until_appear(self.I_E_EXPLORATION_CLICK)
+                self.wait_until_appear(self.I_E_EXPLORATION_CLICK, wait_time=3)
             if self.appear(self.I_E_EXPLORATION_CLICK):
                 break
 
@@ -183,23 +182,22 @@ class ScriptTask(GeneralBattle, GameUi, SwitchSoul, ExplorationAssets):
         while 1:
             self.screenshot()
             # 战后奖励
-            self.appear_then_click(self.I_BATTLE_REWARD)
+            if self.appear(self.I_BATTLE_REWARD) and not self.appear(self.I_GET_REWARD):
+                self.click(self.I_BATTLE_REWARD)
             # boss 战
             if self.appear_then_click(self.I_BOSS_BATTLE_BUTTON):
-                time.sleep(0.5)
-                self.screenshot()
-                if self.appear(self.I_BOSS_BATTLE_BUTTON):
+                if self.wait_until_appear(self.I_BATTLE_START, wait_time=5):
+                    self.run_general_battle(self.config.exploration.general_battle_config)
+                else:
                     continue
-                self.run_general_battle(self.config.exploration.general_battle_config)
             # 小怪 战
             if self.appear_then_click(self.I_NORMAL_BATTLE_BUTTON):
-                time.sleep(0.5)
-                self.screenshot()
-                if self.appear(self.I_NORMAL_BATTLE_BUTTON):
+                if self.wait_until_appear(self.I_BATTLE_START, wait_time=5):
+                    self.run_general_battle(self.config.exploration.general_battle_config)
+                else:
                     continue
-                self.run_general_battle(self.config.exploration.general_battle_config)
-                self.screenshot()
-            elif self.appear(self.I_E_AUTO_ROTATE_ON) and not self.appear(self.I_BATTLE_REWARD):
+            # 滑动
+            elif self.appear(self.I_E_AUTO_ROTATE_ON) or self.appear(self.I_GET_REWARD):
                 self.swipe(self.S_SWIPE_BACKGROUND_RIGHT)
             # 结束流程
             if self.appear(self.I_E_EXPLORATION_CLICK) or self.appear(self.I_EXPLORATION_TITLE):

+ 1 - 1
tasks/RichMan/assets.py

@@ -284,7 +284,7 @@ class RichManAssets:
 	# 购买低级盘 
 	I_SP_BUY_LOW = RuleImage(roi_front=(176,148,144,108), roi_back=(128,142,902,449), threshold=0.8, method="Template matching", file="./tasks/RichMan/mall/special/special_sp_buy_low.png")
 	# 判断是否滑动到底 
-	I_SP_SWIPE_CHECK = RuleImage(roi_front=(866,445,103,96), roi_back=(829,424,164,143), threshold=0.8, method="Template matching", file="./tasks/RichMan/mall/special/special_sp_swipe_check.png")
+	I_SP_SWIPE_CHECK = RuleImage(roi_front=(866,439,170,102), roi_back=(759,374,341,193), threshold=0.8, method="Template matching", file="./tasks/RichMan/mall/special/special_sp_swipe_check.png")
 
 
 	# Ocr Rule Assets

+ 2 - 2
tasks/RichMan/mall/special/image.json

@@ -29,8 +29,8 @@
   {
     "itemName": "sp_swipe_check",
     "imageName": "special_sp_swipe_check.png",
-    "roiFront": "866,445,103,96",
-    "roiBack": "829,424,164,143",
+    "roiFront": "866,439,170,102",
+    "roiBack": "759,374,341,193",
     "method": "Template matching",
     "threshold": 0.8,
     "description": "判断是否滑动到底"

BIN
tasks/RichMan/mall/special/special_sp_swipe_check.png