diff --git a/.idea/inspectionProfiles/.idea/.gitignore b/.idea/inspectionProfiles/.idea/.gitignore new file mode 100644 index 0000000..359bb53 --- /dev/null +++ b/.idea/inspectionProfiles/.idea/.gitignore @@ -0,0 +1,3 @@ +# 默认忽略的文件 +/shelf/ +/workspace.xml diff --git a/.idea/inspectionProfiles/.idea/inspectionProfiles/profiles_settings.xml b/.idea/inspectionProfiles/.idea/inspectionProfiles/profiles_settings.xml new file mode 100644 index 0000000..105ce2d --- /dev/null +++ b/.idea/inspectionProfiles/.idea/inspectionProfiles/profiles_settings.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/.idea/inspectionProfiles/.idea/misc.xml b/.idea/inspectionProfiles/.idea/misc.xml new file mode 100644 index 0000000..220319d --- /dev/null +++ b/.idea/inspectionProfiles/.idea/misc.xml @@ -0,0 +1,7 @@ + + + + + + \ No newline at end of file diff --git a/.idea/inspectionProfiles/.idea/modules.xml b/.idea/inspectionProfiles/.idea/modules.xml new file mode 100644 index 0000000..9f166f0 --- /dev/null +++ b/.idea/inspectionProfiles/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/inspectionProfiles/.idea/vcs.xml b/.idea/inspectionProfiles/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/.idea/inspectionProfiles/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/inspectionProfiles/.idea/梦幻助手.iml b/.idea/inspectionProfiles/.idea/梦幻助手.iml new file mode 100644 index 0000000..d0876a7 --- /dev/null +++ b/.idea/inspectionProfiles/.idea/梦幻助手.iml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml index 220319d..c293e44 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -3,5 +3,5 @@ - + \ No newline at end of file diff --git a/.idea/梦幻助手.iml b/.idea/梦幻助手.iml index d0876a7..909438d 100644 --- a/.idea/梦幻助手.iml +++ b/.idea/梦幻助手.iml @@ -2,7 +2,7 @@ - + \ No newline at end of file diff --git a/__init__.py b/__init__.py index 4dfbb36..4c1e0a9 100644 --- a/__init__.py +++ b/__init__.py @@ -10,6 +10,7 @@ from . import baotu from . import mijing from . import yabiao from . import zhixian +from . import config import time import random @@ -73,12 +74,6 @@ print("程序开启,打开游戏") # zhixian.shanghuichushou(shcswp) -renwuliebiao = [] -shanghuichushou_lb = [] -shiyongwupin_lb = [] -diuqiwupin_lb = [] -baitanchushou_lb = [] - def tunnel(k, v): try: # 尝试将 v 解析为字典 @@ -89,15 +84,15 @@ def tunnel(k, v): for key, value_list in v_dict.items(): print(f"任务-{key} 的值:", value_list) if key == "任务列表": - renwuliebiao.extend(remove_suffix(value_list)) + config.renwuliebiao.extend(remove_suffix(value_list)) if key == "商会出售": - shanghuichushou_lb.extend(remove_suffix(value_list)) + config.shanghuichushou_lb.extend(remove_suffix(value_list)) if key == "使用物品": - shiyongwupin_lb.extend(remove_suffix(value_list)) + config.shiyongwupin_lb.extend(remove_suffix(value_list)) if key == "丢弃物品": - diuqiwupin_lb.extend(remove_suffix(value_list)) + config.diuqiwupin_lb.extend(remove_suffix(value_list)) if key == "出售物品": - baitanchushou_lb.extend(remove_suffix(value_list)) + config.baitanchushou_lb.extend(remove_suffix(value_list)) # 执行所有任务 execute_all_tasks() @@ -110,54 +105,63 @@ def remove_suffix(items): def execute_all_tasks(): # 按顺序执行任务 - if "捉鬼任务" in renwuliebiao: + if "捉鬼任务" in config.renwuliebiao: print("执行任务: 捉鬼任务") common.start_alllive_task_timer(70) sleep(3) zhuogui.zhuogui() + config.renwuliebiao.remove("捉鬼任务") # 移除已完成的任务 print("捉鬼完成,调整全局检测线程时间----120") common.start_alllive_task_timer(120) - if "师门任务" in renwuliebiao: + if "师门任务" in config.renwuliebiao: print("执行任务: 师门任务") shimen.shimenrenwu() + config.renwuliebiao.remove("师门任务") # 移除已完成的任务 - if "宝图任务" in renwuliebiao: + if "宝图任务" in config.renwuliebiao: print("执行任务: 宝图任务") baotu.baoturenwu() + common.closeAllbtn() + config.renwuliebiao.remove("宝图任务") # 移除已完成的任务 - if "自动挖宝" in renwuliebiao: + if "自动挖宝" in config.renwuliebiao: print("执行任务: 自动挖宝") baotu.wabaotu() + config.renwuliebiao.remove("自动挖宝") # 移除已完成的任务 - if "秘境降妖" in renwuliebiao: + if "秘境降妖" in config.renwuliebiao: print("执行任务: 秘境降妖") mijing.mijingxiangyao() + config.renwuliebiao.remove("秘境降妖") # 移除已完成的任务 - if "普通押镖" in renwuliebiao: + if "普通押镖" in config.renwuliebiao: print("执行任务: 普通押镖") yabiao.yabiaorenwu() + config.renwuliebiao.remove("普通押镖") # 移除已完成的任务 # 其他任务按顺序执行 print("执行商会出售任务") - zhixian.shanghuichushou(shanghuichushou_lb) + zhixian.shanghuichushou(config.shanghuichushou_lb) print("执行使用物品任务") # 这里可以添加使用物品的具体逻辑 - # 例如:shiyongwupin(shiyongwupin_lb) + # 例如:shiyongwupin(config.shiyongwupin_lb) print("执行丢弃物品任务") # 这里可以添加丢弃物品的具体逻辑 - # 例如:diuqiwupin(diuqiwupin_lb) + # 例如:diuqiwupin(config.diuqiwupin_lb) print("执行出售物品任务") # 这里可以添加出售物品的具体逻辑 - # 例如:baitanchushou(baitanchushou_lb) + # 例如:baitanchushou(config.baitanchushou_lb) -# 构建一个WebWindow 显示‘/res/ui/a.html’ 通信通道为tunnel 函数 +# # 构建一个WebWindow 显示‘/res/ui/a.html’ 通信通道为tunnel 函数 w = WebWindow(R.ui('index.html'), tunnel) w.show() +# common.huodong() + print("程序结束") def sleep(num): time.sleep(num) diff --git a/baotu.py b/baotu.py index a75e5b4..86b26e5 100644 --- a/baotu.py +++ b/baotu.py @@ -16,13 +16,19 @@ def baoturenwu(): print("----------战斗中----------") sleep(60) continue - sleep(5) + sleep(10) + + print("判断状态2") + if common.isfire(): + print("----------战斗中----------") + sleep(60) + continue res_huodong = common.huodong() print("打开活动") if res_huodong: sleep(1) - res_baotu = common.zhaorenwu("宝图任务.png") + res_baotu = common.zhaorenwu("/baotu_zx/宝图任务.png") if res_baotu is not None: print("宝图任务") res_wancheng = common.zhaowancheng_text(res_baotu) @@ -36,9 +42,9 @@ def baoturenwu(): if res_canjia is not None: common.findandclick(res_canjia) print("点击参加,宝图任务") - sleep(1) + sleep(3) - res_ttwf = common.zhaotu("听听无妨.png") + res_ttwf = common.zhaotu("/baotu_zx/听听无妨.png") if res_ttwf is not None: common.findandclick(res_ttwf) sleep(1) @@ -62,7 +68,7 @@ def wabaotu(): if openbeibao(): num =0 while True: - res_baotu = common.zhaotu("宝图任务.png") + res_baotu = common.zhaotu("/baotu_zx/宝图任务.png") if res_baotu is not None: common.findandclick(res_baotu) sleep(1) @@ -142,7 +148,7 @@ def zhenglibb(): sleep(3) def dianjirenwu(): - res_btrw = common.zhaotu("日常-宝图任务.png") + res_btrw = common.zhaotu("/baotu_zx/日常-宝图任务.png") if res_btrw is None: print("没找到-任务列表-宝图任务") return diff --git a/common.py b/common.py index 8a047b5..7eb3a50 100644 --- a/common.py +++ b/common.py @@ -3,6 +3,8 @@ import random import threading from . import duiwu +from . import config +from . import lingqushuangbei # 导入系统资源模块 from ascript.android.system import R @@ -18,6 +20,8 @@ from ascript.android.screen import FindColors # 文字识别 from ascript.android.screen import Ocr +from ascript.android.screen import CompareColors + # 战斗状态 isfire_wfstatus = False @@ -30,6 +34,14 @@ shuangbei = False # 定义一个全局变量来管理定时器 alllive_task_timer = None +# 记录战斗次数 +battle_count = 0 + +# 记录上次战斗状态 +last_battle_status = False + +# 定义一个全局变量来管理战斗状态监控定时器 +battle_monitor_timer = None def huodong(): while True: @@ -39,6 +51,7 @@ def huodong(): sleep(1) res_hd_c = FindImages.find([R.img("活动-c.png"), ], rect=[421, 76, 620, 137], confidence=0.95) if res_hd_c is not None: + lingquhuodongjiangli() return True else: continue @@ -60,6 +73,58 @@ def huodong(): sleep(1) +def lingquhuodongjiangli(): + x1 = 322 + y1 = 539 + x2 = 382 + y2 = 596 + + hypy = 364 + # 373,592 绿色 #56AE08 + # 已领取 #B08559 + res_ylq = FindColors.find_all("331,541,#AF8458|355,601,#B1875B|388,572,#AA7C52|353,530,#AC8055", + rect=[289, 517, 399, 612]) + res_bsjg = CompareColors.compare("364,625,#56AE08") + if res_bsjg and res_ylq is None: + findandclick({"rect": [x1, y1, x2, y2]}) + + x1 += 130 + x2 += 130 + # 2号奖励 + res_ylq = FindColors.find_all("331,541,#AF8458|355,601,#B1875B|388,572,#AA7C52|353,530,#AC8055", + rect=[289, 517, 399, 612]) + res_bsjg = CompareColors.compare("494,625,#56AE08") + if res_bsjg and res_ylq is None: + findandclick({"rect": [x1, y1, x2, y2]}) + + x1 += 130 + x2 += 130 + # 3号奖励 + res_ylq = FindColors.find_all("331,541,#AF8458|355,601,#B1875B|388,572,#AA7C52|353,530,#AC8055", + rect=[289, 517, 399, 612]) + res_bsjg = CompareColors.compare("630,625,#56AE08") + if res_bsjg and res_ylq is None: + findandclick({"rect": [x1, y1, x2, y2]}) + + x1 += 130 + x2 += 130 + # 4号奖励 + res_ylq = FindColors.find_all("331,541,#AF8458|355,601,#B1875B|388,572,#AA7C52|353,530,#AC8055", + rect=[289, 517, 399, 612]) + res_bsjg = CompareColors.compare("765,625,#56AE08") + if res_bsjg and res_ylq is None: + findandclick({"rect": [x1, y1, x2, y2]}) + + x1 += 130 + x2 += 130 + # 5号奖励 + res_ylq = FindColors.find_all("331,541,#AF8458|355,601,#B1875B|388,572,#AA7C52|353,530,#AC8055", + rect=[289, 517, 399, 612]) + res_bsjg = CompareColors.compare("895,625,#56AE08") + if res_bsjg and res_ylq is None: + findandclick({"rect": [x1, y1, x2, y2]}) + + def findandclick(res): # 提取矩形范围 rect = res["rect"] # [x1, y1, x2, y2] @@ -69,8 +134,8 @@ def findandclick(res): y = random.randint(rect[1], rect[3]) # 随机 y 坐标 # 执行点击操作 - print(f"点击", rect) action.click(x, y) # 在随机点点击 + print(f"点击", rect) time.sleep(0.5) @@ -121,17 +186,65 @@ def zhaotu(name): def isfire(): - global isfire_wfstatus + global isfire_wfstatus, last_battle_status, battle_count # 战斗中 res_zdqx = zhaotu("战斗-取消.png") if res_zdqx is None: print("未找到目标图片:战斗-取消.png") - isfire_wfstatus = False + current_battle_status = False else: print("战斗中.....") - isfire_wfstatus = True + current_battle_status = True + + # 检测战斗状态变化 + if current_battle_status and not last_battle_status: + print("战斗开始") + elif not current_battle_status and last_battle_status: + print("战斗结束") + battle_count += 1 + print(f"战斗次数: {battle_count}") + + last_battle_status = current_battle_status + isfire_wfstatus = current_battle_status return isfire_wfstatus +def monitor_battle_status(): + global battle_monitor_timer + isfire() + if not zhuoguiisover: + battle_monitor_timer = threading.Timer(2, monitor_battle_status) + battle_monitor_timer.start() + else: + stop_battle_monitor_timer() + + + +def start_battle_monitor_timer(): + global battle_monitor_timer + if battle_monitor_timer is not None: + battle_monitor_timer.cancel() + battle_monitor_timer = threading.Timer(2, monitor_battle_status) + battle_monitor_timer.start() + print("战斗状态监控已启动") + +def stop_battle_monitor_timer(): + global battle_monitor_timer + if battle_monitor_timer is not None: + battle_monitor_timer.cancel() + battle_monitor_timer = None + print("战斗状态监控已停止") + +def check_shuangbei(): + global shuangbeidianshu + print("开始检测双倍点数") + res_guaji1 = zhaotu("挂机1.png") + res_guaji = zhaotu("挂机.png") + res_guaji_last = res_guaji or res_guaji1 + if res_guaji_last is not None: + lingqushuangbei.lingqu(res_guaji_last) + print("双倍领取完成") + else: + print("未找到挂机入口,双倍检测失败") def denglu(): while True: @@ -295,6 +408,7 @@ def shizi(fanwei): def alllive_task(num): print("---------------定时任务-寻找异常弹窗----------------") + print(f"--------------当前剩余任务:{config.renwuliebiao}") # 输出当前剩余任务 # zhaotu("道具领取-弹框.png") ref_daoju = zhaotu("道具领取-弹框.png") if ref_daoju is None: diff --git a/config.py b/config.py new file mode 100644 index 0000000..2c5219e --- /dev/null +++ b/config.py @@ -0,0 +1,7 @@ +# config.py + +renwuliebiao = [] +shanghuichushou_lb = [] +shiyongwupin_lb = [] +diuqiwupin_lb = [] +baitanchushou_lb = [] diff --git a/duiwu.py b/duiwu.py index a4d2a76..2af9137 100644 --- a/duiwu.py +++ b/duiwu.py @@ -43,7 +43,7 @@ def tuichuzudui(): common.closeAllbtn() else: print("-------找到创建队伍,没有在队伍中------") - + common.closeAllbtn() return else: sleep(1) diff --git a/lingqushuangbei.py b/lingqushuangbei.py index df52596..69127f0 100644 --- a/lingqushuangbei.py +++ b/lingqushuangbei.py @@ -74,6 +74,7 @@ def lingqu(zuobiao): for i in range(xunhuancishu): print(f"领取双倍 100 点, 次数 {i + 1}/{xunhuancishu}") common.findandclick(res_lingqu) + ylq_num += 100 sleep(0.5) if res_ylq_text is None: @@ -85,6 +86,8 @@ def lingqu(zuobiao): else: shuangbeidianshu = ylq_num if ylq_num >= 4: + if ylq_num >= 1000: + ylq_num = 1000 print(f"正常领取结束,开始任务", ylq_num) common.shuangbei = True common.closeAllbtn() diff --git a/res/img/光芒石.png b/res/img/shanghui/光芒石.png similarity index 100% rename from res/img/光芒石.png rename to res/img/shanghui/光芒石.png diff --git a/res/img/制造书-女衣.png b/res/img/shanghui/制造书-女衣.png similarity index 100% rename from res/img/制造书-女衣.png rename to res/img/shanghui/制造书-女衣.png diff --git a/res/img/制造书-宝珠.png b/res/img/shanghui/制造书-宝珠.png similarity index 100% rename from res/img/制造书-宝珠.png rename to res/img/shanghui/制造书-宝珠.png diff --git a/res/img/制造书-枪.png b/res/img/shanghui/制造书-枪.png similarity index 100% rename from res/img/制造书-枪.png rename to res/img/shanghui/制造书-枪.png diff --git a/res/img/制造书-鞋.png b/res/img/shanghui/制造书-鞋.png similarity index 100% rename from res/img/制造书-鞋.png rename to res/img/shanghui/制造书-鞋.png diff --git a/res/img/玄武石.png b/res/img/shanghui/玄武石.png similarity index 100% rename from res/img/玄武石.png rename to res/img/shanghui/玄武石.png diff --git a/res/img/白虎石.png b/res/img/shanghui/白虎石.png similarity index 100% rename from res/img/白虎石.png rename to res/img/shanghui/白虎石.png diff --git a/res/img/百炼精铁.png b/res/img/shanghui/百炼精铁.png similarity index 100% rename from res/img/百炼精铁.png rename to res/img/shanghui/百炼精铁.png diff --git a/res/img/黑宝石.png b/res/img/shanghui/黑宝石.png similarity index 100% rename from res/img/黑宝石.png rename to res/img/shanghui/黑宝石.png diff --git a/res/img/shimen/按钮-选择.png b/res/img/shimen/按钮-选择.png new file mode 100644 index 0000000..020a042 Binary files /dev/null and b/res/img/shimen/按钮-选择.png differ diff --git a/res/img/shimen/选择-集物.png b/res/img/shimen/选择-集物.png new file mode 100644 index 0000000..63284e1 Binary files /dev/null and b/res/img/shimen/选择-集物.png differ diff --git a/shimen.py b/shimen.py index 8f122e5..502a337 100644 --- a/shimen.py +++ b/shimen.py @@ -7,7 +7,8 @@ from ascript.android.screen import FindImages from ascript.android.screen import FindColors -pngs = ["/shimen/师门-任务按钮", "使用按钮", "/shimen/师门任务1", "普陀山", "购买按钮", "上交按钮", "/shimen/师门01", "摆摊-购买"] +pngs = ["/shimen/师门-任务按钮", "使用按钮", "/shimen/师门任务1", "/shimen/普陀山", "购买按钮", "上交按钮", + "/shimen/师门01", "摆摊-购买", "/shimen/师门-龙宫", "/shimen/首席请", "跳过动画", "/shimen/不打自招"] def shimenrenwu(): @@ -44,10 +45,15 @@ def shimenrenwu(): common.findandclick(res_canjia) print("点击参加,师门任务") sleep(1) + res_xzjw = common.zhaotu("/shimen/选择-集物.png") + if res_xzjw is not None: + findxuanze(res_xzjw) res_qwc = zhaobtn(["/shimen/师门-去完成", "/shimen/师门-继续任务"]) - if res_qwc is not None: - sleep(1) - common.findandclick(res_qwc) + if res_qwc is not None or res_xzjw is not None: + if res_qwc is not None: + sleep(1) + common.findandclick(res_qwc) + while True: print("判断状态1") if common.isfire(): @@ -60,7 +66,12 @@ def shimenrenwu(): common.findandclick(res_btns) sleep(3) - res_qctb = zhaobtn(["请出题吧", "师傅请"]) + res_btns = zhaobtn(pngs) + if res_btns is not None: + common.findandclick(res_btns) + sleep(3) + + res_qctb = zhaobtn(["/shimen/请出题吧", "/shimen/师傅请"]) if res_qctb is not None: common.findandclick(res_qctb) sleep(1) @@ -94,6 +105,13 @@ def shimenrenwu(): sleep(1) +def findxuanze(fanwei): + res_anxz = common.zhaotu("/shimen/按钮-选择.png") + if res_anxz is not None: + common.findandclick(res_anxz) + sleep(1) + + def dianjirenwu(): res_shimen = common.zhaotu("/shimen/师门.png") if res_shimen is None: diff --git a/zhixian.py b/zhixian.py index 5903b58..1656542 100644 --- a/zhixian.py +++ b/zhixian.py @@ -29,7 +29,7 @@ def shanghuichushou(shcswp): common.findandclick(res_gd) sleep(1) - res_shcs = zhaobtn(["商会出售", "商会出售01"]) + res_shcs = zhaobtn(["/shanghui/商会出售", "/shanghui/商会出售01"]) if res_shcs is not None: common.findandclick(res_shcs) sleep(1) @@ -66,7 +66,7 @@ def xiahua(): def zhaobtn(pngs): # 找各种任务按钮 images = [R.img(png + ".png") for png in pngs] - return FindImages.find(images, confidence=0.9) + return FindImages.find(images, confidence=0.95) def sleep(num): time.sleep(num) diff --git a/zhuogui.py b/zhuogui.py index e6a1014..fbfe483 100644 --- a/zhuogui.py +++ b/zhuogui.py @@ -25,125 +25,156 @@ from ascript.android.screen import FindColors from ascript.android.screen import Ocr -def check_shuangbei(): - lingqushuangbei.lingqushuangbei() # 执行双倍点数检测 - print(f"----------------------------5分钟检测一次双倍点数:", lingqushuangbei.shuangbeidianshu) - timeer = threading.Timer(300, check_shuangbei) - timeer.start() - if common.zhuoguiisover is True: - print("捉鬼完成,检测双倍点数线程关闭") - timeer.cancel() - return - - def zhuogui(): - check_shuangbei() - if common.shuangbei is False or common.zhuoguiisover is True: - print("双倍领取失败,双倍不足,捉鬼完成") - duiwu.tuichuzudui() + global battle_count # 声明全局变量 + + # 开始时检测一次双倍点数 + common.check_shuangbei() + if common.shuangbei is False: + print("双倍点数不足,停止捉鬼任务") return - if common.shuangbei: - print("开始捉鬼") - # 先执行退出队伍 - while True: - if common.zhuoguiisover is True and common.shuangbei is False: - print("-------------------------检查到捉鬼完成,退出队伍,进行下一项") - duiwu.tuichuzudui() - return + print("开始捉鬼") + # 先执行退出队伍 + duiwu.tuichuzudui() - # zhaotu("战斗-取消.png") - res_zdsb = common.zhaotu("战斗失败.png") - if res_zdsb is not None: - print("找到战斗失败") - common.findandclick(res_zdsb) + # 启动战斗状态监控定时任务 + common.start_battle_monitor_timer() + + while True: + if common.zhuoguiisover is True: + print("捉鬼完成,退出捉鬼任务") + common.stop_battle_monitor_timer() + return + + if common.shuangbei is False: + print("双倍点数不足,停止捉鬼任务") + common.stop_battle_monitor_timer() + return + + print(f"战斗次数:", common.battle_count, "双倍点数:", + lingqushuangbei.shuangbeidianshu - (common.battle_count * 4)) + # 检测双倍点数 + if lingqushuangbei.shuangbeidianshu < common.battle_count * 4: + print("双倍点数不足,停止捉鬼任务") + common.zhuoguiisover = True + common.stop_battle_monitor_timer() + return + + # 检查战斗状态 + if common.isfire(): + print("----------战斗中----------") + sleep(60) + continue + + res_zdsb = common.zhaotu("战斗失败.png") + if res_zdsb is not None: + print("找到战斗失败") + common.findandclick(res_zdsb) + sleep(1) + duiwu.tuichuzudui() + continue + + print("判断状态1") + if common.isfire(): + print("----------战斗中----------") + sleep(60) + continue + sleep(10) + print("判断状态2") + if common.isfire(): + print("----------再次判断战斗中----------") + sleep(60) + continue + + res_huodong = common.huodong() + if res_huodong: + sleep(1) + res_gui = common.zhaorenwu("鬼图标2.png") + if res_gui is None: + print("未找到目标图片:鬼图标.png") + # 翻页 + common.closeAllbtn() + continue + else: sleep(1) - duiwu.tuichuzudui() - continue - - print("判断状态1") - if common.isfire(): - print("----------战斗中----------") - sleep(60) - continue - sleep(10) - print("判断状态2") - if common.isfire(): - print("----------再次判断战斗中----------") - sleep(60) - continue - - res_huodong = common.huodong() - if res_huodong: - sleep(1) - res_gui = common.zhaorenwu("鬼图标2.png") - if res_gui is None: - print("未找到目标图片:鬼图标.png") - # 翻页 + res_canjia = common.zhaocanjia_text(res_gui) + res_wancheng = common.zhaowancheng(res_gui) + if res_wancheng is not None: + print("捉鬼任务完成,退出队伍") common.closeAllbtn() - continue + sleep(2) + duiwu.tuichuzudui() + common.zhuoguiisover = True + common.stop_battle_monitor_timer() + return + + if res_canjia is None: + print("未找到目标图片:参加.png") + if common.isfire(): + print("正在战斗,等待战斗完成") + sleep(60) + continue + else: + print("异常情况") + common.closeAllbtn() + continue else: sleep(1) - res_canjia = common.zhaocanjia_text(res_gui) - res_wancheng = common.zhaowancheng(res_gui) - if res_wancheng is not None: - print("捉鬼任务完成,退出队伍") + print("点击参加") + common.findandclick(res_canjia) + sleep(1) + res_zdpp = common.zhaotu("自动匹配.png") + res_qxpp = common.zhaotu("取消匹配.png") + if res_qxpp is not None: + print("正在匹配,等待匹配完成") + sleep(20) common.closeAllbtn() - sleep(2) - duiwu.tuichuzudui() - common.zhuoguiisover = True - return + continue - if res_canjia is None: - print("未找到目标图片:参加.png") + if res_zdpp is None: + print("未找到目标图片:自动匹配.png") + print("判断状态3") + sleep(10) if common.isfire(): - print("正在战斗,等待战斗完成") + print("1战斗中-等待战斗结束") sleep(60) continue else: - print("异常情况") - common.closeAllbtn() - continue - else: - sleep(1) - print("点击参加") - common.findandclick(res_canjia) - sleep(1) - res_zdpp = common.zhaotu("自动匹配.png") - res_qxpp = common.zhaotu("取消匹配.png") - if res_qxpp is not None: - print("正在匹配,等待匹配完成") - sleep(20) - common.closeAllbtn() - continue - - if res_zdpp is None: - print("未找到目标图片:自动匹配.png") - print("判断状态3") + print("判断状态4") sleep(10) if common.isfire(): - print("1战斗中-等待战斗结束") + print("2战斗中-等待战斗结束") sleep(60) continue else: - print("判断状态4") - sleep(10) - if common.isfire(): - print("2战斗中-等待战斗结束") - sleep(60) - continue - else: - print("点了参加,也没自动匹配,也没在战斗中-退出队伍") - duiwu.tuichuzudui() - print("退出组队后,重新捉鬼") + print("点了参加,也没自动匹配,也没在战斗中-退出队伍") + duiwu.tuichuzudui() + print("退出组队后,重新捉鬼") + + else: + common.findandclick(res_zdpp) + print("---------捉鬼开始了---------") + common.closeAllbtn() + sleep(2) + common.closeAllbtn() + sleep(60) + + # 检查战斗状态 + if common.isfire(): + print("----------战斗中----------") + sleep(60) + + # 检测双倍点数 + if lingqushuangbei.shuangbeidianshu < common.battle_count * 4: + print("双倍点数不足,停止捉鬼任务") + common.zhuoguiisover = True + common.stop_battle_monitor_timer() + return else: - common.findandclick(res_zdpp) - print("---------捉鬼开始了---------") - common.closeAllbtn() - sleep(2) - common.closeAllbtn() - sleep(60) + print("未进入战斗,重新开始捉鬼任务") + continue sleep(1)