From 6146f195512c24f26c09b0a802e092d9203acf0f Mon Sep 17 00:00:00 2001 From: jinghaibing Date: Tue, 25 Mar 2025 17:01:16 +0800 Subject: [PATCH] =?UTF-8?q?0325=E6=9B=B4=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- __init__.py | 5 ++- baotu.py | 121 +++++++++++++++++++++++++++++++++------------------- zhixian.py | 2 +- 3 files changed, 82 insertions(+), 46 deletions(-) diff --git a/__init__.py b/__init__.py index 0f4b188..4dfbb36 100644 --- a/__init__.py +++ b/__init__.py @@ -122,9 +122,12 @@ def execute_all_tasks(): print("执行任务: 师门任务") shimen.shimenrenwu() + if "宝图任务" in renwuliebiao: + print("执行任务: 宝图任务") + baotu.baoturenwu() + if "自动挖宝" in renwuliebiao: print("执行任务: 自动挖宝") - baotu.baoturenwu() baotu.wabaotu() if "秘境降妖" in renwuliebiao: diff --git a/baotu.py b/baotu.py index 426e405..a75e5b4 100644 --- a/baotu.py +++ b/baotu.py @@ -54,59 +54,92 @@ def baoturenwu(): def wabaotu(): - while True: - if common.isfire(): - print("战斗中,等待战斗完成") - sleep(60) - res_last = common.zhaotu("包裹.png") - if res_last is not None: - common.findandclick(res_last) - sleep(1) + if common.isfire(): + print("战斗中,等待战斗完成") + sleep(60) - res_baotu = common.zhaotu("宝图任务.png") - if res_baotu is not None: - common.findandclick(res_baotu) - sleep(1) + if openbeibao(): + num =0 + while True: + res_baotu = common.zhaotu("宝图任务.png") + if res_baotu is not None: + common.findandclick(res_baotu) + sleep(1) - res_shiyong_beibao = common.zhaotu("背包-使用.png") - if res_shiyong_beibao is not None: - common.findandclick(res_shiyong_beibao) - sleep(1) + res_shiyong_beibao = common.zhaotu("背包-使用.png") + if res_shiyong_beibao is not None: + common.findandclick(res_shiyong_beibao) + sleep(1) - wabaoisover=False - while True: - if common.isfire(): - print("战斗中,等待战斗完成") - sleep(60) + wabaoisover = False + while True: + sleep(10) + if common.isfire(): + print("战斗中,等待战斗完成") + sleep(60) + res_shiyong = common.zhaotu("使用按钮.png") + if res_shiyong is not None: + common.findandclick(res_shiyong) + sleep(5) + else: + print("10秒后再次查找使用按钮") + sleep(10) + res_shiyong = common.zhaotu("使用按钮.png") + if res_shiyong is not None: + print("2次查询,找到使用按钮") + common.findandclick(res_shiyong) + sleep(5) + continue + print("没有找到使用按钮") + sleep(5) + if common.isfire(): + print("战斗中,等待战斗完成") + sleep(60) + else: + print("没在战斗中") - res_shiyong = common.zhaotu("使用按钮.png") - if res_shiyong is not None: - common.findandclick(res_shiyong) - sleep(5) - else: - print("8秒后再次查找使用按钮") - sleep(8) - res_shiyong = common.zhaotu("使用按钮.png") - if res_shiyong is not None: - print("2次查询,找到使用按钮") - common.findandclick(res_shiyong) - sleep(5) - continue - print("没有找到使用按钮") - sleep(5) - if common.isfire(): - print("战斗中,等待战斗完成") - sleep(60) - else: - print("没在战斗中") - wabaoisover =True - return + openbeibao() - sleep(8) + zhenglibb() + res_baotu = common.zhaotu("宝图任务.png") + if res_baotu is None: + wabaoisover = True + print("******背包中没有宝图,挖宝任务完成******") + return + else: + break + sleep(8) + else: + if num >1: + wabaoisover = True + print("******背包中没有宝图,挖宝任务完成******") + return + zhenglibb() + num+=1 + + + +def openbeibao(): + res_last = FindImages.find( + [ + R.img("包裹.png"), + ], + confidence=0.9, + ) + if res_last is not None: + common.findandclick(res_last) sleep(1) + return True + else: + return False +def zhenglibb(): + res_bbzl = common.zhaotu("背包-整理.png") + if res_bbzl is not None: + common.findandclick(res_bbzl) + sleep(3) def dianjirenwu(): res_btrw = common.zhaotu("日常-宝图任务.png") diff --git a/zhixian.py b/zhixian.py index edc3c45..5903b58 100644 --- a/zhixian.py +++ b/zhixian.py @@ -66,7 +66,7 @@ def xiahua(): def zhaobtn(pngs): # 找各种任务按钮 images = [R.img(png + ".png") for png in pngs] - return FindImages.find(images, confidence=0.95) + return FindImages.find(images, confidence=0.9) def sleep(num): time.sleep(num)