From a05fafa122ad71f80965626a35088bf788103a71 Mon Sep 17 00:00:00 2001 From: MistEO Date: Mon, 14 Mar 2022 21:48:13 +0800 Subject: [PATCH 1/8] =?UTF-8?q?fix.=E4=BF=AE=E5=A4=8D=E7=89=B9=E5=88=AB?= =?UTF-8?q?=E5=8D=A1=E7=9A=84=E7=94=B5=E8=84=91=E4=B8=8A=EF=BC=8C=E5=85=B3?= =?UTF-8?q?=E5=8D=A1=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 https://github.com/MistEO/MeoAssistantArknights/issues/284 --- resource/tasks.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resource/tasks.json b/resource/tasks.json index f9464ab436..a01c44cdeb 100644 --- a/resource/tasks.json +++ b/resource/tasks.json @@ -438,7 +438,7 @@ }, "StartButton2": { "action": "clickSelf", - "rearDelay": 20000, + "rearDelay": 40000, "roi": [ 1000, 350, From fd5dc17b27bc2227cc7d964abdefe088e8646ad8 Mon Sep 17 00:00:00 2001 From: MistEO Date: Tue, 15 Mar 2022 00:13:43 +0800 Subject: [PATCH 2/8] =?UTF-8?q?fix.=E4=BF=AE=E5=A4=8D=E4=B8=80=E4=BA=9B?= =?UTF-8?q?=E6=B5=AE=E7=82=B9=E6=95=B0=E6=BA=A2=E5=87=BA=E5=AF=BC=E8=87=B4?= =?UTF-8?q?=E7=9A=84=E5=BC=82=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/MeoAssistant/MatchImageAnalyzer.cpp | 2 +- src/MeoAssistant/MultiMatchImageAnalyzer.cpp | 2 +- src/MeoAssistant/OcrPack.cpp | 3 +++ 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/MeoAssistant/MatchImageAnalyzer.cpp b/src/MeoAssistant/MatchImageAnalyzer.cpp index 8217a5004a..6d82296407 100644 --- a/src/MeoAssistant/MatchImageAnalyzer.cpp +++ b/src/MeoAssistant/MatchImageAnalyzer.cpp @@ -105,7 +105,7 @@ bool asst::MatchImageAnalyzer::match_templ(const cv::Mat templ) Log.trace("match_templ |", m_templ_name, "score:", max_val, "rect:", rect.to_string(), "roi:", m_roi.to_string()); } - if (max_val >= m_templ_thres) { + if (m_templ_thres <= max_val && max_val < 2.0) { m_result = { max_val, rect }; return true; } diff --git a/src/MeoAssistant/MultiMatchImageAnalyzer.cpp b/src/MeoAssistant/MultiMatchImageAnalyzer.cpp index 18dd2e9161..b3ed8b6f4a 100644 --- a/src/MeoAssistant/MultiMatchImageAnalyzer.cpp +++ b/src/MeoAssistant/MultiMatchImageAnalyzer.cpp @@ -110,7 +110,7 @@ bool asst::MultiMatchImageAnalyzer::multi_match_templ(const cv::Mat templ) for (int i = 0; i != matched.rows; ++i) { for (int j = 0; j != matched.cols; ++j) { auto value = matched.at(i, j); - if (value >= m_templ_thres) { + if (m_templ_thres <= value && value < 2.0) { Rect rect(j + m_roi.x, i + m_roi.y, templ.cols, templ.rows); bool need_push = true; // 如果有两个点离得太近,只取里面得分高的那个 diff --git a/src/MeoAssistant/OcrPack.cpp b/src/MeoAssistant/OcrPack.cpp index 59742064e3..5bd90c5c24 100644 --- a/src/MeoAssistant/OcrPack.cpp +++ b/src/MeoAssistant/OcrPack.cpp @@ -89,6 +89,9 @@ std::vector asst::OcrPack::recognize(const cv::Mat image, const } std::string text(*(m_strs_buffer + i)); float score = *(m_scores_buffer + i); + if (score > 2.0) { + score = 0; + } TextRect tr{ score, rect, text }; #ifdef ASST_DEBUG From fa3180544bad819f4e3cd1b52be419371716efea Mon Sep 17 00:00:00 2001 From: MistEO Date: Tue, 15 Mar 2022 17:15:53 +0800 Subject: [PATCH 3/8] =?UTF-8?q?feat.=E6=9B=B4=E6=96=B0`=E5=90=BE=E5=AF=BC?= =?UTF-8?q?=E5=85=88=E8=B7=AF`=E6=B4=BB=E5=8A=A8=E5=85=B3=E5=8D=A1?= =?UTF-8?q?=E8=B5=84=E6=BA=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/MeoAssistant/Version.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/MeoAssistant/Version.h b/src/MeoAssistant/Version.h index 4051c4c325..72b11796a3 100644 --- a/src/MeoAssistant/Version.h +++ b/src/MeoAssistant/Version.h @@ -2,5 +2,5 @@ namespace asst { - constexpr static const char* Version = "v3.0.6"; + constexpr static const char* Version = "v3.0.7"; } From 4e8e8d3d136a55be2546f9d6a56888822c57b7bd Mon Sep 17 00:00:00 2001 From: MistEO Date: Wed, 16 Mar 2022 01:04:23 +0800 Subject: [PATCH 4/8] =?UTF-8?q?fix.=E4=BF=AE=E5=A4=8D=E5=9F=BA=E5=BB=BAall?= =?UTF-8?q?owExternal=E5=AD=97=E6=AE=B5=E4=B8=8D=E7=94=9F=E6=95=88?= =?UTF-8?q?=E5=8F=8A=E5=A4=96=E9=83=A8=E5=B9=B2=E5=91=98=E9=80=89=E6=8B=A9?= =?UTF-8?q?=E9=94=99=E8=AF=AF=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit https://github.com/MistEO/MeoAssistantArknights/issues/288 --- src/MeoAssistant/InfrastConfiger.cpp | 1 + src/MeoAssistant/InfrastProductionTask.cpp | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/MeoAssistant/InfrastConfiger.cpp b/src/MeoAssistant/InfrastConfiger.cpp index 17e2f278aa..76f2e761f3 100644 --- a/src/MeoAssistant/InfrastConfiger.cpp +++ b/src/MeoAssistant/InfrastConfiger.cpp @@ -197,6 +197,7 @@ bool asst::InfrastConfiger::parse(const json::value& json) } group.optional.emplace_back(std::move(comb)); } + group.allow_external = group_json.get("allowExternal", false); group_vec.emplace_back(std::move(group)); } m_skills_groups.emplace(facility_name, std::move(group_vec)); diff --git a/src/MeoAssistant/InfrastProductionTask.cpp b/src/MeoAssistant/InfrastProductionTask.cpp index 2ff385bd87..cc351f7ac6 100644 --- a/src/MeoAssistant/InfrastProductionTask.cpp +++ b/src/MeoAssistant/InfrastProductionTask.cpp @@ -408,8 +408,9 @@ bool asst::InfrastProductionTask::optimal_calc() // 允许外部的话,就把单个干员凑进来 if (group.allow_external) { for (size_t i = cur_combs.size(); i != cur_max_num_of_opers; ++i) { - cur_combs.emplace_back(cur_available_opers.at(i)); - cur_efficient += cur_available_opers.at(i).efficient.at(m_product); + size_t index = i - cur_combs.size(); + cur_combs.emplace_back(cur_available_opers.at(index)); + cur_efficient += cur_available_opers.at(index).efficient.at(m_product); } } else { // 否则这个组合人不够,就不可用了 From e2099fb07b98631c4cc77d3cc3a70d2a6c292dd7 Mon Sep 17 00:00:00 2001 From: MistEO Date: Fri, 18 Mar 2022 12:34:04 +0800 Subject: [PATCH 5/8] docs. RENAME!!! --- README.md | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index cb392b0cd2..3343da9ac8 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ LOGO -# MeoAssistantArknights +# MaaAssistantArknights
@@ -12,15 +12,15 @@ platform
- license - commit - stars + license + commit + stars

-A Game Assistant for Arknights +MAA 的意思是 MAA Assistant Arknights -一款明日方舟游戏小助手,简称 MAA +一款明日方舟游戏小助手 基于图像识别技术,一键完成全部日常任务! @@ -43,8 +43,8 @@ A Game Assistant for Arknights ## 下载地址 -[稳定版](https://github.com/MistEO/MeoAssistantArknights/releases/latest) -[测试版](https://github.com/MistEO/MeoAssistantArknights/releases) +[稳定版](https://github.com/MaaAssistantArknights/MaaAssistantArknights/releases/latest) +[测试版](https://github.com/MaaAssistantArknights/MaaAssistantArknights/releases) ## 使用说明 @@ -70,7 +70,7 @@ A Game Assistant for Arknights ## 关联项目 -- 全新 GUI: [MeoAsstElectronUI](https://github.com/MaaAssistantArknights/MeoAsstElectronUI) (正在开发中) +- 全新 GUI: [MaaAsstElectronUI](https://github.com/MaaAssistantArknights/MaaAsstElectronUI) (正在开发中) - 更新服务器: [MaaDownloadServer](https://github.com/MaaAssistantArknights/MaaDownloadServer)(正在开发中) ## 致谢 @@ -120,9 +120,9 @@ A Game Assistant for Arknights ### API -- [C 接口](https://github.com/MistEO/MeoAssistantArknights/blob/dev/include/AsstCaller.h) -- [Python 接口](https://github.com/MistEO/MeoAssistantArknights/wiki/Python-%E6%8E%A5%E5%8F%A3) -- [Golang 接口](https://github.com/MistEO/MeoAssistantArknights/wiki/Golang-%E6%8E%A5%E5%8F%A3) +- [C 接口](https://github.com/MaaAssistantArknights/MaaAssistantArknights/blob/dev/include/AsstCaller.h) +- [Python 接口](https://github.com/MaaAssistantArknights/MaaAssistantArknights/wiki/Python-%E6%8E%A5%E5%8F%A3) +- [Golang 接口](https://github.com/MaaAssistantArknights/MaaAssistantArknights/wiki/Golang-%E6%8E%A5%E5%8F%A3) - [回调消息协议](docs/回调消息协议.md) ## 声明 From e86639f9f5ba70561964014fbadec64dac971510 Mon Sep 17 00:00:00 2001 From: MistEO Date: Sun, 20 Mar 2022 01:08:44 +0800 Subject: [PATCH 6/8] =?UTF-8?q?fix.=E4=BF=AE=E5=A4=8D=E2=80=9C=E4=BF=A1?= =?UTF-8?q?=E8=B5=96=E5=B7=B2=E6=BB=A1=E2=80=9D=E5=8D=A1=E4=BD=8F=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit https://github.com/MaaAssistantArknights/MaaAssistantArknights/issues/292 --- resource/tasks.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resource/tasks.json b/resource/tasks.json index a01c44cdeb..2704f6d957 100644 --- a/resource/tasks.json +++ b/resource/tasks.json @@ -1825,7 +1825,7 @@ "text": [ "可收获", "订单交付", - "信赖" + "员信赖" ], "action": "clickSelf", "roi": [ From 113f764d82b069fe6612d9e5b3dda91a0e8e3a02 Mon Sep 17 00:00:00 2001 From: MistEO Date: Sun, 20 Mar 2022 01:10:46 +0800 Subject: [PATCH 7/8] =?UTF-8?q?chore.=E6=9B=B4=E6=96=B0=E7=89=88=E6=9C=AC?= =?UTF-8?q?=E5=8F=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/MeoAssistant/Version.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/MeoAssistant/Version.h b/src/MeoAssistant/Version.h index 72b11796a3..7fd02ca9cc 100644 --- a/src/MeoAssistant/Version.h +++ b/src/MeoAssistant/Version.h @@ -2,5 +2,5 @@ namespace asst { - constexpr static const char* Version = "v3.0.7"; + constexpr static const char* Version = "v3.0.8"; } From cadba5d9a5790961f4263fc791fb98bfdbdf0839 Mon Sep 17 00:00:00 2001 From: MistEO Date: Mon, 21 Mar 2022 11:15:07 +0800 Subject: [PATCH 8/8] =?UTF-8?q?fix.=E4=BF=AE=E5=A4=8Dadb=E5=91=BD=E4=BB=A4?= =?UTF-8?q?=E8=B6=85=E6=97=B6=E5=AF=BC=E8=87=B4=E5=8D=A1=E4=BD=8F=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/MeoAssistant/Controller.cpp | 22 ++++++++++++++++------ src/MeoAssistant/Controller.h | 2 +- 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/src/MeoAssistant/Controller.cpp b/src/MeoAssistant/Controller.cpp index 9c0b41bf56..1fb93372d9 100644 --- a/src/MeoAssistant/Controller.cpp +++ b/src/MeoAssistant/Controller.cpp @@ -234,7 +234,7 @@ void asst::Controller::pipe_working_proc() m_cmd_queue.pop(); cmd_queue_lock.unlock(); // todo 判断命令是否执行成功 - call_command(cmd); + call_command(cmd, 20 * 1000); ++m_completed_id; } //else if (!m_thread_idle) { // 队列中没有任务,又不是闲置的时候,就去截图 @@ -398,14 +398,22 @@ bool asst::Controller::try_capture(const EmulatorInfo & info, bool without_handl // } //} -std::optional> asst::Controller::call_command(const std::string & cmd) +std::optional> asst::Controller::call_command(const std::string & cmd, int64_t timeout) { LogTraceFunction; + std::vector pipe_data; + static std::mutex pipe_mutex; std::unique_lock pipe_lock(pipe_mutex); - std::vector pipe_data; + auto start_time = std::chrono::steady_clock::now(); + auto check_timeout = [&]() -> bool { + return timeout && + timeout < std::chrono::duration_cast( + std::chrono::steady_clock::now() - start_time) + .count(); + }; #ifdef _WIN32 PROCESS_INFORMATION process_info = { 0 }; // 进程信息结构体 @@ -423,10 +431,12 @@ std::optional> asst::Controller::call_command(const s pipe_data.insert(pipe_data.end(), m_pipe_buffer.get(), m_pipe_buffer.get() + read_num); } } - } while (::WaitForSingleObject(process_info.hProcess, 0) == WAIT_TIMEOUT); + } while (::WaitForSingleObject(process_info.hProcess, 0) == WAIT_TIMEOUT && !check_timeout()); DWORD exit_ret = 255; - ::GetExitCodeProcess(process_info.hProcess, &exit_ret); + if (!check_timeout()) { + ::GetExitCodeProcess(process_info.hProcess, &exit_ret); + } ::CloseHandle(process_info.hProcess); ::CloseHandle(process_info.hThread); @@ -462,7 +472,7 @@ std::optional> asst::Controller::call_command(const s pipe_data.insert(pipe_data.end(), m_pipe_buffer.get(), m_pipe_buffer.get() + read_num); read_num = read(m_pipe_out[PIPE_READ], m_pipe_buffer.get(), PipeBuffSize); }; - } while (::waitpid(m_child, &exit_ret, WNOHANG) == 0); + } while (::waitpid(m_child, &exit_ret, WNOHANG) == 0 && !check_timeout()); } else { // failed to create child process diff --git a/src/MeoAssistant/Controller.h b/src/MeoAssistant/Controller.h index 0c06954a60..dbdf3df123 100644 --- a/src/MeoAssistant/Controller.h +++ b/src/MeoAssistant/Controller.h @@ -67,7 +67,7 @@ namespace asst bool connect_adb(const std::string& address); void pipe_working_proc(); - std::optional> call_command(const std::string& cmd); + std::optional> call_command(const std::string& cmd, int64_t timeout = 0); int push_cmd(const std::string& cmd); using DecodeFunc = std::function&)>;