mirror of
https://github.com/MaaAssistantArknights/MaaAssistantArknights.git
synced 2026-07-16 09:50:40 +08:00
feat: 为 MaaCore 添加神秘代码支持
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
#include "CopilotTask.h"
|
||||
|
||||
#include <regex>
|
||||
|
||||
#include "Config/Miscellaneous/CopilotConfig.h"
|
||||
#include "Task/Miscellaneous/BattleFormationTask.h"
|
||||
#include "Task/Miscellaneous/BattleProcessTask.h"
|
||||
@@ -42,7 +44,16 @@ bool asst::CopilotTask::set_params(const json::value& params)
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!Copilot.load(utils::path(*filename_opt))) {
|
||||
static const std::regex maa_regex(R"(^maa://(\d+)$)");
|
||||
std::smatch match;
|
||||
|
||||
if (std::regex_match(*filename_opt, match, maa_regex)) {
|
||||
if (!Copilot.parse_magic_code(match[1].str())) {
|
||||
Log.error("CopilotConfig parse failed");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else if (!Copilot.load(utils::path(*filename_opt))) {
|
||||
Log.error("CopilotConfig parse failed");
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user