From 874e06ccb85e962f7e40c7cf215431f02ea95cd6 Mon Sep 17 00:00:00 2001 From: Horror Proton <107091537+horror-proton@users.noreply.github.com> Date: Sat, 30 Jul 2022 10:01:59 +0800 Subject: [PATCH 1/6] fix: fix wrong behavior when recruit permit ran out --- src/MeoAssistant/AutoRecruitTask.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/MeoAssistant/AutoRecruitTask.cpp b/src/MeoAssistant/AutoRecruitTask.cpp index bbd89d7384..7f31595613 100644 --- a/src/MeoAssistant/AutoRecruitTask.cpp +++ b/src/MeoAssistant/AutoRecruitTask.cpp @@ -139,7 +139,9 @@ bool asst::AutoRecruitTask::_run() // m_cur_times means how many times has the confirm button been pressed, NOT expedited plan used while ((m_use_expedited || !m_pending_recruit_slot.empty()) && m_cur_times != m_max_times) { + if (m_force_discard_flag) { return false; } if (m_slot_fail >= slot_retry_limit) { return false; } + if (!check_recruit_home_page()) { return false; } if (m_use_expedited) { Log.info("ready to use expedited"); if (need_exit()) return false; @@ -244,6 +246,7 @@ bool asst::AutoRecruitTask::recruit_one() if (!confirm()) { // ran out of recruit permit? Log.info("Failed to confirm current recruit config."); m_force_discard_flag = true; + click_return_button(); return false; } From a417152a6bdeef6100c90dbc0590397c4ea04ac9 Mon Sep 17 00:00:00 2001 From: uye <2396806385@qq.com> Date: Sat, 30 Jul 2022 10:06:37 +0800 Subject: [PATCH 2/6] =?UTF-8?q?feat:=20=E6=9B=B4=E6=96=B0=E4=BD=9C?= =?UTF-8?q?=E4=B8=9A=E7=BE=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/MeoAsstGui/Resources/Localizations/en-us.xaml | 3 ++- src/MeoAsstGui/Resources/Localizations/ja-jp.xaml | 3 ++- src/MeoAsstGui/Resources/Localizations/ko-kr.xaml | 3 ++- src/MeoAsstGui/Resources/Localizations/pallas.xaml | 3 ++- src/MeoAsstGui/Resources/Localizations/zh-cn.xaml | 3 ++- src/MeoAsstGui/Resources/Localizations/zh-tw.xaml | 3 ++- src/MeoAsstGui/UserControl/AboutUserControl.xaml | 9 ++++++++- 7 files changed, 20 insertions(+), 7 deletions(-) diff --git a/src/MeoAsstGui/Resources/Localizations/en-us.xaml b/src/MeoAsstGui/Resources/Localizations/en-us.xaml index 8f73558f54..e1308360da 100644 --- a/src/MeoAsstGui/Resources/Localizations/en-us.xaml +++ b/src/MeoAsstGui/Resources/Localizations/en-us.xaml @@ -327,9 +327,10 @@ MAA Website Source: GitHub Copilot Json sharing QQ group - QQ group1(Full) + QQ group1 QQ group2 QQ group3 + (Full) Q&A Issue diff --git a/src/MeoAsstGui/Resources/Localizations/ja-jp.xaml b/src/MeoAsstGui/Resources/Localizations/ja-jp.xaml index a263ef6d09..150e5c4b31 100644 --- a/src/MeoAsstGui/Resources/Localizations/ja-jp.xaml +++ b/src/MeoAsstGui/Resources/Localizations/ja-jp.xaml @@ -327,9 +327,10 @@ MAA公式サイト ソースコード:GitHub 自動攻略ファイルシェアQQグループ - グループ1(フル) + グループ1 グループ2 グループ3 + (フル) よくある質問 フィードバック diff --git a/src/MeoAsstGui/Resources/Localizations/ko-kr.xaml b/src/MeoAsstGui/Resources/Localizations/ko-kr.xaml index d0d3c438e6..1472db455b 100644 --- a/src/MeoAsstGui/Resources/Localizations/ko-kr.xaml +++ b/src/MeoAsstGui/Resources/Localizations/ko-kr.xaml @@ -327,9 +327,10 @@ MAA 공식 웹사이트 소스 코드: GitHub 자동 작전 작업 공유 QQ그룹 - QQ그룹1 (만원) + QQ그룹1 QQ그룹2 QQ그룹3 + (만원) 자주 묻는 질문 문제 피드백 diff --git a/src/MeoAsstGui/Resources/Localizations/pallas.xaml b/src/MeoAsstGui/Resources/Localizations/pallas.xaml index 2ac7a0dfb0..350105a476 100644 --- a/src/MeoAsstGui/Resources/Localizations/pallas.xaml +++ b/src/MeoAsstGui/Resources/Localizations/pallas.xaml @@ -327,9 +327,10 @@ 🍸🍷🍺🍺 💃🍺💃🍻💃 🕺🍷🍸🍺🍷🕺🍺 - 🍻🍺🍻🍷 + 🍻🍺 🍷💃 🍺🍻 + 🍻🍷 🍷💃🕺 🍺💃🕺 diff --git a/src/MeoAsstGui/Resources/Localizations/zh-cn.xaml b/src/MeoAsstGui/Resources/Localizations/zh-cn.xaml index 39b0bd8cca..f4a1e10461 100644 --- a/src/MeoAsstGui/Resources/Localizations/zh-cn.xaml +++ b/src/MeoAsstGui/Resources/Localizations/zh-cn.xaml @@ -327,9 +327,10 @@ MAA 官网 源码:GitHub 自动战斗作业分享 Q 群 - 一群(已满) + 一群 二群 三群 + (已满) 常见问题 问题反馈 diff --git a/src/MeoAsstGui/Resources/Localizations/zh-tw.xaml b/src/MeoAsstGui/Resources/Localizations/zh-tw.xaml index b15b1ea77e..4f3e0e0b0b 100644 --- a/src/MeoAsstGui/Resources/Localizations/zh-tw.xaml +++ b/src/MeoAsstGui/Resources/Localizations/zh-tw.xaml @@ -327,9 +327,10 @@ MAA 官網 源碼:GitHub 自動戰鬥作業分享 Q 群 - 一群(已滿) + 一群 二群 三群 + (已滿) 常見問題 問題回饋 diff --git a/src/MeoAsstGui/UserControl/AboutUserControl.xaml b/src/MeoAsstGui/UserControl/AboutUserControl.xaml index 1a38f38791..6771b59b4a 100644 --- a/src/MeoAsstGui/UserControl/AboutUserControl.xaml +++ b/src/MeoAsstGui/UserControl/AboutUserControl.xaml @@ -48,13 +48,20 @@ HorizontalAlignment="Center" VerticalAlignment="Center" Style="{StaticResource TextBlockDefault}"> - + + + + + Date: Sat, 30 Jul 2022 10:20:05 +0800 Subject: [PATCH 3/6] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0=E8=BF=9E?= =?UTF-8?q?=E6=8E=A5=E8=AE=BE=E7=BD=AE=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/MeoAsstGui/Resources/Localizations/en-us.xaml | 1 + src/MeoAsstGui/Resources/Localizations/ja-jp.xaml | 1 + src/MeoAsstGui/Resources/Localizations/ko-kr.xaml | 1 + src/MeoAsstGui/Resources/Localizations/pallas.xaml | 1 + src/MeoAsstGui/Resources/Localizations/zh-cn.xaml | 1 + src/MeoAsstGui/Resources/Localizations/zh-tw.xaml | 1 + src/MeoAsstGui/UserControl/ConnectSettingsUserControl.xaml | 1 + 7 files changed, 7 insertions(+) diff --git a/src/MeoAsstGui/Resources/Localizations/en-us.xaml b/src/MeoAsstGui/Resources/Localizations/en-us.xaml index e1308360da..9703bab899 100644 --- a/src/MeoAsstGui/Resources/Localizations/en-us.xaml +++ b/src/MeoAsstGui/Resources/Localizations/en-us.xaml @@ -119,6 +119,7 @@ Tip: It will be automatically detected here. If there is an error, you can try to modify it again, otherwise you do not need to fill in it yourself ADB path (rel/abs) Connection address + It will be filled in automatically when you use it for the first time. If you encounter any problems, you can try to manually modify it Connection Preset diff --git a/src/MeoAsstGui/Resources/Localizations/ja-jp.xaml b/src/MeoAsstGui/Resources/Localizations/ja-jp.xaml index 150e5c4b31..5aa7b71939 100644 --- a/src/MeoAsstGui/Resources/Localizations/ja-jp.xaml +++ b/src/MeoAsstGui/Resources/Localizations/ja-jp.xaml @@ -119,6 +119,7 @@ ヒント:ここで自動的に検出されます。エラーが発生した場合は、もう一度変更を試みることができます。それ以外の場合は、自分で入力する必要はありません。 adbパス (相対/絶対) 接続先アドレス + はじめて使うと自動で記入されるので、問題があれば手動で修正してみる 接続構成 diff --git a/src/MeoAsstGui/Resources/Localizations/ko-kr.xaml b/src/MeoAsstGui/Resources/Localizations/ko-kr.xaml index 1472db455b..08b622a4a5 100644 --- a/src/MeoAsstGui/Resources/Localizations/ko-kr.xaml +++ b/src/MeoAsstGui/Resources/Localizations/ko-kr.xaml @@ -119,6 +119,7 @@ 팁: 여기에서 자동으로 감지됩니다. 오류가 있는 경우 다시 수정을 시도할 수 있습니다. 그렇지 않으면 직접 입력할 필요가 없습니다. adb 경로 (상대/절대) 연결 주소 + 처음 사용할 때는 자동으로 작성되며, 문제가 있으면 수동으로 수정하십시오 연결 사전 설정 diff --git a/src/MeoAsstGui/Resources/Localizations/pallas.xaml b/src/MeoAsstGui/Resources/Localizations/pallas.xaml index 350105a476..f796b526f4 100644 --- a/src/MeoAsstGui/Resources/Localizations/pallas.xaml +++ b/src/MeoAsstGui/Resources/Localizations/pallas.xaml @@ -119,6 +119,7 @@ 🍸🍻🍻🍸🍸🍻💃🍻🍸🍷🍸🍷🍷💃🍸🍻💃🍷🍺🍺🍸🍷🕺🍷🍷🍷🕺🍻🍷🍸💃🕺🍸🍷🍺 🕺💃🍸🍷🍸💃🍸 🍻🕺🍻 + 🍷🍷🍷🍺🍺🍻💃🍻🍺🍺🍷🍻🕺🍻🕺💃🕺🍸💃🍸🍷🍷🍺🕺🍸 🍸🍷🍻 diff --git a/src/MeoAsstGui/Resources/Localizations/zh-cn.xaml b/src/MeoAsstGui/Resources/Localizations/zh-cn.xaml index f4a1e10461..ac50701ad2 100644 --- a/src/MeoAsstGui/Resources/Localizations/zh-cn.xaml +++ b/src/MeoAsstGui/Resources/Localizations/zh-cn.xaml @@ -119,6 +119,7 @@ 小提示:这里会自动检测的,若出现问题可再尝试修改,否则不需要自行填写 adb 路径 (相对/绝对) 连接地址 + 第一次使用会自动填写,若遇到问题可尝试手动修改 连接配置 diff --git a/src/MeoAsstGui/Resources/Localizations/zh-tw.xaml b/src/MeoAsstGui/Resources/Localizations/zh-tw.xaml index 4f3e0e0b0b..64a92df639 100644 --- a/src/MeoAsstGui/Resources/Localizations/zh-tw.xaml +++ b/src/MeoAsstGui/Resources/Localizations/zh-tw.xaml @@ -119,6 +119,7 @@ 小提示:這裡會自動檢測的,若出現問題可再嘗試修改,否則不需要自行填寫 adb 路徑 (相對/絕對) 連接地址 + 第一次使用會自動填寫,若遇到問題可嘗試手動修改 連接配置 diff --git a/src/MeoAsstGui/UserControl/ConnectSettingsUserControl.xaml b/src/MeoAsstGui/UserControl/ConnectSettingsUserControl.xaml index 333d3c676a..1692e67ee9 100644 --- a/src/MeoAsstGui/UserControl/ConnectSettingsUserControl.xaml +++ b/src/MeoAsstGui/UserControl/ConnectSettingsUserControl.xaml @@ -68,6 +68,7 @@ Width="250" Height="30" Margin="10" + ToolTip="{DynamicResource ConnectionAddressTip}" Text="{Binding ConnectAddress}" /> Date: Sat, 30 Jul 2022 15:45:05 +0800 Subject: [PATCH 4/6] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E5=85=AC=E6=8B=9B?= =?UTF-8?q?=E6=96=87=E6=9C=AC=20`=E5=87=BA=E7=8E=B0=E9=94=99=E8=AF=AF`=20?= =?UTF-8?q?=E7=9A=84=E6=9C=AC=E5=9C=B0=E5=8C=96=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/1379 --- src/MeoAsstGui/Helper/AsstProxy.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/MeoAsstGui/Helper/AsstProxy.cs b/src/MeoAsstGui/Helper/AsstProxy.cs index 542b3d7225..2cffcb470a 100644 --- a/src/MeoAsstGui/Helper/AsstProxy.cs +++ b/src/MeoAsstGui/Helper/AsstProxy.cs @@ -452,7 +452,7 @@ namespace MeoAsstGui case "AutoRecruitTask": { - var why_str = details.TryGetValue("why", out var why) ? why.ToString() : Localization.GetString("出现错误"); + var why_str = details.TryGetValue("why", out var why) ? why.ToString() : Localization.GetString("ErrorOccurred"); mainModel.AddLog(why_str + "," + Localization.GetString("HasReturned"), "darkred"); break; } From 5565d5ad0a313c0786bfb5555031c2e95d1b1ace Mon Sep 17 00:00:00 2001 From: MistEO Date: Sat, 30 Jul 2022 15:55:06 +0800 Subject: [PATCH 5/6] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E6=88=98=E6=96=97?= =?UTF-8?q?=E4=B8=AD=E5=B9=B2=E5=91=98=20cooling=20=E7=8A=B6=E6=80=81?= =?UTF-8?q?=E5=81=B6=E7=8E=B0=E8=AF=86=E5=88=AB=E9=94=99=E8=AF=AF=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 | 10 +++++++++- src/MeoAssistant/BattleImageAnalyzer.cpp | 25 ++++++++++++++---------- src/MeoAssistant/TaskData.cpp | 19 +++++++++++------- 3 files changed, 36 insertions(+), 18 deletions(-) diff --git a/resource/tasks.json b/resource/tasks.json index 2ecdd29246..98692c2370 100644 --- a/resource/tasks.json +++ b/resource/tasks.json @@ -5695,7 +5695,7 @@ }, "BattleOperCooling": { "template": "empty.png", - "specialThreshold": 6000, + "specialThreshold": 1000, "specialThreshold_Doc": "这个任务中作为符合range的像素点数量阈值", "rectMove": [ -45, @@ -5703,9 +5703,17 @@ 75, 120 ], + "maskRange_Doc": "拿来做H通道的范围", "maskRange": [ 0, 10 + ], + "specificRect_Doc": "拿来做S、V通道的范围", + "specificRect": [ + 200, + 255, + 0, + 255 ] }, "BattleOperRoleRange": { diff --git a/src/MeoAssistant/BattleImageAnalyzer.cpp b/src/MeoAssistant/BattleImageAnalyzer.cpp index 720e9894ab..ae6cf5ae32 100644 --- a/src/MeoAssistant/BattleImageAnalyzer.cpp +++ b/src/MeoAssistant/BattleImageAnalyzer.cpp @@ -228,19 +228,24 @@ bool asst::BattleImageAnalyzer::oper_cooling_analyze(const Rect& roi) { const auto cooling_task_ptr = Task.get("BattleOperCooling"); + auto img_roi = m_image(utils::make_rect(roi)); cv::Mat hsv; - cv::cvtColor(m_image(utils::make_rect(roi)), hsv, cv::COLOR_BGR2HSV); - std::vector channels; - cv::split(hsv, channels); - int mask_lowb = cooling_task_ptr->mask_range.first; - int mask_uppb = cooling_task_ptr->mask_range.second; + cv::cvtColor(img_roi, hsv, cv::COLOR_BGR2HSV); + int h_low = cooling_task_ptr->mask_range.first; + int h_up = cooling_task_ptr->mask_range.second; + int s_low = cooling_task_ptr->specific_rect.x; + int s_up = cooling_task_ptr->specific_rect.y; + int v_low = cooling_task_ptr->specific_rect.width; + int v_up = cooling_task_ptr->specific_rect.height; + + cv::Mat bin; + cv::inRange(hsv, cv::Scalar(h_low, s_low, v_low), cv::Scalar(h_up, s_up, v_up), bin); int count = 0; - auto& h_channel = channels.at(0); - for (int i = 0; i != h_channel.rows; ++i) { - for (int j = 0; j != h_channel.cols; ++j) { - cv::uint8_t value = h_channel.at(i, j); - if (mask_lowb < value && value < mask_uppb) { + for (int i = 0; i != bin.rows; ++i) { + for (int j = 0; j != bin.cols; ++j) { + cv::uint8_t value = bin.at(i, j); + if (value) { ++count; } } diff --git a/src/MeoAssistant/TaskData.cpp b/src/MeoAssistant/TaskData.cpp index 22190fd73a..e98bc9e1df 100644 --- a/src/MeoAssistant/TaskData.cpp +++ b/src/MeoAssistant/TaskData.cpp @@ -9,7 +9,6 @@ #include "TemplResource.h" #include "Logger.hpp" - const std::unordered_set& asst::TaskData::get_templ_required() const noexcept { return m_templ_required; @@ -113,12 +112,6 @@ bool asst::TaskData::parse(const json::value& json) } else if (action == "clickrect") { task_info_ptr->action = ProcessTaskAction::ClickRect; - const json::value& rect_json = task_json.at("specificRect"); - task_info_ptr->specific_rect = Rect( - rect_json[0].as_integer(), - rect_json[1].as_integer(), - rect_json[2].as_integer(), - rect_json[3].as_integer()); } else if (action == "swipetotheleft") { task_info_ptr->action = ProcessTaskAction::SwipeToTheLeft; @@ -198,6 +191,18 @@ bool asst::TaskData::parse(const json::value& json) task_info_ptr->rect_move = Rect(); } + if (auto opt = task_json.find("specificRect")) { + auto& rect_arr = opt.value(); + task_info_ptr->specific_rect = Rect( + rect_arr[0].as_integer(), + rect_arr[1].as_integer(), + rect_arr[2].as_integer(), + rect_arr[3].as_integer()); + } + else { + task_info_ptr->specific_rect = Rect(); + } + m_all_tasks_info[name] = task_info_ptr; } #ifdef ASST_DEBUG From 6cf5bf0e01c815dd64ea38693be7e480b02cd5b8 Mon Sep 17 00:00:00 2001 From: Horror Proton <107091537+horror-proton@users.noreply.github.com> Date: Sat, 30 Jul 2022 15:54:20 +0800 Subject: [PATCH 6/6] fix: remove a fake error in auto recruit task --- src/MeoAssistant/AutoRecruitTask.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/MeoAssistant/AutoRecruitTask.cpp b/src/MeoAssistant/AutoRecruitTask.cpp index 7f31595613..47aa89eb9d 100644 --- a/src/MeoAssistant/AutoRecruitTask.cpp +++ b/src/MeoAssistant/AutoRecruitTask.cpp @@ -132,7 +132,7 @@ bool asst::AutoRecruitTask::_run() } if (!m_use_expedited) { // analyze once only - if (!analyze_start_buttons()) return false; + if (!analyze_start_buttons()) return true; } static constexpr size_t slot_retry_limit = 3;