From cdaeffb817f4b3944d95c84522e50705819842dd Mon Sep 17 00:00:00 2001 From: MistEO Date: Thu, 19 May 2022 20:31:21 +0800 Subject: [PATCH] =?UTF-8?q?fix.=E4=BC=98=E5=8C=96=E5=B9=B6=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D=E6=8E=89=E8=90=BD=E8=AF=86=E5=88=AB=E5=85=B3=E5=8D=A1?= =?UTF-8?q?=E5=90=8D=E8=AF=86=E5=88=AB=E9=94=99=E8=AF=AF=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- resource/tasks.json | 8 ++++---- src/MeoAssistant/Controller.cpp | 6 ++++++ src/MeoAssistant/StageDropsConfiger.h | 10 +++++++++- src/MeoAssistant/StageDropsImageAnalyzer.cpp | 2 +- src/MeoAssistant/StageDropsTaskPlugin.cpp | 2 +- 5 files changed, 21 insertions(+), 7 deletions(-) diff --git a/resource/tasks.json b/resource/tasks.json index 8ea444e57e..4cd077205c 100644 --- a/resource/tasks.json +++ b/resource/tasks.json @@ -6407,10 +6407,10 @@ "action": "DoNothing", "text": [], "roi": [ - 98, - 24, - 400, - 135 + 100, + 0, + 450, + 200 ] }, "StageDrops-BaseLine": { diff --git a/src/MeoAssistant/Controller.cpp b/src/MeoAssistant/Controller.cpp index 5cea90c772..98cb3fd72e 100644 --- a/src/MeoAssistant/Controller.cpp +++ b/src/MeoAssistant/Controller.cpp @@ -393,6 +393,12 @@ bool asst::Controller::screencap() { LogTraceFunction; + //if (true) { + // std::unique_lock image_lock(m_image_mutex); + // m_cache_image = cv::imread("err.png"); + // return true; + //} + DecodeFunc decode_raw_with_gzip = [&](const std::vector& data) -> bool { auto unzip_data = gzip::decompress(data.data(), data.size()); Log.trace("unzip data size:", unzip_data.size()); diff --git a/src/MeoAssistant/StageDropsConfiger.h b/src/MeoAssistant/StageDropsConfiger.h index 3583a7106d..be954cd4a6 100644 --- a/src/MeoAssistant/StageDropsConfiger.h +++ b/src/MeoAssistant/StageDropsConfiger.h @@ -64,7 +64,15 @@ namespace asst const auto& get_stage_info(const std::string& code, StageDifficulty difficulty) const { - return m_stage_info.at(StageKey{ code, difficulty }); + StageKey key{ code, difficulty }; + if (auto find_iter = m_stage_info.find(key); + find_iter != m_stage_info.end()) { + return find_iter->second; + } + else { + static StageInfo empty_info; + return empty_info; + } } const auto& get_all_stage_code() const { diff --git a/src/MeoAssistant/StageDropsImageAnalyzer.cpp b/src/MeoAssistant/StageDropsImageAnalyzer.cpp index 92b1bb9b75..473e7a767a 100644 --- a/src/MeoAssistant/StageDropsImageAnalyzer.cpp +++ b/src/MeoAssistant/StageDropsImageAnalyzer.cpp @@ -199,7 +199,7 @@ bool asst::StageDropsImageAnalyzer::analyze_drops() info.quantity = quantity; const std::string& name = ResrcItem.get_item_name(info.item_id); - info.item_name = name.empty() ? "未知材料" : name; + info.item_name = name.empty() ? info.item_id : name; static const std::unordered_map DropTypeName = { { StageDropType::Normal, "NORMAL_DROP" }, diff --git a/src/MeoAssistant/StageDropsTaskPlugin.cpp b/src/MeoAssistant/StageDropsTaskPlugin.cpp index 0d393f0687..4ed9e4117e 100644 --- a/src/MeoAssistant/StageDropsTaskPlugin.cpp +++ b/src/MeoAssistant/StageDropsTaskPlugin.cpp @@ -136,7 +136,7 @@ void asst::StageDropsTaskPlugin::drop_info_callback() json::value info; info["itemId"] = id; const std::string& name = item.get_item_name(id); - info["itemName"] = name.empty() ? "未知材料" : name; + info["itemName"] = name.empty() ? id : name; info["quantity"] = count; stats_vec.emplace_back(std::move(info)); }