diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..359bb53 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,3 @@ +# 默认忽略的文件 +/shelf/ +/workspace.xml diff --git a/.idea/inspectionProfiles/profiles_settings.xml b/.idea/inspectionProfiles/profiles_settings.xml new file mode 100644 index 0000000..105ce2d --- /dev/null +++ b/.idea/inspectionProfiles/profiles_settings.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..220319d --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,7 @@ + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..9f166f0 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/梦幻助手.iml b/.idea/梦幻助手.iml new file mode 100644 index 0000000..d0876a7 --- /dev/null +++ b/.idea/梦幻助手.iml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/__init__.py b/__init__.py new file mode 100644 index 0000000..a298f58 --- /dev/null +++ b/__init__.py @@ -0,0 +1,70 @@ +# __init__.py 为初始化加载文件 + +from . import common + +from . import zhuogui +from . import lingqushuangbei +from . import duiwu +from . import shimen +from . import baotu +from . import mijing +from . import yabiao +from . import zhixian +import time + +import random + +# 导入系统资源模块 + +from ascript.android.system import R + +# 导入动作模块 + +from ascript.android import action + +# 导入节点检索模块 + +from ascript.android import node + +# 导入图色检索模块 + +from ascript.android import screen + +from ascript.android.node import Selector + +from ascript.android.screen import FindColors + +from ascript.android.screen import FindImages + +from ascript.android.screen import Ocr +import re + +from ascript.android import system + +shcswp = ["百炼精铁"] + +print("程序开启,打开游戏") +# # 根据包名启动,推荐使用 +# # com.netease.my +# res_qidong = system.open("com.netease.my") +# print(res_qidong) +# if res_qidong is None: +# # time.sleep(10) +# # action.click(0, 0) # 在随机点点击 +# common.denglu() + +# common.alllive_task() + +# zhuogui.zhuogui() + +# shimen.shimenrenwu() + +# baotu.baoturenwu() + +# baotu.wabaotu() + +# mijing.mijingxiangyao() + +# yabiao.yabiaorenwu() + +zhixian.shanghuichushou(shcswp) \ No newline at end of file diff --git a/bangpai.py b/bangpai.py new file mode 100644 index 0000000..e0d51bb --- /dev/null +++ b/bangpai.py @@ -0,0 +1,15 @@ +import time +from . import common +# 导入系统资源模块 +from ascript.android.system import R +# 导入图色检索模块 +from ascript.android.screen import FindImages + +from ascript.android.screen import FindColors + +def bangpaiqiandao(): + resyxj=common.zhaotu("右下角+.png") + if resyxj is not None: + common.findandclick(resyxj) + common.sleep(1) + common.zhaotu("帮派.png") \ No newline at end of file diff --git a/baotu.py b/baotu.py new file mode 100644 index 0000000..426e405 --- /dev/null +++ b/baotu.py @@ -0,0 +1,121 @@ +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) diff --git a/build.as b/build.as new file mode 100644 index 0000000..1c597e5 --- /dev/null +++ b/build.as @@ -0,0 +1,19 @@ +{ + "name": "梦幻助手", + "pip": { + "options": ["--timeout", "1000"], + "install": [ + "opencv-contrib-python==4.1.2.30", + "requests", + "pymysql", + "numpy", + "websocket-client", + "pillow", + "pandas", + "openpyxl", + "schedule", + "pycryptodome" + ] + }, + "gp":[] +} diff --git a/ceshi.py b/ceshi.py new file mode 100644 index 0000000..4911a0b --- /dev/null +++ b/ceshi.py @@ -0,0 +1,4 @@ +a =202 +for i in range(a%100): + print(i) +# print(a%100) diff --git a/common.py b/common.py new file mode 100644 index 0000000..626bfe0 --- /dev/null +++ b/common.py @@ -0,0 +1,348 @@ +import time +import random +import threading + +from . import duiwu + +# 导入系统资源模块 +from ascript.android.system import R + +# 导入动作模块 +from ascript.android import action + +# 导入图色检索模块 +from ascript.android.screen import FindImages + +from ascript.android.screen import FindColors + +# 文字识别 +from ascript.android.screen import Ocr + +# 战斗状态 +isfire_wfstatus = False + +# 捉鬼状态 +zhuoguiisover = False + +# 领取双倍状态 +shuangbei = False + + +def huodong(): + while True: + res_last = zhaotu("活动.png") + if res_last is not None: + findandclick(res_last) + 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: + return True + else: + continue + else: + print("没找到活动按钮") + if isfire(): + print("战斗中,打开所有按钮") + res_suoyoutubiao = zhaotu("所有图标.png") + if res_suoyoutubiao is None: + print("未找到目标图片:所有图标.png") + # 异常情况 + closeAllbtn() + else: + # 找到所有活动图标,点击 + findandclick(res_suoyoutubiao) + else: + closeAllbtn() + + sleep(1) + + +def findandclick(res): + # 提取矩形范围 + rect = res["rect"] # [x1, y1, x2, y2] + # 随机生成矩形范围内的一个点 + + x = random.randint(rect[0], rect[2]) # 随机 x 坐标 + y = random.randint(rect[1], rect[3]) # 随机 y 坐标 + # 执行点击操作 + + print(f"点击", rect) + action.click(x, y) # 在随机点点击 + time.sleep(0.5) + + +def closeAllbtn(): + res_allclose = zhaotu("总开关.png") + + if res_allclose is None: + print("未找到目标图片:总开关.png") + else: + print("关闭-总开关弹框") + findandclick(res_allclose) + + res_flkg = zhaotu("福利-开关.png") + + if res_flkg is None: + print("未找到目标图片:福利-开关.png") + else: + print("关闭-福利-开关弹框") + findandclick(res_flkg) + + # 见面礼-关闭.png + res_flkg = zhaotu("见面礼-关闭.png") + if res_flkg is None: + print("未找到目标图片:见面礼-关闭.png") + else: + print("关闭-见面礼-开关弹框") + findandclick(res_flkg) + + # 师门-关闭.png + res_smgb = zhaotu("师门-关闭.png") + if res_smgb is not None: + print("关闭-师门任务-弹框") + findandclick(res_smgb) + + +def zhaotu(name): + print(f"找图--", name) + result = FindImages.find( + [ + R.img(name), + ], + confidence=0.95, + ) + if result is None: + print(f"未找到图片:", name) + + return result + + +def isfire(): + global isfire_wfstatus + # 战斗中 + res_zdqx = zhaotu("战斗-取消.png") + if res_zdqx is None: + print("未找到目标图片:战斗-取消.png") + isfire_wfstatus = False + else: + print("战斗中.....") + isfire_wfstatus = True + return isfire_wfstatus + + +def denglu(): + while True: + res_fwq = FindColors.find("382,434,#BC3010|380,442,#CE3116|643,431,#FFE986") + if res_fwq is None: + print("未找到服务器信息") + # 找聊天框,找到认为已经进入游戏 + res_liaotian = zhaotu("聊天.png") + if res_liaotian is None: + print("找不到聊天,异常情况") + else: + # 在游戏中 + print("在游戏中-------") + + return + else: + res_denglu = zhaotu("登录游戏.png") + # 判断是否找到目标图片 + if res_denglu is None: + print("未找到目标图片:登录游戏.png") + else: + findandclick(res_denglu) + sleep(5) + + while True: + res_tcpd = zhaotu("退出排队.png") + if res_tcpd is None: + print("未找到目标图片:退出排队.png") + return + else: + # findandclick(res_tcpd) + sleep(60) + + sleep(1) + + +def zhaorenwu(name): + # zhaorenwu.py 中优化滑动逻辑 + for i in range(3): + res_tu = zhaotu(name) + if res_tu is not None: + return res_tu + action.slide(731, 427, 408, 148, 2000) + sleep(1) + + for i in range(3): + res_tu = zhaotu(name) + if res_tu is not None: + return res_tu + action.slide(408, 148, 731, 427, 2000) + sleep(1) + + return None + + +def zhaocanjia_text(renwu_fanwei): + # 266,273 + # 499,y1- x1+320,y+50 + # x+234,y ,x+320,y+50 + gui_rect = renwu_fanwei["rect"] # [x1, y1, x2, y2] + print(gui_rect) + x = gui_rect[0] + y = gui_rect[1] + x1 = x + 234 + x2 = x + 320 + y2 = y + 50 + search_region = [x1, y, x2, y2] + print(f"找----参加-----文字坐标: ({x1}, {y},{x2}, {y2})") + res = Ocr.paddleocr_v2(rect=search_region) + if res is None: + print("未找到参加文字") + return None + if res[0].text == "参加": + res = {"rect": res[0].rect} + return res + else: + return None + + +def zhaocanjia(renwu_fanwei): + gui_rect = renwu_fanwei["rect"] # [x1, y1, x2, y2] + print(gui_rect) + x1 = gui_rect[0] + y1 = gui_rect[1] + expand_x = 337 # X 方向扩展 337 像素 + expand_y = 93 # Y 方向扩展 93 像素 + x2 = x1 + expand_x + y2 = y1 + expand_y + search_region = [x1, y1, x2, y2] + print(f"随机点击坐标: ({x1}, {y1},{x2}, {y2})") + res_canjia = FindImages.find( + [ + R.img("参加.png"), + ], + rect=search_region, + confidence=0.95, + ) + + return res_canjia + + +def zhaowancheng_text(renwu_fanwei): + # 266,273 + # 499,y1- x1+320,y+50 + # x+234,y ,x+320,y+50 + gui_rect = renwu_fanwei["rect"] # [x1, y1, x2, y2] + print(gui_rect) + x = gui_rect[0] + y = gui_rect[1] + x1 = x + 234 + x2 = x + 320 + y2 = y + 50 + search_region = [x1, y, x2, y2] + print(f"找----完成-----文字坐标: ({x1}, {y},{x2}, {y2})") + res = Ocr.paddleocr_v2(rect=search_region) + if res is None: + print("未找到参加文字") + return None + if res[0].text == "完成": + res = {"rect": res[0].rect} + return res + else: + return None + + +def zhaowancheng(renwu_fanwei): + gui_rect = renwu_fanwei["rect"] # [x1, y1, x2, y2] + print(gui_rect) + x1 = gui_rect[0] + y1 = gui_rect[1] + expand_x = 337 # X 方向扩展 337 像素 + expand_y = 93 # Y 方向扩展 93 像素 + x2 = x1 + expand_x + y2 = y1 + expand_y + search_region = [x1, y1, x2, y2] + print(f"随机点击坐标: ({x1}, {y1},{x2}, {y2})") + res_canjia = FindImages.find( + [ + R.img("完成.png"), + ], + rect=search_region, + confidence=0.95, + ) + + return res_canjia + + +def shizi(fanwei): + print("开始识别") + # 截取屏幕指定区域 + # fanwei=[500, 616, 545, 649] # 定义区域范围 + res = Ocr.paddleocr_v2(rect=fanwei) + # print(res) + if res: + # 循环打印识别到的每一个段落 + for r in res: + return r.text + else: + return None + + +def alllive_task(): + print("---------------定时任务-寻找异常弹窗----------------") + # zhaotu("道具领取-弹框.png") + ref_daoju = zhaotu("道具领取-弹框.png") + if ref_daoju is None: + print("未找到目标图片:弹框.png") + else: + findandclick(ref_daoju) + + res_map = zhaotu("地图.png") + if res_map is None: + print("未找到目标图片:地图.png") + else: + findandclick(res_map) + + res_dmj = zhaotu("洞冥记.png") + if res_dmj is None: + print("未找到目标图片:地图.png") + else: + findandclick(res_dmj) + # 指引-关闭.png + res_zy = zhaotu("指引-关闭.png") + if res_zy is None: + print("未找到目标图片:指引-关闭.png") + else: + findandclick(res_zy) + + # 充值-关闭.png + res_cz = zhaotu("充值.png") + if res_cz is None: + print("未找到目标图片:充值.png") + else: + findandclick(res_cz) + + res_sl = zhaotu("算了.png") + if res_sl is None: + print("未找到目标图片:算了.png") + else: + findandclick(res_sl) + + res_jj = zhaotu("拒绝.png") + if res_jj is None: + print("未找到目标图片:拒绝.png") + else: + findandclick(res_jj) + + # 战斗状态监控 + isfire() + + duiwu.shifoukaping() + + threading.Timer(70, alllive_task).start() + + +def sleep(num): + time.sleep(num) diff --git a/duiwu.py b/duiwu.py new file mode 100644 index 0000000..a4d2a76 --- /dev/null +++ b/duiwu.py @@ -0,0 +1,203 @@ +from . import common + +# 导入系统资源模块 + +from ascript.android.system import R + +# 导入动作模块 + +from ascript.android import action + +# 导入图色检索模块 + +from ascript.android.screen import FindImages + +# 文字识别 + +from ascript.android.screen import Ocr +import time + + +def tuichuzudui(): + num = 0 + + while True: + if num > 10: + print("退出队伍失败") + return + + res_duiwu = common.zhaotu("队伍.png") + res_duiwu1 = common.zhaotu("队伍1.png") + res_duiwu2 = common.zhaotu("队伍2.png") + res_last = res_duiwu or res_duiwu1 or res_duiwu2 + if res_last is not None: + common.findandclick(res_last) + sleep(1) + rec_duiwu_tc = common.zhaotu("队伍-退出队伍.png") + if rec_duiwu_tc is None: + print("未找到目标图片:队伍-退出队伍.png") + res_cjdw = common.zhaotu("创建队伍.png") + if res_cjdw is None: + print("异常情况") + num += 1 + common.closeAllbtn() + else: + print("-------找到创建队伍,没有在队伍中------") + + return + else: + sleep(1) + common.findandclick(rec_duiwu_tc) + common.closeAllbtn() + print("退出队伍完成") + if common.isfire(): + sleep(60) + + return + + else: + print("没找到队伍按钮") + if common.isfire(): + print("战斗中,打开所有按钮") + res_suoyoutubiao = common.zhaotu("所有图标.png") + if res_suoyoutubiao is None: + print("退出组队-异常情况") + num += 1 + common.closeAllbtn() + else: + # 找到所有活动图标,点击 + common.findandclick(res_suoyoutubiao) + print("展开所有图标") + continue + else: + common.closeAllbtn() + + sleep(0.5) + + +def shifouzaiduiwu(): + print("开始检测是否在队伍中") + num = 0 + while True: + if num > 10: + return False + + res_duiwu = common.zhaotu("队伍.png") + res_duiwu1 = common.zhaotu("队伍1.png") + res_duiwu2 = common.zhaotu("队伍2.png") + res_last = res_duiwu or res_duiwu1 or res_duiwu2 + + if res_last is not None: + common.findandclick(res_last) + sleep(1) + common.findandclick(res_last) + + rec_duiwu_tc = common.zhaotu("队伍-退出队伍.png") + if rec_duiwu_tc is None: + print("未找到目标图片:队伍-退出队伍.png") + res_cjdw = common.zhaotu("创建队伍.png") + if res_cjdw is not None: + print("-------等待创建队伍,没有在队伍中,退出队伍完成------") + common.closeAllbtn() + return False + else: + print("!!!异常情况!!!") + print("-------检测是否在队伍中出现异常------") + common.closeAllbtn() + num += 1 + continue + + else: + # common.findandclick(rec_duiwu_tc) + # common.closeAllbtn() + print("退出队伍-已找到,正在队伍中") + return True + + else: + print("没找到队伍按钮") + if common.isfire(): + print("战斗中,打开所有按钮") + res_suoyoutubiao = common.zhaotu("所有图标.png") + if res_suoyoutubiao is None: + print("未找到目标图片:所有图标.png") + # 异常情况 + num += 1 + common.closeAllbtn() + else: + # 找到所有活动图标,点击 + common.findandclick(res_suoyoutubiao) + else: + common.closeAllbtn() + + sleep(1) + + if common.zhuoguiisover is True: + print("捉鬼完成,不需要检测是否在队伍中--定时任务结束") + else: + threading.Timer(180, shifouzaiduiwu).start() + + +def renwumingc(): + num = 0 + while True: + if num > 10: + print("任务名称识别失败") + return None + + res_duiwu = common.zhaotu("队伍.png") + res_duiwu1 = common.zhaotu("队伍1.png") + res_duiwu2 = common.zhaotu("队伍2.png") + res_last = res_duiwu or res_duiwu1 or res_duiwu2 + if res_last is not None: + common.findandclick(res_last) + sleep(0.5) + res_rwmc = common.shizi([378, 144, 502, 188]) + common.closeAllbtn() + return res_rwmc + else: + print("没找到队伍按钮") + if common.isfire(): + print("战斗中,打开所有按钮") + res_suoyoutubiao = common.zhaotu("所有图标.png") + if res_suoyoutubiao is None: + res_back = common.zhaotu("返回.png") + # 异常情况 + if res_back is not None: + # 找到所有返回 + # common.findandclick(res_back) + continue + else: + num += 1 + common.closeAllbtn() + else: + # 找到所有活动图标,点击 + common.findandclick(res_suoyoutubiao) + + sleep(0.5) + +# 人物闲置时间 +xianzhicishu = 0 +# 人物是否闲置 +renwuxianzhi = False +def shifoukaping(): + global xianzhicishu, renwuxianzhi # 声明全局变量 + + print(f"人物闲置时间(s):", xianzhicishu) + res_iszd = common.isfire_wfstatus # 假设 common.isfire() 是外部方法 + if res_iszd is True: + # 战斗中 + xianzhicishu = 0 + else: + xianzhicishu += 70 + + print(f"----------------------------人物闲置k:", xianzhicishu) + if xianzhicishu > 200: + print("-----------------------------卡屏或者长时间没有操作---------------------------------") + renwuxianzhi = True + else: + renwuxianzhi = False + + return renwuxianzhi + +def sleep(num): + time.sleep(num) diff --git a/lingqushuangbei.py b/lingqushuangbei.py new file mode 100644 index 0000000..91c798c --- /dev/null +++ b/lingqushuangbei.py @@ -0,0 +1,106 @@ +from . import common +import time +import random +import threading +import re + +shuangbeidianshu_fw = [663, 618, 809, 652] +shuangbeidianshu_ylq = [432, 616, 549, 650] + +shuangbeidianshu = 0 + +def lingqushuangbei(): + print("开始领取双倍") + a = 0 + while True: + if a > 10: + print("找不到挂机入口,程序停止") + return + res_guaji1 = common.zhaotu("挂机1.png") + res_guaji=common.zhaotu("挂机.png") + res_guaji_last=res_guaji or res_guaji1 + if res_guaji_last is not None: + lingqu(res_guaji_last) + print("双倍领取完成,开始捉鬼") + return + else: + if common.isfire(): + # 战斗中,打开展示所有图标 + res_suoyoutubiao = common.zhaotu("所有图标.png") + if res_suoyoutubiao is None: + print("未找到目标图片:所有图标.png") + a += 1 + common.closeAllbtn() + continue + else: + common.findandclick(res_suoyoutubiao) + sleep(1) + continue + +def lingqu(zuobiao): + global shuangbeidianshu + sleep(1) + common.findandclick(zuobiao) + # 找是不是有双倍点数 + sleep(1) + xunhuancishu = 0 + print("领取双倍") + res_lingqu = common.zhaotu("领取.png") + res_dlq_text = common.shizi(shuangbeidianshu_fw) + dlq_num=0 + if res_dlq_text is not None: + res_dlq = qushuzi(res_dlq_text) + dlq_num = int(res_dlq) + if dlq_num > 0: + xunhuancishu = dlq_num % 100 + common.shuangbei = True + if xunhuancishu == 0: + print(f"领取双倍一次,余数为:",xunhuancishu) + common.findandclick(res_lingqu) + else: + # 循环 xunhuancishu 次 + for i in range(xunhuancishu): + print(f"领取双倍{xunhuancishu}*", i) + common.findandclick(res_lingqu) + sleep(0.5) + + res_ylq_text = common.shizi(shuangbeidianshu_ylq) + if res_ylq_text is None : + print("--------------------------双倍点数识别失败-停止抓鬼") + common.shuangbei = False + common.zhuoguiisover = True + common.closeAllbtn() + return + else: + res_ylq = qushuzi(res_ylq_text) + ylq_num = int(res_ylq) + shuangbeidianshu = ylq_num + if ylq_num >= 4: + print(f"正常领取结束,开始任务", ylq_num) + common.shuangbei = True + common.closeAllbtn() + sleep(1) + return + else: + print(f"双倍已消耗完/点数不足-停止抓鬼---", ylq_num) + common.shuangbei = False + common.zhuoguiisover = True + common.closeAllbtn() + sleep(1) + return + +def qushuzi(text): + # 使用正则表达式提取数字 + match = re.search(r"\d+", text) # 匹配连续的数字 + if match: + num_str = match.group() # 提取匹配的数字部分 + num = int(num_str) + print(f"提取的数字:", num) + return num + else: + print("未找到有效数字") + return -1 + + +def sleep(num): + time.sleep(num) diff --git a/mijing.py b/mijing.py new file mode 100644 index 0000000..7d9164c --- /dev/null +++ b/mijing.py @@ -0,0 +1,110 @@ +import time +from . import common +# 导入系统资源模块 +from ascript.android.system import R +# 导入图色检索模块 +from ascript.android.screen import FindImages + +from ascript.android.screen import FindColors + +pngs = ["秘境任务", "进入战斗"] + + +def mijingxiangyao(): + while True: + + if common.isfire(): + print("----------战斗中----------") + sleep(60) + continue + res_likai = common.zhaotu("离开.png") + if res_likai is not None: + print("找到离开,就在秘境里") + sleep(1) + renwuneirong() + else: + res_huodong = common.huodong() + if res_huodong: + print("打开活动") + sleep(1) + res_mjxy = common.zhaorenwu("秘境降妖.png") + if res_mjxy is not None: + res_wancheng = common.zhaowancheng_text(res_mjxy) + if res_wancheng is not None: + print("秘境降妖任务完成,进行下一项") + common.closeAllbtn() + sleep(2) + return + + res_canjia = common.zhaocanjia_text(res_mjxy) + if res_canjia is not None: + common.findandclick(res_canjia) + print("点击参加,秘境降妖") + sleep(2) + + res_mjrw = zhaobtn(pngs) + if res_mjrw is not None: + common.findandclick(res_mjrw) + sleep(3) + + res_jxtz = common.zhaotu("继续挑战.png") + if res_jxtz is not None: + common.findandclick(res_jxtz) + sleep(3) + + renwuneirong() + + return + sleep(1) + + +def renwuneirong(): + while True: + 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) + res_lk = common.zhaotu("离开.png") + if res_lk is not None: + print("找到离开") + common.findandclick(res_lk) + sleep(1) + print("战斗失败-离开秘境,进行下一项") + return + + res_tyll=common.zhaotu("汤圆来了.png") + if res_tyll is not None: + common.findandclick({"rect":[815,266,844,305]}) + sleep(3) + + res_btns = zhaobtn(pngs) + if res_btns is not None: + common.findandclick(res_btns) + sleep(3) + + dianjirenwu() + sleep(3) + + +def dianjirenwu(): + res_shimen = common.zhaotu("秘境降妖-关卡.png") + if res_shimen is None: + print("没找到-任务列表-秘境降妖-关卡") + return + else: + common.findandclick({"rect": [793, 265, 1016, 341]}) + + +def zhaobtn(pngs): + # 找各种任务按钮 + images = [R.img(png + ".png") for png in pngs] + return FindImages.find(images, rect=[172, 96, 1005, 714], confidence=0.95) + + +def sleep(num): + time.sleep(num) diff --git a/readme b/readme deleted file mode 100644 index f59f9fc..0000000 --- a/readme +++ /dev/null @@ -1 +0,0 @@ -测试提交123 \ No newline at end of file diff --git a/res/img/logo.png b/res/img/logo.png new file mode 100644 index 0000000..5e34b12 Binary files /dev/null and b/res/img/logo.png differ diff --git a/res/img/上交按钮.png b/res/img/上交按钮.png new file mode 100644 index 0000000..118e904 Binary files /dev/null and b/res/img/上交按钮.png differ diff --git a/res/img/九幽诗集.png b/res/img/九幽诗集.png new file mode 100644 index 0000000..3c5b807 Binary files /dev/null and b/res/img/九幽诗集.png differ diff --git a/res/img/使用按钮.png b/res/img/使用按钮.png new file mode 100644 index 0000000..9814d3f Binary files /dev/null and b/res/img/使用按钮.png differ diff --git a/res/img/充值.png b/res/img/充值.png new file mode 100644 index 0000000..cd319e8 Binary files /dev/null and b/res/img/充值.png differ diff --git a/res/img/光芒石.png b/res/img/光芒石.png new file mode 100644 index 0000000..60ec4ee Binary files /dev/null and b/res/img/光芒石.png differ diff --git a/res/img/冻结.png b/res/img/冻结.png new file mode 100644 index 0000000..8e26f39 Binary files /dev/null and b/res/img/冻结.png differ diff --git a/res/img/出售.png b/res/img/出售.png new file mode 100644 index 0000000..3ff6752 Binary files /dev/null and b/res/img/出售.png differ diff --git a/res/img/创建队伍.png b/res/img/创建队伍.png new file mode 100644 index 0000000..ab12f18 Binary files /dev/null and b/res/img/创建队伍.png differ diff --git a/res/img/制造书-女衣.png b/res/img/制造书-女衣.png new file mode 100644 index 0000000..141c3c4 Binary files /dev/null and b/res/img/制造书-女衣.png differ diff --git a/res/img/制造书-宝珠.png b/res/img/制造书-宝珠.png new file mode 100644 index 0000000..2cba099 Binary files /dev/null and b/res/img/制造书-宝珠.png differ diff --git a/res/img/制造书-枪.png b/res/img/制造书-枪.png new file mode 100644 index 0000000..fd863a4 Binary files /dev/null and b/res/img/制造书-枪.png differ diff --git a/res/img/制造书-鞋.png b/res/img/制造书-鞋.png new file mode 100644 index 0000000..2f9d926 Binary files /dev/null and b/res/img/制造书-鞋.png differ diff --git a/res/img/包裹.png b/res/img/包裹.png new file mode 100644 index 0000000..0238a97 Binary files /dev/null and b/res/img/包裹.png differ diff --git a/res/img/参加.png b/res/img/参加.png new file mode 100644 index 0000000..9a89934 Binary files /dev/null and b/res/img/参加.png differ diff --git a/res/img/取消.png b/res/img/取消.png new file mode 100644 index 0000000..b7d6814 Binary files /dev/null and b/res/img/取消.png differ diff --git a/res/img/取消匹配.png b/res/img/取消匹配.png new file mode 100644 index 0000000..3b3faf5 Binary files /dev/null and b/res/img/取消匹配.png differ diff --git a/res/img/右下角+.png b/res/img/右下角+.png new file mode 100644 index 0000000..7bbcea7 Binary files /dev/null and b/res/img/右下角+.png differ diff --git a/res/img/听听无妨.png b/res/img/听听无妨.png new file mode 100644 index 0000000..2b36847 Binary files /dev/null and b/res/img/听听无妨.png differ diff --git a/res/img/商会出售.png b/res/img/商会出售.png new file mode 100644 index 0000000..d79b4e6 Binary files /dev/null and b/res/img/商会出售.png differ diff --git a/res/img/商会出售01.png b/res/img/商会出售01.png new file mode 100644 index 0000000..fc3f853 Binary files /dev/null and b/res/img/商会出售01.png differ diff --git a/res/img/地图.png b/res/img/地图.png new file mode 100644 index 0000000..a022b9d Binary files /dev/null and b/res/img/地图.png differ diff --git a/res/img/完成.png b/res/img/完成.png new file mode 100644 index 0000000..9215fff Binary files /dev/null and b/res/img/完成.png differ diff --git a/res/img/宝图任务.png b/res/img/宝图任务.png new file mode 100644 index 0000000..2bc7aa3 Binary files /dev/null and b/res/img/宝图任务.png differ diff --git a/res/img/师傅请.png b/res/img/师傅请.png new file mode 100644 index 0000000..e0277d6 Binary files /dev/null and b/res/img/师傅请.png differ diff --git a/res/img/师门-任务按钮.png b/res/img/师门-任务按钮.png new file mode 100644 index 0000000..7bffa70 Binary files /dev/null and b/res/img/师门-任务按钮.png differ diff --git a/res/img/师门-关闭.png b/res/img/师门-关闭.png new file mode 100644 index 0000000..51e4f9a Binary files /dev/null and b/res/img/师门-关闭.png differ diff --git a/res/img/师门-去完成.png b/res/img/师门-去完成.png new file mode 100644 index 0000000..f4ba43f Binary files /dev/null and b/res/img/师门-去完成.png differ diff --git a/res/img/师门-继续任务.png b/res/img/师门-继续任务.png new file mode 100644 index 0000000..5307b3b Binary files /dev/null and b/res/img/师门-继续任务.png differ diff --git a/res/img/师门.png b/res/img/师门.png new file mode 100644 index 0000000..458a1d6 Binary files /dev/null and b/res/img/师门.png differ diff --git a/res/img/师门01.png b/res/img/师门01.png new file mode 100644 index 0000000..ffd2a6e Binary files /dev/null and b/res/img/师门01.png differ diff --git a/res/img/师门01png b/res/img/师门01png new file mode 100644 index 0000000..2dc09ed Binary files /dev/null and b/res/img/师门01png differ diff --git a/res/img/师门任务.png b/res/img/师门任务.png new file mode 100644 index 0000000..1e4c359 Binary files /dev/null and b/res/img/师门任务.png differ diff --git a/res/img/师门任务1.png b/res/img/师门任务1.png new file mode 100644 index 0000000..2973fb7 Binary files /dev/null and b/res/img/师门任务1.png differ diff --git a/res/img/师门任务完成.png b/res/img/师门任务完成.png new file mode 100644 index 0000000..f3a0913 Binary files /dev/null and b/res/img/师门任务完成.png differ diff --git a/res/img/帮派.png b/res/img/帮派.png new file mode 100644 index 0000000..a52d11b Binary files /dev/null and b/res/img/帮派.png differ diff --git a/res/img/帮派列表.png b/res/img/帮派列表.png new file mode 100644 index 0000000..e911b1a Binary files /dev/null and b/res/img/帮派列表.png differ diff --git a/res/img/总开关.png b/res/img/总开关.png new file mode 100644 index 0000000..a2d470a Binary files /dev/null and b/res/img/总开关.png differ diff --git a/res/img/战斗-取消.png b/res/img/战斗-取消.png new file mode 100644 index 0000000..4df8695 Binary files /dev/null and b/res/img/战斗-取消.png differ diff --git a/res/img/战斗失败.png b/res/img/战斗失败.png new file mode 100644 index 0000000..9d40819 Binary files /dev/null and b/res/img/战斗失败.png differ diff --git a/res/img/所有图标.png b/res/img/所有图标.png new file mode 100644 index 0000000..429d559 Binary files /dev/null and b/res/img/所有图标.png differ diff --git a/res/img/押送普通.png b/res/img/押送普通.png new file mode 100644 index 0000000..5a15338 Binary files /dev/null and b/res/img/押送普通.png differ diff --git a/res/img/押镖任务.png b/res/img/押镖任务.png new file mode 100644 index 0000000..25562ed Binary files /dev/null and b/res/img/押镖任务.png differ diff --git a/res/img/拒绝.png b/res/img/拒绝.png new file mode 100644 index 0000000..6d4ca72 Binary files /dev/null and b/res/img/拒绝.png differ diff --git a/res/img/挂机.png b/res/img/挂机.png new file mode 100644 index 0000000..feb0f34 Binary files /dev/null and b/res/img/挂机.png differ diff --git a/res/img/挂机1.png b/res/img/挂机1.png new file mode 100644 index 0000000..510df3e Binary files /dev/null and b/res/img/挂机1.png differ diff --git a/res/img/指引-关闭.png b/res/img/指引-关闭.png new file mode 100644 index 0000000..7c70f77 Binary files /dev/null and b/res/img/指引-关闭.png differ diff --git a/res/img/摆摊-购买.png b/res/img/摆摊-购买.png new file mode 100644 index 0000000..22efd91 Binary files /dev/null and b/res/img/摆摊-购买.png differ diff --git a/res/img/日常-宝图任务.png b/res/img/日常-宝图任务.png new file mode 100644 index 0000000..a4327c3 Binary files /dev/null and b/res/img/日常-宝图任务.png differ diff --git a/res/img/普陀山.png b/res/img/普陀山.png new file mode 100644 index 0000000..39235b9 Binary files /dev/null and b/res/img/普陀山.png differ diff --git a/res/img/更多.png b/res/img/更多.png new file mode 100644 index 0000000..b59f596 Binary files /dev/null and b/res/img/更多.png differ diff --git a/res/img/材料包.png b/res/img/材料包.png new file mode 100644 index 0000000..f818f1f Binary files /dev/null and b/res/img/材料包.png differ diff --git a/res/img/汤圆来了.png b/res/img/汤圆来了.png new file mode 100644 index 0000000..3cdceb3 Binary files /dev/null and b/res/img/汤圆来了.png differ diff --git a/res/img/法宝碎片.png b/res/img/法宝碎片.png new file mode 100644 index 0000000..189abb2 Binary files /dev/null and b/res/img/法宝碎片.png differ diff --git a/res/img/洞冥记.png b/res/img/洞冥记.png new file mode 100644 index 0000000..0ad3d3f Binary files /dev/null and b/res/img/洞冥记.png differ diff --git a/res/img/活动-c.png b/res/img/活动-c.png new file mode 100644 index 0000000..7ad8326 Binary files /dev/null and b/res/img/活动-c.png differ diff --git a/res/img/活动.png b/res/img/活动.png new file mode 100644 index 0000000..de0330a Binary files /dev/null and b/res/img/活动.png differ diff --git a/res/img/满.png b/res/img/满.png new file mode 100644 index 0000000..1b18398 Binary files /dev/null and b/res/img/满.png differ diff --git a/res/img/玄武石.png b/res/img/玄武石.png new file mode 100644 index 0000000..36f8830 Binary files /dev/null and b/res/img/玄武石.png differ diff --git a/res/img/登录游戏.png b/res/img/登录游戏.png new file mode 100644 index 0000000..30009d1 Binary files /dev/null and b/res/img/登录游戏.png differ diff --git a/res/img/白虎石.png b/res/img/白虎石.png new file mode 100644 index 0000000..a2279c4 Binary files /dev/null and b/res/img/白虎石.png differ diff --git a/res/img/百炼精铁.png b/res/img/百炼精铁.png new file mode 100644 index 0000000..864858e Binary files /dev/null and b/res/img/百炼精铁.png differ diff --git a/res/img/确定.png b/res/img/确定.png new file mode 100644 index 0000000..f803d55 Binary files /dev/null and b/res/img/确定.png differ diff --git a/res/img/福利-开关.png b/res/img/福利-开关.png new file mode 100644 index 0000000..8fea501 Binary files /dev/null and b/res/img/福利-开关.png differ diff --git a/res/img/离开.png b/res/img/离开.png new file mode 100644 index 0000000..d17a117 Binary files /dev/null and b/res/img/离开.png differ diff --git a/res/img/秘境任务.png b/res/img/秘境任务.png new file mode 100644 index 0000000..8900d88 Binary files /dev/null and b/res/img/秘境任务.png differ diff --git a/res/img/秘境降妖-关卡.png b/res/img/秘境降妖-关卡.png new file mode 100644 index 0000000..ff2105d Binary files /dev/null and b/res/img/秘境降妖-关卡.png differ diff --git a/res/img/秘境降妖.png b/res/img/秘境降妖.png new file mode 100644 index 0000000..37dab09 Binary files /dev/null and b/res/img/秘境降妖.png differ diff --git a/res/img/立即上阵.png b/res/img/立即上阵.png new file mode 100644 index 0000000..54b16b4 Binary files /dev/null and b/res/img/立即上阵.png differ diff --git a/res/img/算了.png b/res/img/算了.png new file mode 100644 index 0000000..d6349d6 Binary files /dev/null and b/res/img/算了.png differ diff --git a/res/img/继续挑战.png b/res/img/继续挑战.png new file mode 100644 index 0000000..e1ccccd Binary files /dev/null and b/res/img/继续挑战.png differ diff --git a/res/img/翡翠石.png b/res/img/翡翠石.png new file mode 100644 index 0000000..f910e28 Binary files /dev/null and b/res/img/翡翠石.png differ diff --git a/res/img/聊天.png b/res/img/聊天.png new file mode 100644 index 0000000..1d7887e Binary files /dev/null and b/res/img/聊天.png differ diff --git a/res/img/背包-使用.png b/res/img/背包-使用.png new file mode 100644 index 0000000..71ef6e1 Binary files /dev/null and b/res/img/背包-使用.png differ diff --git a/res/img/背包-整理.png b/res/img/背包-整理.png new file mode 100644 index 0000000..75241ad Binary files /dev/null and b/res/img/背包-整理.png differ diff --git a/res/img/自动匹配.png b/res/img/自动匹配.png new file mode 100644 index 0000000..91cb5df Binary files /dev/null and b/res/img/自动匹配.png differ diff --git a/res/img/舍利子.png b/res/img/舍利子.png new file mode 100644 index 0000000..9e200a8 Binary files /dev/null and b/res/img/舍利子.png differ diff --git a/res/img/见面礼-关闭.png b/res/img/见面礼-关闭.png new file mode 100644 index 0000000..d11fc9d Binary files /dev/null and b/res/img/见面礼-关闭.png differ diff --git a/res/img/请出题吧.png b/res/img/请出题吧.png new file mode 100644 index 0000000..b3cfe09 Binary files /dev/null and b/res/img/请出题吧.png differ diff --git a/res/img/购买按钮.png b/res/img/购买按钮.png new file mode 100644 index 0000000..4b750d3 Binary files /dev/null and b/res/img/购买按钮.png differ diff --git a/res/img/购买点数.png b/res/img/购买点数.png new file mode 100644 index 0000000..9498a0d Binary files /dev/null and b/res/img/购买点数.png differ diff --git a/res/img/返回.png b/res/img/返回.png new file mode 100644 index 0000000..be2a329 Binary files /dev/null and b/res/img/返回.png differ diff --git a/res/img/进入战斗.png b/res/img/进入战斗.png new file mode 100644 index 0000000..0a6ca65 Binary files /dev/null and b/res/img/进入战斗.png differ diff --git a/res/img/退出排队.png b/res/img/退出排队.png new file mode 100644 index 0000000..fed40c9 Binary files /dev/null and b/res/img/退出排队.png differ diff --git a/res/img/道具领取-弹框.png b/res/img/道具领取-弹框.png new file mode 100644 index 0000000..5cd6000 Binary files /dev/null and b/res/img/道具领取-弹框.png differ diff --git a/res/img/队伍-退出队伍.png b/res/img/队伍-退出队伍.png new file mode 100644 index 0000000..4e27f3e Binary files /dev/null and b/res/img/队伍-退出队伍.png differ diff --git a/res/img/队伍.png b/res/img/队伍.png new file mode 100644 index 0000000..65cc9f7 Binary files /dev/null and b/res/img/队伍.png differ diff --git a/res/img/队伍1.png b/res/img/队伍1.png new file mode 100644 index 0000000..4bd9a48 Binary files /dev/null and b/res/img/队伍1.png differ diff --git a/res/img/队伍2.png b/res/img/队伍2.png new file mode 100644 index 0000000..c5ec1a1 Binary files /dev/null and b/res/img/队伍2.png differ diff --git a/res/img/青龙石.png b/res/img/青龙石.png new file mode 100644 index 0000000..3eb6d27 Binary files /dev/null and b/res/img/青龙石.png differ diff --git a/res/img/领取.png b/res/img/领取.png new file mode 100644 index 0000000..02f3fb2 Binary files /dev/null and b/res/img/领取.png differ diff --git a/res/img/鬼图标.png b/res/img/鬼图标.png new file mode 100644 index 0000000..8fbf532 Binary files /dev/null and b/res/img/鬼图标.png differ diff --git a/res/img/鬼图标2.png b/res/img/鬼图标2.png new file mode 100644 index 0000000..3412072 Binary files /dev/null and b/res/img/鬼图标2.png differ diff --git a/res/img/黑宝石.png b/res/img/黑宝石.png new file mode 100644 index 0000000..27ad4b1 Binary files /dev/null and b/res/img/黑宝石.png differ diff --git a/shimen.py b/shimen.py new file mode 100644 index 0000000..d45807d --- /dev/null +++ b/shimen.py @@ -0,0 +1,113 @@ +import time +from . import common +# 导入系统资源模块 +from ascript.android.system import R +# 导入图色检索模块 +from ascript.android.screen import FindImages + +from ascript.android.screen import FindColors + +pngs = ["师门-任务按钮", "使用按钮", "师门任务1", "普陀山", "购买按钮", "上交按钮", "师门01", "摆摊-购买"] + + +def shimenrenwu(): + while True: + + print("判断状态1") + if common.isfire(): + print("----------战斗中----------") + sleep(60) + continue + sleep(5) + print("判断状态2") + if common.isfire(): + print("----------再次判断战斗中----------") + sleep(60) + continue + + res_huodong = common.huodong() + print("打开活动") + if res_huodong: + sleep(1) + res_shimen = common.zhaorenwu("师门任务.png") + if res_shimen is not None: + print("找到师门任务") + res_wancheng = common.zhaowancheng_text(res_shimen) + if res_wancheng is not None: + print("------------------------师门任务已完成") + common.closeAllbtn() + sleep(2) + return + + res_canjia = common.zhaocanjia_text(res_shimen) + if res_canjia is not None: + common.findandclick(res_canjia) + print("点击参加,师门任务") + sleep(1) + res_qwc = zhaobtn(["师门-去完成", "师门-继续任务"]) + if res_qwc is not None: + sleep(1) + common.findandclick(res_qwc) + while True: + print("判断状态1") + if common.isfire(): + print("----------战斗中----------") + sleep(60) + continue + + res_btns = zhaobtn(pngs) + if res_btns is not None: + common.findandclick(res_btns) + sleep(3) + + res_qctb = zhaobtn(["请出题吧", "师傅请"]) + if res_qctb is not None: + common.findandclick(res_qctb) + sleep(1) + while True: + print("选择最后一个选项") + common.findandclick({"rect": [730, 517, 978, 559]}) + sleep(1) + res_zsjg = FindColors.find( + "810,526,#F4DBBE|782,551,#F2D19E|924,526,#F4DBBE|930,554,#F2CF96", + rect=[687, 510, 1016, 616]) + if res_zsjg is None: + break + + sleep(1) + + res_rwwc = common.zhaotu("师门任务完成.png") + if res_rwwc is not None: + sleep(1) + print("师门任务完成") + common.findandclick({"rect": [418, 560, 612, 609]}) + common.closeAllbtn() + return + + # 点击任务 + dianjirenwu() + sleep(4) + + else: + common.closeAllbtn() + + sleep(1) + + +def dianjirenwu(): + res_shimen = common.zhaotu("师门.png") + if res_shimen is None: + print("没找到-任务列表-师门任务") + return + else: + common.findandclick({"rect": [806, 245, 1018, 323]}) + + +def zhaobtn(pngs): + # 找各种任务按钮 + images = [R.img(png + ".png") for png in pngs] + return FindImages.find(images, rect=[172, 96, 1005, 714], confidence=0.95) + + +def sleep(num): + time.sleep(num) diff --git a/yabiao.py b/yabiao.py new file mode 100644 index 0000000..2dd878c --- /dev/null +++ b/yabiao.py @@ -0,0 +1,56 @@ +import time +from . import common +# 导入系统资源模块 +from ascript.android.system import R +# 导入图色检索模块 +from ascript.android.screen import FindImages + +from ascript.android.screen import FindColors + +pngs = ["押送普通","确定"] +def yabiaorenwu(): + while True: + + if common.isfire(): + print("----------战斗中----------") + sleep(60) + continue + + res_huodong = common.huodong() + if res_huodong: + print("打开活动") + sleep(1) + res_mjxy = common.zhaorenwu("押镖任务.png") + if res_mjxy is not None: + res_wancheng = common.zhaowancheng_text(res_mjxy) + if res_wancheng is not None: + print("押镖任务完成,进行下一项") + common.closeAllbtn() + sleep(2) + return + + res_canjia = common.zhaocanjia_text(res_mjxy) + if res_canjia is not None: + common.findandclick(res_canjia) + print("点击参加,押镖任务") + sleep(2) + + res_btns = zhaobtn(pngs) + if res_btns is not None: + common.findandclick(res_btns) + sleep(2) + + res_btns = zhaobtn(pngs) + if res_btns is not None: + common.findandclick(res_btns) + sleep(2) + + sleep(5) + +def zhaobtn(pngs): + # 找各种任务按钮 + images = [R.img(png + ".png") for png in pngs] + return FindImages.find(images, rect=[172, 96, 1005, 714], confidence=0.95) + +def sleep(num): + time.sleep(num) diff --git a/zhixian.py b/zhixian.py new file mode 100644 index 0000000..1621eae --- /dev/null +++ b/zhixian.py @@ -0,0 +1,64 @@ +import time +from . import common +# 导入系统资源模块 +from ascript.android.system import R +# 导入图色检索模块 +from ascript.android.screen import FindImages + +from ascript.android.screen import FindColors + +# 导入动作模块 +from ascript.android import action + +def shanghuichushou(shcswp): + print("开始商会出售") + res_last = zhaobtn(["包裹","包裹01"]) + if res_last is not None: + common.findandclick(res_last) + sleep(1) + while True: + res_kcswp = zhaobtn(shcswp) + if res_kcswp is not None: + common.findandclick(res_kcswp) + sleep(1) + res_gd = common.zhaotu("更多.png") + if res_gd is not None: + common.findandclick(res_gd) + sleep(1) + + res_shcs = zhaobtn(["商会出售","商会出售01"]) + if res_shcs is not None: + common.findandclick(res_shcs) + sleep(1) + res_man = common.zhaotu("满.png") + if res_man is not None: + common.findandclick(res_man) + sleep(1) + res_chushou = common.zhaotu("出售.png") + if res_chushou is not None: + common.findandclick(res_chushou) + sleep(2) + res_bbzl = common.zhaotu("背包-整理.png") + if res_bbzl is not None: + common.findandclick(res_bbzl) + sleep(5) + else: + print("没有找到商会出售的道具,进行下一项") + common.closeAllbtn() + return + sleep(1) + + +def xiahua(): + print("开始下滑") + action.slide(749, 555, 749, 241, 2000) + sleep(1) + + +def zhaobtn(pngs): + # 找各种任务按钮 + images = [R.img(png + ".png") for png in pngs] + return FindImages.find(images, confidence=0.95) + +def sleep(num): + time.sleep(num) diff --git a/zhuogui.py b/zhuogui.py new file mode 100644 index 0000000..e6a1014 --- /dev/null +++ b/zhuogui.py @@ -0,0 +1,152 @@ +import time +import random +import threading + +from . import common +from . import lingqushuangbei +from . import duiwu + +# 导入系统资源模块 + +from ascript.android.system import R + +# 导入动作模块 + +from ascript.android import action + +# 导入图色检索模块 + +from ascript.android.screen import FindImages + +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() + return + + if common.shuangbei: + print("开始捉鬼") + # 先执行退出队伍 + while True: + if common.zhuoguiisover is True and common.shuangbei is False: + print("-------------------------检查到捉鬼完成,退出队伍,进行下一项") + duiwu.tuichuzudui() + return + + # zhaotu("战斗-取消.png") + 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) + res_canjia = common.zhaocanjia_text(res_gui) + res_wancheng = common.zhaowancheng(res_gui) + if res_wancheng is not None: + print("捉鬼任务完成,退出队伍") + common.closeAllbtn() + sleep(2) + duiwu.tuichuzudui() + common.zhuoguiisover = True + return + + if res_canjia is None: + print("未找到目标图片:参加.png") + if common.isfire(): + print("正在战斗,等待战斗完成") + 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") + sleep(10) + if common.isfire(): + print("1战斗中-等待战斗结束") + sleep(60) + continue + else: + print("判断状态4") + sleep(10) + if common.isfire(): + print("2战斗中-等待战斗结束") + sleep(60) + continue + else: + print("点了参加,也没自动匹配,也没在战斗中-退出队伍") + duiwu.tuichuzudui() + print("退出组队后,重新捉鬼") + + else: + common.findandclick(res_zdpp) + print("---------捉鬼开始了---------") + common.closeAllbtn() + sleep(2) + common.closeAllbtn() + sleep(60) + + sleep(1) + + +def sleep(num): + time.sleep(num)