mirror of
https://github.com/MaaAssistantArknights/MaaAssistantArknights.git
synced 2026-07-20 02:55:38 +08:00
chore: revert some changes on analyze_baseline
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
|
||||
#include "Common/AsstTypes.h"
|
||||
#include "Common/AsstVersion.h"
|
||||
#include "Config/GeneralConfig.h"
|
||||
#include "Config/Miscellaneous/ItemConfig.h"
|
||||
#include "Config/Miscellaneous/StageDropsConfig.h"
|
||||
#include "Config/TaskData.h"
|
||||
@@ -115,28 +116,26 @@ bool asst::StageDropsTaskPlugin::recognize_drops()
|
||||
StageDropsImageAnalyzer analyzer(image_stride);
|
||||
|
||||
bool ret = false;
|
||||
Point cropped_out = {};
|
||||
while (!analyzer.analyze_baseline(cropped_out)) {
|
||||
while (true) {
|
||||
ret = false;
|
||||
if (cropped_out == Point {}) break; // other error, return false
|
||||
|
||||
// else: more materials to reveal?
|
||||
// more materials to reveal?
|
||||
|
||||
auto swipe_begin = Point { WindowWidthDefault - 40, 632 };
|
||||
|
||||
cropped_out.y -= 4;
|
||||
cropped_out.x -= image_stride.cols - WindowWidthDefault;
|
||||
const int swipe_dist = 200;
|
||||
ctrler()->swipe(cropped_out, cropped_out + swipe_dist * Point::left(), 1000, true);
|
||||
sleep(2000);
|
||||
ctrler()->swipe(swipe_begin, swipe_begin + swipe_dist * Point::left(), 500, true, 2, 0);
|
||||
sleep(Config.get_options().task_delay * 3);
|
||||
|
||||
const cv::Rect ref_roi = { image_stride.cols - 320, 520, 280, 120 };
|
||||
const cv::Rect ref_roi = { image_stride.cols - 320, 530, 280, 100 };
|
||||
auto new_img = ctrler()->get_image();
|
||||
|
||||
// find relative position of old image on new one
|
||||
Matcher offset_match(new_img(cv::Rect { 0, ref_roi.y, new_img.cols, ref_roi.height }));
|
||||
offset_match.set_templ(image_stride(ref_roi));
|
||||
offset_match.set_threshold(0.7);
|
||||
if (!offset_match.analyze()) break;
|
||||
|
||||
// int offset = ref_roi.x - offset_match.get_result().rect.x;
|
||||
const int offset = (new_img.cols - offset_match.get_result().rect.x) - (image_stride.cols - ref_roi.x);
|
||||
Log.trace("new image offset:", offset);
|
||||
if (offset <= 4) {
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
#include <numbers>
|
||||
#include <regex>
|
||||
|
||||
#include "Common/AsstTypes.h"
|
||||
#include "Utils/Ranges.hpp"
|
||||
|
||||
#include "Utils/NoWarningCV.h"
|
||||
@@ -227,7 +226,7 @@ bool asst::StageDropsImageAnalyzer::analyze_drops()
|
||||
{
|
||||
LogTraceFunction;
|
||||
|
||||
if (Point p {}; !analyze_baseline(p) && p == Point {}) {
|
||||
if (!analyze_baseline()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -362,7 +361,7 @@ bool asst::StageDropsImageAnalyzer::analyze_drops_for_12()
|
||||
return !flag_analyzer.analyze();
|
||||
}
|
||||
|
||||
bool asst::StageDropsImageAnalyzer::analyze_baseline(Point& cropped_out)
|
||||
bool asst::StageDropsImageAnalyzer::analyze_baseline()
|
||||
{
|
||||
LogTraceFunction;
|
||||
|
||||
@@ -463,11 +462,8 @@ bool asst::StageDropsImageAnalyzer::analyze_baseline(Point& cropped_out)
|
||||
}
|
||||
|
||||
if (m_image.cols - (x_offset + bounding_rect.width) < 30 + max_spacing) {
|
||||
cropped_out.x = x_offset + bounding_rect.width;
|
||||
cropped_out.y = task_ptr->roi.y;
|
||||
Log.trace("bounding_rect.right=", cropped_out.x, ", more materials to reveal?");
|
||||
return false;
|
||||
}
|
||||
Log.trace("bounding_rect.right=", x_offset + bounding_rect.width, ", more materials to reveal?");
|
||||
} // TODO: else tell caller to prevent unnecessary swipe
|
||||
|
||||
return !m_baseline.empty();
|
||||
}
|
||||
|
||||
@@ -23,13 +23,12 @@ namespace asst
|
||||
// <drop_type, <item_id, quantity>>
|
||||
const auto& get_drops() const noexcept { return m_drops; }
|
||||
|
||||
bool analyze_baseline(Point& cropped_out);
|
||||
|
||||
protected:
|
||||
bool analyze_stage_code();
|
||||
bool analyze_times();
|
||||
bool analyze_stars();
|
||||
bool analyze_difficulty();
|
||||
bool analyze_baseline();
|
||||
bool analyze_drops();
|
||||
// 落叶殇火 活动(异格夜刀), act24side, 2023-03
|
||||
bool analyze_drops_for_CF();
|
||||
|
||||
Reference in New Issue
Block a user