auto artifacts: fix two stuck points (#435)

This commit is contained in:
Yang-z
2025-03-13 09:42:24 +08:00
committed by GitHub
parent 626dd909d8
commit b399a43aa8
6 changed files with 78 additions and 7 deletions

View File

@@ -48,7 +48,19 @@
"move_mode": "walk",
"#": "3"
},
{
"x": 9688.345703125,
"y": 230.91455078125,
"type": "target",
"move_mode": "walk",
"#": "3"
},
{
"x": 9694.974609375,
"y": 220.93896484375,
"type": "orientation"
},
{
"x": 9694.974609375,
"y": 220.93896484375,

View File

@@ -33,6 +33,14 @@
"action": "combat_script",
"action_params": "wait(0.8)",
"#" : "2"
},
{
"x": 3890.994140625,
"y": 2429.1708984375,
"type": "path",
"move_mode": "dash",
"//": "跑远,防止'揭示之书'和地图缩放按钮重叠导致地图识别失败"
}
]
}

View File

@@ -35,7 +35,7 @@
const pathingB = [
"狗粮-枫丹-枫丹庭区-3个.json",
"狗粮-枫丹-白露区-秋分山东侧-2个-f.json",
"狗粮-枫丹-白露区-秋分山东侧-2个-f~m.json",
"狗粮-枫丹-伊黎耶林区-欧庇克莱歌剧院东南-2个-f.json",
"(恢复)狗粮-枫丹-研究院区.json",
"狗粮-枫丹-研究院区-学术会堂-1个2个-f.json",
@@ -122,16 +122,39 @@
}
// 调整地图
async function resizeMap() {
// zoom map to 75%
async function resizeMap(level = 1) {
keyPress("M"); await sleep(1000);
for (let i = 0; i < 5; i++) {
click(42, 420); await sleep(500); // zoom in
for (let i = 5; i > 0; --i) {
click(46, 436); await sleep(500); // zoom in
}
for (let i = 0; i < level; ++i) {
click(46, 630); await sleep(500); // zoom out
}
click(42, 645); await sleep(1000); // zoom out
keyPress("M"); await sleep(1000);
}
// 拖拽地图
async function dragMap(byX, byY) {
let byL = Math.sqrt(byX * byX + byY * byY);
let d = 5;
let dx = Math.round(d * byX / byL);
let dy = Math.round(d * byY / byL);
let times = Math.round(byX / dx) * 2; //
log.debug(`byL: ${byL}; dx: ${dx}; dy: ${dy}; times: ${times};`);
keyPress("M"); await sleep(1000);
moveMouseBy(-byX, -byY); await sleep(300);
leftButtonDown(); await sleep(300);
for (let i = 0; i < times; ++i) {
moveMouseBy(dx, dy); await sleep(30);
}
leftButtonUp(); await sleep(300);
}
// 分解圣遗物
async function salvage() {
if (!autoSalvage) return;
@@ -183,6 +206,14 @@
//执行路径追踪脚本
log.info(filePath);
await pathingScript.runFile(filePath);
// 地图缩放按键同某些地图标识重叠,导致识别失败(bgi[v0.43.0]后引入)
// 完成路径后,拖拽地图,并就近传送。仍有问题,到下个路径时会关闭地图再打开。
// let shouldDragMap_after = filePath.search("~m") != -1;
// if (shouldDragMap_after) await dragMap(-50, 50);
// 完成路径后,放大地图。仍可能被缩小回去。
// let shouldDragMap_after = filePath.search("~m") != -1;
// if (shouldDragMap_after) await resizeMap(0);
}
catch (error) { // bgi已捕获可预期异常此处仅做兜底
log.error(error.toString());

View File

@@ -1,7 +1,7 @@
{
"manifest_version": 1,
"name": "狗粮ABE路线自动拾取分解",
"version": "2.3.4",
"version": "2.3.5",
"bgi_version": "0.42.0",
"description": "圣遗物狗粮AB及额外路线自动轮换自动分解就近恢复。",
"authors": [

View File

@@ -48,7 +48,19 @@
"move_mode": "walk",
"#": "3"
},
{
"x": 9688.345703125,
"y": 230.91455078125,
"type": "target",
"move_mode": "walk",
"#": "3"
},
{
"x": 9694.974609375,
"y": 220.93896484375,
"type": "orientation"
},
{
"x": 9694.974609375,
"y": 220.93896484375,

View File

@@ -33,6 +33,14 @@
"action": "combat_script",
"action_params": "wait(0.8)",
"#" : "2"
},
{
"x": 3890.994140625,
"y": 2429.1708984375,
"type": "path",
"move_mode": "dash",
"//": "跑远,防止'揭示之书'和地图缩放按钮重叠导致地图识别失败"
}
]
}