mirror of
https://gitee.com/sui-feng-cb/AzurLaneAutoScript1
synced 2026-03-12 05:08:19 +08:00
Add: Mystery code support of MAA copilot
This commit is contained in:
@@ -288,7 +288,8 @@
|
||||
},
|
||||
"DrGrandet": {
|
||||
"type": "checkbox",
|
||||
"value": false
|
||||
"value": false,
|
||||
"display": "hide"
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -335,7 +336,7 @@
|
||||
},
|
||||
"Select3": {
|
||||
"type": "checkbox",
|
||||
"value": false
|
||||
"value": true
|
||||
},
|
||||
"Select4": {
|
||||
"type": "checkbox",
|
||||
|
||||
@@ -68,7 +68,7 @@ MaaFight:
|
||||
MaaRecruit:
|
||||
Refresh: true
|
||||
SkipRobot: true
|
||||
Select3: false
|
||||
Select3: true
|
||||
Select4: true
|
||||
Select5: true
|
||||
Level3ShortTime: True
|
||||
|
||||
@@ -32,6 +32,7 @@ MaaFight:
|
||||
Stone: 0
|
||||
Times: 0
|
||||
Drops: null
|
||||
DrGrandet: false
|
||||
|
||||
MaaRecruit:
|
||||
Scheduler:
|
||||
|
||||
@@ -48,7 +48,7 @@ class GeneratedConfig:
|
||||
# Group `MaaRecruit`
|
||||
MaaRecruit_Refresh = True
|
||||
MaaRecruit_SkipRobot = True
|
||||
MaaRecruit_Select3 = False
|
||||
MaaRecruit_Select3 = True
|
||||
MaaRecruit_Select4 = True
|
||||
MaaRecruit_Select5 = True
|
||||
MaaRecruit_Level3ShortTime = True
|
||||
|
||||
@@ -359,10 +359,10 @@
|
||||
"MaaCopilot": {
|
||||
"_info": {
|
||||
"name": "作业设置",
|
||||
"help": "请在有“开始行动”界面的按钮使用本功能\n更多作业下载见https://prts.plus/"
|
||||
"help": "请在有“开始行动”按钮的界面使用本功能\n使用好友助战可以关闭“自动编队”,手动选择干员后开始\n悖论模拟需要关闭“自动编队”,并选好技能后处于“开始模拟”按钮的界面再开始\n神秘代码获取见https://prts.plus/,更多作业下载可以加MAA作业群"
|
||||
},
|
||||
"FileName": {
|
||||
"name": "作业路径",
|
||||
"name": "作业路径/神秘代码",
|
||||
"help": ""
|
||||
},
|
||||
"Formation": {
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
import os
|
||||
import sys
|
||||
import json
|
||||
import time
|
||||
import requests
|
||||
import datetime
|
||||
from importlib import import_module
|
||||
from typing import Any
|
||||
@@ -307,7 +309,23 @@ class AssistantHandler:
|
||||
self.config.Scheduler_Enable = False
|
||||
|
||||
def copilot(self):
|
||||
homework = read_file(self.config.MaaCopilot_FileName)
|
||||
filename = self.config.MaaCopilot_FileName
|
||||
if filename.startswith('maa://'):
|
||||
logger.info('正在从神秘代码中下载作业')
|
||||
r = requests.get(f"https://api.prts.plus/copilot/get/{filename.strip('maa://')}", timeout=30)
|
||||
if r.status_code != 200:
|
||||
logger.critical('作业文件下载失败,请检查神秘代码或网络状况')
|
||||
raise RequestHumanTakeover
|
||||
logger.info('作业下载完毕')
|
||||
|
||||
r.encoding = 'utf-8'
|
||||
buf = json.loads(r.text)['data']['content'].encode('utf-8')
|
||||
filename = os.path.join(self.config.MaaEmulator_MaaPath, './resource/_temp_copilot.json')
|
||||
filename = filename.replace('\\', '/').replace('./', '/').replace('//', '/')
|
||||
with open(filename, 'wb') as f:
|
||||
f.write(buf)
|
||||
|
||||
homework = read_file(filename)
|
||||
stage = deep_get(homework, keys='stage_name')
|
||||
if not stage:
|
||||
logger.critical('作业文件不存在或已经损坏')
|
||||
@@ -315,6 +333,6 @@ class AssistantHandler:
|
||||
|
||||
self.maa_start('Copilot', {
|
||||
"stage_name": stage,
|
||||
"filename": self.config.MaaCopilot_FileName,
|
||||
"filename": filename,
|
||||
"formation": self.config.MaaCopilot_Formation
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user