menghuanzhushou/__init__.py

187 lines
5.1 KiB
Python
Raw Permalink Normal View History

2025-03-24 13:15:59 +08:00
# __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
2025-03-27 11:50:25 +08:00
from . import config
2025-03-24 13:15:59 +08:00
import time
import random
2025-03-25 10:58:51 +08:00
import json
2025-03-24 13:15:59 +08:00
2025-03-25 10:58:51 +08:00
from ascript.android.ui import WebWindow
2025-03-24 13:15:59 +08:00
# 导入系统资源模块
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
2025-03-28 17:41:27 +08:00
from ascript.android.screen import CompareColors
2025-03-24 13:15:59 +08:00
from ascript.android.screen import Ocr
import re
from ascript.android import system
2025-03-25 10:58:51 +08:00
shcswp = ["百炼精铁", "制造书-女衣", "制造书-宝珠", "制造书-枪", "制造书-鞋"]
2025-03-24 13:15:59 +08:00
print("程序开启,打开游戏")
2025-03-25 10:58:51 +08:00
2025-03-24 13:15:59 +08:00
# # 根据包名启动,推荐使用
# # 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()
2025-03-25 10:58:51 +08:00
# 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 == "任务列表":
2025-03-27 11:50:25 +08:00
config.renwuliebiao.extend(remove_suffix(value_list))
2025-03-25 10:58:51 +08:00
if key == "商会出售":
2025-03-27 11:50:25 +08:00
config.shanghuichushou_lb.extend(remove_suffix(value_list))
2025-03-25 10:58:51 +08:00
if key == "使用物品":
2025-03-27 11:50:25 +08:00
config.shiyongwupin_lb.extend(remove_suffix(value_list))
2025-03-25 10:58:51 +08:00
if key == "丢弃物品":
2025-03-27 11:50:25 +08:00
config.diuqiwupin_lb.extend(remove_suffix(value_list))
2025-03-25 10:58:51 +08:00
if key == "出售物品":
2025-03-27 11:50:25 +08:00
config.baitanchushou_lb.extend(remove_suffix(value_list))
2025-03-28 17:41:27 +08:00
if key == "捉鬼次数":
print(f"捉鬼次数:{value_list}")
config.zhuoguicishu = int(value_list);
2025-03-25 10:58:51 +08:00
# 执行所有任务
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():
# 按顺序执行任务
2025-03-27 11:50:25 +08:00
if "捉鬼任务" in config.renwuliebiao:
2025-03-25 10:58:51 +08:00
print("执行任务: 捉鬼任务")
common.start_alllive_task_timer(70)
sleep(3)
zhuogui.zhuogui()
2025-03-27 11:50:25 +08:00
config.renwuliebiao.remove("捉鬼任务") # 移除已完成的任务
2025-03-25 10:58:51 +08:00
print("捉鬼完成,调整全局检测线程时间----120")
common.start_alllive_task_timer(120)
2025-03-27 11:50:25 +08:00
if "师门任务" in config.renwuliebiao:
2025-03-25 10:58:51 +08:00
print("执行任务: 师门任务")
shimen.shimenrenwu()
2025-03-27 11:50:25 +08:00
config.renwuliebiao.remove("师门任务") # 移除已完成的任务
2025-03-25 10:58:51 +08:00
2025-03-27 11:50:25 +08:00
if "宝图任务" in config.renwuliebiao:
2025-03-25 17:01:16 +08:00
print("执行任务: 宝图任务")
baotu.baoturenwu()
2025-03-27 11:50:25 +08:00
common.closeAllbtn()
config.renwuliebiao.remove("宝图任务") # 移除已完成的任务
2025-03-25 17:01:16 +08:00
2025-03-27 11:50:25 +08:00
if "自动挖宝" in config.renwuliebiao:
2025-03-25 10:58:51 +08:00
print("执行任务: 自动挖宝")
baotu.wabaotu()
2025-03-27 11:50:25 +08:00
config.renwuliebiao.remove("自动挖宝") # 移除已完成的任务
2025-03-25 10:58:51 +08:00
2025-03-27 11:50:25 +08:00
if "秘境降妖" in config.renwuliebiao:
2025-03-25 10:58:51 +08:00
print("执行任务: 秘境降妖")
mijing.mijingxiangyao()
2025-03-27 11:50:25 +08:00
config.renwuliebiao.remove("秘境降妖") # 移除已完成的任务
2025-03-25 10:58:51 +08:00
2025-03-27 11:50:25 +08:00
if "普通押镖" in config.renwuliebiao:
2025-03-25 10:58:51 +08:00
print("执行任务: 普通押镖")
yabiao.yabiaorenwu()
2025-03-27 11:50:25 +08:00
config.renwuliebiao.remove("普通押镖") # 移除已完成的任务
2025-03-25 10:58:51 +08:00
# 其他任务按顺序执行
print("执行商会出售任务")
2025-03-27 11:50:25 +08:00
zhixian.shanghuichushou(config.shanghuichushou_lb)
2025-03-25 10:58:51 +08:00
print("执行使用物品任务")
# 这里可以添加使用物品的具体逻辑
2025-03-27 11:50:25 +08:00
# 例如shiyongwupin(config.shiyongwupin_lb)
2025-03-25 10:58:51 +08:00
print("执行丢弃物品任务")
# 这里可以添加丢弃物品的具体逻辑
2025-03-27 11:50:25 +08:00
# 例如diuqiwupin(config.diuqiwupin_lb)
2025-03-25 10:58:51 +08:00
print("执行出售物品任务")
# 这里可以添加出售物品的具体逻辑
2025-03-27 11:50:25 +08:00
# 例如baitanchushou(config.baitanchushou_lb)
2025-03-25 10:58:51 +08:00
2025-03-27 11:50:25 +08:00
# # 构建一个WebWindow 显示‘/res/ui/a.html 通信通道为tunnel 函数
2025-03-28 17:41:27 +08:00
# 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("|"))
)
2025-03-25 10:58:51 +08:00
2025-03-28 17:41:27 +08:00
print(new_color_points)
2025-03-27 11:50:25 +08:00
# common.huodong()
2025-03-25 10:58:51 +08:00
print("程序结束")
def sleep(num):
time.sleep(num)