From 0c71faa245cabbf2c69324fb8542e6b2885671ef Mon Sep 17 00:00:00 2001 From: zzyyyl Date: Mon, 29 Aug 2022 23:15:00 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E8=AF=86=E5=88=AB=E5=88=B0=E6=97=A0?= =?UTF-8?q?=E5=A5=96=E5=8A=B1=E5=85=B3=E5=8D=A1=E6=97=B6=E8=87=AA=E5=8A=A8?= =?UTF-8?q?=E5=81=9C=E6=AD=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit fix https://github.com/MaaAssistantArknights/MaaAssistantArknights/issues/325 --- resource/tasks.json | 14 ++++++++++++++ src/MeoAssistant/StageDropsImageAnalyzer.cpp | 10 +++++----- src/MeoAssistant/StageDropsTaskPlugin.cpp | 6 ++++-- 3 files changed, 23 insertions(+), 7 deletions(-) diff --git a/resource/tasks.json b/resource/tasks.json index 3d15a1db58..c5074077b4 100644 --- a/resource/tasks.json +++ b/resource/tasks.json @@ -8348,6 +8348,20 @@ "algorithm": "OcrDetect", "action": "DoNothing", "text": [], + "ocrReplace": [ + [ + "^.*-EX-.*$", + "_INVALID_" + ], + [ + "^.*-S-.*$", + "_INVALID_" + ], + [ + "^.*-MO-.*$", + "_INVALID_" + ] + ], "roi": [ 140, 60, diff --git a/src/MeoAssistant/StageDropsImageAnalyzer.cpp b/src/MeoAssistant/StageDropsImageAnalyzer.cpp index e278ea99eb..516be3fbb7 100644 --- a/src/MeoAssistant/StageDropsImageAnalyzer.cpp +++ b/src/MeoAssistant/StageDropsImageAnalyzer.cpp @@ -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 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 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; diff --git a/src/MeoAssistant/StageDropsTaskPlugin.cpp b/src/MeoAssistant/StageDropsTaskPlugin.cpp index 7b54755c40..5dee9cdf01 100644 --- a/src/MeoAssistant/StageDropsTaskPlugin.cpp +++ b/src/MeoAssistant/StageDropsTaskPlugin.cpp @@ -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;