优化剿灭逻辑

This commit is contained in:
DLmaster
2024-04-30 22:59:01 +08:00
parent 5af41d3b72
commit caf37e6c99
11 changed files with 117 additions and 58 deletions

Binary file not shown.

View File

@@ -36,24 +36,20 @@ MAA下载地址 [GitHub下载](https://github.com/MaaAssistantArknights/MaaAs
### MAA配置
1.完成MAA的adb配置等基本配置
1. 完成MAA的adb配置等基本配置
2.在“完成后”菜单选择“退出MAA和模拟器”。勾选“手动输入关卡名”和“无限吃48小时内过期的理智药
2. 确保当前配置名为“Default”取消所有“定时执行
![MAA配置1](https://github.com/DLmaster361/AUTO_MAA/blob/main/res/README/MAA配置1.png "MAA配置1")
3.确保当前配置名为“Default”取消所有“定时执行”
3. 取消勾选“开机自启动MAA”勾选“启动MAA后直接运行”和“启动MAA后自动开启模拟器”。配置自己模拟器所在的位置并根据实际情况填写“等待模拟器启动时间”建议预留10s以防意外。如果是多开用户需要填写“附加命令”具体填写值参见多开模拟器对应快捷方式路径如“-v 1”
![MAA配置2](https://github.com/DLmaster361/AUTO_MAA/blob/main/res/README/MAA配置2.png "MAA配置2")
4.取消勾选“开机自启动MAA”勾选“启动MAA后直接运行”和“启动MAA后自动开启模拟器”。配置自己模拟器所在的位置并根据实际情况填写“等待模拟器启动时间”建议预留10s以防意外。如果是多开用户需要填写“附加命令”具体填写值参见多开模拟器对应快捷方式路径如“-v 1”
4. 勾选“定时检查更新”、“自动下载更新包”和“自动安装更新包”
![MAA配置3](https://github.com/DLmaster361/AUTO_MAA/blob/main/res/README/MAA配置3.png "MAA配置3")
5.勾选“定时检查更新”、“自动下载更新包”和“自动安装更新包”
![MAA配置4](https://github.com/DLmaster361/AUTO_MAA/blob/main/res/README/MAA配置4.png "MAA配置4")
## 下载AUTO_MAA软件包 [![](https://img.shields.io/github/downloads/DLmaster361/AUTO_MAA/total?color=66ccff)](https://github.com/DLmaster361/AUTO_MAA/releases)
GitHub下载地址 [GitHub下载](https://github.com/DLmaster361/AUTO_MAA/releases)

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 59 KiB

After

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 44 KiB

After

Width:  |  Height:  |  Size: 60 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 60 KiB

After

Width:  |  Height:  |  Size: 52 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 52 KiB

View File

@@ -4,7 +4,7 @@ VSVersionInfo(
ffi=FixedFileInfo(
# filevers and prodvers should be always a tuple with four items: (1, 2, 3, 4)
# Set not needed items to zero 0.
filevers=(2, 1, 3, 0),
filevers=(2, 1, 4, 0),
prodvers=(0, 0, 0, 0),
# Contains a bitmask that specifies the valid bits 'flags'r
mask=0x3f,
@@ -31,13 +31,13 @@ VSVersionInfo(
[StringStruct('Comments', 'https://github.com/DLmaster361/AUTO_MAA/'),
StringStruct('CompanyName', 'AUTO_MAA Team'),
StringStruct('FileDescription', 'AUTO_MAA Component'),
StringStruct('FileVersion', '2.1.3'),
StringStruct('FileVersion', '2.1.4'),
StringStruct('InternalName', 'AUTO_MAA'),
StringStruct('LegalCopyright', 'Copyright © 2024 DLmaster361'),
StringStruct('OriginalFilename', 'AUTO_MAA'),
StringStruct('ProductName', 'AUTO_MAA'),
StringStruct('ProductVersion', 'v2.1.3'),
StringStruct('Assembly Version', '2.1.3.0')])
StringStruct('ProductVersion', 'v2.1.4'),
StringStruct('Assembly Version', '2.1.4.0')])
])
]
)

BIN
run.exe

Binary file not shown.

153
run.py
View File

@@ -28,64 +28,123 @@ import time
import json
from termcolor import colored
#执行MAA任务
def runmaa(id,tel,game,num=3):
#配置MAA运行参数
#配置MAA运行参数
def setmaa(s,tel,game):
with open(setpath,"r",encoding="utf-8") as f:
data=json.load(f)
data["Configurations"]["Default"]["Start.AccountName"]=tel[:3]+"****"+tel[7:]
data["Configurations"]["Default"]["MainFunction.Stage1"]="Annihilation"
data["Configurations"]["Default"]["Fight.RemainingSanityStage"]=game
data["Configurations"]["Default"]["Fight.UseRemainingSanityStage"]="True"
data["Configurations"]["Default"]["GUI.CustomStageCode"]="True"
if s==0:
data["Configurations"]["Default"]["MainFunction.ActionAfterCompleted"]="ExitEmulatorAndSelf" #完成后退出MAA和模拟器
data["Configurations"]["Default"]["Start.RunDirectly"]="True" #启动MAA后直接运行
data["Configurations"]["Default"]["Start.StartEmulator"]="True" #启动MAA后自动开启模拟器
elif s==1:
data["Configurations"]["Default"]["Start.AccountName"]=tel[:3]+"****"+tel[7:] #账号切换
data["Configurations"]["Default"]["TaskQueue.WakeUp.IsChecked"]="True" #开始唤醒
data["Configurations"]["Default"]["TaskQueue.Recruiting.IsChecked"]="False" #自动公招
data["Configurations"]["Default"]["TaskQueue.Base.IsChecked"]="False" #基建换班
data["Configurations"]["Default"]["TaskQueue.Combat.IsChecked"]="True" #刷理智
data["Configurations"]["Default"]["TaskQueue.Mission.IsChecked"]="False" #领取奖励
data["Configurations"]["Default"]["TaskQueue.Mall.IsChecked"]="False" #获取信用及购物
data["Configurations"]["Default"]["MainFunction.Stage1"]="Annihilation" #主关卡
data["Configurations"]["Default"]["MainFunction.Stage2"]="" #备选关卡1
data["Configurations"]["Default"]["MainFunction.Stage3"]="" #备选关卡2
data["Configurations"]["Default"]["Fight.RemainingSanityStage"]="" #剩余理智关卡
data["Configurations"]["Default"]["Penguin.IsDrGrandet"]="False" #博朗台模式
data["Configurations"]["Default"]["GUI.CustomStageCode"]="True" #手动输入关卡名
data["Configurations"]["Default"]["GUI.UseAlternateStage"]="False" #使用备选关卡
data["Configurations"]["Default"]["Fight.UseRemainingSanityStage"]="False" #使用剩余理智
data["Configurations"]["Default"]["Fight.UseExpiringMedicine"]="True" #无限吃48小时内过期的理智药
elif s==2:
data["Configurations"]["Default"]["Start.AccountName"]=tel[:3]+"****"+tel[7:] #账号切换
data["Configurations"]["Default"]["TaskQueue.WakeUp.IsChecked"]="True" #开始唤醒
data["Configurations"]["Default"]["TaskQueue.Recruiting.IsChecked"]="True" #自动公招
data["Configurations"]["Default"]["TaskQueue.Base.IsChecked"]="True" #基建换班
data["Configurations"]["Default"]["TaskQueue.Combat.IsChecked"]="True" #刷理智
data["Configurations"]["Default"]["TaskQueue.Mission.IsChecked"]="True" #领取奖励
data["Configurations"]["Default"]["TaskQueue.Mall.IsChecked"]="True" #获取信用及购物
data["Configurations"]["Default"]["MainFunction.Stage1"]=game #主关卡
data["Configurations"]["Default"]["MainFunction.Stage2"]="" #备选关卡1
data["Configurations"]["Default"]["MainFunction.Stage3"]="" #备选关卡2
data["Configurations"]["Default"]["Fight.RemainingSanityStage"]="" #剩余理智关卡
data["Configurations"]["Default"]["Penguin.IsDrGrandet"]="False" #博朗台模式
data["Configurations"]["Default"]["GUI.CustomStageCode"]="True" #手动输入关卡名
data["Configurations"]["Default"]["GUI.UseAlternateStage"]="False" #使用备选关卡
data["Configurations"]["Default"]["Fight.UseRemainingSanityStage"]="False" #使用剩余理智
data["Configurations"]["Default"]["Fight.UseExpiringMedicine"]="True" #无限吃48小时内过期的理智药
with open(setpath,"w",encoding="utf-8") as f:
json.dump(data,f)
return True
#执行MAA任务
def runmaa(id,tel,game,num=3):
#开始运行
for i in range(num):
global idnew,idold,idfail,idall,logx,logi
#创建MAA任务
time.sleep(10)
maa=subprocess.Popen([maapath])
maapid=maa.pid
#等待MAA启动
idsuccess=idnew+idold
idwait=[idx for idx in idall if not idx in idsuccess+idfail+[id]]
os.system('cls')
if i==0:
print(colored("正在代理:",'white')+colored(id,'blue'))
else:
print(colored("正在代理:",'white')+colored(id,'light_blue'))
print(colored("等待代理:",'white')+colored(''.join(idwait),'yellow'))
print(colored("代理成功:",'white')+colored(''.join(idsuccess),'green'))
print(colored("代理失败:",'white')+colored(''.join(idfail),'red'))
print(colored("运行日志:",'white')+colored("等待MAA初始化",'light_green'))
time.sleep(60)
#监测MAA运行状态
while True:
#打印基本信息
runbook=[False for i in range(2)]
for j in range(2):
#配置MAA
setmaa(j+1,tel,game)
#创建MAA任务
print(colored("等待中~",'yellow'))
time.sleep(10)
maa=subprocess.Popen([maapath])
maapid=maa.pid
#等待MAA启动
idsuccess=idnew+idold
idwait=[idx for idx in idall if not idx in idsuccess+idfail+[id]]
os.system('cls')
if i==0:
print(colored("正在代理:",'white')+colored(id,'blue'))
if j==0:
print(colored("正在代理:",'white')+colored(id+"-剿灭",'blue'))
elif j==1:
print(colored("正在代理:",'white')+colored(id+"-日常",'blue'))
else:
print(colored("正在代理:",'white')+colored(id,'light_blue'))
if j==0:
print(colored("正在代理:",'white')+colored(id+"-剿灭",'light_blue'))
elif j==1:
print(colored("正在代理:",'white')+colored(id+"-日常",'light_blue'))
print(colored("等待代理:",'white')+colored(''.join(idwait),'yellow'))
print(colored("代理成功:",'white')+colored(''.join(idsuccess),'green'))
print(colored("代理失败:",'white')+colored(''.join(idfail),'red'))
print(colored("运行日志:",'white'))
#读取并保存MAA日志
with open(logpath,'r',encoding='utf-8') as f:
logs=f.readlines()[-1:-11:-1]
print(colored(''.join(logs[::-1]),'light_green'),end='')
log=''.join(logs)
logx[logi]=log
logi=(logi+1) % len(logx)
#判断MAA程序运行状态
if ("任务已全部完成!" in log):
return True
elif ("请检查连接设置或尝试重启模拟器与 ADB 或重启电脑" in log) or ("已停止" in log) or ("MaaAssistantArknights GUI exited" in log) or timeout():
os.system('taskkill /F /T /PID '+str(maapid))
break
time.sleep(10)
print(colored("运行日志:",'white')+colored("等待MAA初始化",'light_green'))
time.sleep(60)
#监测MAA运行状态
while True:
#打印基本信息
os.system('cls')
if i==0:
if j==0:
print(colored("正在代理:",'white')+colored(id+"-剿灭",'blue'))
elif j==1:
print(colored("正在代理:",'white')+colored(id+"-日常",'blue'))
else:
if j==0:
print(colored("正在代理:",'white')+colored(id+"-剿灭",'light_blue'))
elif j==1:
print(colored("正在代理:",'white')+colored(id+"-日常",'light_blue'))
print(colored("等待代理:",'white')+colored(''.join(idwait),'yellow'))
print(colored("代理成功:",'white')+colored(''.join(idsuccess),'green'))
print(colored("代理失败:",'white')+colored(''.join(idfail),'red'))
print(colored("运行日志:",'white'))
#读取并保存MAA日志
with open(logpath,'r',encoding='utf-8') as f:
logs=f.readlines()[-1:-11:-1]
print(colored(''.join(logs[::-1]),'light_green'),end='')
log=''.join(logs)
logx[logi]=log
logi=(logi+1) % len(logx)
#判断MAA程序运行状态
if ("任务已全部完成!" in log):
runbook[j]=True
break
elif ("请检查连接设置或尝试重启模拟器与 ADB 或重启电脑" in log) or ("已停止" in log) or ("MaaAssistantArknights GUI exited" in log) or timeout():
os.system('taskkill /F /T /PID '+str(maapid))
break
if j==0:
time.sleep(40)
elif j==1:
time.sleep(10)
if runbook[0] and runbook[1]:
return True
return False
#检查是否超时
@@ -149,6 +208,9 @@ idall=[data[i][0] for i in range(len(data))]
LOGXLEN=60
logx=['' for i in range(LOGXLEN)]
logi=0
#MAA预配置
setmaa(0,0,0)
#优先代理今日未完成的用户
for i in range(len(data)):
if data[i][3]=='y' and data[i][4]!=curdate and data[i][2]>0:
book=runmaa(data[i][0],data[i][1],data[i][5])
@@ -157,6 +219,7 @@ for i in range(len(data)):
idnew.append(data[i][0])
else:
idfail.append(data[i][0])
#次优先重复代理
for i in range(len(data)):
if data[i][3]=='y' and data[i][4]==curdate and data[i][2]>0:
book=runmaa(data[i][0],data[i][1],data[i][5])

View File

@@ -1,3 +1,3 @@
项目初始阶段,不会提供专门的版本更新程序,您需要手动更新程序。
v2.1.2版本的使用者将旧版本data文件夹移动至新版本软件根目录下覆盖掉预置文件即可完成更新。(其它文件不需要动)
v2.1.2~v2.1.3版本的使用者将旧版本data文件夹移动至新版本软件根目录下覆盖掉预置文件即可完成更新。
新用户请忽略本说明。