Compare commits

...

11 Commits

Author SHA1 Message Date
DLmaster
44ee917d88 同步到MAA新版本的配置方法 2024-08-03 13:11:54 +08:00
DLmaster
669019c051 优化超时判定 2024-07-28 10:42:55 +08:00
DLmaster
4685c12570 Update python-app.yml
自动构建
2024-07-27 22:25:28 +08:00
DLmaster
d815529510 Update python-app.yml
自动构建
2024-07-27 22:03:02 +08:00
DLmaster
1da3620feb Update python-app.yml
自动构建
2024-07-27 22:00:23 +08:00
DLmaster
44d529c60f Update python-app.yml
自动构建
2024-07-27 21:53:49 +08:00
DLmaster
cdbcebd945 Update python-app.yml
自动构建
2024-07-27 21:51:37 +08:00
DLmaster
5bc2bf9397 Update python-app.yml
自动构建
2024-07-27 21:48:27 +08:00
DLmaster
d41419a579 Update python-app.yml
自动构建
2024-07-27 21:40:34 +08:00
DLmaster
a7e15e509e Create python-app.yml
自动构建
2024-07-27 21:30:41 +08:00
DLmaster
6518a378ac 修正v3.0_Beta版更新说明 2024-07-24 21:13:50 +08:00
6 changed files with 129 additions and 77 deletions

44
.github/workflows/python-app.yml vendored Normal file
View File

@@ -0,0 +1,44 @@
# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
name: Python application
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
permissions:
contents: read
jobs:
build:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.12
uses: actions/setup-python@v3
with:
python-version: "3.12"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8 pytest
pip install -r requirements.txt
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Built with pyinstaller
run: |
pyinstaller -F --version-file res/info.txt -w --icon=res/AUTO_MAA.ico AUTO_MAA.py
- name: Upload Artifact
uses: actions/upload-artifact@v2
with:
name: AUTO_MAA
path: ./

Binary file not shown.

View File

@@ -119,21 +119,17 @@ class MaaRunner(QtCore.QThread):
maa = subprocess.Popen([self.MaaPath]) maa = subprocess.Popen([self.MaaPath])
# 记录当前时间 # 记录当前时间
StartTime = datetime.datetime.now() StartTime = datetime.datetime.now()
# 初始化log记录列表 # 记录是否超时的标记
if j == 0: self.TimeOut = False
logx = [k for k in range(self.Annihilation * 60)]
elif j == 1:
logx = [k for k in range(self.Routine * 60)]
logi = 0
# 更新运行信息 # 更新运行信息
WaitUid = [ WaitUid = [
idx for idx in AllUid if (not idx in OverUid + ErrorUid + [uid]) idx for idx in AllUid if (not idx in OverUid + ErrorUid + [uid])
] ]
# 监测MAA运行状态 # 监测MAA运行状态
while True: while True:
# 更新MAA日志 # 获取MAA日志
logs = []
with open(self.LogPath, "r", encoding="utf-8") as f: with open(self.LogPath, "r", encoding="utf-8") as f:
logs = []
for entry in f: for entry in f:
try: try:
entry_time = datetime.datetime.strptime( entry_time = datetime.datetime.strptime(
@@ -143,26 +139,41 @@ class MaaRunner(QtCore.QThread):
logs.append(entry) logs.append(entry)
except ValueError: except ValueError:
pass pass
log = "".join(logs) # 判断是否超时
if j == 0: if len(logs) > 0:
self.UpGui.emit( LastTime = datetime.datetime.strptime(
self.data[uid][0] + "_第" + str(i + 1) + "次_剿灭", logs[-1][1:20], "%Y-%m-%d %H:%M:%S"
"\n".join([self.data[k][0] for k in WaitUid]), )
"\n".join([self.data[k][0] for k in OverUid]), NowTime = datetime.datetime.now()
"\n".join([self.data[k][0] for k in ErrorUid]), if (
log, j == 0
) and NowTime - LastTime
elif j == 1: > datetime.timedelta(minutes=self.Annihilation)
self.UpGui.emit( ) or (
self.data[uid][0] + "_第" + str(i + 1) + "次_日常", j == 1
"\n".join([self.data[k][0] for k in WaitUid]), and NowTime - LastTime
"\n".join([self.data[k][0] for k in OverUid]), > datetime.timedelta(minutes=self.Routine)
"\n".join([self.data[k][0] for k in ErrorUid]), ):
log, self.TimeOut = True
) # 合并日志
if len(logs) != 0: log = "".join(logs)
logx[logi] = logs[-1] # 更新MAA日志
logi = (logi + 1) % len(logx) if j == 0:
self.UpGui.emit(
self.data[uid][0] + "_第" + str(i + 1) + "次_剿灭",
"\n".join([self.data[k][0] for k in WaitUid]),
"\n".join([self.data[k][0] for k in OverUid]),
"\n".join([self.data[k][0] for k in ErrorUid]),
log,
)
elif j == 1:
self.UpGui.emit(
self.data[uid][0] + "_第" + str(i + 1) + "次_日常",
"\n".join([self.data[k][0] for k in WaitUid]),
"\n".join([self.data[k][0] for k in OverUid]),
"\n".join([self.data[k][0] for k in ErrorUid]),
log,
)
# 判断MAA程序运行状态 # 判断MAA程序运行状态
if "任务已全部完成!" in log: if "任务已全部完成!" in log:
runbook[j] = True runbook[j] = True
@@ -179,10 +190,11 @@ class MaaRunner(QtCore.QThread):
("请检查连接设置或尝试重启模拟器与 ADB 或重启电脑" in log) ("请检查连接设置或尝试重启模拟器与 ADB 或重启电脑" in log)
or ("已停止" in log) or ("已停止" in log)
or ("MaaAssistantArknights GUI exited" in log) or ("MaaAssistantArknights GUI exited" in log)
or self.TimeOut(logx) or self.TimeOut
or not self.ifRun or not self.ifRun
): ):
# 打印中止信息 # 打印中止信息
# 此时log变量内存储的就是出现异常的日志信息可以保存或发送用于问题排查
if ( if (
( (
"请检查连接设置或尝试重启模拟器与 ADB 或重启电脑" "请检查连接设置或尝试重启模拟器与 ADB 或重启电脑"
@@ -192,7 +204,7 @@ class MaaRunner(QtCore.QThread):
or ("MaaAssistantArknights GUI exited" in log) or ("MaaAssistantArknights GUI exited" in log)
): ):
info = "检测到MAA进程异常\n正在中止相关程序\n请等待10s" info = "检测到MAA进程异常\n正在中止相关程序\n请等待10s"
elif self.TimeOut(logx): elif self.TimeOut:
info = "检测到MAA进程超时\n正在中止相关程序\n请等待10s" info = "检测到MAA进程超时\n正在中止相关程序\n请等待10s"
elif not self.ifRun: elif not self.ifRun:
info = "您中止了本次任务\n正在中止相关程序\n请等待" info = "您中止了本次任务\n正在中止相关程序\n请等待"
@@ -251,8 +263,8 @@ class MaaRunner(QtCore.QThread):
data = json.load(f) data = json.load(f)
if s == 0: if s == 0:
data["Configurations"]["Default"][ data["Configurations"]["Default"][
"MainFunction.ActionAfterCompleted" "MainFunction.PostActions"
] = "ExitEmulatorAndSelf" # 完成后退出MAA和模拟器 ] = "12" # 完成后退出MAA和模拟器
data["Configurations"]["Default"][ data["Configurations"]["Default"][
"Start.RunDirectly" "Start.RunDirectly"
] = "True" # 启动MAA后直接运行 ] = "True" # 启动MAA后直接运行
@@ -329,46 +341,53 @@ class MaaRunner(QtCore.QThread):
data["Configurations"]["Default"][ data["Configurations"]["Default"][
"TaskQueue.Mall.IsChecked" "TaskQueue.Mall.IsChecked"
] = "True" # 获取信用及购物 ] = "True" # 获取信用及购物
data["Configurations"]["Default"]["MainFunction.Stage1"] = self.data[uid][ # 主关卡
5 if self.data[uid][5] == "-":
] # 主关卡 data["Configurations"]["Default"]["MainFunction.Stage1"] = ""
data["Configurations"]["Default"]["MainFunction.Stage2"] = self.data[uid][ else:
6 data["Configurations"]["Default"]["MainFunction.Stage1"] = self.data[
] # 备选关卡1 uid
data["Configurations"]["Default"]["MainFunction.Stage3"] = self.data[uid][ ][5]
7 # 备选关卡1
] # 备选关卡2 if self.data[uid][6] == "-":
data["Configurations"]["Default"]["MainFunction.Stage2"] = ""
else:
data["Configurations"]["Default"]["MainFunction.Stage2"] = self.data[
uid
][6]
# 备选关卡2
if self.data[uid][7] == "-":
data["Configurations"]["Default"]["MainFunction.Stage3"] = ""
else:
data["Configurations"]["Default"]["MainFunction.Stage3"] = self.data[
uid
][7]
data["Configurations"]["Default"][ data["Configurations"]["Default"][
"Fight.RemainingSanityStage" "Fight.RemainingSanityStage"
] = "" # 剩余理智关卡 ] = "" # 剩余理智关卡
# 连战次数
if self.data[uid][5] == "1-7": if self.data[uid][5] == "1-7":
data["Configurations"]["Default"][ data["Configurations"]["Default"]["MainFunction.Series.Quantity"] = "6"
"MainFunction.Series.Quantity"
] = "6" # 连战次数
else: else:
data["Configurations"]["Default"][ data["Configurations"]["Default"]["MainFunction.Series.Quantity"] = "1"
"MainFunction.Series.Quantity"
] = "1" # 连战次数
data["Configurations"]["Default"][ data["Configurations"]["Default"][
"Penguin.IsDrGrandet" "Penguin.IsDrGrandet"
] = "False" # 博朗台模式 ] = "False" # 博朗台模式
data["Configurations"]["Default"][ data["Configurations"]["Default"][
"GUI.CustomStageCode" "GUI.CustomStageCode"
] = "True" # 手动输入关卡名 ] = "True" # 手动输入关卡名
# 备选关卡
if self.data[uid][6] == "-" and self.data[uid][7] == "-": if self.data[uid][6] == "-" and self.data[uid][7] == "-":
data["Configurations"]["Default"][ data["Configurations"]["Default"]["GUI.UseAlternateStage"] = "False"
"GUI.UseAlternateStage"
] = "False" # 不使用备选关卡
else: else:
data["Configurations"]["Default"][ data["Configurations"]["Default"]["GUI.UseAlternateStage"] = "True"
"GUI.UseAlternateStage"
] = "True" # 使用备选关卡
data["Configurations"]["Default"][ data["Configurations"]["Default"][
"Fight.UseRemainingSanityStage" "Fight.UseRemainingSanityStage"
] = "False" # 使用剩余理智 ] = "False" # 使用剩余理智
data["Configurations"]["Default"][ data["Configurations"]["Default"][
"Fight.UseExpiringMedicine" "Fight.UseExpiringMedicine"
] = "True" # 无限吃48小时内过期的理智药 ] = "True" # 无限吃48小时内过期的理智药
# 自定义基建配置
if self.data[uid][9] == "-": if self.data[uid][9] == "-":
data["Configurations"]["Default"][ data["Configurations"]["Default"][
"Infrast.CustomInfrastEnabled" "Infrast.CustomInfrastEnabled"
@@ -392,14 +411,6 @@ class MaaRunner(QtCore.QThread):
json.dump(data, f, indent=4) json.dump(data, f, indent=4)
return True return True
# 超时判断
def TimeOut(self, logx):
log0 = logx[0]
for i in logx:
if i != log0:
return False
return True
class MainTimer(QtCore.QThread): class MainTimer(QtCore.QThread):
@@ -1005,15 +1016,11 @@ class Main(QWidget):
if os.path.exists(self.GameidPath): if os.path.exists(self.GameidPath):
with open(self.GameidPath, encoding="utf-8") as f: with open(self.GameidPath, encoding="utf-8") as f:
gameids = f.readlines() gameids = f.readlines()
for i in range(len(gameids)): for line in gameids:
for j in range(len(gameids[i])): if "" in line:
if gameids[i][j] == "" or gameids[i][j] == ":": gamein, gameout = line.split("", 1)
gamein = gameids[i][:j] games[gamein.strip()] = gameout.strip()
gameout = gameids[i][j + 1 :] text = games.get(text, text)
break
games[gamein.strip()] = gameout.strip()
if text in games:
text = games[text]
if item.column() == 9: if item.column() == 9:
text = text.replace("\\", "/") text = text.replace("\\", "/")
if item.column() == 10: if item.column() == 10:

View File

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

View File

@@ -1,5 +1,6 @@
#主界面 #主界面
"MainFunction.ActionAfterCompleted": "ExitEmulatorAndSelf" #完成后 "MainFunction.ActionAfterCompleted": "ExitEmulatorAndSelf" #完成后(旧)
"MainFunction.PostActions": "12" #完成后(新)
"TaskQueue.WakeUp.IsChecked": "True" #开始唤醒 "TaskQueue.WakeUp.IsChecked": "True" #开始唤醒
"TaskQueue.Recruiting.IsChecked": "True" #自动公招 "TaskQueue.Recruiting.IsChecked": "True" #自动公招
"TaskQueue.Base.IsChecked": "True" #基建换班 "TaskQueue.Base.IsChecked": "True" #基建换班

View File

@@ -1,5 +1,5 @@
项目初始阶段,不会提供专门的版本更新程序,您需要手动更新程序。 项目初始阶段,不会提供专门的版本更新程序,您需要手动更新程序。
v2.1.5及以前的用户,由于新版本采用全新的架构,您需要手动输入之前的信息。 v2.1.5及以前的用户,由于新版本采用全新的架构,您需要手动输入之前的信息。
v3.0_Beta版用户直接用AUTO_MAA.exe替代gui.exe后重新设置每个用户的“自定义基建”选项输入“-”以关闭该功能,输入自定义基建配置文件地址以开启该功能)。 v3.0_Beta版用户直接用AUTO_MAA.exe替代gui.exe后将原文件夹下的gui文件夹用新版本对应文件替换重新设置每个用户的“自定义基建”选项(输入“-”以关闭该功能,输入自定义基建配置文件地址以开启该功能)。
v3.1版用户将原文件夹下的AUTO_MAA.exe文件和gui文件夹用新版本对应文件替换即可。 v3.1~v3.1.1版用户将原文件夹下的AUTO_MAA.exe文件和gui文件夹用新版本对应文件替换即可。
新用户请忽略本说明。 新用户请忽略本说明。