0327更改

This commit is contained in:
jinghaibing 2025-03-27 11:50:25 +08:00
parent 6146f19551
commit a6454d45ed
28 changed files with 361 additions and 140 deletions

3
.idea/inspectionProfiles/.idea/.gitignore generated vendored Normal file
View File

@ -0,0 +1,3 @@
# 默认忽略的文件
/shelf/
/workspace.xml

View File

@ -0,0 +1,6 @@
<component name="InspectionProjectProfileManager">
<settings>
<option name="USE_PROJECT_PROFILE" value="false" />
<version value="1.0" />
</settings>
</component>

7
.idea/inspectionProfiles/.idea/misc.xml generated Normal file
View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Black">
<option name="sdkName" value="Python 3.8 (pythonProject)" />
</component>
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.8 (pythonProject)" project-jdk-type="Python SDK" />
</project>

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/梦幻助手.iml" filepath="$PROJECT_DIR$/.idea/梦幻助手.iml" />
</modules>
</component>
</project>

6
.idea/inspectionProfiles/.idea/vcs.xml generated Normal file
View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="PYTHON_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$" />
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

2
.idea/misc.xml generated
View File

@ -3,5 +3,5 @@
<component name="Black"> <component name="Black">
<option name="sdkName" value="Python 3.8 (pythonProject)" /> <option name="sdkName" value="Python 3.8 (pythonProject)" />
</component> </component>
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.8 (pythonProject)" project-jdk-type="Python SDK" /> <component name="ProjectRootManager" version="2" project-jdk-name="Python 3.11" project-jdk-type="Python SDK" />
</project> </project>

View File

@ -2,7 +2,7 @@
<module type="PYTHON_MODULE" version="4"> <module type="PYTHON_MODULE" version="4">
<component name="NewModuleRootManager"> <component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$" /> <content url="file://$MODULE_DIR$" />
<orderEntry type="inheritedJdk" /> <orderEntry type="jdk" jdkName="Python 3.11" jdkType="Python SDK" />
<orderEntry type="sourceFolder" forTests="false" /> <orderEntry type="sourceFolder" forTests="false" />
</component> </component>
</module> </module>

View File

@ -10,6 +10,7 @@ from . import baotu
from . import mijing from . import mijing
from . import yabiao from . import yabiao
from . import zhixian from . import zhixian
from . import config
import time import time
import random import random
@ -73,12 +74,6 @@ print("程序开启,打开游戏")
# zhixian.shanghuichushou(shcswp) # zhixian.shanghuichushou(shcswp)
renwuliebiao = []
shanghuichushou_lb = []
shiyongwupin_lb = []
diuqiwupin_lb = []
baitanchushou_lb = []
def tunnel(k, v): def tunnel(k, v):
try: try:
# 尝试将 v 解析为字典 # 尝试将 v 解析为字典
@ -89,15 +84,15 @@ def tunnel(k, v):
for key, value_list in v_dict.items(): for key, value_list in v_dict.items():
print(f"任务-{key} 的值:", value_list) print(f"任务-{key} 的值:", value_list)
if key == "任务列表": if key == "任务列表":
renwuliebiao.extend(remove_suffix(value_list)) config.renwuliebiao.extend(remove_suffix(value_list))
if key == "商会出售": if key == "商会出售":
shanghuichushou_lb.extend(remove_suffix(value_list)) config.shanghuichushou_lb.extend(remove_suffix(value_list))
if key == "使用物品": if key == "使用物品":
shiyongwupin_lb.extend(remove_suffix(value_list)) config.shiyongwupin_lb.extend(remove_suffix(value_list))
if key == "丢弃物品": if key == "丢弃物品":
diuqiwupin_lb.extend(remove_suffix(value_list)) config.diuqiwupin_lb.extend(remove_suffix(value_list))
if key == "出售物品": if key == "出售物品":
baitanchushou_lb.extend(remove_suffix(value_list)) config.baitanchushou_lb.extend(remove_suffix(value_list))
# 执行所有任务 # 执行所有任务
execute_all_tasks() execute_all_tasks()
@ -110,54 +105,63 @@ def remove_suffix(items):
def execute_all_tasks(): def execute_all_tasks():
# 按顺序执行任务 # 按顺序执行任务
if "捉鬼任务" in renwuliebiao: if "捉鬼任务" in config.renwuliebiao:
print("执行任务: 捉鬼任务") print("执行任务: 捉鬼任务")
common.start_alllive_task_timer(70) common.start_alllive_task_timer(70)
sleep(3) sleep(3)
zhuogui.zhuogui() zhuogui.zhuogui()
config.renwuliebiao.remove("捉鬼任务") # 移除已完成的任务
print("捉鬼完成,调整全局检测线程时间----120") print("捉鬼完成,调整全局检测线程时间----120")
common.start_alllive_task_timer(120) common.start_alllive_task_timer(120)
if "师门任务" in renwuliebiao: if "师门任务" in config.renwuliebiao:
print("执行任务: 师门任务") print("执行任务: 师门任务")
shimen.shimenrenwu() shimen.shimenrenwu()
config.renwuliebiao.remove("师门任务") # 移除已完成的任务
if "宝图任务" in renwuliebiao: if "宝图任务" in config.renwuliebiao:
print("执行任务: 宝图任务") print("执行任务: 宝图任务")
baotu.baoturenwu() baotu.baoturenwu()
common.closeAllbtn()
config.renwuliebiao.remove("宝图任务") # 移除已完成的任务
if "自动挖宝" in renwuliebiao: if "自动挖宝" in config.renwuliebiao:
print("执行任务: 自动挖宝") print("执行任务: 自动挖宝")
baotu.wabaotu() baotu.wabaotu()
config.renwuliebiao.remove("自动挖宝") # 移除已完成的任务
if "秘境降妖" in renwuliebiao: if "秘境降妖" in config.renwuliebiao:
print("执行任务: 秘境降妖") print("执行任务: 秘境降妖")
mijing.mijingxiangyao() mijing.mijingxiangyao()
config.renwuliebiao.remove("秘境降妖") # 移除已完成的任务
if "普通押镖" in renwuliebiao: if "普通押镖" in config.renwuliebiao:
print("执行任务: 普通押镖") print("执行任务: 普通押镖")
yabiao.yabiaorenwu() yabiao.yabiaorenwu()
config.renwuliebiao.remove("普通押镖") # 移除已完成的任务
# 其他任务按顺序执行 # 其他任务按顺序执行
print("执行商会出售任务") print("执行商会出售任务")
zhixian.shanghuichushou(shanghuichushou_lb) zhixian.shanghuichushou(config.shanghuichushou_lb)
print("执行使用物品任务") print("执行使用物品任务")
# 这里可以添加使用物品的具体逻辑 # 这里可以添加使用物品的具体逻辑
# 例如shiyongwupin(shiyongwupin_lb) # 例如shiyongwupin(config.shiyongwupin_lb)
print("执行丢弃物品任务") print("执行丢弃物品任务")
# 这里可以添加丢弃物品的具体逻辑 # 这里可以添加丢弃物品的具体逻辑
# 例如diuqiwupin(diuqiwupin_lb) # 例如diuqiwupin(config.diuqiwupin_lb)
print("执行出售物品任务") 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 = WebWindow(R.ui('index.html'), tunnel)
w.show() w.show()
# common.huodong()
print("程序结束") print("程序结束")
def sleep(num): def sleep(num):
time.sleep(num) time.sleep(num)

View File

@ -16,13 +16,19 @@ def baoturenwu():
print("----------战斗中----------") print("----------战斗中----------")
sleep(60) sleep(60)
continue continue
sleep(5) sleep(10)
print("判断状态2")
if common.isfire():
print("----------战斗中----------")
sleep(60)
continue
res_huodong = common.huodong() res_huodong = common.huodong()
print("打开活动") print("打开活动")
if res_huodong: if res_huodong:
sleep(1) sleep(1)
res_baotu = common.zhaorenwu("宝图任务.png") res_baotu = common.zhaorenwu("/baotu_zx/宝图任务.png")
if res_baotu is not None: if res_baotu is not None:
print("宝图任务") print("宝图任务")
res_wancheng = common.zhaowancheng_text(res_baotu) res_wancheng = common.zhaowancheng_text(res_baotu)
@ -36,9 +42,9 @@ def baoturenwu():
if res_canjia is not None: if res_canjia is not None:
common.findandclick(res_canjia) common.findandclick(res_canjia)
print("点击参加,宝图任务") print("点击参加,宝图任务")
sleep(1) sleep(3)
res_ttwf = common.zhaotu("听听无妨.png") res_ttwf = common.zhaotu("/baotu_zx/听听无妨.png")
if res_ttwf is not None: if res_ttwf is not None:
common.findandclick(res_ttwf) common.findandclick(res_ttwf)
sleep(1) sleep(1)
@ -62,7 +68,7 @@ def wabaotu():
if openbeibao(): if openbeibao():
num =0 num =0
while True: while True:
res_baotu = common.zhaotu("宝图任务.png") res_baotu = common.zhaotu("/baotu_zx/宝图任务.png")
if res_baotu is not None: if res_baotu is not None:
common.findandclick(res_baotu) common.findandclick(res_baotu)
sleep(1) sleep(1)
@ -142,7 +148,7 @@ def zhenglibb():
sleep(3) sleep(3)
def dianjirenwu(): def dianjirenwu():
res_btrw = common.zhaotu("日常-宝图任务.png") res_btrw = common.zhaotu("/baotu_zx/日常-宝图任务.png")
if res_btrw is None: if res_btrw is None:
print("没找到-任务列表-宝图任务") print("没找到-任务列表-宝图任务")
return return

122
common.py
View File

@ -3,6 +3,8 @@ import random
import threading import threading
from . import duiwu from . import duiwu
from . import config
from . import lingqushuangbei
# 导入系统资源模块 # 导入系统资源模块
from ascript.android.system import R 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 Ocr
from ascript.android.screen import CompareColors
# 战斗状态 # 战斗状态
isfire_wfstatus = False isfire_wfstatus = False
@ -30,6 +34,14 @@ shuangbei = False
# 定义一个全局变量来管理定时器 # 定义一个全局变量来管理定时器
alllive_task_timer = None alllive_task_timer = None
# 记录战斗次数
battle_count = 0
# 记录上次战斗状态
last_battle_status = False
# 定义一个全局变量来管理战斗状态监控定时器
battle_monitor_timer = None
def huodong(): def huodong():
while True: while True:
@ -39,6 +51,7 @@ def huodong():
sleep(1) sleep(1)
res_hd_c = FindImages.find([R.img("活动-c.png"), ], rect=[421, 76, 620, 137], confidence=0.95) res_hd_c = FindImages.find([R.img("活动-c.png"), ], rect=[421, 76, 620, 137], confidence=0.95)
if res_hd_c is not None: if res_hd_c is not None:
lingquhuodongjiangli()
return True return True
else: else:
continue continue
@ -60,6 +73,58 @@ def huodong():
sleep(1) 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): def findandclick(res):
# 提取矩形范围 # 提取矩形范围
rect = res["rect"] # [x1, y1, x2, y2] rect = res["rect"] # [x1, y1, x2, y2]
@ -69,8 +134,8 @@ def findandclick(res):
y = random.randint(rect[1], rect[3]) # 随机 y 坐标 y = random.randint(rect[1], rect[3]) # 随机 y 坐标
# 执行点击操作 # 执行点击操作
print(f"点击", rect)
action.click(x, y) # 在随机点点击 action.click(x, y) # 在随机点点击
print(f"点击", rect)
time.sleep(0.5) time.sleep(0.5)
@ -121,17 +186,65 @@ def zhaotu(name):
def isfire(): def isfire():
global isfire_wfstatus global isfire_wfstatus, last_battle_status, battle_count
# 战斗中 # 战斗中
res_zdqx = zhaotu("战斗-取消.png") res_zdqx = zhaotu("战斗-取消.png")
if res_zdqx is None: if res_zdqx is None:
print("未找到目标图片:战斗-取消.png") print("未找到目标图片:战斗-取消.png")
isfire_wfstatus = False current_battle_status = False
else: else:
print("战斗中.....") 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 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(): def denglu():
while True: while True:
@ -295,6 +408,7 @@ def shizi(fanwei):
def alllive_task(num): def alllive_task(num):
print("---------------定时任务-寻找异常弹窗----------------") print("---------------定时任务-寻找异常弹窗----------------")
print(f"--------------当前剩余任务:{config.renwuliebiao}") # 输出当前剩余任务
# zhaotu("道具领取-弹框.png") # zhaotu("道具领取-弹框.png")
ref_daoju = zhaotu("道具领取-弹框.png") ref_daoju = zhaotu("道具领取-弹框.png")
if ref_daoju is None: if ref_daoju is None:

7
config.py Normal file
View File

@ -0,0 +1,7 @@
# config.py
renwuliebiao = []
shanghuichushou_lb = []
shiyongwupin_lb = []
diuqiwupin_lb = []
baitanchushou_lb = []

View File

@ -43,7 +43,7 @@ def tuichuzudui():
common.closeAllbtn() common.closeAllbtn()
else: else:
print("-------找到创建队伍,没有在队伍中------") print("-------找到创建队伍,没有在队伍中------")
common.closeAllbtn()
return return
else: else:
sleep(1) sleep(1)

View File

@ -74,6 +74,7 @@ def lingqu(zuobiao):
for i in range(xunhuancishu): for i in range(xunhuancishu):
print(f"领取双倍 100 点, 次数 {i + 1}/{xunhuancishu}") print(f"领取双倍 100 点, 次数 {i + 1}/{xunhuancishu}")
common.findandclick(res_lingqu) common.findandclick(res_lingqu)
ylq_num += 100
sleep(0.5) sleep(0.5)
if res_ylq_text is None: if res_ylq_text is None:
@ -85,6 +86,8 @@ def lingqu(zuobiao):
else: else:
shuangbeidianshu = ylq_num shuangbeidianshu = ylq_num
if ylq_num >= 4: if ylq_num >= 4:
if ylq_num >= 1000:
ylq_num = 1000
print(f"正常领取结束,开始任务", ylq_num) print(f"正常领取结束,开始任务", ylq_num)
common.shuangbei = True common.shuangbei = True
common.closeAllbtn() common.closeAllbtn()

View File

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 2.9 KiB

View File

Before

Width:  |  Height:  |  Size: 4.0 KiB

After

Width:  |  Height:  |  Size: 4.0 KiB

View File

Before

Width:  |  Height:  |  Size: 3.6 KiB

After

Width:  |  Height:  |  Size: 3.6 KiB

View File

Before

Width:  |  Height:  |  Size: 4.9 KiB

After

Width:  |  Height:  |  Size: 4.9 KiB

View File

Before

Width:  |  Height:  |  Size: 3.6 KiB

After

Width:  |  Height:  |  Size: 3.6 KiB

View File

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 2.8 KiB

View File

Before

Width:  |  Height:  |  Size: 3.6 KiB

After

Width:  |  Height:  |  Size: 3.6 KiB

View File

Before

Width:  |  Height:  |  Size: 4.1 KiB

After

Width:  |  Height:  |  Size: 4.1 KiB

View File

Before

Width:  |  Height:  |  Size: 3.3 KiB

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

View File

@ -7,7 +7,8 @@ from ascript.android.screen import FindImages
from ascript.android.screen import FindColors from ascript.android.screen import FindColors
pngs = ["/shimen/师门-任务按钮", "使用按钮", "/shimen/师门任务1", "普陀山", "购买按钮", "上交按钮", "/shimen/师门01", "摆摊-购买"] pngs = ["/shimen/师门-任务按钮", "使用按钮", "/shimen/师门任务1", "/shimen/普陀山", "购买按钮", "上交按钮",
"/shimen/师门01", "摆摊-购买", "/shimen/师门-龙宫", "/shimen/首席请", "跳过动画", "/shimen/不打自招"]
def shimenrenwu(): def shimenrenwu():
@ -44,10 +45,15 @@ def shimenrenwu():
common.findandclick(res_canjia) common.findandclick(res_canjia)
print("点击参加,师门任务") print("点击参加,师门任务")
sleep(1) sleep(1)
res_xzjw = common.zhaotu("/shimen/选择-集物.png")
if res_xzjw is not None:
findxuanze(res_xzjw)
res_qwc = zhaobtn(["/shimen/师门-去完成", "/shimen/师门-继续任务"]) res_qwc = zhaobtn(["/shimen/师门-去完成", "/shimen/师门-继续任务"])
if res_qwc is not None: if res_qwc is not None or res_xzjw is not None:
sleep(1) if res_qwc is not None:
common.findandclick(res_qwc) sleep(1)
common.findandclick(res_qwc)
while True: while True:
print("判断状态1") print("判断状态1")
if common.isfire(): if common.isfire():
@ -60,7 +66,12 @@ def shimenrenwu():
common.findandclick(res_btns) common.findandclick(res_btns)
sleep(3) 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: if res_qctb is not None:
common.findandclick(res_qctb) common.findandclick(res_qctb)
sleep(1) sleep(1)
@ -94,6 +105,13 @@ def shimenrenwu():
sleep(1) 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(): def dianjirenwu():
res_shimen = common.zhaotu("/shimen/师门.png") res_shimen = common.zhaotu("/shimen/师门.png")
if res_shimen is None: if res_shimen is None:

View File

@ -29,7 +29,7 @@ def shanghuichushou(shcswp):
common.findandclick(res_gd) common.findandclick(res_gd)
sleep(1) sleep(1)
res_shcs = zhaobtn(["商会出售", "商会出售01"]) res_shcs = zhaobtn(["/shanghui/商会出售", "/shanghui/商会出售01"])
if res_shcs is not None: if res_shcs is not None:
common.findandclick(res_shcs) common.findandclick(res_shcs)
sleep(1) sleep(1)
@ -66,7 +66,7 @@ def xiahua():
def zhaobtn(pngs): def zhaobtn(pngs):
# 找各种任务按钮 # 找各种任务按钮
images = [R.img(png + ".png") for png in 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): def sleep(num):
time.sleep(num) time.sleep(num)

View File

@ -25,125 +25,156 @@ from ascript.android.screen import FindColors
from ascript.android.screen import Ocr 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(): def zhuogui():
check_shuangbei() global battle_count # 声明全局变量
if common.shuangbei is False or common.zhuoguiisover is True:
print("双倍领取失败,双倍不足,捉鬼完成") # 开始时检测一次双倍点数
duiwu.tuichuzudui() common.check_shuangbei()
if common.shuangbei is False:
print("双倍点数不足,停止捉鬼任务")
return return
if common.shuangbei: print("开始捉鬼")
print("开始捉鬼") # 先执行退出队伍
# 先执行退出队伍 duiwu.tuichuzudui()
while True:
if common.zhuoguiisover is True and common.shuangbei is False:
print("-------------------------检查到捉鬼完成,退出队伍,进行下一项")
duiwu.tuichuzudui()
return
# zhaotu("战斗-取消.png") # 启动战斗状态监控定时任务
res_zdsb = common.zhaotu("战斗失败.png") common.start_battle_monitor_timer()
if res_zdsb is not None:
print("找到战斗失败") while True:
common.findandclick(res_zdsb) 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) sleep(1)
duiwu.tuichuzudui() res_canjia = common.zhaocanjia_text(res_gui)
continue res_wancheng = common.zhaowancheng(res_gui)
if res_wancheng is not None:
print("判断状态1") print("捉鬼任务完成,退出队伍")
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() 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: else:
sleep(1) sleep(1)
res_canjia = common.zhaocanjia_text(res_gui) print("点击参加")
res_wancheng = common.zhaowancheng(res_gui) common.findandclick(res_canjia)
if res_wancheng is not None: sleep(1)
print("捉鬼任务完成,退出队伍") res_zdpp = common.zhaotu("自动匹配.png")
res_qxpp = common.zhaotu("取消匹配.png")
if res_qxpp is not None:
print("正在匹配,等待匹配完成")
sleep(20)
common.closeAllbtn() common.closeAllbtn()
sleep(2) continue
duiwu.tuichuzudui()
common.zhuoguiisover = True
return
if res_canjia is None: if res_zdpp is None:
print("未找到目标图片:参加.png") print("未找到目标图片:自动匹配.png")
print("判断状态3")
sleep(10)
if common.isfire(): if common.isfire():
print("正在战斗,等待战斗完成") print("1战斗中-等待战斗结束")
sleep(60) sleep(60)
continue continue
else: else:
print("异常情况") print("判断状态4")
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")
sleep(10) sleep(10)
if common.isfire(): if common.isfire():
print("1战斗中-等待战斗结束") print("2战斗中-等待战斗结束")
sleep(60) sleep(60)
continue continue
else: else:
print("判断状态4") print("点了参加,也没自动匹配,也没在战斗中-退出队伍")
sleep(10) duiwu.tuichuzudui()
if common.isfire(): print("退出组队后,重新捉鬼")
print("2战斗中-等待战斗结束")
sleep(60) else:
continue common.findandclick(res_zdpp)
else: print("---------捉鬼开始了---------")
print("点了参加,也没自动匹配,也没在战斗中-退出队伍") common.closeAllbtn()
duiwu.tuichuzudui() sleep(2)
print("退出组队后,重新捉鬼") 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: else:
common.findandclick(res_zdpp) print("未进入战斗,重新开始捉鬼任务")
print("---------捉鬼开始了---------") continue
common.closeAllbtn()
sleep(2)
common.closeAllbtn()
sleep(60)
sleep(1) sleep(1)