mirror of
https://github.com/MaaAssistantArknights/MaaAssistantArknights.git
synced 2026-07-17 18:01:26 +08:00
fix: 博朗台计算等待时间失败数据处理
This commit is contained in:
@@ -69,6 +69,7 @@ int asst::DrGrandetTaskPlugin::analyze_time_left(const cv::Mat& image)
|
||||
analyzer.set_use_char_model(false);
|
||||
|
||||
if (!analyzer.analyze()) {
|
||||
Log.warn(__FUNCTION__, "unable to analyze time");
|
||||
return -1;
|
||||
}
|
||||
auto text = analyzer.get_result().front().text;
|
||||
@@ -76,6 +77,7 @@ int asst::DrGrandetTaskPlugin::analyze_time_left(const cv::Mat& image)
|
||||
auto regex = std::regex(R"((\d):(\d?)(\d?))");
|
||||
std::smatch match;
|
||||
if (!std::regex_search(text, match, regex)) {
|
||||
Log.warn(__FUNCTION__, "Unable to match time:", text);
|
||||
return -1;
|
||||
}
|
||||
std::string time = match.str(0);
|
||||
|
||||
@@ -104,7 +104,9 @@ bool asst::MedicineCounterTaskPlugin::_run()
|
||||
|
||||
if (*sanity_target >= *sanity_max) [[unlikely]] {
|
||||
auto waitTime = DrGrandetTaskPlugin::analyze_time_left(image);
|
||||
sleep(waitTime);
|
||||
if (waitTime > 0) {
|
||||
sleep(waitTime);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user