diff --git a/repo/js/AutoLeyLineOutcrop/README.md b/repo/js/AutoLeyLineOutcrop/README.md index ec941b07..b8f4cc4f 100644 --- a/repo/js/AutoLeyLineOutcrop/README.md +++ b/repo/js/AutoLeyLineOutcrop/README.md @@ -34,6 +34,10 @@ wgc的bug,请使用bitblt截图方式,脚本只支持这个 打开大地图,点击左下角设置,开启自定义标记。 脚本非正常结束运行时会出现该问题。 ## 更新日志 +### 3.5 +- 减少部分日志输出 +- 修改部分错误提示信息 + ### 3.4 - 重构代码结构 - 修复部分提示错误 diff --git a/repo/js/AutoLeyLineOutcrop/main.js b/repo/js/AutoLeyLineOutcrop/main.js index b985bb5c..08422b8a 100644 --- a/repo/js/AutoLeyLineOutcrop/main.js +++ b/repo/js/AutoLeyLineOutcrop/main.js @@ -75,22 +75,20 @@ async function initialize() { await genshin.returnMainUi(); setGameMetrics(1920, 1080, 1); try { - eval(file.readTextSync("utils/attemptReward.js")); - log.debug("utils/attemptReward.js 加载成功"); - eval(file.readTextSync("utils/breadthFirstPathSearch.js")); - log.debug("utils/breadthFirstPathSearch.js 加载成功"); - eval(file.readTextSync("utils/executePathsUsingNodeData.js")); - log.debug("utils/executePathsUsingNodeData.js 加载成功"); - eval(file.readTextSync("utils/findLeyLineOutcrop.js")); - log.debug("utils/findLeyLineOutcrop.js 加载成功"); - eval(file.readTextSync("utils/loadSettings.js")); - log.debug("utils/loadSettings.js 加载成功"); - eval(file.readTextSync("utils/locateLeyLineOutcrop.js")); - log.debug("utils/locateLeyLineOutcrop.js 加载成功"); - eval(file.readTextSync("utils/processLeyLineOutcrop.js")); - log.debug("utils/processLeyLineOutcrop.js 加载成功"); - eval(file.readTextSync("utils/recognizeTextInRegion.js")); - log.debug("utils/recognizeTextInRegion.js 加载成功"); + const utils = [ + "attemptReward.js", + "breadthFirstPathSearch.js", + "executePathsUsingNodeData.js", + "findLeyLineOutcrop.js", + "loadSettings.js", + "locateLeyLineOutcrop.js", + "processLeyLineOutcrop.js", + "recognizeTextInRegion.js" + ]; + for (const fileName of utils) { + eval(file.readTextSync(`utils/${fileName}`)); + log.debug(`utils/${fileName} 加载成功`); + } } catch (error) { throw new Error(`JS文件缺失,请重新安装脚本! ${error.message}`); } @@ -292,9 +290,9 @@ function selectOptimalPath(paths) { // 记录路径选择日志 for (let i = 0; i < Math.min(paths.length, 3); i++) { - // log.info(`路径选项 ${i + 1}: 起点ID ${paths[i].startNode.id}, ${paths[i].routes.length} 段路径`); + log.debug(`路径选项 ${i + 1}: 起点ID ${paths[i].startNode.id}, ${paths[i].routes.length} 段路径`); for (let j = 0; j < paths[i].routes.length; j++) { - // log.info(` - 路径 ${j + 1}: ${paths[i].routes[j]}`); + log.debug(` - 路径 ${j + 1}: ${paths[i].routes[j]}`); } } @@ -567,7 +565,7 @@ async function startRewardTextDetection(cts) { // 检查是否误触发其他页面 if (captureRegion.Find(paimonMenuRo).IsEmpty()) { - log.info("误触发其他页面,尝试关闭页面"); + log.debug("误触发其他页面,尝试关闭页面"); await genshin.returnMainUi(); await sleep(300); continue; @@ -578,7 +576,7 @@ async function startRewardTextDetection(cts) { if (resList && resList.count > 0) { for (let i = 0; i < resList.count; i++) { if (resList[i].text.includes("原粹树脂")) { - log.info("已到达领取页面,可以领奖"); + log.debug("已到达领取页面,可以领奖"); resolve(true); return; } @@ -592,7 +590,7 @@ async function startRewardTextDetection(cts) { if (ocrResults[i].text.includes("接触") || ocrResults[i].text.includes("地脉") || ocrResults[i].text.includes("之花")) { - log.info("检测到文字: " + ocrResults[i].text); + log.debug("检测到文字: " + ocrResults[i].text); resolve(true); return; } @@ -683,10 +681,10 @@ async function adjustViewForReward(boxIconRo, token) { const isAboveCenter = iconRes.y < screenCenterY; const isWithinAngle = angleInDegrees <= maxAngle; - log.info(`图标位置: (${iconRes.x}, ${iconRes.y}), 角度: ${angleInDegrees.toFixed(2)}°`); + log.debug(`图标位置: (${iconRes.x}, ${iconRes.y}), 角度: ${angleInDegrees.toFixed(2)}°`); if (isAboveCenter && isWithinAngle) { - log.info(`视野调整成功,图标角度: ${angleInDegrees.toFixed(2)}°,在${maxAngle}°范围内`); + log.debug(`视野调整成功,图标角度: ${angleInDegrees.toFixed(2)}°,在${maxAngle}°范围内`); return true; } else { keyUp("w"); // 确保停止前进 diff --git a/repo/js/AutoLeyLineOutcrop/manifest.json b/repo/js/AutoLeyLineOutcrop/manifest.json index a93b74f2..0e9bc77c 100644 --- a/repo/js/AutoLeyLineOutcrop/manifest.json +++ b/repo/js/AutoLeyLineOutcrop/manifest.json @@ -1,7 +1,7 @@ { "manifest_version": 1, "name": "全自动地脉花", - "version": "3.4.0", + "version": "3.5.0", "tags": ["地脉花"], "bgi_version": "0.44.7", "description": "基于OCR图像识别的全自动刷取地脉花。\n💡更多信息请查看在线手册:https://hcnsvf0s8d0s.feishu.cn/wiki/Tb1twpThLi7UlykqcYOcuccTnjJ \n\n----------注意事项----------\n●仅支持BetterGI 0.44.7 及以上版本!\n●部分地脉花因特殊原因不支持全自动,具体的点位请在手册中查看。\n●树脂使用的优先级:2倍原粹树脂 > 浓缩树脂 > 原粹树脂。\n●运行时会传送到七天神像设置中设置的七天神像,需要关闭七天神像设置中的“是否就近七天神像恢复血量”,并指定七天神像。\n●战斗策略注意调度器设置中地图追踪行走配置里的“允许在JsSpript中使用”和“覆盖JS中的自动战斗配置”,只有在都打开的情况下脚本才会使用下面的战斗配置,否则会使用独立任务中的战斗策略。战斗超时时间不能大于脚本自定义配置中的时间。\n\n如果遇到问题,请先参照手册中的方法进行解决。", diff --git a/repo/js/AutoLeyLineOutcrop/utils/attemptReward.js b/repo/js/AutoLeyLineOutcrop/utils/attemptReward.js index d05d9da3..423c548f 100644 --- a/repo/js/AutoLeyLineOutcrop/utils/attemptReward.js +++ b/repo/js/AutoLeyLineOutcrop/utils/attemptReward.js @@ -12,7 +12,7 @@ async function () { throw new Error("超过最大重试次数,领取奖励失败"); } - log.info("领取奖励,优先使用浓缩树脂"); + log.info("开始领取地脉奖励"); keyPress("F"); await sleep(500); @@ -62,12 +62,6 @@ async function () { log.info("切换回战斗队伍"); await sleep(500); const switchSuccess = await switchTeam(settings.team); - // if (!switchSuccess) { - // log.warn("切换队伍失败,返回七天神像切换"); - // await genshin.tpToStatueOfTheSeven(); - // await genshin.switchParty(settings.team); - // throw new Error("切换队伍失败"); - // } } } diff --git a/repo/js/AutoLeyLineOutcrop/utils/breadthFirstPathSearch.js b/repo/js/AutoLeyLineOutcrop/utils/breadthFirstPathSearch.js index 7d22257f..a744b69c 100644 --- a/repo/js/AutoLeyLineOutcrop/utils/breadthFirstPathSearch.js +++ b/repo/js/AutoLeyLineOutcrop/utils/breadthFirstPathSearch.js @@ -12,7 +12,7 @@ function (nodeData, targetNode, nodeMap) { // 获取所有传送点作为起点 const teleportNodes = nodeData.node.filter(node => node.type === "teleport"); - //log.info(`找到 ${teleportNodes.length} 个传送点作为可能的起点`); + log.debug(`找到 ${teleportNodes.length} 个传送点作为可能的起点`); // 对每个传送点,尝试查找到目标的路径 for (const startNode of teleportNodes) { @@ -70,6 +70,6 @@ function (nodeData, targetNode, nodeMap) { const reversePaths = findReversePathsIfNeeded(nodeData, targetNode, nodeMap, validPaths); validPaths.push(...reversePaths); - log.info(`共找到 ${validPaths.length} 条有效路径`); + log.debug(`共找到 ${validPaths.length} 条有效路径`); return validPaths; } \ No newline at end of file diff --git a/repo/js/AutoLeyLineOutcrop/utils/executePathsUsingNodeData.js b/repo/js/AutoLeyLineOutcrop/utils/executePathsUsingNodeData.js index 337b81bf..c861352b 100644 --- a/repo/js/AutoLeyLineOutcrop/utils/executePathsUsingNodeData.js +++ b/repo/js/AutoLeyLineOutcrop/utils/executePathsUsingNodeData.js @@ -14,7 +14,7 @@ async function (position) { log.error(`未找到与坐标(${currentNodePosition.x}, ${currentNodePosition.y})匹配的目标节点`); return; } - // log.info(`找到目标节点: ID ${targetNode.id}, 位置(${targetNode.position.x}, ${targetNode.position.y})`); + log.debug(`找到目标节点: ID ${targetNode.id}, 位置(${targetNode.position.x}, ${targetNode.position.y})`); const paths = findPathsToTarget(nodeData, targetNode); if (paths.length === 0) { @@ -24,7 +24,7 @@ async function (position) { // 选择最短的路径执行 const optimalPath = selectOptimalPath(paths); - // log.info(`选择了含有 ${optimalPath.routes.length} 个路径点的最优路径`); + log.debug(`选择了含有 ${optimalPath.routes.length} 个路径点的最优路径`); // 执行路径 await executePath(optimalPath); diff --git a/repo/js/AutoLeyLineOutcrop/utils/processLeyLineOutcrop.js b/repo/js/AutoLeyLineOutcrop/utils/processLeyLineOutcrop.js index 8fadd460..8bee96f9 100644 --- a/repo/js/AutoLeyLineOutcrop/utils/processLeyLineOutcrop.js +++ b/repo/js/AutoLeyLineOutcrop/utils/processLeyLineOutcrop.js @@ -12,9 +12,9 @@ async function (timeout, targetPath, retries = 0) { // 如果超过最大重试次数,记录错误并返回,避免死循环 if (retries >= MAX_RETRIES) { - log.error(`打开地脉花失败,已重试${MAX_RETRIES}次,终止处理`); + log.error(`开启地脉花失败,已重试${MAX_RETRIES}次,终止处理`); log.error("我辣么大一个地脉花哪去了?"); - throw new Error("我辣么大一个地脉花哪去了?"); + throw new Error("开启地脉花失败"); } let captureRegion = captureGameRegion(); diff --git a/repo/js/AutoLeyLineOutcrop/utils/recognizeTextInRegion.js b/repo/js/AutoLeyLineOutcrop/utils/recognizeTextInRegion.js index 23609839..9a42d25e 100644 --- a/repo/js/AutoLeyLineOutcrop/utils/recognizeTextInRegion.js +++ b/repo/js/AutoLeyLineOutcrop/utils/recognizeTextInRegion.js @@ -23,7 +23,7 @@ async function (timeout) { // 检查成功关键词 for (let keyword of successKeywords) { if (text.includes(keyword)) { - log.info("检测到战斗成功关键词: {0}", keyword); + log.debug("检测到战斗成功关键词: {0}", keyword); resolve(true); return; } @@ -32,7 +32,7 @@ async function (timeout) { // 检查失败关键词 for (let keyword of failureKeywords) { if (text.includes(keyword)) { - log.warn("检测到战斗失败关键词: {0}", keyword); + log.debug("检测到战斗失败关键词: {0}", keyword); resolve(false); return; }