Compare commits
7 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
3e885fda29 | ||
![]() |
1e89c897f5 | ||
![]() |
a6454d45ed | ||
![]() |
6146f19551 | ||
![]() |
e8d912a4e7 | ||
![]() |
6d1214a723 | ||
![]() |
e0162d90b0 |
3
.idea/inspectionProfiles/.idea/.gitignore
generated
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
# 默认忽略的文件
|
||||
/shelf/
|
||||
/workspace.xml
|
6
.idea/inspectionProfiles/.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/inspectionProfiles/.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/inspectionProfiles/.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/inspectionProfiles/.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/inspectionProfiles/.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>
|
2
.idea/misc.xml
generated
@ -3,5 +3,5 @@
|
||||
<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" />
|
||||
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.11" project-jdk-type="Python SDK" />
|
||||
</project>
|
2
.idea/梦幻助手.iml
generated
@ -2,7 +2,7 @@
|
||||
<module type="PYTHON_MODULE" version="4">
|
||||
<component name="NewModuleRootManager">
|
||||
<content url="file://$MODULE_DIR$" />
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="jdk" jdkName="Python 3.11" jdkType="Python SDK" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
122
__init__.py
@ -10,10 +10,13 @@ from . import baotu
|
||||
from . import mijing
|
||||
from . import yabiao
|
||||
from . import zhixian
|
||||
from . import config
|
||||
import time
|
||||
|
||||
import random
|
||||
import json
|
||||
|
||||
from ascript.android.ui import WebWindow
|
||||
# 导入系统资源模块
|
||||
|
||||
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 FindImages
|
||||
|
||||
from ascript.android.screen import CompareColors
|
||||
from ascript.android.screen import Ocr
|
||||
import re
|
||||
|
||||
from ascript.android import system
|
||||
|
||||
shcswp = ["百炼精铁"]
|
||||
shcswp = ["百炼精铁", "制造书-女衣", "制造书-宝珠", "制造书-枪", "制造书-鞋"]
|
||||
|
||||
print("程序开启,打开游戏")
|
||||
|
||||
|
||||
# # 根据包名启动,推荐使用
|
||||
# # com.netease.my
|
||||
# res_qidong = system.open("com.netease.my")
|
||||
@ -67,4 +72,115 @@ print("程序开启,打开游戏")
|
||||
|
||||
# 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)
|
||||
|
75
baotu.py
@ -16,13 +16,19 @@ def baoturenwu():
|
||||
print("----------战斗中----------")
|
||||
sleep(60)
|
||||
continue
|
||||
sleep(5)
|
||||
sleep(10)
|
||||
|
||||
print("判断状态2")
|
||||
if common.isfire():
|
||||
print("----------战斗中----------")
|
||||
sleep(60)
|
||||
continue
|
||||
|
||||
res_huodong = common.huodong()
|
||||
print("打开活动")
|
||||
if res_huodong:
|
||||
sleep(1)
|
||||
res_baotu = common.zhaorenwu("宝图任务.png")
|
||||
res_baotu = common.zhaorenwu("/baotu_zx/宝图任务.png")
|
||||
if res_baotu is not None:
|
||||
print("宝图任务")
|
||||
res_wancheng = common.zhaowancheng_text(res_baotu)
|
||||
@ -36,9 +42,9 @@ def baoturenwu():
|
||||
if res_canjia is not None:
|
||||
common.findandclick(res_canjia)
|
||||
print("点击参加,宝图任务")
|
||||
sleep(1)
|
||||
sleep(3)
|
||||
|
||||
res_ttwf = common.zhaotu("听听无妨.png")
|
||||
res_ttwf = common.zhaotu("/baotu_zx/听听无妨.png")
|
||||
if res_ttwf is not None:
|
||||
common.findandclick(res_ttwf)
|
||||
sleep(1)
|
||||
@ -54,17 +60,15 @@ def baoturenwu():
|
||||
|
||||
|
||||
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 openbeibao():
|
||||
num =0
|
||||
while True:
|
||||
res_baotu = common.zhaotu("/baotu_zx/宝图任务.png")
|
||||
if res_baotu is not None:
|
||||
common.findandclick(res_baotu)
|
||||
sleep(1)
|
||||
@ -74,19 +78,19 @@ def wabaotu():
|
||||
common.findandclick(res_shiyong_beibao)
|
||||
sleep(1)
|
||||
|
||||
wabaoisover=False
|
||||
wabaoisover = False
|
||||
while True:
|
||||
sleep(10)
|
||||
if common.isfire():
|
||||
print("战斗中,等待战斗完成")
|
||||
sleep(60)
|
||||
|
||||
res_shiyong = common.zhaotu("使用按钮.png")
|
||||
if res_shiyong is not None:
|
||||
common.findandclick(res_shiyong)
|
||||
sleep(5)
|
||||
else:
|
||||
print("8秒后再次查找使用按钮")
|
||||
sleep(8)
|
||||
print("10秒后再次查找使用按钮")
|
||||
sleep(10)
|
||||
res_shiyong = common.zhaotu("使用按钮.png")
|
||||
if res_shiyong is not None:
|
||||
print("2次查询,找到使用按钮")
|
||||
@ -100,16 +104,51 @@ def wabaotu():
|
||||
sleep(60)
|
||||
else:
|
||||
print("没在战斗中")
|
||||
wabaoisover =True
|
||||
|
||||
openbeibao()
|
||||
|
||||
zhenglibb()
|
||||
res_baotu = common.zhaotu("宝图任务.png")
|
||||
if res_baotu is None:
|
||||
wabaoisover = True
|
||||
print("******背包中没有宝图,挖宝任务完成******")
|
||||
return
|
||||
|
||||
else:
|
||||
break
|
||||
sleep(8)
|
||||
else:
|
||||
|
||||
if num >1:
|
||||
wabaoisover = True
|
||||
print("******背包中没有宝图,挖宝任务完成******")
|
||||
return
|
||||
zhenglibb()
|
||||
num+=1
|
||||
|
||||
|
||||
|
||||
def openbeibao():
|
||||
res_last = FindImages.find(
|
||||
[
|
||||
R.img("包裹.png"),
|
||||
],
|
||||
confidence=0.9,
|
||||
)
|
||||
if res_last is not None:
|
||||
common.findandclick(res_last)
|
||||
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():
|
||||
res_btrw = common.zhaotu("日常-宝图任务.png")
|
||||
res_btrw = common.zhaotu("/baotu_zx/日常-宝图任务.png")
|
||||
if res_btrw is None:
|
||||
print("没找到-任务列表-宝图任务")
|
||||
return
|
||||
|
147
common.py
@ -3,6 +3,8 @@ import random
|
||||
import threading
|
||||
|
||||
from . import duiwu
|
||||
from . import config
|
||||
from . import lingqushuangbei
|
||||
|
||||
# 导入系统资源模块
|
||||
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 CompareColors
|
||||
|
||||
# 战斗状态
|
||||
isfire_wfstatus = False
|
||||
|
||||
@ -27,6 +31,18 @@ zhuoguiisover = False
|
||||
# 领取双倍状态
|
||||
shuangbei = False
|
||||
|
||||
# 定义一个全局变量来管理定时器
|
||||
alllive_task_timer = None
|
||||
|
||||
# 记录战斗次数
|
||||
battle_count = 0
|
||||
|
||||
# 记录上次战斗状态
|
||||
last_battle_status = False
|
||||
|
||||
# 定义一个全局变量来管理战斗状态监控定时器
|
||||
battle_monitor_timer = None
|
||||
|
||||
|
||||
def huodong():
|
||||
while True:
|
||||
@ -36,6 +52,7 @@ def huodong():
|
||||
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:
|
||||
# lingquhuodongjiangli()
|
||||
return True
|
||||
else:
|
||||
continue
|
||||
@ -57,6 +74,64 @@ def huodong():
|
||||
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):
|
||||
# 提取矩形范围
|
||||
rect = res["rect"] # [x1, y1, x2, y2]
|
||||
@ -66,8 +141,8 @@ def findandclick(res):
|
||||
y = random.randint(rect[1], rect[3]) # 随机 y 坐标
|
||||
# 执行点击操作
|
||||
|
||||
print(f"点击", rect)
|
||||
action.click(x, y) # 在随机点点击
|
||||
print(f"点击", rect)
|
||||
time.sleep(0.5)
|
||||
|
||||
|
||||
@ -97,7 +172,7 @@ def closeAllbtn():
|
||||
findandclick(res_flkg)
|
||||
|
||||
# 师门-关闭.png
|
||||
res_smgb = zhaotu("师门-关闭.png")
|
||||
res_smgb = zhaotu("/shimen/师门-关闭.png")
|
||||
if res_smgb is not None:
|
||||
print("关闭-师门任务-弹框")
|
||||
findandclick(res_smgb)
|
||||
@ -118,18 +193,56 @@ def zhaotu(name):
|
||||
|
||||
|
||||
def isfire():
|
||||
global isfire_wfstatus
|
||||
global isfire_wfstatus, last_battle_status, battle_count
|
||||
# 战斗中
|
||||
res_zdqx = zhaotu("战斗-取消.png")
|
||||
if res_zdqx is None:
|
||||
print("未找到目标图片:战斗-取消.png")
|
||||
isfire_wfstatus = False
|
||||
current_battle_status = False
|
||||
else:
|
||||
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
|
||||
|
||||
|
||||
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():
|
||||
while True:
|
||||
res_fwq = FindColors.find("382,434,#BC3010|380,442,#CE3116|643,431,#FFE986")
|
||||
@ -290,8 +403,9 @@ def shizi(fanwei):
|
||||
return None
|
||||
|
||||
|
||||
def alllive_task():
|
||||
def alllive_task(num):
|
||||
print("---------------定时任务-寻找异常弹窗----------------")
|
||||
print(f"--------------当前剩余任务:{config.renwuliebiao}") # 输出当前剩余任务
|
||||
# zhaotu("道具领取-弹框.png")
|
||||
ref_daoju = zhaotu("道具领取-弹框.png")
|
||||
if ref_daoju is None:
|
||||
@ -339,9 +453,26 @@ def alllive_task():
|
||||
# 战斗状态监控
|
||||
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):
|
||||
|
8
config.py
Normal file
@ -0,0 +1,8 @@
|
||||
# config.py
|
||||
|
||||
renwuliebiao = []
|
||||
shanghuichushou_lb = []
|
||||
shiyongwupin_lb = []
|
||||
diuqiwupin_lb = []
|
||||
baitanchushou_lb = []
|
||||
zhuoguicishu = 0
|
2
duiwu.py
@ -43,7 +43,7 @@ def tuichuzudui():
|
||||
common.closeAllbtn()
|
||||
else:
|
||||
print("-------找到创建队伍,没有在队伍中------")
|
||||
|
||||
common.closeAllbtn()
|
||||
return
|
||||
else:
|
||||
sleep(1)
|
||||
|
@ -9,6 +9,7 @@ shuangbeidianshu_ylq = [432, 616, 549, 650]
|
||||
|
||||
shuangbeidianshu = 0
|
||||
|
||||
|
||||
def lingqushuangbei():
|
||||
print("开始领取双倍")
|
||||
a = 0
|
||||
@ -17,8 +18,8 @@ def lingqushuangbei():
|
||||
print("找不到挂机入口,程序停止")
|
||||
return
|
||||
res_guaji1 = common.zhaotu("挂机1.png")
|
||||
res_guaji=common.zhaotu("挂机.png")
|
||||
res_guaji_last=res_guaji or res_guaji1
|
||||
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("双倍领取完成,开始捉鬼")
|
||||
@ -37,6 +38,7 @@ def lingqushuangbei():
|
||||
sleep(1)
|
||||
continue
|
||||
|
||||
|
||||
def lingqu(zuobiao):
|
||||
global shuangbeidianshu
|
||||
sleep(1)
|
||||
@ -47,35 +49,46 @@ def lingqu(zuobiao):
|
||||
print("领取双倍")
|
||||
res_lingqu = common.zhaotu("领取.png")
|
||||
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:
|
||||
res_dlq = qushuzi(res_dlq_text)
|
||||
dlq_num = int(res_dlq)
|
||||
if dlq_num > 0:
|
||||
xunhuancishu = dlq_num % 100
|
||||
print(f"待领取双倍点数:", dlq_num)
|
||||
print(f"已领取双倍点数:", ylq_num)
|
||||
|
||||
# 计算剩余可领取点数
|
||||
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
|
||||
if xunhuancishu == 0:
|
||||
print(f"领取双倍一次,余数为:",xunhuancishu)
|
||||
common.findandclick(res_lingqu)
|
||||
else:
|
||||
# 循环 xunhuancishu 次
|
||||
for i in range(xunhuancishu):
|
||||
print(f"领取双倍{xunhuancishu}*", i)
|
||||
print(f"领取双倍 100 点, 次数 {i + 1}/{xunhuancishu}")
|
||||
common.findandclick(res_lingqu)
|
||||
ylq_num += 100
|
||||
sleep(0.5)
|
||||
|
||||
res_ylq_text = common.shizi(shuangbeidianshu_ylq)
|
||||
if res_ylq_text is None :
|
||||
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:
|
||||
if ylq_num >= 1000:
|
||||
ylq_num = 1000
|
||||
shuangbeidianshu = ylq_num
|
||||
print(f"正常领取结束,开始任务", ylq_num)
|
||||
common.shuangbei = True
|
||||
common.closeAllbtn()
|
||||
@ -89,6 +102,41 @@ def lingqu(zuobiao):
|
||||
sleep(1)
|
||||
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):
|
||||
# 使用正则表达式提取数字
|
||||
match = re.search(r"\d+", text) # 匹配连续的数字
|
||||
|
BIN
res/img/baotu_zx/听听无妨.png
Normal file
After Width: | Height: | Size: 3.3 KiB |
BIN
res/img/baotu_zx/宝图任务.png
Normal file
After Width: | Height: | Size: 4.2 KiB |
BIN
res/img/baotu_zx/日常-宝图任务.png
Normal file
After Width: | Height: | Size: 6.0 KiB |
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 2.9 KiB |
Before Width: | Height: | Size: 4.0 KiB After Width: | Height: | Size: 4.0 KiB |
Before Width: | Height: | Size: 3.6 KiB After Width: | Height: | Size: 3.6 KiB |
Before Width: | Height: | Size: 4.9 KiB After Width: | Height: | Size: 4.9 KiB |
Before Width: | Height: | Size: 3.6 KiB After Width: | Height: | Size: 3.6 KiB |
BIN
res/img/shanghui/商会出售.png
Normal file
After Width: | Height: | Size: 3.5 KiB |
BIN
res/img/shanghui/商会出售01.png
Normal file
After Width: | Height: | Size: 3.3 KiB |
Before Width: | Height: | Size: 2.8 KiB After Width: | Height: | Size: 2.8 KiB |
Before Width: | Height: | Size: 3.6 KiB After Width: | Height: | Size: 3.6 KiB |
Before Width: | Height: | Size: 4.1 KiB After Width: | Height: | Size: 4.1 KiB |
Before Width: | Height: | Size: 3.3 KiB After Width: | Height: | Size: 3.3 KiB |
BIN
res/img/shimen/不打自招.png
Normal file
After Width: | Height: | Size: 4.6 KiB |
BIN
res/img/shimen/师傅请.png
Normal file
After Width: | Height: | Size: 2.9 KiB |
Before Width: | Height: | Size: 6.8 KiB After Width: | Height: | Size: 6.8 KiB |
Before Width: | Height: | Size: 816 B After Width: | Height: | Size: 816 B |
Before Width: | Height: | Size: 2.4 KiB After Width: | Height: | Size: 2.4 KiB |
Before Width: | Height: | Size: 3.6 KiB After Width: | Height: | Size: 3.6 KiB |
BIN
res/img/shimen/师门-龙宫.png
Normal file
After Width: | Height: | Size: 7.8 KiB |
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.7 KiB |
Before Width: | Height: | Size: 7.8 KiB After Width: | Height: | Size: 7.8 KiB |
BIN
res/img/shimen/师门01png
Normal file
After Width: | Height: | Size: 7.8 KiB |
Before Width: | Height: | Size: 4.1 KiB After Width: | Height: | Size: 4.1 KiB |
Before Width: | Height: | Size: 3.6 KiB After Width: | Height: | Size: 3.6 KiB |
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 11 KiB |
BIN
res/img/shimen/按钮-选择.png
Normal file
After Width: | Height: | Size: 2.4 KiB |
BIN
res/img/shimen/普陀山.png
Normal file
After Width: | Height: | Size: 6.7 KiB |
BIN
res/img/shimen/请出题吧.png
Normal file
After Width: | Height: | Size: 3.9 KiB |
BIN
res/img/shimen/选择-集物.png
Normal file
After Width: | Height: | Size: 10 KiB |
BIN
res/img/shimen/首席请.png
Normal file
After Width: | Height: | Size: 2.7 KiB |
BIN
res/img/包裹.png
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 1.8 KiB |
BIN
res/img/包裹01.png
Normal file
After Width: | Height: | Size: 3.0 KiB |
BIN
res/img/师门01.png
Before Width: | Height: | Size: 8.1 KiB |
BIN
res/img/跳过动画.png
Normal file
After Width: | Height: | Size: 6.0 KiB |
16608
res/ui/index.html
Normal file
30
shimen.py
@ -7,7 +7,8 @@ from ascript.android.screen import FindImages
|
||||
|
||||
from ascript.android.screen import FindColors
|
||||
|
||||
pngs = ["师门-任务按钮", "使用按钮", "师门任务1", "普陀山", "购买按钮", "上交按钮", "师门01", "摆摊-购买"]
|
||||
pngs = ["/shimen/师门-任务按钮", "使用按钮", "/shimen/师门任务1", "/shimen/普陀山", "购买按钮", "上交按钮",
|
||||
"/shimen/师门01", "摆摊-购买", "/shimen/师门-龙宫", "/shimen/首席请", "跳过动画", "/shimen/不打自招"]
|
||||
|
||||
|
||||
def shimenrenwu():
|
||||
@ -29,7 +30,7 @@ def shimenrenwu():
|
||||
print("打开活动")
|
||||
if res_huodong:
|
||||
sleep(1)
|
||||
res_shimen = common.zhaorenwu("师门任务.png")
|
||||
res_shimen = common.zhaorenwu("/shimen/师门任务.png")
|
||||
if res_shimen is not None:
|
||||
print("找到师门任务")
|
||||
res_wancheng = common.zhaowancheng_text(res_shimen)
|
||||
@ -44,10 +45,15 @@ def shimenrenwu():
|
||||
common.findandclick(res_canjia)
|
||||
print("点击参加,师门任务")
|
||||
sleep(1)
|
||||
res_qwc = zhaobtn(["师门-去完成", "师门-继续任务"])
|
||||
res_xzjw = common.zhaotu("/shimen/选择-集物.png")
|
||||
if res_xzjw is not None:
|
||||
findxuanze(res_xzjw)
|
||||
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:
|
||||
print("判断状态1")
|
||||
if common.isfire():
|
||||
@ -60,7 +66,12 @@ def shimenrenwu():
|
||||
common.findandclick(res_btns)
|
||||
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:
|
||||
common.findandclick(res_qctb)
|
||||
sleep(1)
|
||||
@ -76,7 +87,7 @@ def shimenrenwu():
|
||||
|
||||
sleep(1)
|
||||
|
||||
res_rwwc = common.zhaotu("师门任务完成.png")
|
||||
res_rwwc = common.zhaotu("/shimen/师门任务完成.png")
|
||||
if res_rwwc is not None:
|
||||
sleep(1)
|
||||
print("师门任务完成")
|
||||
@ -94,8 +105,15 @@ def shimenrenwu():
|
||||
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():
|
||||
res_shimen = common.zhaotu("师门.png")
|
||||
res_shimen = common.zhaotu("/shimen/师门.png")
|
||||
if res_shimen is None:
|
||||
print("没找到-任务列表-师门任务")
|
||||
return
|
||||
|
14
zhixian.py
@ -10,12 +10,15 @@ from ascript.android.screen import FindColors
|
||||
# 导入动作模块
|
||||
from ascript.android import action
|
||||
|
||||
|
||||
def shanghuichushou(shcswp):
|
||||
print("开始商会出售")
|
||||
res_last = zhaobtn(["包裹","包裹01"])
|
||||
res_last = zhaobtn(["包裹", "包裹01"])
|
||||
if res_last is not None:
|
||||
common.findandclick(res_last)
|
||||
print("点击包裹")
|
||||
sleep(1)
|
||||
num = 0
|
||||
while True:
|
||||
res_kcswp = zhaobtn(shcswp)
|
||||
if res_kcswp is not None:
|
||||
@ -26,7 +29,7 @@ def shanghuichushou(shcswp):
|
||||
common.findandclick(res_gd)
|
||||
sleep(1)
|
||||
|
||||
res_shcs = zhaobtn(["商会出售","商会出售01"])
|
||||
res_shcs = zhaobtn(["/shanghui/商会出售", "/shanghui/商会出售01"])
|
||||
if res_shcs is not None:
|
||||
common.findandclick(res_shcs)
|
||||
sleep(1)
|
||||
@ -37,16 +40,21 @@ def shanghuichushou(shcswp):
|
||||
res_chushou = common.zhaotu("出售.png")
|
||||
if res_chushou is not None:
|
||||
common.findandclick(res_chushou)
|
||||
sleep(2)
|
||||
sleep(4)
|
||||
num += 1
|
||||
if num >= 5:
|
||||
res_bbzl = common.zhaotu("背包-整理.png")
|
||||
if res_bbzl is not None:
|
||||
common.findandclick(res_bbzl)
|
||||
sleep(5)
|
||||
num = 0
|
||||
else:
|
||||
print("没有找到商会出售的道具,进行下一项")
|
||||
common.closeAllbtn()
|
||||
return
|
||||
sleep(1)
|
||||
else:
|
||||
print("没有找到包裹,进行下一项")
|
||||
|
||||
|
||||
def xiahua():
|
||||
|
84
zhuogui.py
@ -3,6 +3,7 @@ import random
|
||||
import threading
|
||||
|
||||
from . import common
|
||||
from . import config
|
||||
from . import lingqushuangbei
|
||||
from . import duiwu
|
||||
|
||||
@ -25,34 +26,54 @@ 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()
|
||||
global battle_count # 声明全局变量
|
||||
|
||||
# 开始时检测一次双倍点数
|
||||
lingqushuangbei.lingqushuangbei()
|
||||
if common.shuangbei is False:
|
||||
print("双倍点数不足,停止捉鬼任务")
|
||||
return
|
||||
|
||||
if common.shuangbei:
|
||||
print("开始捉鬼")
|
||||
|
||||
# 先执行退出队伍
|
||||
# duiwu.tuichuzudui()
|
||||
|
||||
# 启动战斗状态监控定时任务
|
||||
common.start_battle_monitor_timer()
|
||||
|
||||
while True:
|
||||
if common.zhuoguiisover is True and common.shuangbei is False:
|
||||
print("-------------------------检查到捉鬼完成,退出队伍,进行下一项")
|
||||
if common.zhuoguiisover is True or common.battle_count >= config.zhuoguicishu:
|
||||
print("捉鬼完成,退出捉鬼任务")
|
||||
common.stop_battle_monitor_timer()
|
||||
duiwu.tuichuzudui()
|
||||
print("判断状态1")
|
||||
while True:
|
||||
if common.isfire():
|
||||
print("----------战斗中----------")
|
||||
sleep(60)
|
||||
continue
|
||||
else:
|
||||
break
|
||||
|
||||
lingqushuangbei.dongjieshuangbei()
|
||||
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
|
||||
|
||||
# zhaotu("战斗-取消.png")
|
||||
res_zdsb = common.zhaotu("战斗失败.png")
|
||||
if res_zdsb is not None:
|
||||
print("找到战斗失败")
|
||||
@ -61,12 +82,20 @@ def zhuogui():
|
||||
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("----------再次判断战斗中----------")
|
||||
@ -92,6 +121,7 @@ def zhuogui():
|
||||
sleep(2)
|
||||
duiwu.tuichuzudui()
|
||||
common.zhuoguiisover = True
|
||||
common.stop_battle_monitor_timer()
|
||||
return
|
||||
|
||||
if res_canjia is None:
|
||||
@ -145,6 +175,22 @@ def zhuogui():
|
||||
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:
|
||||
print("未进入战斗,重新开始捉鬼任务")
|
||||
continue
|
||||
|
||||
sleep(1)
|
||||
|
||||
|
||||
|