fix(AutoLeyLineOutcrop): 修复OCR物理识别和区域匹配问题 (#2708)

- 添加调试日志输出ocrPhysical数据
- 移除ocrPhysical.ok验证条件以提高兼容性
- 使用可选链操作符安全访问remainder属性
- 更新版本号从4.5到4.5.1
- 调整添加按钮识别区域坐标和尺寸参数
This commit is contained in:
云端客
2026-01-17 21:00:53 +08:00
committed by GitHub
parent 5193369b1c
commit 697b044600
3 changed files with 8 additions and 7 deletions

View File

@@ -1,7 +1,7 @@
{
"manifest_version": 1,
"name": "全自动地脉花",
"version": "4.5",
"version": "4.5.1",
"tags": ["地脉花"],
"bgi_version": "0.52.0",
"description": "基于OCR图像识别的全自动刷取地脉花。\n💡更多信息请查看README! \n\n----------注意事项----------\n●仅支持BetterGI 0.52.0 及以上版本!\n●部分地脉花因特殊原因不支持全自动具体的点位请在手册中查看。\n●树脂使用的优先级2倍原粹树脂 > 浓缩树脂 > 原粹树脂。\n●运行时会传送到七天神像设置中设置的七天神像需要关闭七天神像设置中的“是否就近七天神像恢复血量”并指定七天神像。\n●战斗策略注意调度器设置中地图追踪行走配置里的“允许在JsSpript中使用”和“覆盖JS中的自动战斗配置”只有在都打开的情况下脚本才会使用下面的战斗配置否则会使用独立任务中的战斗策略。战斗超时时间不能大于脚本自定义配置中的时间。\n\n如果遇到问题请先参照README中的方法进行解决。",

View File

@@ -212,10 +212,11 @@ async function countOriginalResin(tryOriginalMode, opToMainUi, openMap) {
} else {
log.info('尝试使用优化模式');
let ocrPhysical = await physical.ocrPhysical(opToMainUi, openMap);
log.debug(`ocrPhysical: {0}`,JSON.stringify(ocrPhysical))
await sleep(600)
// ocrPhysical = false//模拟异常
if (ocrPhysical && ocrPhysical.ok) {
return ocrPhysical.remainder;
if (ocrPhysical/* && ocrPhysical.ok*/) {
return ocrPhysical?.remainder;
} else {
//异常 退出至地图 尝试使用原始模式
await keyPress("VK_ESCAPE")

View File

@@ -89,10 +89,10 @@ async function ocrPhysical(opToMainUi = false,openMap=false) {
let add_buttonJSON = getJsonPath('add_button');
let add_objJson = {
path: `${add_buttonJSON.path}${add_buttonJSON.name}${add_buttonJSON.type}`,
x: 1264,
y: 39,
width: genshinJson.width - 1264,
height: 60,
x: 1242,
y: 21,
width: 54,
height: 51,
}
let templateMatchAddButtonRo = RecognitionObject.TemplateMatch(file.ReadImageMatSync(`${add_objJson.path}`), add_objJson.x, add_objJson.y, add_objJson.width, add_objJson.height);
let regionA = captureGameRegion()