[feature] 上传ArknightsMaa相关文件

This commit is contained in:
lichx 2025-01-14 16:05:37 +08:00
commit 33d9f2eff1
13 changed files with 629 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
*.log

View File

@ -0,0 +1,328 @@
{
"plans": [
{
"rooms": {
"trading": [
{
"product": "LMD",
"operators": ["巫恋", "龙舌兰", "卡夫卡"],
"sort": true,
"autofill": false
},
{
"product": "LMD",
"operators": ["但书", "乌有", "银灰"],
"sort": true,
"autofill": false
}
],
"manufacture": [
{
"product": "Battle Record",
"operators": ["红云", "稀音", "帕拉斯"],
"sort": true,
"autofill": false
},
{
"product": "Battle Record",
"operators": ["食铁兽", "断罪者", "槐琥"],
"sort": true,
"autofill": false
},
{
"product": "Pure Gold",
"operators": ["清流", "温蒂", "苍苔"],
"sort": true,
"autofill": false
},
{
"product": "Pure Gold",
"operators": ["砾", "至简", "夜烟"],
"sort": true,
"autofill": false
}
],
"hire": [
{
"operators": ["絮雨"],
"autofill": false
}
],
"dormitory": [
{
"operators": ["车尔尼"],
"sort": true,
"autofill": true
},
{
"operators": ["爱丽丝"],
"sort": true,
"autofill": true
},
{
"operators": [],
"sort": false,
"autofill": true
},
{
"operators": [],
"sort": false,
"autofill": true
}
],
"control": [
{
"skip": false,
"operators": ["阿米娅", "重岳", "琴柳", "令", "夕"]
}
],
"power": [
{
"operators": ["承曦格雷伊"],
"autofill": false
},
{
"operators": ["澄闪"],
"autofill": false
},
{
"operators": ["格雷伊"],
"autofill": false
}
],
"meeting": [
{
"operators": [],
"autofill": true
}
]
},
"drones": {
"enable": true,
"index": 1,
"room": "manufacture",
"order": "pre"
},
"name": "16H最高效率长班",
"description": "请手动把年放加工站下次在16小时后换班"
},
{
"rooms": {
"trading": [
{
"product": "LMD",
"operators": ["巫恋", "龙舌兰", "卡夫卡"],
"sort": true,
"autofill": false
},
{
"product": "LMD",
"operators": ["但书", "空弦", "涤火杰西卡"],
"sort": true,
"autofill": false
}
],
"manufacture": [
{
"product": "Battle Record",
"operators": ["食铁兽", "断罪者", "槐琥"],
"sort": true,
"autofill": false
},
{
"product": "Battle Record",
"operators": ["赫默", "野鬃", "灰毫"],
"sort": true,
"autofill": false
},
{
"product": "Pure Gold",
"operators": ["水月", "海沫", "多萝西"],
"sort": true,
"autofill": false
},
{
"product": "Pure Gold",
"operators": ["砾", "至简", "夜烟"],
"sort": true,
"autofill": false
}
],
"hire": [
{
"operators": ["絮雨"],
"autofill": false
}
],
"dormitory": [
{
"operators": ["车尔尼"],
"sort": true,
"autofill": true
},
{
"operators": ["爱丽丝"],
"sort": true,
"autofill": true
},
{
"operators": [],
"sort": false,
"autofill": true
},
{
"operators": [],
"sort": false,
"autofill": true
}
],
"control": [
{
"skip": false,
"operators": ["阿米娅", "凯尔希", "琴柳", "焰尾", "令"]
}
],
"power": [
{
"operators": ["正义骑士号"],
"autofill": false
},
{
"operators": ["澄闪"],
"autofill": false
},
{
"operators": ["雷蛇"],
"autofill": false
}
],
"meeting": [
{
"operators": [],
"autofill": true
}
]
},
"drones": {
"enable": true,
"index": 1,
"room": "manufacture",
"order": "pre"
},
"name": "4H 次高效替补 2 班",
"description": "下次在4小时后换班"
},
{
"rooms": {
"trading": [
{
"product": "LMD",
"operators": ["海蒂", "蛇屠箱", "柏喙"],
"sort": true,
"autofill": false
},
{
"product": "LMD",
"operators": ["能天使", "孑", "银灰"],
"sort": true,
"autofill": false
}
],
"manufacture": [
{
"product": "Battle Record",
"operators": ["红云", "稀音", "帕拉斯"],
"sort": true,
"autofill": false
},
{
"product": "Battle Record",
"operators": ["赫默", "野鬃", "灰毫"],
"sort": false,
"autofill": false
},
{
"product": "Pure Gold",
"operators": ["清流", "温蒂", "苍苔"],
"sort": true,
"autofill": false
},
{
"product": "Pure Gold",
"operators": ["水月", "海沫", "多萝西"],
"sort": true,
"autofill": false
}
],
"hire": [
{
"operators": ["斥罪"],
"autofill": false
}
],
"dormitory": [
{
"operators": [],
"sort": false,
"autofill": true
},
{
"operators": [],
"sort": false,
"autofill": true
},
{
"operators": [],
"sort": false,
"autofill": true
},
{
"operators": [],
"sort": false,
"autofill": true
}
],
"control": [
{
"skip": false,
"operators": ["诗怀雅", "凯尔希", "焰尾", "维什戴尔", "老鲤"]
}
],
"power": [
{
"operators": ["承曦格雷伊"],
"autofill": false
},
{
"operators": ["格雷伊"],
"autofill": false
},
{
"operators": ["雷蛇"],
"autofill": false
}
],
"meeting": [
{
"operators": [],
"autofill": true
}
]
},
"drones": {
"enable": true,
"index": 1,
"room": "manufacture",
"order": "pre"
},
"name": "4H 次高效替补 1 班",
"description": "下次在4小时后换班"
}
],
"author": "Anchor",
"description": "干员配置要求极高,请留意\\n若缺少干员请自行通过id在一图流基建排班生成器上修改并重新生成导出请勿直接修改以免更新后被覆盖\\n\\n感谢公孙长乐大佬提供数据及方案支持\\n[20230224 修订] 视频地址: https://www.bilibili.com/video/BV1EM411c7Ng\\n请把年放在加工站\\n可自行在一图流排班生成器上自定义班次起止时间",
"id": 1677312017553916,
"title": "243极限效率一天三换需手动菲亚梅塔",
"buildingType": "243",
"planTimes": "3班"
}

93
ArknightsMaaConfig/maa.py Executable file
View File

@ -0,0 +1,93 @@
#!/usr/bin/env python3
import os
import sys
import asyncio
import re
import time
from datetime import datetime
# time record
def fprint(s:str)->None:
print(s)
sys.stdout.flush()
fprint("-------------------------------------------------------")
fprint(datetime.now().strftime("%Y-%m-%d %H:%M:%S"))
fprint("-------------------------------------------------------")
time.sleep(1)
class CommandProcessor:
def Command(self,s:str) -> int:
self._command = s
fprint("_> " + s)
if (t:=os.system(s))!=0:
fprint("Fatal Error: Command Failed:" + s)
fprint("Error Number: " + str(t))
return t
return 0
def RetryCommand(self,s:str,retry:int=3) -> int:
result = 0
while retry > 0:
result = cp.Command(s)
if result == 0:
break
retry-=1
time.sleep(1)
return result
async def AsyncCommand(self,command:str,regex:str):
self._asyncCommand = command
fprint("_> await! " + command)
process = await asyncio.create_subprocess_shell(command,stderr=asyncio.subprocess.PIPE)
while True:
line = (await process.stderr.readline()).decode()
fprint(line)
if re.search(regex, line):
fprint("done")
break
# cp.Command("command")
# cp.RetryCommand("command",retry_time:int)
# asyncio.run(cp.AsyncCommand("command","stop track regex"))
script_dir = os.path.dirname((os.path.abspath(__file__)))
cp = CommandProcessor()
haveError = False
def TaskFailRetry(command:str)->int:
retry = 3
result = 0
while retry > 0:
retry -= 1
result = cp.RetryCommand(command)
if result == 0:
return 0
fprint(f"Task Command is {command}, ret code is {result}")
fprint("Task Failed, retrying...")
cp.RetryCommand("maa closedown")
cp.RetryCommand("maa run startup")
return result
# update
cp.Command("maa update")
cp.Command("maa self update")
# fire it up
cp.Command("docker stop redroid")
os.chdir("/home/lichx/.config/redroid-rk3588/")
cp.Command("docker compose up -d")
time.sleep(15)
cp.RetryCommand("adb connect localhost:5555")
cp.RetryCommand("adb -s localhost:5555 shell am start --windowingMode 4 com.hypergryph.arknights/com.u8.sdk.U8UnityContext")
# run maa
haveError |= TaskFailRetry("maa run startup") != 0
haveError |= TaskFailRetry("maa run recruit") != 0
haveError |= TaskFailRetry("maa run infrast") != 0
haveError |= TaskFailRetry("maa run fight") != 0
haveError |= TaskFailRetry("maa run mall") != 0
haveError |= TaskFailRetry("maa run award") != 0
# storage error log
if haveError:
cp.Command(f"cp {script_dir}/pyshell.log {script_dir}/pyshell.{datetime.now().strftime('%Y-%m-%d-%H-%M-%S')}.log")
# shutdown
cp.RetryCommand("maa closedown")
cp.Command("docker stop redroid")

View File

@ -0,0 +1,11 @@
{
"connection": {
"preset": "ADB"
},
"instance_options": {
"adb_lite_enabled": false,
"deployment_with_pause": false,
"kill_adb_on_exit": false,
"touch_mode": "MaaTouch"
}
}

View File

@ -0,0 +1 @@
adb -s localhost:5555 shell am start --windowingMode 4 com.hypergryph.arknights/com.u8.sdk.U8UnityContext

View File

@ -0,0 +1,12 @@
[[tasks]]
name = "领取奖励"
type = "Award"
[tasks.params]
award = true
mail = true
orundum = true
specialaccess = true
[[tasks.variants]]
condition = { type = "Time", start = "18:00:00", timezone = "Official" }

View File

@ -0,0 +1,31 @@
[[tasks]]
name = "刷理智"
type = "Fight"
# 改变Condition匹配模式
strategy = "merge"
# 周末清理理智药
[[tasks.variants]]
params = { expiring_medicine = 1000 }
[tasks.variants.condition]
type = "And"
conditions = [
{ type = "Time", start = "18:00:00" },
{ type = "Weekday", weekdays = ["Sun"], timezone = "Official"},
]
# 其他时间(?已经没有嘞)刷1-7
[[tasks.variants]]
params = { stage = "1-7" }
# 在夏活期间以外的周一、周四和周六刷AP-5红票
[[tasks.variants]]
condition = { type = "Weekday", weekdays = ["Mon", "Thu", "Sat"], timezone = "Official"}
params = { stage = "AP-5" }
# 在夏活期间以外的周二、周三、周五和周日刷CA-5经验书
[[tasks.variants]]
condition = { type = "Weekday", weekdays = ["Tue", "Wed", "Fri", "Sun"], timezone = "Official"}
params = { stage = "CA-5" }
# ss期间 刷活动关
[[tasks.variants]]
params = { stage = "RS-8" }
condition = { type = "OnSideStory", client = "Official" }

View File

@ -0,0 +1,22 @@
[[tasks]]
name = "基建换班"
type = "Infrast"
[tasks.params]
mode = 10000
facility = ["Trade", "Reception", "Mfg", "Control", "Power", "Office", "Dorm"]
dorm_trust_enabled = true
filename = "normal.json" # 自定义的基建计划的文件名应该位于`$MAA_CONFIG_DIR/infrast`
# 在 18:00:00到第二天的 04:00:00 使用计划 0在 12:00:00 之前使用计划 1之后使用计划 2
[[tasks.variants]]
condition = { type = "Time", start = "22:00:00", end = "08:00:00", timezone = 8 } # 当结束时间小于开始时间时,结束时间被视为第二天的时间
params = { plan_index = 0 }
[[tasks.variants]]
condition = { type = "Time", end = "16:00:00", timezone = 8 } # 如果开始时间被省略,那么只要当前时间小于结束时间时,这个条件就会被匹配
params = { plan_index = 1 }
[[tasks.variants]]
condition = { type = "Time", start = "16:00:00", timezone = 8 } # 如果结束时间被省略,那么只要当前时间大于开始时间时,这个条件就会被匹配
params = { plan_index = 2 }

View File

@ -0,0 +1,7 @@
# 只在18:00:00(CST: 22:00:00)之后进行信用商店相关的操作
[[tasks]]
name = "信用商店"
type = "Mall"
[[tasks.variants]]
condition = { type = "Time", start = "18:00:00", timezone = "Official" }

View File

@ -0,0 +1,18 @@
[[tasks]]
type = "Recruit"
name = "公开招募"
[tasks.params]
refresh = true
select = [4, 5]
confirm = [3, 4, 5]
skip_robot = false
recruitment_time = { '3' = 460 }
[[tasks.variants]]
condition = { type = "Time", start = "17:00:00" }
params = { times = 4 }
# consume refresh times
[[tasks.variants]]
params = { times = 1 }

View File

@ -0,0 +1,4 @@
[[tasks]]
name = "启动游戏" # 任务的名字,可选,默认为任务类型
type = "StartUp" # 任务的类型
params = { client_type = "Official", start_game_enabled = true } # 对应任务的参数

View File

@ -0,0 +1,97 @@
[[tasks]]
name = "启动游戏" # 任务的名字,可选,默认为任务类型
type = "StartUp" # 任务的类型
params = { client_type = "Official", start_game_enabled = true } # 对应任务的参数
[[tasks]]
type = "Recruit"
name = "公开招募"
[tasks.params]
refresh = true
select = [4, 5]
confirm = [3, 4, 5]
skip_robot = false
recruitment_time = { '3' = 460 }
[[tasks.variants]]
condition = { type = "Time", start = "17:00:00" }
params = { times = 4 }
# consume refresh times
[[tasks.variants]]
params = { times = 1 }
[[tasks]]
name = "基建换班"
type = "Infrast"
[tasks.params]
mode = 10000
facility = ["Trade", "Reception", "Mfg", "Control", "Power", "Office", "Dorm"]
dorm_trust_enabled = true
filename = "normal.json" # 自定义的基建计划的文件名应该位于`$MAA_CONFIG_DIR/infrast`
# 在 18:00:00到第二天的 04:00:00 使用计划 0在 12:00:00 之前使用计划 1之后使用计划 2
[[tasks.variants]]
condition = { type = "Time", start = "22:00:00", end = "08:00:00", timezone = 8 } # 当结束时间小于开始时间时,结束时间被视为第二天的时间
params = { plan_index = 0 }
[[tasks.variants]]
condition = { type = "Time", end = "16:00:00", timezone = 8 } # 如果开始时间被省略,那么只要当前时间小于结束时间时,这个条件就会被匹配
params = { plan_index = 1 }
[[tasks.variants]]
condition = { type = "Time", start = "16:00:00", timezone = 8 } # 如果结束时间被省略,那么只要当前时间大于开始时间时,这个条件就会被匹配
params = { plan_index = 2 }
[[tasks]]
name = "刷理智"
type = "Fight"
# 改变Condition匹配模式
strategy = "merge"
# 周末清理理智药
[[tasks.variants]]
params = { expiring_medicine = 1000 }
[tasks.variants.condition]
type = "And"
conditions = [
{ type = "Weekday", weekdays = ["Sun"], timezone = "Official"},
]
# 在夏活期间刷SL-8
[[tasks.variants]]
params = { stage = "GO-8" }
condition = { type = "OnSideStory", client = "Official" }
# 在夏活期间以外的周一、周四和周六刷AP-5红票
[[tasks.variants]]
condition = { type = "Weekday", weekdays = ["Mon", "Thu", "Sat"], timezone = "Official"}
params = { stage = "AP-5" }
# 在夏活期间以外的周二、周三、周五和周日刷CA-5经验书
[[tasks.variants]]
condition = { type = "Weekday", weekdays = ["Tue", "Wed", "Fri", "Sun"], timezone = "Official"}
params = { stage = "CA-5" }
# 其他时间(?已经没有嘞)刷1-7
[[tasks.variants]]
params = { stage = "1-7" }
# 只在18:00:00之后进行信用商店相关的操作
[[tasks]]
name = "信用商店"
type = "Mall"
[[tasks.variants]]
condition = { type = "Time", start = "18:00:00" }
[[tasks]]
name = "领取奖励"
type = "Award"
[tasks.params]
award = true
mail = true
orundum = true
specialaccess = true

4
README.md Normal file
View File

@ -0,0 +1,4 @@
## Lichx's Maa Like software config
目前包括明日方舟(ArknightsMAA)
计划加入重返未来·1999(M9A)