fix(utils): 修复原粹树脂识别坐标和清理冗余代码 (#2960)

- 更新add_button坐标从(1242,21)调整为(1375,27),尺寸从(54,51)调整为(49,40)
- 移除未使用的add_obj坐标定位代码
- 删除废弃的200数值匹配相关注释代码
- 优化物理资源识别模块的坐标精确定位
- 更新版本号从4.5.2到4.5.3
This commit is contained in:
云端客
2026-03-05 15:58:25 +08:00
committed by GitHub
parent becbecea1e
commit e9b9d31c56
3 changed files with 6 additions and 33 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 835 B

After

Width:  |  Height:  |  Size: 811 B

View File

@@ -1,7 +1,7 @@
{
"manifest_version": 1,
"name": "全自动地脉花",
"version": "4.5.2",
"version": "4.5.3",
"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

@@ -1,3 +1,4 @@
const commonPath = 'assets/icon/'
const commonMap = new Map([
['main_ui', {
@@ -53,7 +54,6 @@ async function saveOnlyNumber(str) {
// parseInt 将连接后的字符串转换为整数
return parseInt(str.match(/\d+/g).join(''));
}
/**
* 识别原粹树脂(体力)的函数
* @param {boolean} [opToMainUi=false] - 是否操作到主界面
@@ -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: 1242,
y: 21,
width: 54,
height: 51,
x: 1375,
y: 27,
width: 49,
height: 40,
}
let templateMatchAddButtonRo = RecognitionObject.TemplateMatch(file.ReadImageMatSync(`${add_objJson.path}`), add_objJson.x, add_objJson.y, add_objJson.width, add_objJson.height);
let regionA = captureGameRegion()
@@ -108,12 +108,6 @@ async function ocrPhysical(opToMainUi = false,openMap=false) {
}finally {
regionA.Dispose()
}
// let add_obj = {
// x: 1264,
// y: 39,
// }
// await click(add_obj.x, add_obj.y)
await sleep(ms)
log.debug(`===[定位原粹树脂]===`)
@@ -139,27 +133,6 @@ async function ocrPhysical(opToMainUi = false,openMap=false) {
region.Dispose()
}
/* log.debug(`===[定位/200]===`)
//定位200
let jsonPath2 = getJsonPath('200');
let tmJson2 = {
path: `${jsonPath2.path}${jsonPath2.name}${jsonPath2.type}`,
x: TemplateOrcJson.x,
y: TemplateOrcJson.y,
width: TemplateOrcJson.width,
height: TemplateOrcJson.height,
}
let templateMatchButtonRo2 = RecognitionObject.TemplateMatch(file.ReadImageMatSync(`${tmJson2.path}`), tmJson2.x, tmJson2.y, tmJson2.width, tmJson2.height);
let region2 = captureGameRegion()
let button2 = region2.find(templateMatchButtonRo2);
region2.Dispose()
await sleep(ms)
if (!button2.isExist()) {
log.error(`${tmJson2.path} 匹配异常`)
throwError(`${tmJson2.path} 匹配异常`)
}*/
log.debug(`===[识别原粹树脂]===`)
//识别体力 x=1625,y=31,width=79,height=30 / x=1689,y=35,width=15,height=26
let ocr_obj = {