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(): 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) 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) wabaoisover=False while True: 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("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 sleep(8) sleep(1) 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)