重构,GUI初步开发

This commit is contained in:
DLmaster
2024-07-07 12:43:40 +08:00
parent e550b9a155
commit 2010855139
15 changed files with 2026 additions and 805 deletions

Binary file not shown.

View File

@@ -1,76 +0,0 @@
# <AUTO_MAA:A MAA Multi Account Management and Automation Tool>
# Copyright © <2024> <DLmaster361>
# This file is part of AUTO_MAA.
# AUTO_MAA is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published
# by the Free Software Foundation, either version 3 of the License,
# or (at your option) any later version.
# AUTO_MAA is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty
# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
# the GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with AUTO_MAA. If not, see <https://www.gnu.org/licenses/>.
# DLmaster_361@163.com
import sqlite3
import subprocess
import atexit
import datetime
import time
import os
from termcolor import colored
#资源回收
def cleanup():
if os.path.exists("state/BEGIN"):
os.remove("state/BEGIN")
DATABASE="data/data.db"
#设置回调函数
atexit.register(cleanup)
while True:
db=sqlite3.connect(DATABASE)
cur=db.cursor()
cur.execute("SELECT * FROM timeset WHERE True")
timeset=cur.fetchall()
cur.close()
db.close()
timeset=[list(row) for row in timeset]
timeset=[timeset[i][0] for i in range(len(timeset))]
for i in range(60):
#展示当前信息
curtime=datetime.datetime.now().strftime("%H:%M")
os.system('cls')
if len(timeset)!=0:
print(colored("设定时间:"+''.join(timeset),'green'))
print(colored("当前时间:"+curtime,'green'))
print(colored("运行日志:",'green'))
if os.path.exists("state/running"):
print(colored("正在运行代理",'yellow'))
elif os.path.exists("log.txt"):
with open("log.txt",'r',encoding="utf-8") as f:
linex=f.read()
print(colored(linex,'light_green'))
else:
print(colored("暂无",'light_green'))
#定时执行
if (curtime in timeset) and not os.path.exists("state/running"):
with open("state/BEGIN","w",encoding="utf-8") as f:
print("BEGIN",file=f)
run=subprocess.Popen(["run.exe"])
runpid=run.pid
while True:
if os.path.exists("state/END"):
os.system('taskkill /F /T /PID '+str(runpid))
os.remove("state/END")
break
time.sleep(1)
os.remove("state/BEGIN")
time.sleep(1)

View File

@@ -1,3 +0,0 @@
管理密钥是解密用户密码的唯一凭证与数据库绑定。密钥丢失或data/key/目录下任一文件损坏都将导致解密无法正常进行。
本项目采用自主开发的混合加密模式项目组也无法找回您的管理密钥或修复data/key/目录下的文件。如果不幸的事发生建议您删除data/data.db重新录入信息。

BIN
gui.exe Normal file

Binary file not shown.

1041
gui.py Normal file

File diff suppressed because it is too large Load Diff

978
gui/ui/main.ui Normal file
View File

@@ -0,0 +1,978 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>AUTO_MAA</class>
<widget class="QWidget" name="AUTO_MAA">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>1280</width>
<height>720</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_13">
<item>
<widget class="QTabWidget" name="tabWidget">
<property name="currentIndex">
<number>2</number>
</property>
<widget class="QWidget" name="tab_users">
<property name="enabled">
<bool>true</bool>
</property>
<attribute name="title">
<string>用户管理</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QFrame" name="frame_manage">
<property name="frameShape">
<enum>QFrame::Shape::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Shadow::Raised</enum>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QPushButton" name="pushButton_new">
<property name="text">
<string>新建</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButton_del">
<property name="text">
<string>删除</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Orientation::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="pushButton_password">
<property name="text">
<string>显示密码</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButton_refresh">
<property name="text">
<string>刷新</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QTableWidget" name="tableWidget_userlist">
<column>
<property name="text">
<string>用户名</string>
</property>
</column>
<column>
<property name="text">
<string>手机号码</string>
</property>
</column>
<column>
<property name="text">
<string>代理天数</string>
</property>
</column>
<column>
<property name="text">
<string>状态</string>
</property>
</column>
<column>
<property name="text">
<string>执行情况</string>
</property>
</column>
<column>
<property name="text">
<string>关卡</string>
</property>
</column>
<column>
<property name="text">
<string>备选关卡-1</string>
</property>
</column>
<column>
<property name="text">
<string>备选关卡-2</string>
</property>
</column>
<column>
<property name="text">
<string>剿灭</string>
</property>
</column>
<column>
<property name="text">
<string>自定义基建</string>
</property>
</column>
<column>
<property name="text">
<string>密码</string>
</property>
</column>
<column>
<property name="text">
<string>备注</string>
</property>
</column>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="tab_run">
<attribute name="title">
<string>执行</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_11">
<item>
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>定时执行</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<layout class="QGridLayout" name="gridLayout">
<item row="2" column="0">
<widget class="QFrame" name="frame_timeset1">
<property name="frameShape">
<enum>QFrame::Shape::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Shadow::Raised</enum>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_7" stretch="0,0">
<item>
<widget class="QCheckBox" name="checkBox_t1">
<property name="enabled">
<bool>true</bool>
</property>
<property name="minimumSize">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<widget class="QTimeEdit" name="timeEdit_1"/>
</item>
</layout>
</widget>
</item>
<item row="3" column="4">
<widget class="QFrame" name="frame_timeset10">
<property name="frameShape">
<enum>QFrame::Shape::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Shadow::Raised</enum>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_16">
<item>
<widget class="QCheckBox" name="checkBox_t10">
<property name="enabled">
<bool>true</bool>
</property>
<property name="minimumSize">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<widget class="QTimeEdit" name="timeEdit_10"/>
</item>
</layout>
</widget>
</item>
<item row="2" column="2">
<widget class="QFrame" name="frame_timeset3">
<property name="frameShape">
<enum>QFrame::Shape::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Shadow::Raised</enum>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_9">
<item>
<widget class="QCheckBox" name="checkBox_t3">
<property name="enabled">
<bool>true</bool>
</property>
<property name="minimumSize">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<widget class="QTimeEdit" name="timeEdit_3"/>
</item>
</layout>
</widget>
</item>
<item row="2" column="1">
<widget class="QFrame" name="frame_timeset2">
<property name="frameShape">
<enum>QFrame::Shape::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Shadow::Raised</enum>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_8">
<item>
<widget class="QCheckBox" name="checkBox_t2">
<property name="enabled">
<bool>true</bool>
</property>
<property name="minimumSize">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<widget class="QTimeEdit" name="timeEdit_2"/>
</item>
</layout>
</widget>
</item>
<item row="3" column="3">
<widget class="QFrame" name="frame_timeset9">
<property name="frameShape">
<enum>QFrame::Shape::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Shadow::Raised</enum>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_15">
<item>
<widget class="QCheckBox" name="checkBox_t9">
<property name="enabled">
<bool>true</bool>
</property>
<property name="minimumSize">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<widget class="QTimeEdit" name="timeEdit_9"/>
</item>
</layout>
</widget>
</item>
<item row="2" column="3">
<widget class="QFrame" name="frame_timeset4">
<property name="frameShape">
<enum>QFrame::Shape::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Shadow::Raised</enum>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_10">
<item>
<widget class="QCheckBox" name="checkBox_t4">
<property name="enabled">
<bool>true</bool>
</property>
<property name="minimumSize">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<widget class="QTimeEdit" name="timeEdit_4"/>
</item>
</layout>
</widget>
</item>
<item row="3" column="0">
<widget class="QFrame" name="frame_timeset6">
<property name="frameShape">
<enum>QFrame::Shape::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Shadow::Raised</enum>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_12">
<item>
<widget class="QCheckBox" name="checkBox_t6">
<property name="enabled">
<bool>true</bool>
</property>
<property name="minimumSize">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<widget class="QTimeEdit" name="timeEdit_6"/>
</item>
</layout>
</widget>
</item>
<item row="2" column="4">
<widget class="QFrame" name="frame_timeset5">
<property name="frameShape">
<enum>QFrame::Shape::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Shadow::Raised</enum>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_11">
<item>
<widget class="QCheckBox" name="checkBox_t5">
<property name="enabled">
<bool>true</bool>
</property>
<property name="minimumSize">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<widget class="QTimeEdit" name="timeEdit_5"/>
</item>
</layout>
</widget>
</item>
<item row="3" column="2">
<widget class="QFrame" name="frame_timeset8">
<property name="frameShape">
<enum>QFrame::Shape::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Shadow::Raised</enum>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_13">
<item>
<widget class="QCheckBox" name="checkBox_t8">
<property name="enabled">
<bool>true</bool>
</property>
<property name="minimumSize">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<widget class="QTimeEdit" name="timeEdit_7"/>
</item>
</layout>
</widget>
</item>
<item row="3" column="1">
<widget class="QFrame" name="frame_timeset7">
<property name="frameShape">
<enum>QFrame::Shape::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Shadow::Raised</enum>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_14">
<item>
<widget class="QCheckBox" name="checkBox_t7">
<property name="enabled">
<bool>true</bool>
</property>
<property name="minimumSize">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<widget class="QTimeEdit" name="timeEdit_8"/>
</item>
</layout>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox_2">
<property name="title">
<string>调度台</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<layout class="QVBoxLayout" name="verticalLayout_9">
<item>
<widget class="QFrame" name="frame_main">
<property name="frameShape">
<enum>QFrame::Shape::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Shadow::Raised</enum>
</property>
<layout class="QVBoxLayout" name="verticalLayout_4">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLabel" name="label_main">
<property name="text">
<string>调度器</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Orientation::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="pushButton_runnow">
<property name="text">
<string>立即执行</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QFrame" name="frame_run">
<property name="frameShape">
<enum>QFrame::Shape::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Shadow::Raised</enum>
</property>
<layout class="QVBoxLayout" name="verticalLayout_5">
<item>
<widget class="QLabel" name="label_run">
<property name="text">
<string>代理中</string>
</property>
</widget>
</item>
<item>
<widget class="QTextBrowser" name="textBrowser_run"/>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QFrame" name="frame_wait">
<property name="frameShape">
<enum>QFrame::Shape::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Shadow::Raised</enum>
</property>
<layout class="QVBoxLayout" name="verticalLayout_6">
<item>
<widget class="QLabel" name="label_wait">
<property name="text">
<string>等待中</string>
</property>
</widget>
</item>
<item>
<widget class="QTextBrowser" name="textBrowser_wait"/>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QFrame" name="frame_over">
<property name="frameShape">
<enum>QFrame::Shape::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Shadow::Raised</enum>
</property>
<layout class="QVBoxLayout" name="verticalLayout_7">
<item>
<widget class="QLabel" name="label_over">
<property name="text">
<string>已完成</string>
</property>
</widget>
</item>
<item>
<widget class="QTextBrowser" name="textBrowser_over"/>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QFrame" name="frame_error">
<property name="frameShape">
<enum>QFrame::Shape::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Shadow::Raised</enum>
</property>
<layout class="QVBoxLayout" name="verticalLayout_8">
<item>
<widget class="QLabel" name="label_error">
<property name="text">
<string>异常</string>
</property>
</widget>
</item>
<item>
<widget class="QTextBrowser" name="textBrowser_error"/>
</item>
</layout>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QFrame" name="frame">
<property name="frameShape">
<enum>QFrame::Shape::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Shadow::Raised</enum>
</property>
<layout class="QVBoxLayout" name="verticalLayout_10">
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>日志</string>
</property>
</widget>
</item>
<item>
<widget class="QTextBrowser" name="textBrowser_log"/>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="tab_set">
<attribute name="title">
<string>设置</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_12">
<item>
<widget class="QGroupBox" name="groupBox_4">
<property name="title">
<string>MAA设置</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_14">
<item>
<widget class="QFrame" name="frame_maaset">
<property name="frameShape">
<enum>QFrame::Shape::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Shadow::Raised</enum>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<widget class="QLabel" name="label_2">
<property name="text">
<string>MAA路径</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="lineEdit_MAApath"/>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox_3">
<property name="title">
<string>时间限制</string>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0">
<widget class="QFrame" name="frame_routine">
<property name="frameShape">
<enum>QFrame::Shape::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Shadow::Raised</enum>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_5">
<item>
<widget class="QLabel" name="label_routine">
<property name="text">
<string>日常限制</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Orientation::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QSpinBox" name="spinBox_routine">
<property name="minimumSize">
<size>
<width>100</width>
<height>0</height>
</size>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_routineunit">
<property name="text">
<string>分钟</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="0" column="1">
<widget class="QFrame" name="frame_annihilation">
<property name="frameShape">
<enum>QFrame::Shape::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Shadow::Raised</enum>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_6">
<item>
<widget class="QLabel" name="label_annihilation">
<property name="text">
<string>剿灭限制</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_4">
<property name="orientation">
<enum>Qt::Orientation::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QSpinBox" name="spinBox_annihilation">
<property name="minimumSize">
<size>
<width>100</width>
<height>0</height>
</size>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_annihilationunit">
<property name="text">
<string>分钟</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="0" column="2">
<widget class="QFrame" name="frame_annihilation_2">
<property name="frameShape">
<enum>QFrame::Shape::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Shadow::Raised</enum>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_17">
<item>
<widget class="QLabel" name="label_num">
<property name="text">
<string>运行失败重试次数上限</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_5">
<property name="orientation">
<enum>Qt::Orientation::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QSpinBox" name="spinBox_numt">
<property name="minimumSize">
<size>
<width>100</width>
<height>0</height>
</size>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_num_2">
<property name="text">
<string>次</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox_5">
<property name="title">
<string>管理密钥</string>
</property>
<layout class="QGridLayout" name="gridLayout_3">
<item row="0" column="0">
<widget class="QPushButton" name="pushButton_changePASSWORD">
<property name="text">
<string>修改管理密钥</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox_6">
<property name="title">
<string>tips</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_15">
<item>
<widget class="QTextBrowser" name="textBrowser">
<property name="html">
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;meta charset=&quot;utf-8&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
hr { height: 1px; border-width: 0; }
li.unchecked::marker { content: &quot;\2610&quot;; }
li.checked::marker { content: &quot;\2612&quot;; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Microsoft YaHei UI'; font-size:9pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;致用户:&lt;/p&gt;
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt; 这是AUTO_MAA_v3.0_Beta,项目初步完成可视化。&lt;/p&gt;
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt; 这个版本可能出现各种各样的BUG因此不会去除命令行窗口。当程序出现异常时您可以在命令行窗口中获取报错信息以便向项目组求助。&lt;/p&gt;
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt; 您可以通过官方仓库 &lt;a href=&quot;https://github.com/DLmaster361/AUTO_MAA/&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#007ad6;&quot;&gt;DLmaster361/AUTO_MAA&lt;/span&gt;&lt;/a&gt; 发布Issues求助。&lt;/p&gt;
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt; 官方QQ群957750551&lt;/p&gt;
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p align=&quot;right&quot; style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;DLmaster&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_notice">
<property name="text">
<string>注意:在用户管理页与设置页执行的所有更改,不会对正在执行的任务生效。</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Orientation::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>

Binary file not shown.

470
manage.py
View File

@@ -1,470 +0,0 @@
# <AUTO_MAA:A MAA Multi Account Management and Automation Tool>
# Copyright © <2024> <DLmaster361>
# This file is part of AUTO_MAA.
# AUTO_MAA is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published
# by the Free Software Foundation, either version 3 of the License,
# or (at your option) any later version.
# AUTO_MAA is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty
# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
# the GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with AUTO_MAA. If not, see <https://www.gnu.org/licenses/>.
# DLmaster_361@163.com
import sqlite3
import datetime
import msvcrt
import sys
import os
import hashlib
import random
import secrets
from Crypto.Cipher import AES
from Crypto.PublicKey import RSA
from Crypto.Cipher import PKCS1_OAEP
from Crypto.Util.Padding import pad,unpad
#读入密码
def readpass(text):
sys.stdout=sys.__stdout__
sys.stdout.write(text)
sys.stdout.flush()
p=''
while True:
typed=msvcrt.getch()
if len(p)!=0:
if typed==b'\r':
sys.stdout.write('\b*')
sys.stdout.flush()
break
elif typed==b'\b':
p=p[:-1]
sys.stdout.write('\b \b')
sys.stdout.flush()
else:
p+=typed.decode("utf-8")
sys.stdout.write('\b*'+typed.decode("utf-8"))
sys.stdout.flush()
elif typed!=b'\r' and typed!=b'\b':
p+=typed.decode("utf-8")
sys.stdout.write(typed.decode("utf-8"))
sys.stdout.flush()
print('')
return p
#配置密钥
def getPASSWORD(PASSWORD):
#生成RSA密钥对
key=RSA.generate(2048)
public_key_local=key.publickey()
private_key=key
#保存RSA公钥
with open('data/key/public_key.pem','wb') as f:
f.write(public_key_local.exportKey())
#生成密钥转换与校验随机盐
PASSWORDsalt=secrets.token_hex(random.randint(32,1024))
with open("data/key/PASSWORDsalt.txt","w",encoding="utf-8") as f:
print(PASSWORDsalt,file=f)
verifysalt=secrets.token_hex(random.randint(32,1024))
with open("data/key/verifysalt.txt","w",encoding="utf-8") as f:
print(verifysalt,file=f)
#将管理密钥转化为AES-256密钥
AES_password=hashlib.sha256((PASSWORD+PASSWORDsalt).encode("utf-8")).digest()
#生成AES-256密钥校验哈希值并保存
AES_password_verify=hashlib.sha256(AES_password+verifysalt.encode("utf-8")).digest()
with open("data/key/AES_password_verify.bin","wb") as f:
f.write(AES_password_verify)
#AES-256加密RSA私钥并保存密文
AES_key=AES.new(AES_password,AES.MODE_ECB)
private_key_local=AES_key.encrypt(pad(private_key.exportKey(),32))
with open("data/key/private_key.bin","wb") as f:
f.write(private_key_local)
#加密
def encryptx(note):
#读取RSA公钥
with open('data/key/public_key.pem','rb') as f:
public_key_local=RSA.import_key(f.read())
#使用RSA公钥对数据进行加密
cipher=PKCS1_OAEP.new(public_key_local)
encrypted=cipher.encrypt(note.encode("utf-8"))
return encrypted
#解密
def decryptx(note,PASSWORD):
#读入RSA私钥密文、盐与校验哈希值
with open("data/key/private_key.bin","rb") as f:
private_key_local=f.read().strip()
with open("data/key/PASSWORDsalt.txt","r",encoding="utf-8") as f:
PASSWORDsalt=f.read().strip()
with open("data/key/verifysalt.txt","r",encoding="utf-8") as f:
verifysalt=f.read().strip()
with open("data/key/AES_password_verify.bin","rb") as f:
AES_password_verify=f.read().strip()
#将管理密钥转化为AES-256密钥并验证
AES_password=hashlib.sha256((PASSWORD+PASSWORDsalt).encode("utf-8")).digest()
AES_password_SHA=hashlib.sha256(AES_password+verifysalt.encode("utf-8")).digest()
if AES_password_SHA!=AES_password_verify:
return "管理密钥错误"
else:
#AES解密RSA私钥
AES_key=AES.new(AES_password,AES.MODE_ECB)
private_key_pem=unpad(AES_key.decrypt(private_key_local),32)
private_key=RSA.import_key(private_key_pem)
#使用RSA私钥解密数据
decrypter=PKCS1_OAEP.new(private_key)
note=decrypter.decrypt(note)
return note.decode("utf-8")
#修改管理密钥
def changePASSWORD():
#获取用户信息
db=sqlite3.connect(DATABASE)
cur=db.cursor()
cur.execute("SELECT * FROM adminx WHERE True")
data=cur.fetchall()
cur.close()
db.close()
data=[list(row) for row in data]
global PASSWORD
#验证管理密钥
PASSWORDold=readpass("请输入旧管理密钥:")
if len(data)==0:
print("当前无用户,验证自动通过")
PASSWORDnew=readpass("请输入新管理密钥:")
getPASSWORD(PASSWORDnew)
PASSWORD=PASSWORDnew
return "管理密钥修改成功"
while decryptx(data[0][6],PASSWORDold)=="管理密钥错误":
print("管理密钥错误")
PASSWORDold=readpass("请输入旧管理密钥:")
print("验证通过")
#修改管理密钥
PASSWORDnew=readpass("请输入新管理密钥:")
#使用旧管理密钥解密
for i in range(len(data)):
data[i][6]=decryptx(data[i][6],PASSWORDold)
#使用新管理密钥重新加密
getPASSWORD(PASSWORDnew)
db=sqlite3.connect(DATABASE)
cur=db.cursor()
for i in range(len(data)):
cur.execute("UPDATE adminx SET password=? WHERE admin=?",(encryptx(data[i][6]),data[i][0]))
db.commit()
cur.close()
db.close()
PASSWORD=PASSWORDnew
return "管理密钥修改成功"
#添加用户
def add():
adminx=input("用户名:")
#用户名重复验证
while search(adminx,0)=="":
print("该用户已存在,请重新输入")
adminx=input("用户名:")
numberx=input("手机号码:")
dayx=int(input("代理天数:"))
gamex=input("关卡号:")
passwordx=readpass("密码:")
passwordx=encryptx(passwordx)
#应用更新
db=sqlite3.connect(DATABASE)
cur=db.cursor()
cur.execute("INSERT INTO adminx VALUES(?,?,?,'y','2000-01-01',?,?)",(adminx,numberx,dayx,gamex,passwordx))
db.commit()
cur.close()
db.close()
return "操作成功"
#删除用户信息
def delete(id):
#检查用户是否存在
if search(id,0)!="":
return "未找到"+id
#应用更新
db=sqlite3.connect(DATABASE)
cur=db.cursor()
cur.execute("DELETE FROM adminx WHERE admin=?",(id,))
db.commit()
cur.close()
db.close()
return "成功删除"+id
#检索用户信息与配置
def search(id,book):
db=sqlite3.connect(DATABASE)
cur=db.cursor()
#处理启动时间查询
if id=="time":
cur.execute("SELECT * FROM timeset WHERE True")
timex=cur.fetchall()
timex=[list(row) for row in timex]
cur.close()
db.close()
if len(timex)==0:
return "启动时间未设置"
else:
for i in range(len(timex)):
print(timex[i][0])
return ""
#处理MAA路径查询
if id=="maa":
cur.execute("SELECT * FROM pathset WHERE True")
pathx=cur.fetchall()
if len(pathx)>0:
cur.close()
db.close()
return pathx[0][0]
else:
cur.close()
db.close()
return "MAA路径未设置"
#处理用户查询与全部信息查询
if id=="all":
cur.execute("SELECT * FROM adminx WHERE True")
else:
cur.execute("SELECT * FROM adminx WHERE admin=?",(id,))
data=cur.fetchall()
#处理全部信息查询时的MAA路径与启动时间查询
if id=="all":
cur.execute("SELECT * FROM pathset WHERE True")
pathx=cur.fetchall()
if len(pathx)>0:
print("\nMAA路径"+pathx[0][0])
else:
print("\nMAA路径未设置")
cur.execute("SELECT * FROM timeset WHERE True")
timex=cur.fetchall()
timex=[list(row) for row in timex]
if len(timex)==0:
print("\n启动时间未设置")
else:
print("启动时间:",end='')
for i in range(len(timex)):
print(timex[i][0],end=' ')
print('')
cur.close()
db.close()
data=[list(row) for row in data]
if len(data)>0:
#转译执行情况、用户状态,对全部信息查询与无输出查询隐去密码
curdate=datetime.date.today()
curdate=curdate.strftime('%Y-%m-%d')
for i in range(len(data)):
if data[i][4]==curdate:
data[i][4]="今日已执行"
else:
data[i][4]="今日未执行"
if data[i][3]=='y':
data[i][3]="启用"
else:
data[i][3]="禁用"
if id=="all" or book==0:
data[i][6]="******"
else:
#解密
global PASSWORD
if PASSWORD==0 or decryptx(data[i][6],PASSWORD)=="管理密钥错误":
PASSWORD=readpass("请输入管理密钥:")
data[i][6]=decryptx(data[i][6],PASSWORD)
#制表输出
if book==1:
print('')
print(unit("用户名",15),unit("手机号码",12),unit("代理天数",8),unit("状态",4),unit("执行情况",10),unit("关卡",10),unit("密码",25))
for i in range(len(data)):
print(unit(data[i][0],15),unit(data[i][1],12),unit(data[i][2],8),unit(data[i][3],4),unit(data[i][4],10),unit(data[i][5],10),unit(data[i][6],25))
return ""
elif id=="all":
return "\n当前没有用户记录"
else:
return "未找到"+id
#续期
def renewal(readxx):
#提取用户名与续期时间
for i in range(len(readxx)):
if readxx[i]==' ':
id=readxx[:i]
dayp=int(readxx[i+1:])
break
#检查用户是否存在
if search(id,0)!="":
return "未找到"+id
#应用更新
db=sqlite3.connect(DATABASE)
cur=db.cursor()
cur.execute("SELECT * FROM adminx WHERE admin=?",(id,))
data=cur.fetchall()
cur.execute("UPDATE adminx SET day=? WHERE admin=?",(data[0][2]+dayp,id))
db.commit()
cur.close()
db.close()
return '成功更新'+id+'的代理天数至'+str(data[0][2]+dayp)+''
#用户状态配置
def turn(id,t):
#检查用户是否存在
if search(id,0)!="":
return "未找到"+id
#应用更新
db=sqlite3.connect(DATABASE)
cur=db.cursor()
cur.execute("UPDATE adminx SET status=? WHERE admin=?",(t,id))
db.commit()
cur.close()
db.close()
if t=='y':
return '已启用'+id
else:
return '已禁用'+id
#修改刷取关卡
def gameid(readxx):
#提取用户名与修改值
for i in range(len(readxx)):
if readxx[i]==' ':
id=readxx[:i]
gamep=readxx[i+1:]
break
#检查用户是否存在
if search(id,0)!="":
return "未找到"+id
#导入与应用特殊关卡规则
games={}
with open('data/gameid.txt',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]=='':
gamein=gameids[i][:j]
gameout=gameids[i][j+1:]
break
games[gamein]=gameout.strip()
if gamep in games:
gamep=games[gamep]
#应用更新
db=sqlite3.connect(DATABASE)
cur=db.cursor()
cur.execute("UPDATE adminx SET game=? WHERE admin=?",(gamep,id))
db.commit()
cur.close()
db.close()
return '成功更新'+id+'的关卡为'+gamep
#设置MAA路径
def setpath(pathx):
db=sqlite3.connect(DATABASE)
cur=db.cursor()
cur.execute("SELECT * FROM pathset WHERE True")
pathold=cur.fetchall()
if len(pathold)>0:
cur.execute("UPDATE pathset SET path=? WHERE True",(pathx,))
else:
cur.execute("INSERT INTO pathset VALUES(?)",(pathx,))
db.commit()
cur.close()
db.close()
return "MAA路径已设置为"+pathx
#设置启动时间
def settime(book,timex):
db=sqlite3.connect(DATABASE)
cur=db.cursor()
#检查待操作对象存在情况
cur.execute("SELECT * FROM timeset WHERE True")
timeold=cur.fetchall()
timeold=[list(row) for row in timeold]
timenew=[]
timenew.append(timex)
#添加时间设置
if book=='+':
if timenew in timeold:
cur.close()
db.close()
return "已存在"+timex
else:
cur.execute("INSERT INTO timeset VALUES(?)",(timex,))
db.commit()
cur.close()
db.close()
return "已添加"+timex
#删除时间设置
elif book=='-':
if timenew in timeold:
cur.execute("DELETE FROM timeset WHERE time=?",(timex,))
db.commit()
cur.close()
db.close()
return "已删除"+timex
else:
cur.close()
db.close()
return "未找到"+timex
#统一制表单元
def unit(x,m):
#字母与连接符占1位中文占2位
x=str(x)
n=0
for i in x:
if 'a'<=i<='z' or 'A'<=i<='Z' or '0'<=i<='9' or i=='_' or i=='-':
n+=1
return ' '+x+' '*(m-2*len(x)+n)
#初期检查
DATABASE="data/data.db"
PASSWORD=0
if not os.path.exists(DATABASE):
db=sqlite3.connect(DATABASE)
cur=db.cursor()
db.execute("CREATE TABLE adminx(admin text,number text,day int,status text,last date,game text,password byte)")
db.execute("CREATE TABLE pathset(path text)")
db.execute("CREATE TABLE timeset(time text)")
readx=input("首次启动请设置MAA路径")
cur.execute("INSERT INTO pathset VALUES(?)",(readx,))
db.commit()
cur.close()
db.close()
PASSWORD=readpass("请设置管理密钥(密钥与数据库绑定):")
getPASSWORD(PASSWORD)
#初始界面
print("Good evening!")
print(search("all",1))
#主程序
while True:
read=input()
if len(read)==0:
print("无法识别的输入")
elif read[0]=='+' and len(read)==1:
print(add())
elif read[0]=='-' and len(read)==1:
os._exit(0)
elif read[0]=='/':
print(setpath(read[1:]))
elif read[0]=='*' and len(read)==1:
print(changePASSWORD())
elif read[0]==':' and (read[1]=='+' or read[1]=='-'):
print(settime(read[1],read[2:]))
else:
if read[-1]=='?' and read[-2]==' ':
print(search(read[:-2],1))
elif read[-1]=='+' and read[-2]==' ':
print(renewal(read[:-2]))
elif read[-1]=='-' and read[-2]==' ':
print(delete(read[:-2]))
elif read[-1]=='~' and read[-2]==' ':
print(gameid(read[:-2]))
elif (read[-1]=='y' or read[-1]=='n') and read[-2]==' ':
print(turn(read[:-2],read[-1]))
else:
print("无法识别的输入")

View File

@@ -1,3 +1,3 @@
termcolor PySide6
pycryptodome pycryptodome
pyinstaller pyinstaller

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=(2, 1, 5, 0), filevers=(3, 0, 0, 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', '2.1.5'), StringStruct('FileVersion', '3.0'),
StringStruct('InternalName', 'AUTO_MAA'), StringStruct('InternalName', 'AUTO_MAA'),
StringStruct('LegalCopyright', 'Copyright © 2024 DLmaster361'), StringStruct('LegalCopyright', 'Copyright © 2024 DLmaster361'),
StringStruct('OriginalFilename', 'AUTO_MAA'), StringStruct('OriginalFilename', 'AUTO_MAA'),
StringStruct('ProductName', 'AUTO_MAA'), StringStruct('ProductName', 'AUTO_MAA'),
StringStruct('ProductVersion', 'v2.1.5'), StringStruct('ProductVersion', 'v3.0_Beta'),
StringStruct('Assembly Version', '2.1.5.0')]) StringStruct('Assembly Version', 'v3.0_Beta')])
]) ])
] ]
) )

BIN
run.exe

Binary file not shown.

246
run.py
View File

@@ -1,246 +0,0 @@
# <AUTO_MAA:A MAA Multi Account Management and Automation Tool>
# Copyright © <2024> <DLmaster361>
# This file is part of AUTO_MAA.
# AUTO_MAA is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published
# by the Free Software Foundation, either version 3 of the License,
# or (at your option) any later version.
# AUTO_MAA is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty
# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
# the GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with AUTO_MAA. If not, see <https://www.gnu.org/licenses/>.
# DLmaster_361@163.com
import os
import sys
import subprocess
import atexit
import sqlite3
import datetime
import time
import json
from termcolor import colored
#配置MAA运行参数
def setmaa(s,tel,game):
with open(setpath,"r",encoding="utf-8") as f:
data=json.load(f)
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"]["MainFunction.Series.Quantity"]="1" #连战次数
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"]="" #剩余理智关卡
if game=="1-7":
data["Configurations"]["Default"]["MainFunction.Series.Quantity"]="6" #连战次数
else:
data["Configurations"]["Default"]["MainFunction.Series.Quantity"]="1" #连战次数
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
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:
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')+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
#检查是否超时
def timeout():
global logx
log0=logx[0]
for i in range(len(logx)):
if logx[i]!=log0:
return False
return True
#更新已完成用户的数据
def updata(id):
db=sqlite3.connect(DATABASE)
cur=db.cursor()
cur.execute("SELECT * FROM adminx WHERE admin=?",(id,))
info=cur.fetchall()
cur.execute("UPDATE adminx SET day=? WHERE admin=?",(info[0][2]-1,id))
db.commit()
cur.execute("UPDATE adminx SET last=? WHERE admin=?",(curdate,id))
db.commit()
cur.close()
db.close()
return 0
#资源回收
def cleanup():
if os.path.exists("state/RUNNING"):
os.remove("state/RUNNING")
#读取运行情况
if os.path.exists("state/RUNNING"):
os._exit(1)
#标记当前正在运行
with open("state/RUNNING","w",encoding="utf-8") as f:
print("RUNNING",file=f)
#设置回调函数
atexit.register(cleanup)
#获取PATH与用户数据
DATABASE="data/data.db"
db=sqlite3.connect(DATABASE)
cur=db.cursor()
cur.execute("SELECT * FROM pathset WHERE True")
path=cur.fetchall()
path=str(path[0][0])
setpath=path+"/config/gui.json"
logpath=path+"/debug/gui.log"
maapath=path+"/MAA.exe"
cur.execute("SELECT * FROM adminx WHERE True")
data=cur.fetchall()
data=[list(row) for row in data]
cur.close()
db.close()
#开始执行
curdate=datetime.date.today().strftime('%Y-%m-%d')
begintime=datetime.datetime.now().strftime("%H:%M")
idnew=[]
idold=[]
idfail=[]
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])
if book:
updata(data[i][0])
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])
if book:
idold.append(data[i][0])
else:
idall.remove(data[i][0])
endtime=datetime.datetime.now().strftime("%H:%M")
with open("log.txt","w",encoding="utf-8") as f:
print("任务开始时间:"+begintime+",结束时间:"+endtime,file=f)
print("已完成数:"+str(len(idnew))+",未完成数:"+str(len(idfail))+",重复执行数:"+str(len(idold)),file=f)
if len(idfail)!=0:
print("代理未完成的用户:",file=f)
for i in range(len(idfail)):
print(idfail[i],file=f)
if os.path.exists("state/BEGIN"):
with open("state/END","w",encoding="utf-8") as f:
print("END",file=f)
sys.exit(0)

View File

@@ -1 +0,0 @@
此文件夹内文件用于AUTO_MAA组件间的信息传递如果遇到run.exe闪退或AUTO_MAA.exe一直显示“正在运行代理”请尝试删除本文件夹下的所有文件。

View File

@@ -20,6 +20,4 @@
import os import os
os.system("pyinstaller -F --version-file res/info.txt -i res/AUTO_MAA.ico manage.py") os.system("pyinstaller -F --version-file res/info.txt --icon=res/AUTO_MAA.ico gui.py")
os.system("pyinstaller -F --version-file res/info.txt -i res/AUTO_MAA.ico run.py")
os.system("pyinstaller -F --version-file res/info.txt -i res/AUTO_MAA.ico AUTO_MAA.py")

View File

@@ -1,3 +1,3 @@
项目初始阶段,不会提供专门的版本更新程序,您需要手动更新程序。 项目初始阶段,不会提供专门的版本更新程序,您需要手动更新程序。
v2.1.2~v2.1.4版本的使用者将旧版本data文件夹移动至新版本软件根目录下覆盖掉预置文件即可完成更新 v3.0_Beta版本采用全新的架构,您需要手动输入之前的信息
新用户请忽略本说明。 新用户请忽略本说明。