Compare commits

...

7 Commits
main ... dev

Author SHA1 Message Date
jinghaibing
3e885fda29 0328更改 2025-03-28 17:41:27 +08:00
jinghaibing
1e89c897f5 0326更改-01 2025-03-28 09:08:10 +08:00
jinghaibing
a6454d45ed 0327更改 2025-03-27 11:50:25 +08:00
jinghaibing
6146f19551 0325更改 2025-03-25 17:01:16 +08:00
jinghaibing
e8d912a4e7 Merge remote-tracking branch 'origin/dev' into dev 2025-03-25 16:33:16 +08:00
jinghaibing
6d1214a723 0325更改 2025-03-25 16:32:49 +08:00
jinghaibing
e0162d90b0 0325更改 2025-03-25 10:58:51 +08:00
54 changed files with 17277 additions and 217 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,10 +10,13 @@ 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
import json
from ascript.android.ui import WebWindow
# 导入系统资源模块 # 导入系统资源模块
from ascript.android.system import R from ascript.android.system import R
@ -35,15 +38,17 @@ from ascript.android.node import Selector
from ascript.android.screen import FindColors from ascript.android.screen import FindColors
from ascript.android.screen import FindImages from ascript.android.screen import FindImages
from ascript.android.screen import CompareColors
from ascript.android.screen import Ocr from ascript.android.screen import Ocr
import re import re
from ascript.android import system from ascript.android import system
shcswp = ["百炼精铁"] shcswp = ["百炼精铁", "制造书-女衣", "制造书-宝珠", "制造书-枪", "制造书-鞋"]
print("程序开启,打开游戏") print("程序开启,打开游戏")
# # 根据包名启动,推荐使用 # # 根据包名启动,推荐使用
# # com.netease.my # # com.netease.my
# res_qidong = system.open("com.netease.my") # res_qidong = system.open("com.netease.my")
@ -67,4 +72,115 @@ print("程序开启,打开游戏")
# yabiao.yabiaorenwu() # yabiao.yabiaorenwu()
zhixian.shanghuichushou(shcswp) # zhixian.shanghuichushou(shcswp)
def tunnel(k, v):
try:
# 尝试将 v 解析为字典
v_dict = json.loads(v)
print(f"解析后的字典---", v_dict, type(v_dict))
# 遍历字典中的每个键和值
for key, value_list in v_dict.items():
print(f"任务-{key} 的值:", value_list)
if key == "任务列表":
config.renwuliebiao.extend(remove_suffix(value_list))
if key == "商会出售":
config.shanghuichushou_lb.extend(remove_suffix(value_list))
if key == "使用物品":
config.shiyongwupin_lb.extend(remove_suffix(value_list))
if key == "丢弃物品":
config.diuqiwupin_lb.extend(remove_suffix(value_list))
if key == "出售物品":
config.baitanchushou_lb.extend(remove_suffix(value_list))
if key == "捉鬼次数":
print(f"捉鬼次数:{value_list}")
config.zhuoguicishu = int(value_list);
# 执行所有任务
execute_all_tasks()
except json.JSONDecodeError as e:
print(f"解析 JSON 失败: {e}")
def remove_suffix(items):
return [item.split('-')[0] for item in items]
def execute_all_tasks():
# 按顺序执行任务
if "捉鬼任务" in config.renwuliebiao:
print("执行任务: 捉鬼任务")
common.start_alllive_task_timer(70)
sleep(3)
zhuogui.zhuogui()
config.renwuliebiao.remove("捉鬼任务") # 移除已完成的任务
print("捉鬼完成,调整全局检测线程时间----120")
common.start_alllive_task_timer(120)
if "师门任务" in config.renwuliebiao:
print("执行任务: 师门任务")
shimen.shimenrenwu()
config.renwuliebiao.remove("师门任务") # 移除已完成的任务
if "宝图任务" in config.renwuliebiao:
print("执行任务: 宝图任务")
baotu.baoturenwu()
common.closeAllbtn()
config.renwuliebiao.remove("宝图任务") # 移除已完成的任务
if "自动挖宝" in config.renwuliebiao:
print("执行任务: 自动挖宝")
baotu.wabaotu()
config.renwuliebiao.remove("自动挖宝") # 移除已完成的任务
if "秘境降妖" in config.renwuliebiao:
print("执行任务: 秘境降妖")
mijing.mijingxiangyao()
config.renwuliebiao.remove("秘境降妖") # 移除已完成的任务
if "普通押镖" in config.renwuliebiao:
print("执行任务: 普通押镖")
yabiao.yabiaorenwu()
config.renwuliebiao.remove("普通押镖") # 移除已完成的任务
# 其他任务按顺序执行
print("执行商会出售任务")
zhixian.shanghuichushou(config.shanghuichushou_lb)
print("执行使用物品任务")
# 这里可以添加使用物品的具体逻辑
# 例如shiyongwupin(config.shiyongwupin_lb)
print("执行丢弃物品任务")
# 这里可以添加丢弃物品的具体逻辑
# 例如diuqiwupin(config.diuqiwupin_lb)
print("执行出售物品任务")
# 这里可以添加出售物品的具体逻辑
# 例如baitanchushou(config.baitanchushou_lb)
# # 构建一个WebWindow 显示‘/res/ui/a.html 通信通道为tunnel 函数
# w = WebWindow(R.ui('index.html'), tunnel)
# w.show()
x1 = 322
y1 = 539
x2 = 382
y2 = 596
# 原色标点
color_points = "322,559,#B08559|388,565,#AC7E54|353,599,#AF8659"
# 将色标点的 Y 坐标偏移 130
new_color_points = "|".join(
f"{x},{int(y) + 130},{color}"
for x, y, color in (point.split(",") for point in color_points.split("|"))
)
print(new_color_points)
# common.huodong()
print("程序结束")
def sleep(num):
time.sleep(num)

137
baotu.py
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)
@ -54,62 +60,95 @@ def baoturenwu():
def wabaotu(): def wabaotu():
while True:
if common.isfire():
print("战斗中,等待战斗完成")
sleep(60)
res_last = common.zhaotu("包裹.png") if common.isfire():
if res_last is not None: print("战斗中,等待战斗完成")
common.findandclick(res_last) sleep(60)
sleep(1)
res_baotu = common.zhaotu("宝图任务.png") if openbeibao():
if res_baotu is not None: num =0
common.findandclick(res_baotu) while True:
sleep(1) res_baotu = common.zhaotu("/baotu_zx/宝图任务.png")
if res_baotu is not None:
common.findandclick(res_baotu)
sleep(1)
res_shiyong_beibao = common.zhaotu("背包-使用.png") res_shiyong_beibao = common.zhaotu("背包-使用.png")
if res_shiyong_beibao is not None: if res_shiyong_beibao is not None:
common.findandclick(res_shiyong_beibao) common.findandclick(res_shiyong_beibao)
sleep(1) sleep(1)
wabaoisover=False wabaoisover = False
while True: while True:
if common.isfire(): sleep(10)
print("战斗中,等待战斗完成") if common.isfire():
sleep(60) 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("没在战斗中")
res_shiyong = common.zhaotu("使用按钮.png") openbeibao()
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) 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
def openbeibao():
res_last = FindImages.find(
[
R.img("包裹.png"),
],
confidence=0.9,
)
if res_last is not None:
common.findandclick(res_last)
sleep(1) sleep(1)
return True
else:
return False
def zhenglibb():
res_bbzl = common.zhaotu("背包-整理.png")
if res_bbzl is not None:
common.findandclick(res_bbzl)
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

147
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
@ -27,6 +31,18 @@ zhuoguiisover = False
# 领取双倍状态 # 领取双倍状态
shuangbei = False shuangbei = False
# 定义一个全局变量来管理定时器
alllive_task_timer = None
# 记录战斗次数
battle_count = 0
# 记录上次战斗状态
last_battle_status = False
# 定义一个全局变量来管理战斗状态监控定时器
battle_monitor_timer = None
def huodong(): def huodong():
while True: while True:
@ -36,6 +52,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
@ -57,6 +74,64 @@ def huodong():
sleep(1) sleep(1)
def lingquhuodongjiangli():
x1 = 315
y1 = 526
x2 = 392
y2 = 607
# FindColors.find("311,524,#F0DCC5|446,524,#F1DEC6|580,524,#F0DDC5")
hypy = 364
# 373,592 绿色 #56AE08
# 已领取 #B08559
res_ylq = FindColors.find("322,559,#B08559|388,565,#AC7E54|353,599,#AF8659", rect=[x1, y1, x2, y2])
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
# 原色标点
color_points = "322,559,#B08559|388,565,#AC7E54|353,599,#AF8659"
# 将色标点的 Y 坐标偏移 130
new_color_points = "|".join(
f"{x},{int(y) + 130},{color}"
for x, y, color in (point.split(",") for point in color_points.split("|"))
)
# 2号奖励
res_ylq = FindColors.find(new_color_points, rect=[x1, y1, x2, y2])
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("322,559,#B08559|388,565,#AC7E54|353,599,#AF8659", rect=[x1, y1, x2, y2])
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("322,559,#B08559|388,565,#AC7E54|353,599,#AF8659", rect=[x1, y1, x2, y2])
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("322,559,#B08559|388,565,#AC7E54|353,599,#AF8659", rect=[x1, y1, x2, y2])
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]
@ -66,8 +141,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)
@ -97,7 +172,7 @@ def closeAllbtn():
findandclick(res_flkg) findandclick(res_flkg)
# 师门-关闭.png # 师门-关闭.png
res_smgb = zhaotu("师门-关闭.png") res_smgb = zhaotu("/shimen/师门-关闭.png")
if res_smgb is not None: if res_smgb is not None:
print("关闭-师门任务-弹框") print("关闭-师门任务-弹框")
findandclick(res_smgb) findandclick(res_smgb)
@ -118,18 +193,56 @@ 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(3, 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(3, 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 denglu(): def denglu():
while True: while True:
res_fwq = FindColors.find("382,434,#BC3010|380,442,#CE3116|643,431,#FFE986") res_fwq = FindColors.find("382,434,#BC3010|380,442,#CE3116|643,431,#FFE986")
@ -290,8 +403,9 @@ def shizi(fanwei):
return None return None
def alllive_task(): 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:
@ -339,9 +453,26 @@ def alllive_task():
# 战斗状态监控 # 战斗状态监控
isfire() isfire()
duiwu.shifoukaping() # duiwu.shifoukaping()
threading.Timer(70, alllive_task).start() start_alllive_task_timer(num)
def start_alllive_task_timer(num):
global alllive_task_timer
if alllive_task_timer is not None:
alllive_task_timer.cancel()
alllive_task_timer = threading.Timer(num, alllive_task, args=(num,))
alllive_task_timer.start()
print("定时任务已启动")
def stop_alllive_task_timer():
global alllive_task_timer
if alllive_task_timer is not None:
alllive_task_timer.cancel()
alllive_task_timer = None
print("定时任务已停止")
def sleep(num): def sleep(num):

8
config.py Normal file
View File

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

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

@ -9,6 +9,7 @@ shuangbeidianshu_ylq = [432, 616, 549, 650]
shuangbeidianshu = 0 shuangbeidianshu = 0
def lingqushuangbei(): def lingqushuangbei():
print("开始领取双倍") print("开始领取双倍")
a = 0 a = 0
@ -17,8 +18,8 @@ def lingqushuangbei():
print("找不到挂机入口,程序停止") print("找不到挂机入口,程序停止")
return return
res_guaji1 = common.zhaotu("挂机1.png") res_guaji1 = common.zhaotu("挂机1.png")
res_guaji=common.zhaotu("挂机.png") res_guaji = common.zhaotu("挂机.png")
res_guaji_last=res_guaji or res_guaji1 res_guaji_last = res_guaji or res_guaji1
if res_guaji_last is not None: if res_guaji_last is not None:
lingqu(res_guaji_last) lingqu(res_guaji_last)
print("双倍领取完成,开始捉鬼") print("双倍领取完成,开始捉鬼")
@ -37,6 +38,7 @@ def lingqushuangbei():
sleep(1) sleep(1)
continue continue
def lingqu(zuobiao): def lingqu(zuobiao):
global shuangbeidianshu global shuangbeidianshu
sleep(1) sleep(1)
@ -47,35 +49,46 @@ def lingqu(zuobiao):
print("领取双倍") print("领取双倍")
res_lingqu = common.zhaotu("领取.png") res_lingqu = common.zhaotu("领取.png")
res_dlq_text = common.shizi(shuangbeidianshu_fw) res_dlq_text = common.shizi(shuangbeidianshu_fw)
dlq_num=0 res_ylq_text = common.shizi(shuangbeidianshu_ylq)
ylq_num = 0
if res_ylq_text is not None:
res_ylq = qushuzi(res_ylq_text)
ylq_num = int(res_ylq)
dlq_num = 0
if res_dlq_text is not None: if res_dlq_text is not None:
res_dlq = qushuzi(res_dlq_text) res_dlq = qushuzi(res_dlq_text)
dlq_num = int(res_dlq) dlq_num = int(res_dlq)
if dlq_num > 0: print(f"待领取双倍点数:", dlq_num)
xunhuancishu = dlq_num % 100 print(f"已领取双倍点数:", ylq_num)
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 : remaining_points = min(dlq_num, 1000 - ylq_num)
if remaining_points > 0:
# 计算点击次数
xunhuancishu = remaining_points // 100
if remaining_points % 100 != 0:
xunhuancishu += 1
common.shuangbei = True
for i in range(xunhuancishu):
print(f"领取双倍 100 点, 次数 {i + 1}/{xunhuancishu}")
common.findandclick(res_lingqu)
ylq_num += 100
sleep(0.5)
if res_ylq_text is None:
print("--------------------------双倍点数识别失败-停止抓鬼") print("--------------------------双倍点数识别失败-停止抓鬼")
common.shuangbei = False common.shuangbei = False
common.zhuoguiisover = True common.zhuoguiisover = True
common.closeAllbtn() common.closeAllbtn()
return return
else: else:
res_ylq = qushuzi(res_ylq_text)
ylq_num = int(res_ylq)
shuangbeidianshu = ylq_num shuangbeidianshu = ylq_num
if ylq_num >= 4: if ylq_num >= 4:
if ylq_num >= 1000:
ylq_num = 1000
shuangbeidianshu = ylq_num
print(f"正常领取结束,开始任务", ylq_num) print(f"正常领取结束,开始任务", ylq_num)
common.shuangbei = True common.shuangbei = True
common.closeAllbtn() common.closeAllbtn()
@ -89,6 +102,41 @@ def lingqu(zuobiao):
sleep(1) sleep(1)
return return
def dongjieshuangbei():
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:
common.findandclick(res_guaji_last)
sleep(1)
res_dj=common.zhaotu("冻结.png")
if res_dj is not None:
common.findandclick(res_dj)
sleep(1)
print("---------冻结双倍点数完成")
common.closeAllbtn()
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 qushuzi(text): def qushuzi(text):
# 使用正则表达式提取数字 # 使用正则表达式提取数字
match = re.search(r"\d+", text) # 匹配连续的数字 match = re.search(r"\d+", text) # 匹配连续的数字

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.0 KiB

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 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: 4.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

View File

Before

Width:  |  Height:  |  Size: 6.8 KiB

After

Width:  |  Height:  |  Size: 6.8 KiB

View File

Before

Width:  |  Height:  |  Size: 816 B

After

Width:  |  Height:  |  Size: 816 B

View File

Before

Width:  |  Height:  |  Size: 2.4 KiB

After

Width:  |  Height:  |  Size: 2.4 KiB

View File

Before

Width:  |  Height:  |  Size: 3.6 KiB

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.8 KiB

View File

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

View File

Before

Width:  |  Height:  |  Size: 7.8 KiB

After

Width:  |  Height:  |  Size: 7.8 KiB

BIN
res/img/shimen/师门01png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.8 KiB

View File

Before

Width:  |  Height:  |  Size: 4.1 KiB

After

Width:  |  Height:  |  Size: 4.1 KiB

View File

Before

Width:  |  Height:  |  Size: 3.6 KiB

After

Width:  |  Height:  |  Size: 3.6 KiB

View File

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

BIN
res/img/包裹01.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.1 KiB

BIN
res/img/跳过动画.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.0 KiB

16608
res/ui/index.html Normal file

File diff suppressed because one or more lines are too long

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 = ["师门-任务按钮", "使用按钮", "师门任务1", "普陀山", "购买按钮", "上交按钮", "师门01", "摆摊-购买"] pngs = ["/shimen/师门-任务按钮", "使用按钮", "/shimen/师门任务1", "/shimen/普陀山", "购买按钮", "上交按钮",
"/shimen/师门01", "摆摊-购买", "/shimen/师门-龙宫", "/shimen/首席请", "跳过动画", "/shimen/不打自招"]
def shimenrenwu(): def shimenrenwu():
@ -29,7 +30,7 @@ def shimenrenwu():
print("打开活动") print("打开活动")
if res_huodong: if res_huodong:
sleep(1) sleep(1)
res_shimen = common.zhaorenwu("师门任务.png") res_shimen = common.zhaorenwu("/shimen/师门任务.png")
if res_shimen is not None: if res_shimen is not None:
print("找到师门任务") print("找到师门任务")
res_wancheng = common.zhaowancheng_text(res_shimen) res_wancheng = common.zhaowancheng_text(res_shimen)
@ -44,10 +45,15 @@ def shimenrenwu():
common.findandclick(res_canjia) common.findandclick(res_canjia)
print("点击参加,师门任务") print("点击参加,师门任务")
sleep(1) sleep(1)
res_qwc = zhaobtn(["师门-去完成", "师门-继续任务"]) res_xzjw = common.zhaotu("/shimen/选择-集物.png")
if res_qwc is not None: if res_xzjw is not None:
sleep(1) findxuanze(res_xzjw)
common.findandclick(res_qwc) res_qwc = zhaobtn(["/shimen/师门-去完成", "/shimen/师门-继续任务"])
if res_qwc is not None or res_xzjw is not None:
if res_qwc is not None:
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)
@ -76,7 +87,7 @@ def shimenrenwu():
sleep(1) sleep(1)
res_rwwc = common.zhaotu("师门任务完成.png") res_rwwc = common.zhaotu("/shimen/师门任务完成.png")
if res_rwwc is not None: if res_rwwc is not None:
sleep(1) sleep(1)
print("师门任务完成") print("师门任务完成")
@ -94,8 +105,15 @@ 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("师门.png") res_shimen = common.zhaotu("/shimen/师门.png")
if res_shimen is None: if res_shimen is None:
print("没找到-任务列表-师门任务") print("没找到-任务列表-师门任务")
return return

View File

@ -10,43 +10,51 @@ from ascript.android.screen import FindColors
# 导入动作模块 # 导入动作模块
from ascript.android import action from ascript.android import action
def shanghuichushou(shcswp): def shanghuichushou(shcswp):
print("开始商会出售") print("开始商会出售")
res_last = zhaobtn(["包裹","包裹01"]) res_last = zhaobtn(["包裹", "包裹01"])
if res_last is not None: if res_last is not None:
common.findandclick(res_last) common.findandclick(res_last)
print("点击包裹")
sleep(1) sleep(1)
while True: num = 0
res_kcswp = zhaobtn(shcswp) while True:
if res_kcswp is not None: res_kcswp = zhaobtn(shcswp)
common.findandclick(res_kcswp) if res_kcswp is not None:
sleep(1) common.findandclick(res_kcswp)
res_gd = common.zhaotu("更多.png")
if res_gd is not None:
common.findandclick(res_gd)
sleep(1) sleep(1)
res_gd = common.zhaotu("更多.png")
res_shcs = zhaobtn(["商会出售","商会出售01"]) if res_gd is not None:
if res_shcs is not None: common.findandclick(res_gd)
common.findandclick(res_shcs)
sleep(1)
res_man = common.zhaotu("满.png")
if res_man is not None:
common.findandclick(res_man)
sleep(1) sleep(1)
res_shcs = zhaobtn(["/shanghui/商会出售", "/shanghui/商会出售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") res_chushou = common.zhaotu("出售.png")
if res_chushou is not None: if res_chushou is not None:
common.findandclick(res_chushou) common.findandclick(res_chushou)
sleep(2) sleep(4)
res_bbzl = common.zhaotu("背包-整理.png") num += 1
if res_bbzl is not None: if num >= 5:
common.findandclick(res_bbzl) res_bbzl = common.zhaotu("背包-整理.png")
sleep(5) if res_bbzl is not None:
else: common.findandclick(res_bbzl)
print("没有找到商会出售的道具,进行下一项") sleep(5)
common.closeAllbtn() num = 0
return else:
sleep(1) print("没有找到商会出售的道具,进行下一项")
common.closeAllbtn()
return
sleep(1)
else:
print("没有找到包裹,进行下一项")
def xiahua(): def xiahua():

View File

@ -3,6 +3,7 @@ import random
import threading import threading
from . import common from . import common
from . import config
from . import lingqushuangbei from . import lingqushuangbei
from . import duiwu from . import duiwu
@ -25,125 +26,170 @@ 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() lingqushuangbei.lingqushuangbei()
if common.shuangbei is False:
print("双倍点数不足,停止捉鬼任务")
return return
if common.shuangbei: print("开始捉鬼")
print("开始捉鬼")
# 先执行退出队伍
while True:
if common.zhuoguiisover is True and common.shuangbei is False:
print("-------------------------检查到捉鬼完成,退出队伍,进行下一项")
duiwu.tuichuzudui()
return
# zhaotu("战斗-取消.png") # 先执行退出队伍
res_zdsb = common.zhaotu("战斗失败.png") # duiwu.tuichuzudui()
if res_zdsb is not None:
print("找到战斗失败")
common.findandclick(res_zdsb)
sleep(1)
duiwu.tuichuzudui()
continue
# 启动战斗状态监控定时任务
common.start_battle_monitor_timer()
while True:
if common.zhuoguiisover is True or common.battle_count >= config.zhuoguicishu:
print("捉鬼完成,退出捉鬼任务")
common.stop_battle_monitor_timer()
duiwu.tuichuzudui()
print("判断状态1") print("判断状态1")
if common.isfire(): while True:
print("----------战斗中----------") if common.isfire():
sleep(60) print("----------战斗中----------")
continue sleep(60)
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 continue
else: else:
sleep(1) break
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: lingqushuangbei.dongjieshuangbei()
print("未找到目标图片:参加.png") 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
res_zdsb = common.zhaotu("战斗失败.png")
if res_zdsb is not None:
print("找到战斗失败")
common.findandclick(res_zdsb)
sleep(1)
duiwu.tuichuzudui()
continue
# 检查战斗状态
if common.isfire():
print("----------战斗中----------")
sleep(60)
continue
sleep(10)
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
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:
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(): 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)