feat: 识别到无奖励关卡时自动停止

fix https://github.com/MaaAssistantArknights/MaaAssistantArknights/issues/325
This commit is contained in:
zzyyyl
2022-08-29 23:15:00 +08:00
parent f736fa5474
commit 0c71faa245
3 changed files with 23 additions and 7 deletions

View File

@@ -8348,6 +8348,20 @@
"algorithm": "OcrDetect",
"action": "DoNothing",
"text": [],
"ocrReplace": [
[
"^.*-EX-.*$",
"_INVALID_"
],
[
"^.*-S-.*$",
"_INVALID_"
],
[
"^.*-MO-.*$",
"_INVALID_"
]
],
"roi": [
140,
60,

View File

@@ -56,11 +56,11 @@ bool asst::StageDropsImageAnalyzer::analyze_stage_code()
OcrImageAnalyzer analyzer(m_image);
analyzer.set_task_info("StageDrops-StageName");
const auto& stages = Resrc.drops().get_all_stage_code();
std::vector<std::string> stages_req(stages.cbegin(), stages.cend());
// 名字长的放前面
ranges::sort(stages_req, std::greater {}, std::mem_fn(&std::string::size));
analyzer.set_required(std::move(stages_req));
// const auto& stages = Resrc.drops().get_all_stage_code();
// std::vector<std::string> stages_req(stages.cbegin(), stages.cend());
// // 名字长的放前面
// ranges::sort(stages_req, std::greater {}, std::mem_fn(&std::string::size));
// analyzer.set_required(std::move(stages_req));
if (!analyzer.analyze()) {
return false;

View File

@@ -215,6 +215,7 @@ void asst::StageDropsTaskPlugin::upload_to_penguin()
std::string stage_id = m_cur_info_json.get("stage", "stageId", std::string());
if (stage_id.empty()) {
cb_info["why"] = "未知关卡";
cb_info["details"] = json::object { { "stage_code", m_stage_code } };
callback(AsstMsg::SubTaskError, cb_info);
return;
}
@@ -287,11 +288,12 @@ void asst::StageDropsTaskPlugin::upload_to_penguin()
bool asst::StageDropsTaskPlugin::check_stage_valid()
{
LogTraceFunction;
static const std::string invalid_stage_code = "_INVALID_";
if (m_stage_code.find("-EX-") != std::string::npos) {
if (m_stage_code == invalid_stage_code) {
json::value info = basic_info();
info["subtask"] = "CheckStageValid";
info["why"] = "EX关卡";
info["why"] = "无奖励关卡";
callback(AsstMsg::SubTaskError, info);
return false;