初始版本代码
3
.idea/.gitignore
generated
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
# 默认忽略的文件
|
||||
/shelf/
|
||||
/workspace.xml
|
6
.idea/inspectionProfiles/profiles_settings.xml
generated
Normal file
@ -0,0 +1,6 @@
|
||||
<component name="InspectionProjectProfileManager">
|
||||
<settings>
|
||||
<option name="USE_PROJECT_PROFILE" value="false" />
|
||||
<version value="1.0" />
|
||||
</settings>
|
||||
</component>
|
7
.idea/misc.xml
generated
Normal 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>
|
8
.idea/modules.xml
generated
Normal 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/vcs.xml
generated
Normal 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>
|
8
.idea/梦幻助手.iml
generated
Normal 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>
|
70
__init__.py
Normal file
@ -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)
|
15
bangpai.py
Normal file
@ -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")
|
121
baotu.py
Normal file
@ -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)
|
19
build.as
Normal file
@ -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":[]
|
||||
}
|
4
ceshi.py
Normal file
@ -0,0 +1,4 @@
|
||||
a =202
|
||||
for i in range(a%100):
|
||||
print(i)
|
||||
# print(a%100)
|
348
common.py
Normal file
@ -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)
|
203
duiwu.py
Normal file
@ -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)
|
106
lingqushuangbei.py
Normal file
@ -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)
|
110
mijing.py
Normal file
@ -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)
|
BIN
res/img/logo.png
Normal file
After Width: | Height: | Size: 3.3 KiB |
BIN
res/img/上交按钮.png
Normal file
After Width: | Height: | Size: 1.6 KiB |
BIN
res/img/九幽诗集.png
Normal file
After Width: | Height: | Size: 5.2 KiB |
BIN
res/img/使用按钮.png
Normal file
After Width: | Height: | Size: 2.2 KiB |
BIN
res/img/充值.png
Normal file
After Width: | Height: | Size: 2.2 KiB |
BIN
res/img/光芒石.png
Normal file
After Width: | Height: | Size: 2.9 KiB |
BIN
res/img/冻结.png
Normal file
After Width: | Height: | Size: 2.6 KiB |
BIN
res/img/出售.png
Normal file
After Width: | Height: | Size: 1.6 KiB |
BIN
res/img/创建队伍.png
Normal file
After Width: | Height: | Size: 6.3 KiB |
BIN
res/img/制造书-女衣.png
Normal file
After Width: | Height: | Size: 4.0 KiB |
BIN
res/img/制造书-宝珠.png
Normal file
After Width: | Height: | Size: 3.6 KiB |
BIN
res/img/制造书-枪.png
Normal file
After Width: | Height: | Size: 4.9 KiB |
BIN
res/img/制造书-鞋.png
Normal file
After Width: | Height: | Size: 3.6 KiB |
BIN
res/img/包裹.png
Normal file
After Width: | Height: | Size: 2.2 KiB |
BIN
res/img/参加.png
Normal file
After Width: | Height: | Size: 4.4 KiB |
BIN
res/img/取消.png
Normal file
After Width: | Height: | Size: 2.3 KiB |
BIN
res/img/取消匹配.png
Normal file
After Width: | Height: | Size: 5.3 KiB |
BIN
res/img/右下角+.png
Normal file
After Width: | Height: | Size: 1.5 KiB |
BIN
res/img/听听无妨.png
Normal file
After Width: | Height: | Size: 3.3 KiB |
BIN
res/img/商会出售.png
Normal file
After Width: | Height: | Size: 3.5 KiB |
BIN
res/img/商会出售01.png
Normal file
After Width: | Height: | Size: 3.3 KiB |
BIN
res/img/地图.png
Normal file
After Width: | Height: | Size: 503 B |
BIN
res/img/完成.png
Normal file
After Width: | Height: | Size: 2.1 KiB |
BIN
res/img/宝图任务.png
Normal file
After Width: | Height: | Size: 4.2 KiB |
BIN
res/img/师傅请.png
Normal file
After Width: | Height: | Size: 2.9 KiB |
BIN
res/img/师门-任务按钮.png
Normal file
After Width: | Height: | Size: 6.8 KiB |
BIN
res/img/师门-关闭.png
Normal file
After Width: | Height: | Size: 816 B |
BIN
res/img/师门-去完成.png
Normal file
After Width: | Height: | Size: 2.4 KiB |
BIN
res/img/师门-继续任务.png
Normal file
After Width: | Height: | Size: 3.6 KiB |
BIN
res/img/师门.png
Normal file
After Width: | Height: | Size: 1.7 KiB |
BIN
res/img/师门01.png
Normal file
After Width: | Height: | Size: 8.1 KiB |
BIN
res/img/师门01png
Normal file
After Width: | Height: | Size: 7.8 KiB |
BIN
res/img/师门任务.png
Normal file
After Width: | Height: | Size: 4.1 KiB |
BIN
res/img/师门任务1.png
Normal file
After Width: | Height: | Size: 3.6 KiB |
BIN
res/img/师门任务完成.png
Normal file
After Width: | Height: | Size: 11 KiB |
BIN
res/img/帮派.png
Normal file
After Width: | Height: | Size: 1.6 KiB |
BIN
res/img/帮派列表.png
Normal file
After Width: | Height: | Size: 7.1 KiB |
BIN
res/img/总开关.png
Normal file
After Width: | Height: | Size: 1.5 KiB |
BIN
res/img/战斗-取消.png
Normal file
After Width: | Height: | Size: 9.5 KiB |
BIN
res/img/战斗失败.png
Normal file
After Width: | Height: | Size: 21 KiB |
BIN
res/img/所有图标.png
Normal file
After Width: | Height: | Size: 2.0 KiB |
BIN
res/img/押送普通.png
Normal file
After Width: | Height: | Size: 6.5 KiB |
BIN
res/img/押镖任务.png
Normal file
After Width: | Height: | Size: 5.3 KiB |
BIN
res/img/拒绝.png
Normal file
After Width: | Height: | Size: 2.6 KiB |
BIN
res/img/挂机.png
Normal file
After Width: | Height: | Size: 1.9 KiB |
BIN
res/img/挂机1.png
Normal file
After Width: | Height: | Size: 1.7 KiB |
BIN
res/img/指引-关闭.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
res/img/摆摊-购买.png
Normal file
After Width: | Height: | Size: 3.9 KiB |
BIN
res/img/日常-宝图任务.png
Normal file
After Width: | Height: | Size: 6.0 KiB |
BIN
res/img/普陀山.png
Normal file
After Width: | Height: | Size: 6.7 KiB |
BIN
res/img/更多.png
Normal file
After Width: | Height: | Size: 2.1 KiB |
BIN
res/img/材料包.png
Normal file
After Width: | Height: | Size: 4.0 KiB |
BIN
res/img/汤圆来了.png
Normal file
After Width: | Height: | Size: 4.8 KiB |
BIN
res/img/法宝碎片.png
Normal file
After Width: | Height: | Size: 3.0 KiB |
BIN
res/img/洞冥记.png
Normal file
After Width: | Height: | Size: 1.9 KiB |
BIN
res/img/活动-c.png
Normal file
After Width: | Height: | Size: 2.0 KiB |
BIN
res/img/活动.png
Normal file
After Width: | Height: | Size: 3.1 KiB |
BIN
res/img/满.png
Normal file
After Width: | Height: | Size: 1.6 KiB |
BIN
res/img/玄武石.png
Normal file
After Width: | Height: | Size: 2.8 KiB |
BIN
res/img/登录游戏.png
Normal file
After Width: | Height: | Size: 15 KiB |
BIN
res/img/白虎石.png
Normal file
After Width: | Height: | Size: 3.6 KiB |
BIN
res/img/百炼精铁.png
Normal file
After Width: | Height: | Size: 4.1 KiB |
BIN
res/img/确定.png
Normal file
After Width: | Height: | Size: 2.1 KiB |
BIN
res/img/福利-开关.png
Normal file
After Width: | Height: | Size: 689 B |
BIN
res/img/离开.png
Normal file
After Width: | Height: | Size: 3.5 KiB |
BIN
res/img/秘境任务.png
Normal file
After Width: | Height: | Size: 5.1 KiB |
BIN
res/img/秘境降妖-关卡.png
Normal file
After Width: | Height: | Size: 4.3 KiB |
BIN
res/img/秘境降妖.png
Normal file
After Width: | Height: | Size: 4.3 KiB |
BIN
res/img/立即上阵.png
Normal file
After Width: | Height: | Size: 2.8 KiB |
BIN
res/img/算了.png
Normal file
After Width: | Height: | Size: 1.6 KiB |
BIN
res/img/继续挑战.png
Normal file
After Width: | Height: | Size: 5.0 KiB |
BIN
res/img/翡翠石.png
Normal file
After Width: | Height: | Size: 3.8 KiB |
BIN
res/img/聊天.png
Normal file
After Width: | Height: | Size: 2.2 KiB |
BIN
res/img/背包-使用.png
Normal file
After Width: | Height: | Size: 2.0 KiB |
BIN
res/img/背包-整理.png
Normal file
After Width: | Height: | Size: 3.8 KiB |
BIN
res/img/自动匹配.png
Normal file
After Width: | Height: | Size: 7.9 KiB |
BIN
res/img/舍利子.png
Normal file
After Width: | Height: | Size: 3.2 KiB |
BIN
res/img/见面礼-关闭.png
Normal file
After Width: | Height: | Size: 858 B |
BIN
res/img/请出题吧.png
Normal file
After Width: | Height: | Size: 3.9 KiB |
BIN
res/img/购买按钮.png
Normal file
After Width: | Height: | Size: 3.8 KiB |
BIN
res/img/购买点数.png
Normal file
After Width: | Height: | Size: 5.6 KiB |
BIN
res/img/返回.png
Normal file
After Width: | Height: | Size: 2.3 KiB |
BIN
res/img/进入战斗.png
Normal file
After Width: | Height: | Size: 3.8 KiB |
BIN
res/img/退出排队.png
Normal file
After Width: | Height: | Size: 3.8 KiB |