feat: 剿灭关卡在结算时识别周限进度 (#15847)

* feat: 提供了基于任务协议的剿灭刷取进度识别,并以此为依据完成或继续剿灭

* fix: 添加延时以减少极端情况发生可能性

* perf: 简化检查流程

* chore: 移除不再使用的模板图

* perf: task优化

* rft: 识别迁移至掉落插件

* chore: 漏了个图

---------

Co-authored-by: status102 <102887808+status102@users.noreply.github.com>
This commit is contained in:
CH4
2026-04-01 15:06:27 +08:00
committed by GitHub
parent f43dd6ed30
commit 505d1c32c2
2 changed files with 36 additions and 2 deletions

View File

@@ -1368,7 +1368,7 @@
"specificRect": [1260, 100, 10, 10],
"maxTimes": 10,
"postDelay": 3000,
"next": ["EndOfAction", "(ClickCorner + WaitAfterPRTS + StartUpThemes)#next ^ #self", "#self"],
"next": ["EndOfActionAnnihilation", "EndOfAction", "(ClickCorner + WaitAfterPRTS + StartUpThemes)#next ^ #self", "#self"],
"exceededNext": ["RestartGameAndContinue"]
},
"EndOfAction": {
@@ -4022,6 +4022,11 @@
"text": [],
"roi": [52, 52, 18, 18]
},
"StageDrops-AnnihilationWeeklyLimit": {
"baseTask": "NumberOcrReplace",
"roi": [530, 472, 100, 20],
"useRaw": true
},
"act24side_melding_1": {
"baseTask": "StageDrops-StageCF-ItemMatch",
"template": "items/act24side_melding_1.png"

View File

@@ -16,6 +16,7 @@
#include "Utils/Logger.hpp"
#include "Vision/Matcher.h"
#include "Vision/Miscellaneous/StageDropsImageAnalyzer.h"
#include "Vision/RegionOCRer.h"
bool asst::StageDropsTaskPlugin::verify(AsstMsg msg, const json::value& details) const
{
@@ -140,7 +141,8 @@ bool asst::StageDropsTaskPlugin::recognize_drops()
return false;
}
StageDropsImageAnalyzer analyzer(ctrler()->get_image());
const auto& image = ctrler()->get_image();
StageDropsImageAnalyzer analyzer(image);
bool ret = false;
auto append_image = [&]() {
@@ -205,6 +207,33 @@ bool asst::StageDropsTaskPlugin::recognize_drops()
}
if (m_is_annihilation) {
RegionOCRer ocr(image);
ocr.set_task_info("StageDrops-AnnihilationWeeklyLimit");
if (!ocr.analyze()) {
LogError << __FUNCTION__ << "Annihilation weekly limit OCR failed";
}
else {
const auto& result = ocr.get_result().text;
if (auto idx = result.find("/"); idx == std::string::npos) {
LogError << __FUNCTION__ << "Annihilation weekly limit OCR result format error, result:" << result;
}
else {
const std::string cur = result.substr(0, idx);
const std::string total = result.substr(idx + 1);
int cur_num = 0, total_num = 0;
if (!utils::chars_to_number(cur, cur_num) || !utils::chars_to_number(total, total_num)) {
LogError << __FUNCTION__
<< "Annihilation weekly limit OCR result number format error, result:" << result;
}
else {
LogInfo << __FUNCTION__ << "Annihilation weekly limit:" << cur_num << "/" << total_num;
if (cur_num >= total_num) {
LogInfo << __FUNCTION__ << "Annihilation weekly limit reached, stop task";
stop_task();
}
}
}
}
return true;
}