feat: 优化路径 (#3194)

This commit is contained in:
躁动的氨气
2026-05-08 00:53:20 +08:00
committed by GitHub
parent ebbd7bf787
commit 275e497e4e
29 changed files with 112 additions and 132 deletions

View File

@@ -5,7 +5,7 @@ import { loadRefreshData, cleanupStaleRecords, recordRoute, filterRunnableRoutes
(async function () {
const version = getVersion()
const minVersion = '0.60.2'
const minVersion = '0.60.2-alpha.3'
if (!checkVersion(version, minVersion)) {
log.warn(`当前 BetterGI 版本(${version})低于最低要求(${minVersion}),内部算法缺少优化,出现异常为正常情况`)
@@ -56,7 +56,7 @@ import { loadRefreshData, cleanupStaleRecords, recordRoute, filterRunnableRoutes
return;
}
const allRoutes = await getRoutes();
const allRoutes = getRoutes();
if (allRoutes.length === 0) {
log.error("未找到任何路线文件请确保paths目录下存在路线文件。");
return;

View File

@@ -1,7 +1,7 @@
{
"manifest_version": 1,
"name": "莉奈娅挖矿一条龙",
"version": "0.2.0",
"version": "0.2.1",
"bgi_version": "0.60.2",
"description": "不分矿种,稳定刷新即挖",
"authors": [

View File

@@ -9,7 +9,7 @@
"bgi_version": "0.60.1",
"description": "",
"enable_monster_loot_split": false,
"last_modified_time": 1777628759767,
"last_modified_time": 1778073758649,
"map_match_method": "",
"map_name": "Teyvat",
"name": "A01-希汐岛左下-01",
@@ -51,14 +51,14 @@
"action": "",
"action_params": "",
"id": 4,
"move_mode": "walk",
"move_mode": "run",
"type": "path",
"x": 11026.9268,
"y": 1603.7539
},
{
"action": "linnea_mining",
"action_params": "1,1",
"action_params": "",
"id": 5,
"move_mode": "walk",
"type": "orientation",
@@ -66,40 +66,13 @@
"y": 1576.5312
},
{
"action": "",
"action": "linnea_mining",
"action_params": "",
"id": 6,
"move_mode": "walk",
"type": "path",
"x": 11026.8779,
"y": 1605.7744
},
{
"action": "linnea_mining",
"action_params": "1,1",
"id": 7,
"move_mode": "walk",
"type": "path",
"x": 11027.7734,
"y": 1607.4688
},
{
"action": "",
"action_params": "",
"id": 8,
"move_mode": "walk",
"type": "path",
"x": 11013.6035,
"y": 1596.9648
},
{
"action": "linnea_mining",
"action_params": "1,1",
"id": 9,
"move_mode": "walk",
"type": "orientation",
"x": 10973.5127,
"y": 1682.4473
"x": 11025.1533,
"y": 1624.5928
}
]
}

View File

@@ -9,7 +9,7 @@
"bgi_version": "0.60.1",
"description": "",
"enable_monster_loot_split": false,
"last_modified_time": 1777628765898,
"last_modified_time": 1778073869657,
"map_match_method": "",
"map_name": "Teyvat",
"name": "A01-希汐岛左下-02",
@@ -49,12 +49,12 @@
},
{
"action": "linnea_mining",
"action_params": "1,1",
"action_params": "",
"id": 4,
"move_mode": "walk",
"type": "orientation",
"x": 11013.6035,
"y": 1596.9648
"x": 11000.5313,
"y": 1634.625
}
]
}

View File

@@ -9,7 +9,7 @@
"bgi_version": "0.60.1",
"description": "",
"enable_monster_loot_split": false,
"last_modified_time": 1777628775969,
"last_modified_time": 1778074015548,
"map_match_method": "",
"map_name": "Teyvat",
"name": "A01-希汐岛左下-03",
@@ -157,7 +157,7 @@
},
{
"action": "linnea_mining",
"action_params": "1,1",
"action_params": "",
"id": 16,
"move_mode": "walk",
"type": "orientation",
@@ -184,7 +184,7 @@
},
{
"action": "linnea_mining",
"action_params": "1,1",
"action_params": "",
"id": 19,
"move_mode": "walk",
"type": "orientation",

View File

@@ -9,7 +9,7 @@
"bgi_version": "0.60.1",
"description": "",
"enable_monster_loot_split": false,
"last_modified_time": 1777628783391,
"last_modified_time": 1778074022774,
"map_match_method": "",
"map_name": "Teyvat",
"name": "A02-沐光之台",
@@ -67,7 +67,7 @@
},
{
"action": "linnea_mining",
"action_params": "1,1",
"action_params": "",
"id": 6,
"move_mode": "walk",
"type": "orientation",

View File

@@ -9,7 +9,7 @@
"bgi_version": "0.60.1",
"description": "",
"enable_monster_loot_split": false,
"last_modified_time": 1777641683864,
"last_modified_time": 1778074188795,
"map_match_method": "",
"map_name": "Teyvat",
"name": "A03-月矩力实验设计局左侧",
@@ -50,7 +50,7 @@
},
{
"action": "linnea_mining",
"action_params": "1,1",
"action_params": "",
"id": 4,
"move_mode": "walk",
"type": "orientation",
@@ -135,8 +135,8 @@
"id": 13,
"move_mode": "walk",
"type": "path",
"x": 10090.4531,
"y": 3337.5625
"x": 10095.1797,
"y": 3334.8125
},
{
"action": "",
@@ -149,7 +149,7 @@
},
{
"action": "linnea_mining",
"action_params": "1,1",
"action_params": "",
"id": 15,
"move_mode": "walk",
"type": "orientation",
@@ -158,12 +158,12 @@
},
{
"action": "linnea_mining",
"action_params": "1,1",
"action_params": "",
"id": 16,
"move_mode": "walk",
"type": "orientation",
"x": 10102.0547,
"y": 3340.0547
"x": 10116.5342,
"y": 3337.3916
}
]
}

View File

@@ -9,7 +9,7 @@
"bgi_version": "0.60.1",
"description": "",
"enable_monster_loot_split": false,
"last_modified_time": 1777628809255,
"last_modified_time": 1778074354807,
"map_match_method": "",
"map_name": "Teyvat",
"name": "A04-月矩力实验设计局右侧",
@@ -157,7 +157,7 @@
},
{
"action": "linnea_mining",
"action_params": "1,1",
"action_params": "",
"id": 16,
"move_mode": "walk",
"type": "orientation",

View File

@@ -9,7 +9,7 @@
"bgi_version": "0.60.1",
"description": "",
"enable_monster_loot_split": false,
"last_modified_time": 1777641851214,
"last_modified_time": 1778074685948,
"map_match_method": "",
"map_name": "Teyvat",
"name": "A05-刻拉蒂之眼",
@@ -107,8 +107,8 @@
"id": 10,
"move_mode": "walk",
"type": "path",
"x": 8655.545,
"y": 2260.4873
"x": 8657.875,
"y": 2271.8516
},
{
"action": "",
@@ -121,7 +121,7 @@
},
{
"action": "linnea_mining",
"action_params": "1,1",
"action_params": "",
"id": 12,
"move_mode": "walk",
"type": "orientation",
@@ -139,7 +139,7 @@
},
{
"action": "linnea_mining",
"action_params": "1,1",
"action_params": "",
"id": 14,
"move_mode": "walk",
"type": "orientation",
@@ -166,7 +166,7 @@
},
{
"action": "linnea_mining",
"action_params": "1,1",
"action_params": "",
"id": 17,
"move_mode": "walk",
"type": "orientation",
@@ -175,7 +175,7 @@
},
{
"action": "linnea_mining",
"action_params": "1,1",
"action_params": "",
"id": 18,
"move_mode": "walk",
"type": "orientation",
@@ -211,7 +211,7 @@
},
{
"action": "linnea_mining",
"action_params": "1,1",
"action_params": "",
"id": 22,
"move_mode": "walk",
"type": "orientation",
@@ -264,18 +264,27 @@
"y": 2354.1074
},
{
"action": "linnea_mining",
"action_params": "1,1",
"action": "",
"action_params": "",
"id": 28,
"move_mode": "walk",
"type": "path",
"x": 8733.9531,
"y": 2353.6558
},
{
"action": "linnea_mining",
"action_params": "",
"id": 29,
"move_mode": "walk",
"type": "orientation",
"x": 8739.1748,
"y": 2354.1816
"x": 8749.1123,
"y": 2351.1885
},
{
"action": "",
"action_params": "",
"id": 29,
"id": 30,
"move_mode": "walk",
"type": "path",
"x": 8735.2188,
@@ -284,7 +293,7 @@
{
"action": "",
"action_params": "",
"id": 30,
"id": 31,
"move_mode": "walk",
"type": "path",
"x": 8710.1875,
@@ -292,8 +301,8 @@
},
{
"action": "linnea_mining",
"action_params": "1,1",
"id": 31,
"action_params": "",
"id": 32,
"move_mode": "walk",
"type": "orientation",
"x": 8708.666,

View File

@@ -9,7 +9,7 @@
"bgi_version": "0.60.1",
"description": "",
"enable_monster_loot_split": false,
"last_modified_time": 1777641865085,
"last_modified_time": 1778074768168,
"map_match_method": "",
"map_name": "Teyvat",
"name": "A07-苔骨荒原-01",
@@ -39,8 +39,8 @@
"y": 2102.4414
},
{
"action": "",
"action_params": "",
"action": "combat_script",
"action_params": "wait(0.2),moveby(0,-500)",
"id": 3,
"move_mode": "run",
"type": "path",
@@ -49,7 +49,7 @@
},
{
"action": "linnea_mining",
"action_params": "1,1",
"action_params": "",
"id": 4,
"move_mode": "walk",
"type": "orientation",

View File

@@ -9,7 +9,7 @@
"bgi_version": "0.60.1",
"description": "",
"enable_monster_loot_split": false,
"last_modified_time": 1777641877068,
"last_modified_time": 1778074799690,
"map_match_method": "",
"map_name": "Teyvat",
"name": "A07-苔骨荒原-02",
@@ -42,7 +42,7 @@
"action": "mining",
"action_params": "",
"id": 3,
"move_mode": "walk",
"move_mode": "run",
"type": "target",
"x": 9351.6064,
"y": 1899.5713
@@ -51,7 +51,7 @@
"action": "",
"action_params": "",
"id": 4,
"move_mode": "walk",
"move_mode": "run",
"type": "path",
"x": 9346.4961,
"y": 1890.666

View File

@@ -9,7 +9,7 @@
"bgi_version": "0.60.1",
"description": "",
"enable_monster_loot_split": false,
"last_modified_time": 1777641891906,
"last_modified_time": 1778074828909,
"map_match_method": "",
"map_name": "Teyvat",
"name": "A07-苔骨荒原-03",
@@ -42,7 +42,7 @@
"action": "",
"action_params": "",
"id": 3,
"move_mode": "walk",
"move_mode": "run",
"type": "path",
"x": 9258.9727,
"y": 1939.3989

View File

@@ -9,7 +9,7 @@
"bgi_version": "0.60.1",
"description": "",
"enable_monster_loot_split": false,
"last_modified_time": 1777641908210,
"last_modified_time": 1778074887381,
"map_match_method": "",
"map_name": "Teyvat",
"name": "A08-星砂滩左侧-01",
@@ -49,7 +49,7 @@
},
{
"action": "linnea_mining",
"action_params": "1,1",
"action_params": "",
"id": 4,
"move_mode": "walk",
"type": "orientation",
@@ -58,7 +58,7 @@
},
{
"action": "linnea_mining",
"action_params": "1,1",
"action_params": "",
"id": 5,
"move_mode": "walk",
"type": "orientation",

View File

@@ -9,7 +9,7 @@
"bgi_version": "0.60.1",
"description": "",
"enable_monster_loot_split": false,
"last_modified_time": 1777641928659,
"last_modified_time": 1778074909070,
"map_match_method": "",
"map_name": "Teyvat",
"name": "A08-星砂滩左侧-03",
@@ -40,7 +40,7 @@
},
{
"action": "linnea_mining",
"action_params": "1,1",
"action_params": "",
"id": 3,
"move_mode": "walk",
"type": "orientation",

View File

@@ -9,7 +9,7 @@
"bgi_version": "0.60.1",
"description": "",
"enable_monster_loot_split": false,
"last_modified_time": 1777641972060,
"last_modified_time": 1778075130600,
"map_match_method": "",
"map_name": "Teyvat",
"name": "A10-那夏镇左侧",
@@ -33,7 +33,7 @@
"action": "",
"action_params": "",
"id": 2,
"move_mode": "walk",
"move_mode": "dash",
"type": "path",
"x": 9664.3369,
"y": 1707.124
@@ -42,7 +42,7 @@
"action": "",
"action_params": "",
"id": 3,
"move_mode": "walk",
"move_mode": "dash",
"type": "path",
"x": 9657.1514,
"y": 1682.6221
@@ -85,7 +85,7 @@
},
{
"action": "linnea_mining",
"action_params": "1,1",
"action_params": "",
"id": 8,
"move_mode": "walk",
"type": "orientation",
@@ -121,7 +121,7 @@
},
{
"action": "linnea_mining",
"action_params": "1,1",
"action_params": "",
"id": 12,
"move_mode": "walk",
"type": "orientation",
@@ -139,7 +139,7 @@
},
{
"action": "linnea_mining",
"action_params": "1,1",
"action_params": "",
"id": 14,
"move_mode": "walk",
"type": "orientation",

View File

@@ -9,7 +9,7 @@
"bgi_version": "0.60.1",
"description": "",
"enable_monster_loot_split": false,
"last_modified_time": 1777629050197,
"last_modified_time": 1778075142681,
"map_match_method": "",
"map_name": "Teyvat",
"name": "A11-叮铃哐啷蛋卷工坊",
@@ -76,7 +76,7 @@
},
{
"action": "linnea_mining",
"action_params": "1,1",
"action_params": "",
"id": 7,
"move_mode": "walk",
"type": "orientation",
@@ -103,7 +103,7 @@
},
{
"action": "linnea_mining",
"action_params": "1,1",
"action_params": "",
"id": 10,
"move_mode": "walk",
"type": "orientation",

View File

@@ -9,7 +9,7 @@
"bgi_version": "0.60.1",
"description": "",
"enable_monster_loot_split": false,
"last_modified_time": 1777629067697,
"last_modified_time": 1778075169912,
"map_match_method": "",
"map_name": "Teyvat",
"name": "A12-苔古荒原地下",
@@ -77,7 +77,7 @@
},
{
"action": "linnea_mining",
"action_params": "1,1",
"action_params": "",
"id": 7,
"move_mode": "walk",
"type": "orientation",

View File

@@ -10,8 +10,8 @@
"description": "",
"enable_monster_loot_split": false,
"items": [],
"last_modified_time": 1777641994679,
"map_match_method": "",
"last_modified_time": 1778075412945,
"map_match_method": "SIFT",
"map_name": "Teyvat",
"name": "A13-虚海望-01",
"order": 0,

View File

@@ -10,8 +10,8 @@
"description": "",
"enable_monster_loot_split": false,
"items": [],
"last_modified_time": 1777642007030,
"map_match_method": "",
"last_modified_time": 1778075405381,
"map_match_method": "SIFT",
"map_name": "Teyvat",
"name": "A13-虚海望-02",
"order": 0,
@@ -60,7 +60,7 @@
},
{
"action": "linnea_mining",
"action_params": "1,1",
"action_params": "2",
"id": 5,
"move_mode": "walk",
"type": "orientation",

View File

@@ -10,7 +10,7 @@
"description": "",
"enable_monster_loot_split": false,
"items": [],
"last_modified_time": 1777629362569,
"last_modified_time": 1778075358887,
"map_match_method": "SIFT",
"map_name": "Teyvat",
"name": "A13-虚海望-03",
@@ -86,4 +86,4 @@
"y": 5375.1191
}
]
}
}

View File

@@ -9,7 +9,7 @@
"bgi_version": "0.60.1",
"description": "",
"enable_monster_loot_split": false,
"last_modified_time": 1777629357819,
"last_modified_time": 1778075348681,
"map_match_method": "SIFT",
"map_name": "Teyvat",
"name": "A14-逐浪野-01",

View File

@@ -9,7 +9,7 @@
"bgi_version": "0.60.1",
"description": "",
"enable_monster_loot_split": false,
"last_modified_time": 1777629352796,
"last_modified_time": 1778075340484,
"map_match_method": "SIFT",
"map_name": "Teyvat",
"name": "A14-逐浪野-02",

View File

@@ -9,7 +9,7 @@
"bgi_version": "0.60.1",
"description": "",
"enable_monster_loot_split": false,
"last_modified_time": 1777629347236,
"last_modified_time": 1778075331531,
"map_match_method": "SIFT",
"map_name": "Teyvat",
"name": "A14-逐浪野-03",

View File

@@ -9,7 +9,7 @@
"bgi_version": "0.60.1",
"description": "",
"enable_monster_loot_split": false,
"last_modified_time": 1777629344181,
"last_modified_time": 1778075321169,
"map_match_method": "SIFT",
"map_name": "Teyvat",
"name": "A14-逐浪野-04",

View File

@@ -9,7 +9,7 @@
"bgi_version": "0.60.1",
"description": "",
"enable_monster_loot_split": false,
"last_modified_time": 1777629305575,
"last_modified_time": 1778075311770,
"map_match_method": "SIFT",
"map_name": "Teyvat",
"name": "A15-安瓦蒂尼尔湖-01",

View File

@@ -9,7 +9,7 @@
"bgi_version": "0.60.1",
"description": "",
"enable_monster_loot_split": false,
"last_modified_time": 1777629306960,
"last_modified_time": 1778075303134,
"map_match_method": "SIFT",
"map_name": "Teyvat",
"name": "A15-安瓦蒂尼尔湖-02",

View File

@@ -9,7 +9,7 @@
"bgi_version": "0.60.1",
"description": "",
"enable_monster_loot_split": false,
"last_modified_time": 1777629308300,
"last_modified_time": 1778075294992,
"map_match_method": "SIFT",
"map_name": "Teyvat",
"name": "A15-安瓦蒂尼尔湖-03",
@@ -41,7 +41,7 @@
},
{
"action": "linnea_mining",
"action_params": "1,1",
"action_params": "",
"id": 3,
"move_mode": "walk",
"type": "orientation",

View File

@@ -1,5 +1,5 @@
const REFRESH_DATA_PATH = "local/refresh_records.json";
const FALLBACK_DURATION = 120;
const FALLBACK_DURATION = 60;
/**
* 从本地文件加载刷新记录数据
@@ -127,7 +127,7 @@ function getRouteDuration(routePath, data) {
/**
* 估算多条路线的总运行时长
* 有历史记录的路线使用实际时长,无记录的按 2 分钟计算
* 有历史记录的路线使用实际时长,无记录的按 1 分钟计算
*
* @param {string[]} routePaths - 路线文件路径数组
* @param {Object} data - 刷新记录对象

View File

@@ -1,31 +1,29 @@
/**
* 语义化版本比对,判断当前版本是否满足最低要求
* 支持带预发布标识的版本号(如 0.60.2-alpha.2,自动提取主版本号进行比较
* 支持带预发布标识的版本号(如 0.60.2-alpha.2
* 规则:前缀相同时,有预发布标识的版本 < 无预发布标识的版本
*
* @param {string} version - 当前版本号
* @param {string} minVersion - 最低要求版本号,默认 '0.60.2'
* @param {string} minVersion - 最低要求版本号
* @returns {boolean} 当前版本是否 >= 最低要求版本
*/
function checkVersion(version, minVersion = '0.60.2') {
const normalizeVersion = (v) => {
const match = String(v).match(/^(\d+\.\d+\.\d+)/)
return match ? match[1] : '0.0.0'
function checkVersion(version, minVersion) {
const re = /^(\d+)\.(\d+)\.(\d+)(?:[-.](.+))?$/
const pick = (/** @type {string} */ v, /** @type {number} */ i) => Number(v.match(re)?.[i] ?? 0)
const pre = (/** @type {string} */ v) => v.match(re)?.[4] ?? null
for (const i of [1, 2, 3]) {
if (pick(version, i) > pick(minVersion, i)) return true
if (pick(version, i) < pick(minVersion, i)) return false
}
const currentParts = normalizeVersion(version).split('.').map(Number)
const minParts = normalizeVersion(minVersion).split('.').map(Number)
const a = pre(version), b = pre(minVersion)
if (a === null && b === null) return true
if (a === null) return true
if (b === null) return false
const maxLength = Math.max(currentParts.length, minParts.length)
while (currentParts.length < maxLength) currentParts.push(0)
while (minParts.length < maxLength) minParts.push(0)
for (let i = 0; i < maxLength; i++) {
if (currentParts[i] > minParts[i]) return true
if (currentParts[i] < minParts[i]) return false
}
return true
return a >= b
}
export { checkVersion };