menghuanzhushou/baotu.py

155 lines
5.0 KiB
Python
Raw Normal View History

2025-03-24 13:15:59 +08:00
import time
from . import common
# 导入系统资源模块
from ascript.android.system import R
# 导入图色检索模块
from ascript.android.screen import FindImages
from ascript.android.screen import FindColors
def baoturenwu():
while True:
print("判断状态1")
if common.isfire():
print("----------战斗中----------")
sleep(60)
continue
sleep(5)
res_huodong = common.huodong()
print("打开活动")
if res_huodong:
sleep(1)
res_baotu = common.zhaorenwu("宝图任务.png")
if res_baotu is not None:
print("宝图任务")
res_wancheng = common.zhaowancheng_text(res_baotu)
if res_wancheng is not None:
print("------------------------宝图任务已完成")
common.closeAllbtn()
sleep(2)
return
res_canjia = common.zhaocanjia_text(res_baotu)
if res_canjia is not None:
common.findandclick(res_canjia)
print("点击参加,宝图任务")
sleep(1)
res_ttwf = common.zhaotu("听听无妨.png")
if res_ttwf is not None:
common.findandclick(res_ttwf)
sleep(1)
dianjirenwu()
sleep(5)
print("判断状态")
if common.isfire():
print("----------判断战斗中----------")
sleep(60)
continue
sleep(1)
def wabaotu():
2025-03-25 17:01:16 +08:00
if common.isfire():
print("战斗中,等待战斗完成")
sleep(60)
2025-03-24 13:15:59 +08:00
2025-03-25 17:01:16 +08:00
if openbeibao():
num =0
while True:
res_baotu = common.zhaotu("宝图任务.png")
if res_baotu is not None:
common.findandclick(res_baotu)
sleep(1)
2025-03-24 13:15:59 +08:00
2025-03-25 17:01:16 +08:00
res_shiyong_beibao = common.zhaotu("背包-使用.png")
if res_shiyong_beibao is not None:
common.findandclick(res_shiyong_beibao)
sleep(1)
2025-03-24 13:15:59 +08:00
2025-03-25 17:01:16 +08:00
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("没在战斗中")
openbeibao()
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
2025-03-24 13:15:59 +08:00
2025-03-25 17:01:16 +08:00
def openbeibao():
res_last = FindImages.find(
[
R.img("包裹.png"),
],
confidence=0.9,
)
if res_last is not None:
common.findandclick(res_last)
2025-03-24 13:15:59 +08:00
sleep(1)
2025-03-25 17:01:16 +08:00
return True
else:
return False
2025-03-24 13:15:59 +08:00
2025-03-25 17:01:16 +08:00
def zhenglibb():
res_bbzl = common.zhaotu("背包-整理.png")
if res_bbzl is not None:
common.findandclick(res_bbzl)
sleep(3)
2025-03-24 13:15:59 +08:00
def dianjirenwu():
res_btrw = common.zhaotu("日常-宝图任务.png")
if res_btrw is None:
print("没找到-任务列表-宝图任务")
return
else:
common.findandclick({"rect": [806, 245, 1018, 323]})
def sleep(num):
time.sleep(num)