Merge remote-tracking branch 'origin/dev' into dev

This commit is contained in:
lhhxxxxx
2022-07-30 18:22:10 +08:00
13 changed files with 68 additions and 27 deletions

View File

@@ -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": {

View File

@@ -132,14 +132,16 @@ 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;
// 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;
}

View File

@@ -228,19 +228,24 @@ bool asst::BattleImageAnalyzer::oper_cooling_analyze(const Rect& roi)
{
const auto cooling_task_ptr = Task.get<MatchTaskInfo>("BattleOperCooling");
auto img_roi = m_image(utils::make_rect<cv::Rect>(roi));
cv::Mat hsv;
cv::cvtColor(m_image(utils::make_rect<cv::Rect>(roi)), hsv, cv::COLOR_BGR2HSV);
std::vector<cv::Mat> 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<cv::uint8_t>(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<cv::uint8_t>(i, j);
if (value) {
++count;
}
}

View File

@@ -9,7 +9,6 @@
#include "TemplResource.h"
#include "Logger.hpp"
const std::unordered_set<std::string>& 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<json::array>("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

View File

@@ -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;
}

View File

@@ -119,6 +119,7 @@
<system:String x:Key="ADBTip">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</system:String>
<system:String x:Key="ADBPath">ADB path (rel/abs)</system:String>
<system:String x:Key="ConnectionAddress">Connection address</system:String>
<system:String x:Key="ConnectionAddressTip">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</system:String>
<system:String x:Key="ConnectionPreset">Connection Preset</system:String>
<!-- Settings -->
@@ -327,9 +328,10 @@
<system:String x:Key="Website">MAA Website</system:String>
<system:String x:Key="Github">Source: GitHub</system:String>
<system:String x:Key="QQgroup">Copilot Json sharing QQ group</system:String>
<system:String x:Key="QQgroup1">QQ group1(Full)</system:String>
<system:String x:Key="QQgroup1">QQ group1</system:String>
<system:String x:Key="QQgroup2">QQ group2</system:String>
<system:String x:Key="QQgroup3">QQ group3</system:String>
<system:String x:Key="QQgroupfull">(Full)</system:String>
<system:String x:Key="Help">Q&amp;A</system:String>
<system:String x:Key="Issue">Issue</system:String>
<!-- AboutUser -->

View File

@@ -119,6 +119,7 @@
<system:String x:Key="ADBTip">ヒント:ここで自動的に検出されます。エラーが発生した場合は、もう一度変更を試みることができます。それ以外の場合は、自分で入力する必要はありません。</system:String>
<system:String x:Key="ADBPath">adbパス (相対/絶対)</system:String>
<system:String x:Key="ConnectionAddress">接続先アドレス</system:String>
<system:String x:Key="ConnectionAddressTip">はじめて使うと自動で記入されるので、問題があれば手動で修正してみる</system:String>
<system:String x:Key="ConnectionPreset">接続構成</system:String>
<!-- 設定 -->
@@ -327,9 +328,10 @@
<system:String x:Key="Website">MAA公式サイト</system:String>
<system:String x:Key="Github">ソースコードGitHub</system:String>
<system:String x:Key="QQgroup">自動攻略ファイルシェアQQグループ</system:String>
<system:String x:Key="QQgroup1">グループ1(フル)</system:String>
<system:String x:Key="QQgroup1">グループ1</system:String>
<system:String x:Key="QQgroup2">グループ2</system:String>
<system:String x:Key="QQgroup3">グループ3</system:String>
<system:String x:Key="QQgroupfull">(フル)</system:String>
<system:String x:Key="Help">よくある質問</system:String>
<system:String x:Key="Issue">フィードバック</system:String>
<!-- About -->

View File

@@ -119,6 +119,7 @@
<system:String x:Key="ADBTip">팁: 여기에서 자동으로 감지됩니다. 오류가 있는 경우 다시 수정을 시도할 수 있습니다. 그렇지 않으면 직접 입력할 필요가 없습니다.</system:String>
<system:String x:Key="ADBPath">adb 경로 (상대/절대)</system:String>
<system:String x:Key="ConnectionAddress">연결 주소</system:String>
<system:String x:Key="ConnectionAddressTip">처음 사용할 때는 자동으로 작성되며, 문제가 있으면 수동으로 수정하십시오</system:String>
<system:String x:Key="ConnectionPreset">연결 사전 설정</system:String>
<!-- 설정 -->
@@ -327,9 +328,10 @@
<system:String x:Key="Website">MAA 공식 웹사이트</system:String>
<system:String x:Key="Github">소스 코드: GitHub</system:String>
<system:String x:Key="QQgroup">자동 작전 작업 공유 QQ그룹</system:String>
<system:String x:Key="QQgroup1">QQ그룹1 (만원)</system:String>
<system:String x:Key="QQgroup1">QQ그룹1</system:String>
<system:String x:Key="QQgroup2">QQ그룹2</system:String>
<system:String x:Key="QQgroup3">QQ그룹3</system:String>
<system:String x:Key="QQgroupfull">(만원)</system:String>
<system:String x:Key="Help">자주 묻는 질문</system:String>
<system:String x:Key="Issue">문제 피드백</system:String>
<!-- About -->

View File

@@ -119,6 +119,7 @@
<system:String x:Key="ADBTip">🍸🍻🍻🍸🍸🍻💃🍻🍸🍷🍸🍷🍷💃🍸🍻💃🍷🍺🍺🍸🍷🕺🍷🍷🍷🕺🍻🍷🍸💃🕺🍸🍷🍺</system:String>
<system:String x:Key="ADBPath">🕺💃🍸🍷🍸💃🍸</system:String>
<system:String x:Key="ConnectionAddress">🍻🕺🍻</system:String>
<system:String x:Key="ConnectionAddressTip">🍷🍷🍷🍺🍺🍻💃🍻🍺🍺🍷🍻🕺🍻🕺💃🕺🍸💃🍸🍷🍷🍺🕺🍸</system:String>
<system:String x:Key="ConnectionPreset">🍸🍷🍻</system:String>
<!-- 设置 -->
@@ -327,9 +328,10 @@
<system:String x:Key="Website">🍸🍷🍺🍺</system:String>
<system:String x:Key="Github">💃🍺💃🍻💃</system:String>
<system:String x:Key="QQgroup">🕺🍷🍸🍺🍷🕺🍺</system:String>
<system:String x:Key="QQgroup1">🍻🍺🍻🍷</system:String>
<system:String x:Key="QQgroup1">🍻🍺</system:String>
<system:String x:Key="QQgroup2">🍷💃</system:String>
<system:String x:Key="QQgroup3">🍺🍻</system:String>
<system:String x:Key="QQgroupfull">🍻🍷</system:String>
<system:String x:Key="Help">🍷💃🕺</system:String>
<system:String x:Key="Issue">🍺💃🕺</system:String>
<!-- About -->

View File

@@ -119,6 +119,7 @@
<system:String x:Key="ADBTip">小提示:这里会自动检测的,若出现问题可再尝试修改,否则不需要自行填写</system:String>
<system:String x:Key="ADBPath">adb 路径 (相对/绝对)</system:String>
<system:String x:Key="ConnectionAddress">连接地址</system:String>
<system:String x:Key="ConnectionAddressTip">第一次使用会自动填写,若遇到问题可尝试手动修改</system:String>
<system:String x:Key="ConnectionPreset">连接配置</system:String>
<!-- 设置 -->
@@ -327,9 +328,10 @@
<system:String x:Key="Website">MAA 官网</system:String>
<system:String x:Key="Github">源码GitHub</system:String>
<system:String x:Key="QQgroup">自动战斗作业分享 Q 群</system:String>
<system:String x:Key="QQgroup1">一群(已满)</system:String>
<system:String x:Key="QQgroup1">一群</system:String>
<system:String x:Key="QQgroup2">二群</system:String>
<system:String x:Key="QQgroup3">三群</system:String>
<system:String x:Key="QQgroupfull">(已满)</system:String>
<system:String x:Key="Help">常见问题</system:String>
<system:String x:Key="Issue">问题反馈</system:String>
<!-- About -->

View File

@@ -119,6 +119,7 @@
<system:String x:Key="ADBTip">小提示:這裡會自動檢測的,若出現問題可再嘗試修改,否則不需要自行填寫</system:String>
<system:String x:Key="ADBPath">adb 路徑 (相對/絕對)</system:String>
<system:String x:Key="ConnectionAddress">連接地址</system:String>
<system:String x:Key="ConnectionAddressTip">第一次使用會自動填寫,若遇到問題可嘗試手動修改</system:String>
<system:String x:Key="ConnectionPreset">連接配置</system:String>
<!-- 設定 -->
@@ -327,9 +328,10 @@
<system:String x:Key="Website">MAA 官網</system:String>
<system:String x:Key="Github">源碼GitHub</system:String>
<system:String x:Key="QQgroup">自動戰鬥作業分享 Q 群</system:String>
<system:String x:Key="QQgroup1">一群(已滿)</system:String>
<system:String x:Key="QQgroup1">一群</system:String>
<system:String x:Key="QQgroup2">二群</system:String>
<system:String x:Key="QQgroup3">三群</system:String>
<system:String x:Key="QQgroupfull">(已滿)</system:String>
<system:String x:Key="Help">常見問題</system:String>
<system:String x:Key="Issue">問題回饋</system:String>
<!-- About -->

View File

@@ -48,13 +48,20 @@
HorizontalAlignment="Center"
VerticalAlignment="Center"
Style="{StaticResource TextBlockDefault}">
<TextBlock Text="{DynamicResource QQgroup1}" />
<Hyperlink
Click="Hyperlink_Click"
NavigateUri="https://jq.qq.com/?_wv=1027&amp;k=xRh6gqQZ"
TextDecorations="None">
<TextBlock Text="{DynamicResource QQgroup1}" />
</Hyperlink>
<TextBlock Text="{DynamicResource QQgroupfull}" />
<Hyperlink
Click="Hyperlink_Click"
NavigateUri="https://jq.qq.com/?_wv=1027&amp;k=u9i2n7Sb"
TextDecorations="None">
<TextBlock Text="{DynamicResource QQgroup2}" />
</Hyperlink>
<TextBlock Text="{DynamicResource QQgroupfull}" />
<Hyperlink
Click="Hyperlink_Click"
Cursor="Hand"

View File

@@ -68,6 +68,7 @@
Width="250"
Height="30"
Margin="10"
ToolTip="{DynamicResource ConnectionAddressTip}"
Text="{Binding ConnectAddress}" />
<TextBlock