From b399a43aa8223c50f321019d320b13b14fe59361 Mon Sep 17 00:00:00 2001 From: Yang-z Date: Thu, 13 Mar 2025 09:42:24 +0800 Subject: [PATCH] auto artifacts: fix two stuck points (#435) --- .../狗粮-纳塔-奥奇卡纳塔-托佐兹之岛-6个-f.json | 12 ++++++ ...-2个-f.json => 狗粮-枫丹-白露区-秋分山东侧-2个-f~m.json} | 8 ++++ repo/js/AutoArtifacts_A_B_Extra/main.js | 43 ++++++++++++++++--- repo/js/AutoArtifacts_A_B_Extra/manifest.json | 2 +- .../狗粮-纳塔-奥奇卡纳塔-托佐兹之岛-6个-f.json | 12 ++++++ ...侧-2个-f.json => 狗粮-枫丹-白露区-秋分山东侧-2个-f~m.json} | 8 ++++ 6 files changed, 78 insertions(+), 7 deletions(-) rename repo/js/AutoArtifacts_A_B_Extra/assets/狗粮B线@Yang-z/{狗粮-枫丹-白露区-秋分山东侧-2个-f.json => 狗粮-枫丹-白露区-秋分山东侧-2个-f~m.json} (77%) rename repo/pathing/圣遗物/狗粮B线@Yang-z/{狗粮-枫丹-白露区-秋分山东侧-2个-f.json => 狗粮-枫丹-白露区-秋分山东侧-2个-f~m.json} (77%) diff --git a/repo/js/AutoArtifacts_A_B_Extra/assets/狗粮A线@Yang-z/狗粮-纳塔-奥奇卡纳塔-托佐兹之岛-6个-f.json b/repo/js/AutoArtifacts_A_B_Extra/assets/狗粮A线@Yang-z/狗粮-纳塔-奥奇卡纳塔-托佐兹之岛-6个-f.json index bde75149..9b53bd8a 100644 --- a/repo/js/AutoArtifacts_A_B_Extra/assets/狗粮A线@Yang-z/狗粮-纳塔-奥奇卡纳塔-托佐兹之岛-6个-f.json +++ b/repo/js/AutoArtifacts_A_B_Extra/assets/狗粮A线@Yang-z/狗粮-纳塔-奥奇卡纳塔-托佐兹之岛-6个-f.json @@ -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, diff --git a/repo/js/AutoArtifacts_A_B_Extra/assets/狗粮B线@Yang-z/狗粮-枫丹-白露区-秋分山东侧-2个-f.json b/repo/js/AutoArtifacts_A_B_Extra/assets/狗粮B线@Yang-z/狗粮-枫丹-白露区-秋分山东侧-2个-f~m.json similarity index 77% rename from repo/js/AutoArtifacts_A_B_Extra/assets/狗粮B线@Yang-z/狗粮-枫丹-白露区-秋分山东侧-2个-f.json rename to repo/js/AutoArtifacts_A_B_Extra/assets/狗粮B线@Yang-z/狗粮-枫丹-白露区-秋分山东侧-2个-f~m.json index 3e96e611..373f6b4a 100644 --- a/repo/js/AutoArtifacts_A_B_Extra/assets/狗粮B线@Yang-z/狗粮-枫丹-白露区-秋分山东侧-2个-f.json +++ b/repo/js/AutoArtifacts_A_B_Extra/assets/狗粮B线@Yang-z/狗粮-枫丹-白露区-秋分山东侧-2个-f~m.json @@ -33,6 +33,14 @@ "action": "combat_script", "action_params": "wait(0.8)", "#" : "2" + }, + + { + "x": 3890.994140625, + "y": 2429.1708984375, + "type": "path", + "move_mode": "dash", + "//": "跑远,防止'揭示之书'和地图缩放按钮重叠导致地图识别失败" } ] } \ No newline at end of file diff --git a/repo/js/AutoArtifacts_A_B_Extra/main.js b/repo/js/AutoArtifacts_A_B_Extra/main.js index 47fa08e4..d22d1be4 100644 --- a/repo/js/AutoArtifacts_A_B_Extra/main.js +++ b/repo/js/AutoArtifacts_A_B_Extra/main.js @@ -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()); diff --git a/repo/js/AutoArtifacts_A_B_Extra/manifest.json b/repo/js/AutoArtifacts_A_B_Extra/manifest.json index 4722447f..533d9baf 100644 --- a/repo/js/AutoArtifacts_A_B_Extra/manifest.json +++ b/repo/js/AutoArtifacts_A_B_Extra/manifest.json @@ -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": [ diff --git a/repo/pathing/圣遗物/狗粮A线@Yang-z/狗粮-纳塔-奥奇卡纳塔-托佐兹之岛-6个-f.json b/repo/pathing/圣遗物/狗粮A线@Yang-z/狗粮-纳塔-奥奇卡纳塔-托佐兹之岛-6个-f.json index bde75149..9b53bd8a 100644 --- a/repo/pathing/圣遗物/狗粮A线@Yang-z/狗粮-纳塔-奥奇卡纳塔-托佐兹之岛-6个-f.json +++ b/repo/pathing/圣遗物/狗粮A线@Yang-z/狗粮-纳塔-奥奇卡纳塔-托佐兹之岛-6个-f.json @@ -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, diff --git a/repo/pathing/圣遗物/狗粮B线@Yang-z/狗粮-枫丹-白露区-秋分山东侧-2个-f.json b/repo/pathing/圣遗物/狗粮B线@Yang-z/狗粮-枫丹-白露区-秋分山东侧-2个-f~m.json similarity index 77% rename from repo/pathing/圣遗物/狗粮B线@Yang-z/狗粮-枫丹-白露区-秋分山东侧-2个-f.json rename to repo/pathing/圣遗物/狗粮B线@Yang-z/狗粮-枫丹-白露区-秋分山东侧-2个-f~m.json index 3e96e611..373f6b4a 100644 --- a/repo/pathing/圣遗物/狗粮B线@Yang-z/狗粮-枫丹-白露区-秋分山东侧-2个-f.json +++ b/repo/pathing/圣遗物/狗粮B线@Yang-z/狗粮-枫丹-白露区-秋分山东侧-2个-f~m.json @@ -33,6 +33,14 @@ "action": "combat_script", "action_params": "wait(0.8)", "#" : "2" + }, + + { + "x": 3890.994140625, + "y": 2429.1708984375, + "type": "path", + "move_mode": "dash", + "//": "跑远,防止'揭示之书'和地图缩放按钮重叠导致地图识别失败" } ] } \ No newline at end of file