Compare commits
11 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
44ee917d88 | ||
|
|
669019c051 | ||
|
|
4685c12570 | ||
|
|
d815529510 | ||
|
|
1da3620feb | ||
|
|
44d529c60f | ||
|
|
cdbcebd945 | ||
|
|
5bc2bf9397 | ||
|
|
d41419a579 | ||
|
|
a7e15e509e | ||
|
|
6518a378ac |
44
.github/workflows/python-app.yml
vendored
Normal file
44
.github/workflows/python-app.yml
vendored
Normal 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: ./
|
||||
BIN
AUTO_MAA.exe
BIN
AUTO_MAA.exe
Binary file not shown.
147
AUTO_MAA.py
147
AUTO_MAA.py
@@ -119,21 +119,17 @@ class MaaRunner(QtCore.QThread):
|
||||
maa = subprocess.Popen([self.MaaPath])
|
||||
# 记录当前时间
|
||||
StartTime = datetime.datetime.now()
|
||||
# 初始化log记录列表
|
||||
if j == 0:
|
||||
logx = [k for k in range(self.Annihilation * 60)]
|
||||
elif j == 1:
|
||||
logx = [k for k in range(self.Routine * 60)]
|
||||
logi = 0
|
||||
# 记录是否超时的标记
|
||||
self.TimeOut = False
|
||||
# 更新运行信息
|
||||
WaitUid = [
|
||||
idx for idx in AllUid if (not idx in OverUid + ErrorUid + [uid])
|
||||
]
|
||||
# 监测MAA运行状态
|
||||
while True:
|
||||
# 更新MAA日志
|
||||
# 获取MAA日志
|
||||
logs = []
|
||||
with open(self.LogPath, "r", encoding="utf-8") as f:
|
||||
logs = []
|
||||
for entry in f:
|
||||
try:
|
||||
entry_time = datetime.datetime.strptime(
|
||||
@@ -143,26 +139,41 @@ class MaaRunner(QtCore.QThread):
|
||||
logs.append(entry)
|
||||
except ValueError:
|
||||
pass
|
||||
log = "".join(logs)
|
||||
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,
|
||||
)
|
||||
if len(logs) != 0:
|
||||
logx[logi] = logs[-1]
|
||||
logi = (logi + 1) % len(logx)
|
||||
# 判断是否超时
|
||||
if len(logs) > 0:
|
||||
LastTime = datetime.datetime.strptime(
|
||||
logs[-1][1:20], "%Y-%m-%d %H:%M:%S"
|
||||
)
|
||||
NowTime = datetime.datetime.now()
|
||||
if (
|
||||
j == 0
|
||||
and NowTime - LastTime
|
||||
> datetime.timedelta(minutes=self.Annihilation)
|
||||
) or (
|
||||
j == 1
|
||||
and NowTime - LastTime
|
||||
> datetime.timedelta(minutes=self.Routine)
|
||||
):
|
||||
self.TimeOut = True
|
||||
# 合并日志
|
||||
log = "".join(logs)
|
||||
# 更新MAA日志
|
||||
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程序运行状态
|
||||
if "任务已全部完成!" in log:
|
||||
runbook[j] = True
|
||||
@@ -179,10 +190,11 @@ class MaaRunner(QtCore.QThread):
|
||||
("请检查连接设置或尝试重启模拟器与 ADB 或重启电脑" in log)
|
||||
or ("已停止" in log)
|
||||
or ("MaaAssistantArknights GUI exited" in log)
|
||||
or self.TimeOut(logx)
|
||||
or self.TimeOut
|
||||
or not self.ifRun
|
||||
):
|
||||
# 打印中止信息
|
||||
# 此时,log变量内存储的就是出现异常的日志信息,可以保存或发送用于问题排查
|
||||
if (
|
||||
(
|
||||
"请检查连接设置或尝试重启模拟器与 ADB 或重启电脑"
|
||||
@@ -192,7 +204,7 @@ class MaaRunner(QtCore.QThread):
|
||||
or ("MaaAssistantArknights GUI exited" in log)
|
||||
):
|
||||
info = "检测到MAA进程异常\n正在中止相关程序\n请等待10s"
|
||||
elif self.TimeOut(logx):
|
||||
elif self.TimeOut:
|
||||
info = "检测到MAA进程超时\n正在中止相关程序\n请等待10s"
|
||||
elif not self.ifRun:
|
||||
info = "您中止了本次任务\n正在中止相关程序\n请等待"
|
||||
@@ -251,8 +263,8 @@ class MaaRunner(QtCore.QThread):
|
||||
data = json.load(f)
|
||||
if s == 0:
|
||||
data["Configurations"]["Default"][
|
||||
"MainFunction.ActionAfterCompleted"
|
||||
] = "ExitEmulatorAndSelf" # 完成后退出MAA和模拟器
|
||||
"MainFunction.PostActions"
|
||||
] = "12" # 完成后退出MAA和模拟器
|
||||
data["Configurations"]["Default"][
|
||||
"Start.RunDirectly"
|
||||
] = "True" # 启动MAA后直接运行
|
||||
@@ -329,46 +341,53 @@ class MaaRunner(QtCore.QThread):
|
||||
data["Configurations"]["Default"][
|
||||
"TaskQueue.Mall.IsChecked"
|
||||
] = "True" # 获取信用及购物
|
||||
data["Configurations"]["Default"]["MainFunction.Stage1"] = self.data[uid][
|
||||
5
|
||||
] # 主关卡
|
||||
data["Configurations"]["Default"]["MainFunction.Stage2"] = self.data[uid][
|
||||
6
|
||||
] # 备选关卡1
|
||||
data["Configurations"]["Default"]["MainFunction.Stage3"] = self.data[uid][
|
||||
7
|
||||
] # 备选关卡2
|
||||
# 主关卡
|
||||
if self.data[uid][5] == "-":
|
||||
data["Configurations"]["Default"]["MainFunction.Stage1"] = ""
|
||||
else:
|
||||
data["Configurations"]["Default"]["MainFunction.Stage1"] = self.data[
|
||||
uid
|
||||
][5]
|
||||
# 备选关卡1
|
||||
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"][
|
||||
"Fight.RemainingSanityStage"
|
||||
] = "" # 剩余理智关卡
|
||||
# 连战次数
|
||||
if self.data[uid][5] == "1-7":
|
||||
data["Configurations"]["Default"][
|
||||
"MainFunction.Series.Quantity"
|
||||
] = "6" # 连战次数
|
||||
data["Configurations"]["Default"]["MainFunction.Series.Quantity"] = "6"
|
||||
else:
|
||||
data["Configurations"]["Default"][
|
||||
"MainFunction.Series.Quantity"
|
||||
] = "1" # 连战次数
|
||||
data["Configurations"]["Default"]["MainFunction.Series.Quantity"] = "1"
|
||||
data["Configurations"]["Default"][
|
||||
"Penguin.IsDrGrandet"
|
||||
] = "False" # 博朗台模式
|
||||
data["Configurations"]["Default"][
|
||||
"GUI.CustomStageCode"
|
||||
] = "True" # 手动输入关卡名
|
||||
# 备选关卡
|
||||
if self.data[uid][6] == "-" and self.data[uid][7] == "-":
|
||||
data["Configurations"]["Default"][
|
||||
"GUI.UseAlternateStage"
|
||||
] = "False" # 不使用备选关卡
|
||||
data["Configurations"]["Default"]["GUI.UseAlternateStage"] = "False"
|
||||
else:
|
||||
data["Configurations"]["Default"][
|
||||
"GUI.UseAlternateStage"
|
||||
] = "True" # 使用备选关卡
|
||||
data["Configurations"]["Default"]["GUI.UseAlternateStage"] = "True"
|
||||
data["Configurations"]["Default"][
|
||||
"Fight.UseRemainingSanityStage"
|
||||
] = "False" # 使用剩余理智
|
||||
data["Configurations"]["Default"][
|
||||
"Fight.UseExpiringMedicine"
|
||||
] = "True" # 无限吃48小时内过期的理智药
|
||||
# 自定义基建配置
|
||||
if self.data[uid][9] == "-":
|
||||
data["Configurations"]["Default"][
|
||||
"Infrast.CustomInfrastEnabled"
|
||||
@@ -392,14 +411,6 @@ class MaaRunner(QtCore.QThread):
|
||||
json.dump(data, f, indent=4)
|
||||
return True
|
||||
|
||||
# 超时判断
|
||||
def TimeOut(self, logx):
|
||||
log0 = logx[0]
|
||||
for i in logx:
|
||||
if i != log0:
|
||||
return False
|
||||
return True
|
||||
|
||||
|
||||
class MainTimer(QtCore.QThread):
|
||||
|
||||
@@ -1005,15 +1016,11 @@ class Main(QWidget):
|
||||
if os.path.exists(self.GameidPath):
|
||||
with open(self.GameidPath, encoding="utf-8") as f:
|
||||
gameids = f.readlines()
|
||||
for i in range(len(gameids)):
|
||||
for j in range(len(gameids[i])):
|
||||
if gameids[i][j] == ":" or gameids[i][j] == ":":
|
||||
gamein = gameids[i][:j]
|
||||
gameout = gameids[i][j + 1 :]
|
||||
break
|
||||
games[gamein.strip()] = gameout.strip()
|
||||
if text in games:
|
||||
text = games[text]
|
||||
for line in gameids:
|
||||
if ":" in line:
|
||||
gamein, gameout = line.split(":", 1)
|
||||
games[gamein.strip()] = gameout.strip()
|
||||
text = games.get(text, text)
|
||||
if item.column() == 9:
|
||||
text = text.replace("\\", "/")
|
||||
if item.column() == 10:
|
||||
|
||||
@@ -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=(3, 1, 1, 0),
|
||||
filevers=(3, 1, 2, 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', '3.1.1'),
|
||||
StringStruct('FileVersion', '3.1.2'),
|
||||
StringStruct('InternalName', 'AUTO_MAA'),
|
||||
StringStruct('LegalCopyright', 'Copyright © 2024 DLmaster361'),
|
||||
StringStruct('OriginalFilename', 'AUTO_MAA.py'),
|
||||
StringStruct('ProductName', 'AUTO_MAA'),
|
||||
StringStruct('ProductVersion', 'v3.1.1'),
|
||||
StringStruct('Assembly Version', 'v3.1.1')])
|
||||
StringStruct('ProductVersion', 'v3.1.2'),
|
||||
StringStruct('Assembly Version', 'v3.1.2')])
|
||||
])
|
||||
]
|
||||
)
|
||||
@@ -1,5 +1,6 @@
|
||||
#主界面
|
||||
"MainFunction.ActionAfterCompleted": "ExitEmulatorAndSelf" #完成后
|
||||
"MainFunction.ActionAfterCompleted": "ExitEmulatorAndSelf" #完成后(旧)
|
||||
"MainFunction.PostActions": "12" #完成后(新)
|
||||
"TaskQueue.WakeUp.IsChecked": "True" #开始唤醒
|
||||
"TaskQueue.Recruiting.IsChecked": "True" #自动公招
|
||||
"TaskQueue.Base.IsChecked": "True" #基建换班
|
||||
|
||||
4
更新说明.txt
4
更新说明.txt
@@ -1,5 +1,5 @@
|
||||
项目初始阶段,不会提供专门的版本更新程序,您需要手动更新程序。
|
||||
v2.1.5及以前的用户,由于新版本采用全新的架构,您需要手动输入之前的信息。
|
||||
v3.0_Beta版用户,直接用AUTO_MAA.exe替代gui.exe后,重新设置每个用户的“自定义基建”选项(输入“-”以关闭该功能,输入自定义基建配置文件地址以开启该功能)。
|
||||
v3.1版用户,将原文件夹下的AUTO_MAA.exe文件和gui文件夹用新版本对应文件替换即可。
|
||||
v3.0_Beta版用户,直接用AUTO_MAA.exe替代gui.exe后,将原文件夹下的gui文件夹用新版本对应文件替换,重新设置每个用户的“自定义基建”选项(输入“-”以关闭该功能,输入自定义基建配置文件地址以开启该功能)。
|
||||
v3.1~v3.1.1版用户,将原文件夹下的AUTO_MAA.exe文件和gui文件夹用新版本对应文件替换即可。
|
||||
新用户请忽略本说明。
|
||||
Reference in New Issue
Block a user