Jelajahi Sumber

Merge pull request #1283 from runhey/dev

Automated PR 2025.11.27
huangrunheng 11 bulan lalu
induk
melakukan
e6502386f7

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

@@ -37,6 +37,9 @@ Item {
         anchors.bottomMargin: 12
 
         onLoaded: {
+            if (!contentDefalut.item)
+                return
+
             if(typeof contentDefalut.item.splitPanel === "undefined"){
                 return
             }
@@ -113,6 +116,10 @@ Item {
 //    }
     //设置右边显示的参数项,输入的序列的字符串
     function setLoaderData(args, value){
+        if (!contentLoader.item) {
+            console.log("SplitPanel: contentLoader.item is null in setLoaderData")
+            return
+        }
         contentLoader.item.argsData = args
         contentLoader.item.valueData = value
         contentLoader.item.updataData()
@@ -120,12 +127,20 @@ Item {
 
     //设置上下文
     function setLoaderContext(configName, taskName){
+        if (!contentLoader.item) {
+            console.log("SplitPanel: contentLoader.item is null in setLoaderContext")
+            return
+        }
         contentLoader.item.configName = configName
         contentLoader.item.taskName = taskName
     }
 
     //设置配置的名称
     function setDefalutConfig(name){
+        if (!contentDefalut.item) {
+            console.log("SplitPanel: contentDefalut.item is null in setDefalutConfig")
+            return
+        }
         contentDefalut.item.configName = name
     }
 

+ 24 - 3
module/gui/qml/Content/TaskList.qml

@@ -143,8 +143,29 @@ Item{
 
     Component.onCompleted:{
 
-        const data = JSON.parse(process_manager.gui_task_list(MainEvent.scriptName))
-        const menu = JSON.parse(process_manager.gui_menu())
+        var rawTaskList = process_manager.gui_task_list(MainEvent.scriptName)
+        var rawMenu     = process_manager.gui_menu()
+
+        console.log("TaskList rawTaskList =", rawTaskList)
+        console.log("TaskList rawMenu =", rawMenu)
+
+        var data = {}
+        var menu = {}
+
+        try {
+            data = JSON.parse(rawTaskList)
+        } catch (e) {
+            console.error("TaskList: JSON.parse task_list error:", e, "raw =", rawTaskList)
+            return   // 解析失败就不要往下走了
+        }
+
+        try {
+            menu = JSON.parse(rawMenu)
+        } catch (e) {
+            console.error("TaskList: JSON.parse menu error:", e, "raw =", rawMenu)
+            return
+        }
+
         for(const key in menu){
             if(key === "Overview" || key === 'TaskList' || key === 'Script' || key === 'Tools'){
                 continue
@@ -152,9 +173,9 @@ Item{
             const groupData = classify(menu[key], data)
             create_group(key, groupData)
         }
-
     }
 
+
     // 分类对每一个任务组,
     // 第一个参数是这个菜单组的所有, 如["Script", "Restart", "GlobalGame"]
     // 第二个参数是整个的数据

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

@@ -151,6 +151,8 @@ class GeneralBattleAssets:
 	O_PRESET = RuleOcr(roi=(20,620,60,80), area=(20,620,60,80), mode="Single", method="Default", keyword="预", name="preset")
 	# 预设 
 	O_PRESET_FULL = RuleOcr(roi=(20,620,60,80), area=(20,620,60,80), mode="Single", method="Default", keyword="预设", name="preset_full")
+	# 已标记 
+	O_BOSS_MARK = RuleOcr(roi=(379,44,50,21), area=(379,44,50,21), mode="Single", method="Default", keyword="已标记", name="boss_mark")
 
 
 	# Swipe Rule Assets

+ 11 - 2
tasks/Component/GeneralBattle/gb/ocr.json

@@ -11,7 +11,7 @@
   {
     "itemName": "preset",
     "roiFront": "20,620,60,80",
-    "roiBack":  "20,620,60,80",
+    "roiBack": "20,620,60,80",
     "mode": "Single",
     "method": "Default",
     "keyword": "预",
@@ -20,10 +20,19 @@
   {
     "itemName": "preset_full",
     "roiFront": "20,620,60,80",
-    "roiBack":  "20,620,60,80",
+    "roiBack": "20,620,60,80",
     "mode": "Single",
     "method": "Default",
     "keyword": "预设",
     "description": "预设"
+  },
+  {
+    "itemName": "boss_mark",
+    "roiFront": "379,44,50,21",
+    "roiBack": "379,44,50,21",
+    "mode": "Single",
+    "method": "Default",
+    "keyword": "已标记",
+    "description": "已标记"
   }
 ]

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

@@ -539,6 +539,28 @@ class GeneralBattle(GeneralBuff, GeneralBattleAssets):
             if self.appear_then_click(self.I_BUFF, interval=1):
                 continue
 
+    def boss_mark(self, enable=True) -> bool:
+        if not enable or self._boss_mark_flag:
+            return False
+        if self.ocr_appear(self.O_BOSS_MARK):
+            self.screenshot()
+            if self.ocr_appear(self.O_BOSS_MARK):
+                self._boss_mark_flag = True
+                logger.info('Boss marked')
+                self.device.stuck_record_add('BATTLE_STATUS_S')
+                return True
+        if self.device.click_record.count(str(self.O_BOSS_MARK)) >= 3:
+            self._boss_mark_flag = True
+            logger.info('Boss mark skipped due to maybe no boss')
+            self.device.stuck_record_add('BATTLE_STATUS_S')
+            return False
+        if self.click(self.O_BOSS_MARK, interval=1.8):
+            return False
+        return False
+
+    def boss_mark_reset(self):
+        self._boss_mark_flag = False
+
 
 if __name__ == '__main__':
     from module.config.config import Config

+ 4 - 4
tasks/Duel/assets.py

@@ -61,12 +61,12 @@ class DuelAssets:
 	# 战斗带保护的 
 	I_D_BATTLE_PROTECT = RuleImage(roi_front=(1153,578,100,100), roi_back=(1118,553,155,149), threshold=0.8, method="Template matching", file="./tasks/Duel/duel/duel_d_battle_protect.png")
 	# 自动上阵 
-	I_D_AUTO_ENTRY = RuleImage(roi_front=(42,133,66,62), roi_back=(20,119,115,111), threshold=0.8, method="Template matching", file="./tasks/Duel/duel/duel_d_auto_entry.png")
+	I_D_AUTO_ENTRY = RuleImage(roi_front=(21,116,66,62), roi_back=(2,95,115,111), threshold=0.8, method="Template matching", file="./tasks/Duel/duel/duel_d_auto_entry.png")
 	# 主界面的感叹号 
-	I_D_HELP = RuleImage(roi_front=(719,434,32,30), roi_back=(708,397,49,78), threshold=0.8, method="Template matching", file="./tasks/Duel/duel/duel_d_help.png")
+	I_D_HELP = RuleImage(roi_front=(784,502,32,30), roi_back=(774,489,49,55), threshold=0.8, method="Template matching", file="./tasks/Duel/duel/duel_d_help.png")
 	# 准备 
 	I_D_PREPARE = RuleImage(roi_front=(1127,541,100,100), roi_back=(1127,541,100,100), threshold=0.8, method="Template matching", file="./tasks/Duel/duel/duel_d_prepare.png")
-    # 准备完毕 
+	# 准备完毕 
 	I_D_PREPARE_DONE = RuleImage(roi_front=(495,82,75,55), roi_back=(495,82,75,55), threshold=0.8, method="Template matching", file="./tasks/Duel/duel/duel_d_prepare_done.png")
 	# 战斗数据 
 	I_D_BATTLE_DATA = RuleImage(roi_front=(1068,610,38,60), roi_back=(1068,610,38,60), threshold=0.8, method="Template matching", file="./tasks/Duel/duel/duel_d_battle_data.png")
@@ -91,7 +91,7 @@ class DuelAssets:
 	# 禁用 
 	I_BAN = RuleImage(roi_front=(1112,537,100,100), roi_back=(1112,537,100,100), threshold=0.8, method="Template matching", file="./tasks/Duel/duel/duel_ban.png")
 	# 左上角的退出 
-	I_DUEL_EXIT = RuleImage(roi_front=(14,12,43,41), roi_back=(14,12,43,41), threshold=0.8, method="Template matching", file="./tasks/Duel/duel/gb_exit.png")
+	I_DUEL_EXIT = RuleImage(roi_front=(14,12,43,41), roi_back=(14,12,43,41), threshold=0.8, method="Template matching", file="./tasks/Duel/duel/duel_duel_exit.png")
 
 
 	# Ocr Rule Assets

TEMPAT SAMPAH
tasks/Duel/duel/duel_d_auto_entry.png


TEMPAT SAMPAH
tasks/Duel/duel/duel_d_help.png


TEMPAT SAMPAH
tasks/Duel/duel/duel_d_team.png


TEMPAT SAMPAH
tasks/Duel/duel/duel_d_team_swtich.png


+ 5 - 5
tasks/Duel/duel/image.json

@@ -38,8 +38,8 @@
   {
     "itemName": "d_auto_entry",
     "imageName": "duel_d_auto_entry.png",
-    "roiFront": "42,133,66,62",
-    "roiBack": "20,119,115,111",
+    "roiFront": "21,116,66,62",
+    "roiBack": "2,95,115,111",
     "method": "Template matching",
     "threshold": 0.8,
     "description": "自动上阵"
@@ -47,8 +47,8 @@
   {
     "itemName": "d_help",
     "imageName": "duel_d_help.png",
-    "roiFront": "719,434,32,30",
-    "roiBack": "708,397,49,78",
+    "roiFront": "784,502,32,30",
+    "roiBack": "774,489,49,55",
     "method": "Template matching",
     "threshold": 0.8,
     "description": "主界面的感叹号"
@@ -163,7 +163,7 @@
   },
   {
     "itemName": "duel_exit",
-    "imageName": "gb_exit.png",
+    "imageName": "duel_duel_exit.png",
     "roiFront": "14,12,43,41",
     "roiBack": "14,12,43,41",
     "method": "Template matching",

+ 8 - 2
tasks/Duel/script_task.py

@@ -22,6 +22,7 @@ from tasks.Component.SwitchSoul.switch_soul import SwitchSoul
 from tasks.GameUi.page import page_main, page_team, page_shikigami_records
 import os
 from module.atom.image import RuleImage
+from tasks.GlobalGame.assets import GlobalGameAssets as GGA
 """ 斗技 """
 
 
@@ -88,6 +89,9 @@ class ScriptTask(GameUi, GeneralBattle, SwitchSoul, DuelAssets):
         duel_week_over = False
         while 1:
             self.screenshot()
+            # 关闭恭喜晋升段位页面
+            if self.appear_then_click(GGA.I_UI_BACK_RED):
+                continue
             if self.appear_then_click(self.I_REWARD, interval=0.6):
                 continue
             if not self.duel_main():
@@ -410,6 +414,9 @@ class ScriptTask(GameUi, GeneralBattle, SwitchSoul, DuelAssets):
         swipe_timer.start()
         while 1:
             self.screenshot()
+            # 收取奖励
+            if self.ui_reward_appear_click(True):
+                continue
             if self.appear_then_click(self.I_D_BATTLE_DATA, action=self.C_D_BATTLE_DATA, interval=0.6):
                 continue
             if self.appear(self.I_FALSE):
@@ -474,8 +481,7 @@ class ScriptTask(GameUi, GeneralBattle, SwitchSoul, DuelAssets):
 if __name__ == '__main__':
     from module.config.config import Config
     from module.device.device import Device
-
-    c = Config('mi')
+    c = Config('oas3')
     d = Device(c)
     t = ScriptTask(c, d)
 

+ 1 - 1
tasks/MetaDemon/assets.py

@@ -49,7 +49,7 @@ class MetaDemonAssets:
 
 	# Image Rule Assets
 	# 右侧进去 
-	I_RIGHT_ENTER = RuleImage(roi_front=(1183,314,46,42), roi_back=(1150,131,100,360), threshold=0.75, method="Template matching", file="./tasks/MetaDemon/md/md_right_enter.png")
+	I_RIGHT_ENTER = RuleImage(roi_front=(1183,314,46,34), roi_back=(1150,131,100,360), threshold=0.75, method="Template matching", file="./tasks/MetaDemon/md/md_right_enter.png")
 	# description 
 	I_ENTER2 = RuleImage(roi_front=(461,265,44,156), roi_back=(428,220,100,258), threshold=0.8, method="Template matching", file="./tasks/MetaDemon/md/md_enter2.png")
 	# 寻找鬼王 

+ 1 - 1
tasks/MetaDemon/md/image_2025.json

@@ -2,7 +2,7 @@
   {
     "itemName": "right_enter",
     "imageName": "md_right_enter.png",
-    "roiFront": "1183,314,46,42",
+    "roiFront": "1183,314,46,34",
     "roiBack": "1150,131,100,360",
     "method": "Template matching",
     "threshold": 0.75,

TEMPAT SAMPAH
tasks/MetaDemon/md/md_right_enter.png


+ 5 - 2
tasks/MetaDemon/script_task.py

@@ -100,7 +100,7 @@ class ScriptTask(RightActivity, GeneralBattle, SwitchSoul, Star56):
         if self.config.meta_demon.meta_demon_config.meta_crafting_card:
             self.crafting()
 
-        boss_timer = Timer(180)
+        boss_timer = Timer(50)
         boss_timer.start()
         first_battle_for_easy_boss = True
         while 1:
@@ -133,7 +133,7 @@ class ScriptTask(RightActivity, GeneralBattle, SwitchSoul, Star56):
                     is_hard_boss = True
             # 是否喝茶 疲劳满了就不打了
             current_exhaustion = self.current_exhaustion()
-            if current_exhaustion > 99:
+            if current_exhaustion > 100:
                 if self.config.meta_demon.meta_demon_config.auto_tea:
                     logger.info('Exhaustion is full, buy tea')
                     boss_timer.reset()
@@ -274,6 +274,7 @@ class ScriptTask(RightActivity, GeneralBattle, SwitchSoul, Star56):
         self.device.stuck_record_add('BATTLE_STATUS_S')
         self.device.click_record_clear()
         logger.info("Start battle process")
+        self.boss_mark_reset()
         while 1:
             self.screenshot()
             # if self.appear_then_click(self.I_WIN, interval=1):
@@ -287,6 +288,8 @@ class ScriptTask(RightActivity, GeneralBattle, SwitchSoul, Star56):
                 logger.warning('False battle')
                 self.ui_click_until_disappear(self.I_MD_BATTLE_FAILURE)
                 return False
+            if self.boss_mark():
+                continue
 
 
 if __name__ == '__main__':

+ 1 - 1
tasks/RichMan/assets.py

@@ -156,7 +156,7 @@ class RichManAssets:
 	# 寄售屋 
 	I_MALL_CONSIGNMENT_CHECK = RuleImage(roi_front=(12,166,100,390), roi_back=(12,166,100,390), threshold=0.8, method="Template matching", file="./tasks/RichMan/mall/navbar/navbar_mall_consignment_check.png")
 	# 密卷屋 
-	I_MALL_SCCALES = RuleImage(roi_front=(470,649,68,49), roi_back=(427,621,147,92), threshold=0.8, method="Template matching", file="./tasks/RichMan/mall/navbar/navbar_mall_sccales.png")
+	I_MALL_SCCALES = RuleImage(roi_front=(470,647,68,37), roi_back=(427,621,147,92), threshold=0.8, method="Template matching", file="./tasks/RichMan/mall/navbar/navbar_mall_sccales.png")
 	# 密卷屋 
 	I_MALL_SCCALES_CHECK = RuleImage(roi_front=(409,253,100,100), roi_back=(409,253,100,100), threshold=0.8, method="Template matching", file="./tasks/RichMan/mall/navbar/navbar_mall_sccales_check.png")
 	# description 

+ 1 - 1
tasks/RichMan/mall/navbar/image_bottom.json

@@ -20,7 +20,7 @@
   {
     "itemName": "mall_sccales",
     "imageName": "navbar_mall_sccales.png",
-    "roiFront": "470,649,68,49",
+    "roiFront": "470,647,68,37",
     "roiBack": "427,621,147,92",
     "method": "Template matching",
     "threshold": 0.8,

TEMPAT SAMPAH
tasks/RichMan/mall/navbar/navbar_mall_sccales.png


TEMPAT SAMPAH
tasks/RichMan/mall/navbar/navbar_mall_sccales_check.png


+ 1 - 0
tasks/base_task.py

@@ -59,6 +59,7 @@ class BaseTask(GlobalGameAssets, CostumeBase):
 
         # 战斗次数相关
         self.current_count = 0  # 战斗次数
+        self._boss_mark_flag = False
 
     def _burst(self) -> bool:
         """