diff --git a/repo/js/AutoFishingTeyvat/assets/pathing/挪德卡莱-垂钓点-帕哈岛月矩力实验设计局北.json b/repo/js/AutoFishingTeyvat/assets/pathing/挪德卡莱-垂钓点-帕哈岛月矩力实验设计局北.json index b9071774d..fc0278ee0 100644 --- a/repo/js/AutoFishingTeyvat/assets/pathing/挪德卡莱-垂钓点-帕哈岛月矩力实验设计局北.json +++ b/repo/js/AutoFishingTeyvat/assets/pathing/挪德卡莱-垂钓点-帕哈岛月矩力实验设计局北.json @@ -105,8 +105,8 @@ "id": 10, "move_mode": "walk", "type": "target", - "x": 9998.44, - "y": 3513.26 + "x": 9997.92, + "y": 3513.66 } ] } \ No newline at end of file diff --git a/repo/js/AutoFishingTeyvat/main.js b/repo/js/AutoFishingTeyvat/main.js index 2ac895fe8..285f86f17 100644 --- a/repo/js/AutoFishingTeyvat/main.js +++ b/repo/js/AutoFishingTeyvat/main.js @@ -196,6 +196,95 @@ // 存储本次任务中的所有鱼类,作为调节时间的关键参考 let list_fish = []; + // 偽造日志 + async function fakeLog(name, isJs, isStart, duration) { + await sleep(10); + const currentTime = Date.now(); + // 参数检查 + if (typeof name !== 'string') { + log.error("参数 'name' 必须是字符串类型!"); + return; + } + if (typeof isJs !== 'boolean') { + log.error("参数 'isJs' 必须是布尔型!"); + return; + } + if (typeof isStart !== 'boolean') { + log.error("参数 'isStart' 必须是布尔型!"); + return; + } + if (typeof currentTime !== 'number' || !Number.isInteger(currentTime)) { + log.error("参数 'currentTime' 必须是整数!"); + return; + } + if (typeof duration !== 'number' || !Number.isInteger(duration)) { + log.error("参数 'duration' 必须是整数!"); + return; + } + + // 将 currentTime 转换为 Date 对象并格式化为 HH:mm:ss.sss + const date = new Date(currentTime); + const hours = String(date.getHours()).padStart(2, '0'); + const minutes = String(date.getMinutes()).padStart(2, '0'); + const seconds = String(date.getSeconds()).padStart(2, '0'); + const milliseconds = String(date.getMilliseconds()).padStart(3, '0'); + const formattedTime = `${hours}:${minutes}:${seconds}.${milliseconds}`; + + // 将 duration 转换为分钟和秒,并保留三位小数 + const durationInSeconds = duration / 1000; // 转换为秒 + const durationMinutes = Math.floor(durationInSeconds / 60); + const durationSeconds = (durationInSeconds % 60).toFixed(3); // 保留三位小数 + + // 使用四个独立的 if 语句处理四种情况 + if (isJs && isStart) { + // 处理 isJs = true 且 isStart = true 的情况 + const logMessage = `正在伪造js开始的日志记录\n\n` + + `[${formattedTime}] [INF] BetterGenshinImpact.Service.ScriptService\n` + + `------------------------------\n\n` + + `[${formattedTime}] [INF] BetterGenshinImpact.Service.ScriptService\n` + + `→ 开始执行JS脚本: "${name}"`; + log.debug(logMessage); + } + if (isJs && !isStart) { + // 处理 isJs = true 且 isStart = false 的情况 + const logMessage = `正在伪造js结束的日志记录\n\n` + + `[${formattedTime}] [INF] BetterGenshinImpact.Service.ScriptService\n` + + `→ 脚本执行结束: "${name}", 耗时: ${durationMinutes}分${durationSeconds}秒\n\n` + + `[${formattedTime}] [INF] BetterGenshinImpact.Service.ScriptService\n` + + `------------------------------`; + log.debug(logMessage); + } + if (!isJs && isStart) { + // 处理 isJs = false 且 isStart = true 的情况 + const logMessage = `正在伪造地图追踪开始的日志记录\n\n` + + `[${formattedTime}] [INF] BetterGenshinImpact.Service.ScriptService\n` + + `------------------------------\n\n` + + `[${formattedTime}] [INF] BetterGenshinImpact.Service.ScriptService\n` + + `→ 开始执行地图追踪任务: "${name}"`; + log.debug(logMessage); + } + if (!isJs && !isStart) { + // 处理 isJs = false 且 isStart = false 的情况 + const logMessage = `正在伪造地图追踪结束的日志记录\n\n` + + `[${formattedTime}] [INF] BetterGenshinImpact.Service.ScriptService\n` + + `→ 脚本执行结束: "${name}", 耗时: ${durationMinutes}分${durationSeconds}秒\n\n` + + `[${formattedTime}] [INF] BetterGenshinImpact.Service.ScriptService\n` + + `------------------------------`; + log.debug(logMessage); + } + // 交互或拾取:"XXXX" + if (duration == 9527) { + // const logMessage = `正在 交互或拾取 的日志记录\n\n` + + // `[${formattedTime}] [INF] BetterGenshinImpact.Service.ScriptService\n` + + // `------------------------------\n\n` + + // `[${formattedTime}] [INF] BetterGenshinImpact.Service.AutoPick.AutoPickTrigger\n` + + // `交互或拾取:"${name}"`; + // log.debug(logMessage); + log.info(`交互或拾取:"${name}"`); + } + + } + /** * * 向上/下滑动一或多个页面[主要物品选择页面](有误差) @@ -652,6 +741,8 @@ } } + // 偽造地图追踪开始 + await fakeLog(file_name, false, true, 0); await pathingScript.runFile(base_path_pathing + file_name + ".json"); if (file_name === "稻妻-垂钓点-鹤观逢岳之野西南") { @@ -853,6 +944,8 @@ } else if (fishing_cd && !flag) { log.warn(`本次钓鱼异常,不计算垂钓点CD`); } + // 偽造地图追踪结束 + await fakeLog(file_name, false, false, 0); } async function main() { diff --git a/repo/js/AutoFishingTeyvat/manifest.json b/repo/js/AutoFishingTeyvat/manifest.json index fee1eac14..400cdf6cc 100644 --- a/repo/js/AutoFishingTeyvat/manifest.json +++ b/repo/js/AutoFishingTeyvat/manifest.json @@ -1,7 +1,7 @@ { "manifest_version": 1, "name": "提瓦特自动钓鱼(全流程+自选)", - "version": "2.3.7", + "version": "2.3.8", "bgi_version": "0.47.0", "description": "支持自动追踪并垂钓bgi支持的全提瓦特垂钓点", "authors": [ @@ -12,6 +12,9 @@ "name": "蜜柑魚" } ], + "saved_files": [ + "assets/archive.json" + ], "settings_ui": "settings.json", "main": "main.js" }