Merge remote-tracking branch 'origin/dev' into dev

This commit is contained in:
jinghaibing 2025-03-25 16:33:16 +08:00
commit e8d912a4e7
16 changed files with 183 additions and 56 deletions

View File

@ -13,7 +13,9 @@ from . import zhixian
import time
import random
import json
from ascript.android.ui import WebWindow
# 导入系统资源模块
from ascript.android.system import R
@ -41,9 +43,11 @@ import re
from ascript.android import system
shcswp = ["百炼精铁"]
shcswp = ["百炼精铁", "制造书-女衣", "制造书-宝珠", "制造书-枪", "制造书-鞋"]
print("程序开启,打开游戏")
# # 根据包名启动,推荐使用
# # com.netease.my
# res_qidong = system.open("com.netease.my")
@ -67,4 +71,90 @@ print("程序开启,打开游戏")
# yabiao.yabiaorenwu()
zhixian.shanghuichushou(shcswp)
# zhixian.shanghuichushou(shcswp)
renwuliebiao = []
shanghuichushou_lb = []
shiyongwupin_lb = []
diuqiwupin_lb = []
baitanchushou_lb = []
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 == "任务列表":
renwuliebiao.extend(remove_suffix(value_list))
if key == "商会出售":
shanghuichushou_lb.extend(remove_suffix(value_list))
if key == "使用物品":
shiyongwupin_lb.extend(remove_suffix(value_list))
if key == "丢弃物品":
diuqiwupin_lb.extend(remove_suffix(value_list))
if key == "出售物品":
baitanchushou_lb.extend(remove_suffix(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 renwuliebiao:
print("执行任务: 捉鬼任务")
common.start_alllive_task_timer(70)
sleep(3)
zhuogui.zhuogui()
print("捉鬼完成,调整全局检测线程时间----120")
common.start_alllive_task_timer(120)
if "师门任务" in renwuliebiao:
print("执行任务: 师门任务")
shimen.shimenrenwu()
if "自动挖宝" in renwuliebiao:
print("执行任务: 自动挖宝")
baotu.baoturenwu()
baotu.wabaotu()
if "秘境降妖" in renwuliebiao:
print("执行任务: 秘境降妖")
mijing.mijingxiangyao()
if "普通押镖" in renwuliebiao:
print("执行任务: 普通押镖")
yabiao.yabiaorenwu()
# 其他任务按顺序执行
print("执行商会出售任务")
zhixian.shanghuichushou(shanghuichushou_lb)
print("执行使用物品任务")
# 这里可以添加使用物品的具体逻辑
# 例如shiyongwupin(shiyongwupin_lb)
print("执行丢弃物品任务")
# 这里可以添加丢弃物品的具体逻辑
# 例如diuqiwupin(diuqiwupin_lb)
print("执行出售物品任务")
# 这里可以添加出售物品的具体逻辑
# 例如baitanchushou(baitanchushou_lb)
# 构建一个WebWindow 显示‘/res/ui/a.html 通信通道为tunnel 函数
w = WebWindow(R.ui('index.html'), tunnel)
w.show()
print("程序结束")
def sleep(num):
time.sleep(num)

View File

@ -27,6 +27,9 @@ zhuoguiisover = False
# 领取双倍状态
shuangbei = False
# 定义一个全局变量来管理定时器
alllive_task_timer = None
def huodong():
while True:
@ -97,7 +100,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)
@ -290,7 +293,7 @@ def shizi(fanwei):
return None
def alllive_task():
def alllive_task(num):
print("---------------定时任务-寻找异常弹窗----------------")
# zhaotu("道具领取-弹框.png")
ref_daoju = zhaotu("道具领取-弹框.png")
@ -341,7 +344,23 @@ def alllive_task():
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):

View File

@ -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,33 +49,40 @@ 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
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)
print(f"待领取双倍点数:", dlq_num)
print(f"已领取双倍点数:", ylq_num)
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)
sleep(0.5)
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)
@ -89,6 +98,7 @@ def lingqu(zuobiao):
sleep(1)
return
def qushuzi(text):
# 使用正则表达式提取数字
match = re.search(r"\d+", text) # 匹配连续的数字

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 816 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

View File

@ -7,7 +7,7 @@ from ascript.android.screen import FindImages
from ascript.android.screen import FindColors
pngs = ["师门-任务按钮", "使用按钮", "师门任务1", "普陀山", "购买按钮", "上交按钮", "师门01", "摆摊-购买"]
pngs = ["/shimen/师门-任务按钮", "使用按钮", "/shimen/师门任务1", "普陀山", "购买按钮", "上交按钮", "/shimen/师门01", "摆摊-购买"]
def shimenrenwu():
@ -29,7 +29,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,7 +44,7 @@ def shimenrenwu():
common.findandclick(res_canjia)
print("点击参加,师门任务")
sleep(1)
res_qwc = zhaobtn(["师门-去完成", "师门-继续任务"])
res_qwc = zhaobtn(["/shimen/师门-去完成", "/shimen/师门-继续任务"])
if res_qwc is not None:
sleep(1)
common.findandclick(res_qwc)
@ -76,7 +76,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("师门任务完成")
@ -95,7 +95,7 @@ def shimenrenwu():
def dianjirenwu():
res_shimen = common.zhaotu("师门.png")
res_shimen = common.zhaotu("/shimen/师门.png")
if res_shimen is None:
print("没找到-任务列表-师门任务")
return

View File

@ -10,43 +10,51 @@ 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)
while True:
res_kcswp = zhaobtn(shcswp)
if res_kcswp is not None:
common.findandclick(res_kcswp)
sleep(1)
res_gd = common.zhaotu("更多.png")
if res_gd is not None:
common.findandclick(res_gd)
num = 0
while True:
res_kcswp = zhaobtn(shcswp)
if res_kcswp is not None:
common.findandclick(res_kcswp)
sleep(1)
res_shcs = zhaobtn(["商会出售","商会出售01"])
if res_shcs is not None:
common.findandclick(res_shcs)
sleep(1)
res_man = common.zhaotu("满.png")
if res_man is not None:
common.findandclick(res_man)
res_gd = common.zhaotu("更多.png")
if res_gd is not None:
common.findandclick(res_gd)
sleep(1)
res_shcs = zhaobtn(["商会出售", "商会出售01"])
if res_shcs is not None:
common.findandclick(res_shcs)
sleep(1)
res_man = common.zhaotu("满.png")
if res_man is not None:
common.findandclick(res_man)
sleep(1)
res_chushou = common.zhaotu("出售.png")
if res_chushou is not None:
common.findandclick(res_chushou)
sleep(2)
res_bbzl = common.zhaotu("背包-整理.png")
if res_bbzl is not None:
common.findandclick(res_bbzl)
sleep(5)
else:
print("没有找到商会出售的道具,进行下一项")
common.closeAllbtn()
return
sleep(1)
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():