diff --git a/repo/js/AutoPickLitter/README.md b/repo/js/AutoPickLitter/README.md index ec0cbbf33..67006d507 100644 --- a/repo/js/AutoPickLitter/README.md +++ b/repo/js/AutoPickLitter/README.md @@ -4,7 +4,7 @@ 稻妻抽签、稻妻海螺屋 枫丹领取福利餐 纳塔领取龙蛋 -挪德卡莱转盘、今日收获、糖雕; +挪德卡莱转盘、今日收获、糖雕 ## 注意事项 运行脚本的时候,一定要把世界权限设置【不允许加入】!!! @@ -29,6 +29,9 @@ ## 更新 -### 版本:2.1.2 -更换识别方式,让龙蛋数量进行准确识别 -回退为打开背包识别龙蛋 +### 版本:2.1.3 +记录各子任务运行时间,避免出现重复运行 +增加界面调整,应对某些环境,导致点击失败 +去除实时任务 + +注意此次更新会覆盖本地默认账户文件 \ No newline at end of file diff --git a/repo/js/AutoPickLitter/assets/滚动滚轮.json b/repo/js/AutoPickLitter/assets/滚动滚轮.json new file mode 100644 index 000000000..e5bfdf994 --- /dev/null +++ b/repo/js/AutoPickLitter/assets/滚动滚轮.json @@ -0,0 +1,337 @@ +{ + "macroEvents": [ + { + "type": 6, + "mouseX": 0, + "mouseY": -120, + "time": 594 + }, + { + "type": 6, + "mouseX": 0, + "mouseY": -120, + "time": 625 + }, + { + "type": 6, + "mouseX": 0, + "mouseY": -120, + "time": 656 + }, + { + "type": 6, + "mouseX": 0, + "mouseY": -120, + "time": 688 + }, + { + "type": 6, + "mouseX": 0, + "mouseY": -120, + "time": 938 + }, + { + "type": 6, + "mouseX": 0, + "mouseY": -120, + "time": 969 + }, + { + "type": 6, + "mouseX": 0, + "mouseY": -120, + "time": 969 + }, + { + "type": 6, + "mouseX": 0, + "mouseY": -120, + "time": 985 + }, + { + "type": 6, + "mouseX": 0, + "mouseY": -120, + "time": 1031 + }, + { + "type": 6, + "mouseX": 0, + "mouseY": -120, + "time": 1281 + }, + { + "type": 6, + "mouseX": 0, + "mouseY": -120, + "time": 1297 + }, + { + "type": 6, + "mouseX": 0, + "mouseY": -120, + "time": 1313 + }, + { + "type": 6, + "mouseX": 0, + "mouseY": -120, + "time": 1328 + }, + { + "type": 6, + "mouseX": 0, + "mouseY": -120, + "time": 1344 + }, + { + "type": 6, + "mouseX": 0, + "mouseY": -120, + "time": 1610 + }, + { + "type": 6, + "mouseX": 0, + "mouseY": -120, + "time": 1625 + }, + { + "type": 6, + "mouseX": 0, + "mouseY": -120, + "time": 1641 + }, + { + "type": 6, + "mouseX": 0, + "mouseY": -120, + "time": 1656 + }, + { + "type": 6, + "mouseX": 0, + "mouseY": -120, + "time": 1672 + }, + { + "type": 6, + "mouseX": 0, + "mouseY": -120, + "time": 1922 + }, + { + "type": 6, + "mouseX": 0, + "mouseY": -120, + "time": 1953 + }, + { + "type": 6, + "mouseX": 0, + "mouseY": -120, + "time": 1969 + }, + { + "type": 6, + "mouseX": 0, + "mouseY": -120, + "time": 1969 + }, + { + "type": 6, + "mouseX": 0, + "mouseY": -120, + "time": 1985 + }, + { + "type": 6, + "mouseX": 0, + "mouseY": -120, + "time": 2235 + }, + { + "type": 6, + "mouseX": 0, + "mouseY": -120, + "time": 2266 + }, + { + "type": 6, + "mouseX": 0, + "mouseY": -120, + "time": 2281 + }, + { + "type": 6, + "mouseX": 0, + "mouseY": -120, + "time": 2297 + }, + { + "type": 6, + "mouseX": 0, + "mouseY": -120, + "time": 2297 + }, + { + "type": 6, + "mouseX": 0, + "mouseY": -120, + "time": 2563 + }, + { + "type": 6, + "mouseX": 0, + "mouseY": -120, + "time": 2578 + }, + { + "type": 6, + "mouseX": 0, + "mouseY": -120, + "time": 2610 + }, + { + "type": 6, + "mouseX": 0, + "mouseY": -120, + "time": 2610 + }, + { + "type": 6, + "mouseX": 0, + "mouseY": -120, + "time": 2625 + }, + { + "type": 6, + "mouseX": 0, + "mouseY": -120, + "time": 2656 + }, + { + "type": 6, + "mouseX": 0, + "mouseY": -120, + "time": 2860 + }, + { + "type": 6, + "mouseX": 0, + "mouseY": -120, + "time": 2875 + }, + { + "type": 6, + "mouseX": 0, + "mouseY": -120, + "time": 2891 + }, + { + "type": 6, + "mouseX": 0, + "mouseY": -120, + "time": 2891 + }, + { + "type": 6, + "mouseX": 0, + "mouseY": -120, + "time": 2906 + }, + { + "type": 6, + "mouseX": 0, + "mouseY": -120, + "time": 3125 + }, + { + "type": 6, + "mouseX": 0, + "mouseY": -120, + "time": 3141 + }, + { + "type": 6, + "mouseX": 0, + "mouseY": -120, + "time": 3156 + }, + { + "type": 6, + "mouseX": 0, + "mouseY": -120, + "time": 3156 + }, + { + "type": 6, + "mouseX": 0, + "mouseY": -120, + "time": 3172 + }, + { + "type": 6, + "mouseX": 0, + "mouseY": -120, + "time": 3766 + }, + { + "type": 6, + "mouseX": 0, + "mouseY": -120, + "time": 3797 + }, + { + "type": 6, + "mouseX": 0, + "mouseY": -120, + "time": 3813 + }, + { + "type": 6, + "mouseX": 0, + "mouseY": -120, + "time": 3828 + }, + { + "type": 6, + "mouseX": 0, + "mouseY": -120, + "time": 4125 + }, + { + "type": 6, + "mouseX": 0, + "mouseY": -120, + "time": 4125 + }, + { + "type": 6, + "mouseX": 0, + "mouseY": -120, + "time": 4156 + }, + { + "type": 6, + "mouseX": 0, + "mouseY": -120, + "time": 4172 + }, + { + "type": 6, + "mouseX": 0, + "mouseY": -120, + "time": 4188 + } + ], + "info": { + "name": "", + "description": "", + "x": 0, + "y": 0, + "width": 1920, + "height": 1080, + "recordDpi": 1 + } +} \ No newline at end of file diff --git a/repo/js/AutoPickLitter/assets/调为白天.json b/repo/js/AutoPickLitter/assets/调为白天.json new file mode 100644 index 000000000..7fe4d442e --- /dev/null +++ b/repo/js/AutoPickLitter/assets/调为白天.json @@ -0,0 +1,31 @@ +{ + "info": { + "authors": [ + { + "links": "", + "name": "mno" + } + ], + "bgi_version": "0.45.0", + "description": "", + "enable_monster_loot_split": false, + "last_modified_time": 1765207268104, + "map_match_method": "", + "map_name": "Teyvat", + "name": "调为白天", + "tags": [], + "type": "collect", + "version": "1.0" + }, + "positions": [ + { + "action": "set_time", + "action_params": "6:00", + "id": 1, + "move_mode": "walk", + "type": "orientation", + "x": 0, + "y": 0 + } + ] +} \ No newline at end of file diff --git a/repo/js/AutoPickLitter/main.js b/repo/js/AutoPickLitter/main.js index d5183d71f..40afcedf6 100644 --- a/repo/js/AutoPickLitter/main.js +++ b/repo/js/AutoPickLitter/main.js @@ -1,11 +1,23 @@ -// 初始化相关变量 +/* --------------------------初始变量区----------------------- */ let gameRegion; // 游戏截图区域 const dialogZone = { x: { min: 900, max: 1700 }, y: { min: 450, max: 880 } }; // 对话识别区域 let record = {}; // record 记录内容 -let recordsNum = 0; // 写入内容次数 -let sticksTime = false; // 判定是否可以上香 + +// 判定是否可以运行子任务 +let recordsTime = { + "waterTime": false, + "sticksTime": false, + "lotsTime": false, + "conchsTime": false, + "mealTime": false, + "eggsTime": false, + "turntableTime": false, + "todayLuckTime": false, + "sweetStatueTime": false +}; + //六龙蛋位置 -const coordinates = [ +const eggCoordinates = [ [565, 150], // 山 [568, 723], // 飞 [1088, 161], // 圣 @@ -14,8 +26,9 @@ const coordinates = [ [1339, 358] // 菲 ]; -// 通用方法区域 -//切换队伍 + +/* --------------------------封装函数区----------------------- */ +// 切换队伍 async function switchPartyIfNeeded() { if (!settings.partyName) { await genshin.returnMainUi(); @@ -137,7 +150,6 @@ async function clickLongTalk() { do { leftButtonClick(); isMainUi = await findImgIcon("assets/RecognitionObject/PaiMonMenu.png", { min: 15, max: 112 }, { min: 0, max: 84 }, false, 0.8, 500); - // log.info(`你看嘛: ${isMainUi.success}`); } while (!isMainUi.success); }; @@ -171,15 +183,15 @@ async function scrollPage(totalDistance, stepDistance = 10, delayMs = 5) { leftButtonUp(); // 等待100ms await sleep(100); -} +}; -//fakeLog 函数,使用方法:将本函数放在主函数前,调用时请务必使用await,否则可能出现v8白框报错 -//在js开头处伪造该js结束运行的日志信息,如 await fakeLog("js脚本", true, true, 0); -//在js结尾处伪造该js开始运行的日志信息,如 await fakeLog("js脚本", true, false, 2333); -//duration项目仅在伪造结束信息时有效,且无实际作用,可以任意填写,当你需要在日志中输出特定值时才需要,单位为毫秒 -//在调用地图追踪前伪造该地图追踪开始运行的日志信息,如 await fakeLog(`地图追踪.json`, false, true, 0); -//在调用地图追踪后伪造该地图追踪结束运行的日志信息,如 await fakeLog(`地图追踪.json`, false, false, 0); -//如此便可以在js运行过程中伪造地图追踪的日志信息,可以在日志分析等中查看 +/* fakeLog 函数,使用方法:将本函数放在主函数前,调用时请务必使用await,否则可能出现v8白框报错 +在js开头处伪造该js结束运行的日志信息,如 await fakeLog("js脚本", true, true, 0); +在js结尾处伪造该js开始运行的日志信息,如 await fakeLog("js脚本", true, false, 2333); +duration项目仅在伪造结束信息时有效,且无实际作用,可以任意填写,当你需要在日志中输出特定值时才需要,单位为毫秒 +在调用地图追踪前伪造该地图追踪开始运行的日志信息,如 await fakeLog(`地图追踪.json`, false, true, 0); +在调用地图追踪后伪造该地图追踪结束运行的日志信息,如 await fakeLog(`地图追踪.json`, false, false, 0); +如此便可以在js运行过程中伪造地图追踪的日志信息,可以在日志分析等中查看 */ async function fakeLog(name, isJs, isStart, duration) { await sleep(10); const currentTime = Date.now(); @@ -300,7 +312,15 @@ async function recordForFile(judge) { /* ---------- 初始化记录对象 ---------- */ record = { lastRunDate: "1970/01/01", - lastActivateTime: new Date("1970-01-01T20:00:00.000Z"), + lastWaterTime: new Date("1970-01-01 20:00"), + lastSticksTime: new Date("1970-01-01 20:00"), + lastLotsTime: new Date("1970-01-01 20:00"), + lastConchsTime: new Date("1970-01-01 20:00"), + lastMealTime: new Date("1970-01-01 20:00"), + lastEggsTime: new Date("1970-01-01 20:00"), + lastTurntableTime: new Date("1970-01-01 20:00"), + lastTodayLuckTime: new Date("1970-01-01 20:00"), + lastSweetStatueTime: new Date("1970-01-01 20:00"), lastDragonEggsNum: "【山之血:0,飞澜鲨鲨:0,圣龙君临:0,太阳的轰鸣:0,献给小酒杯:0,菲耶蒂娜:0】", records: new Array(51).fill(""), version: "" @@ -328,15 +348,112 @@ async function recordForFile(judge) { record.lastRunDate = line.slice("上次运行日期:".length).trim(); }; - /* 上次上香时间 */ - let timeStr = null; - if (line.startsWith("上次上香时间:")) { - timeStr = line.slice("上次上香时间:".length).trim(); + /* 上次取水时间 */ + let waterTime = null; + if (line.startsWith("上次取水时间:")) { + waterTime = line.slice("上次取水时间:".length).trim(); }; - if (timeStr) { - const d = new Date(timeStr); + if (waterTime) { + const d = new Date(waterTime); if (!isNaN(d.getTime())) { - record.lastActivateTime = d; // 保持 Date 对象 + record.lastWaterTime = d; // 保持 Date 对象 + }; + }; + + /* 上次上香时间 */ + let sticksTime = null; + if (line.startsWith("上次上香时间:")) { + sticksTime = line.slice("上次上香时间:".length).trim(); + }; + if (sticksTime) { + const d = new Date(sticksTime); + if (!isNaN(d.getTime())) { + record.lastSticksTime = d; // 保持 Date 对象 + }; + }; + + /* 上次抽签时间 */ + let lotsTime = null; + if (line.startsWith("上次抽签时间:")) { + lotsTime = line.slice("上次抽签时间:".length).trim(); + }; + if (lotsTime) { + const d = new Date(lotsTime); + if (!isNaN(d.getTime())) { + record.lastLotsTime = d; // 保持 Date 对象 + }; + }; + + /* 上次拾螺时间 */ + let conchsTime = null; + if (line.startsWith("上次拾螺时间:")) { + conchsTime = line.slice("上次拾螺时间:".length).trim(); + }; + if (conchsTime) { + const d = new Date(conchsTime); + if (!isNaN(d.getTime())) { + record.lastConchsTime = d; // 保持 Date 对象 + }; + }; + + /* 上次探监时间 */ + let mealTime = null; + if (line.startsWith("上次探监时间:")) { + mealTime = line.slice("上次探监时间:".length).trim(); + }; + if (mealTime) { + const d = new Date(mealTime); + if (!isNaN(d.getTime())) { + record.lastMealTime = d; // 保持 Date 对象 + }; + }; + + /* 上次拾蛋时间 */ + let eggsTime = null; + if (line.startsWith("上次拾蛋时间:")) { + eggsTime = line.slice("上次拾蛋时间:".length).trim(); + }; + if (eggsTime) { + const d = new Date(eggsTime); + if (!isNaN(d.getTime())) { + record.lastEggsTime = d; // 保持 Date 对象 + }; + }; + + /* 上次转盘时间 */ + let turntableTime = null; + if (line.startsWith("上次转盘时间:")) { + turntableTime = line.slice("上次转盘时间:".length).trim(); + }; + if (turntableTime) { + const d = new Date(turntableTime); + if (!isNaN(d.getTime())) { + record.lastTurntableTime = d; // 保持 Date 对象 + }; + }; + + /* 上次领菜时间 */ + let todayLuckTime = null; + if (line.startsWith("上次领菜时间:")) { + todayLuckTime = line.slice("上次领菜时间:".length).trim(); + }; + if (todayLuckTime) { + const d = new Date(todayLuckTime); + if (!isNaN(d.getTime())) { + record.lastTodayLuckTime = d; // 保持 Date 对象 + }; + }; + + /* 上次领糖时间 */ + let sweetStatueTime = null; + if (line.startsWith("上次领糖时间:")) { + sweetStatueTime = line.slice("上次领糖时间:".length).trim(); + }; + if (sweetStatueTime) { + + const d = new Date(sweetStatueTime); + if (!isNaN(d.getTime())) { + record.lastSweetStatueTime = d; // 保持 Date 对象 }; }; @@ -363,7 +480,6 @@ async function recordForFile(judge) { }; log.info(`上次运行日期: ${record.lastRunDate}`); - log.info(`上次上香开始时间: ${record.lastActivateTime.toLocaleString()}`); /* ---------- 读取 manifest 版本 ---------- */ try { @@ -374,28 +490,148 @@ async function recordForFile(judge) { log.error("读取或解析 manifest.json 失败:", err); }; + /* ---------- 判断取水时间 ---------- */ + if (settings.water) { + const now = Date.now(); // 当前毫秒时间戳 + const aimWaterTime = new Date(record.lastWaterTime.getTime() + 24 * 60 * 60 * 1000).getTime(); + /* ---------- 计算下次可取水时间 ---------- */ + if (aimWaterTime - now > 0) { + log.info(`取水时间还未到!!!`); + recordsTime.waterTime = false; + } else { + log.info(`取水时间已到,请准备取水!`); + recordsTime.waterTime = true; + }; + }; + /* ---------- 判断上香时间 ---------- */ if (settings.sticks) { const now = Date.now(); // 当前毫秒时间戳 - const aimActivateTime = new Date(record.lastActivateTime.getTime() + 24 * 60 * 60 * 1000).getTime(); + const aimSticksTime = new Date(record.lastSticksTime.getTime() + 24 * 60 * 60 * 1000).getTime(); /* ---------- 计算下次可上香时间 ---------- */ - if (aimActivateTime - now > 0) { + if (aimSticksTime - now > 0) { log.info(`上香时间还未到!!!`); - sticksTime = false; + recordsTime.sticksTime = false; } else { log.info(`上香时间已到,请准备上香!`); - sticksTime = true; + recordsTime.sticksTime = true; }; }; + + /* ---------- 判断抽签时间 ---------- */ + if (settings.lots) { + const now = Date.now(); // 当前毫秒时间戳 + const aimLotsTime = new Date(record.lastLotsTime.getTime() + 24 * 60 * 60 * 1000).getTime(); + /* ---------- 计算下次可抽签时间 ---------- */ + if (aimLotsTime - now > 0) { + log.info(`抽签时间还未到!!!`); + recordsTime.lotsTime = false; + } else { + log.info(`抽签时间已到,请准备抽签!`); + recordsTime.lotsTime = true; + }; + }; + + /* ---------- 判断拾螺时间 ---------- */ + if (settings.conchs) { + const now = Date.now(); // 当前毫秒时间戳 + const aimConchsTime = new Date(record.lastConchsTime.getTime() + 24 * 60 * 60 * 1000).getTime(); + /* ---------- 计算下次可拾螺时间 ---------- */ + if (aimConchsTime - now > 0) { + log.info(`拾螺时间还未到!!!`); + recordsTime.conchsTime = false; + } else { + log.info(`拾螺时间已到,请准备拾螺!`); + recordsTime.conchsTime = true; + }; + }; + + /* ---------- 判断探监时间 ---------- */ + if (settings.meal) { + const now = Date.now(); // 当前毫秒时间戳 + const aimMealTime = new Date(record.lastMealTime.getTime() + 24 * 60 * 60 * 1000).getTime(); + /* ---------- 计算下次可探监时间 ---------- */ + if (aimMealTime - now > 0) { + log.info(`探监时间还未到!!!`); + recordsTime.mealTime = false; + } else { + log.info(`探监时间已到,请准备探监!`); + recordsTime.mealTime = true; + }; + }; + + /* ---------- 判断拾蛋时间 ---------- */ + if (settings.eggs) { + const now = Date.now(); // 当前毫秒时间戳 + const aimEggsTime = new Date(record.lastEggsTime.getTime() + 24 * 60 * 60 * 1000).getTime(); + /* ---------- 计算下次可拾蛋时间 ---------- */ + if (aimEggsTime - now > 0) { + log.info(`拾蛋时间还未到!!!`); + recordsTime.eggsTime = false; + } else { + log.info(`拾蛋时间已到,请准备拾蛋!`); + recordsTime.eggsTime = true; + }; + }; + + /* ---------- 判断转盘时间 ---------- */ + if (settings.turntable) { + const now = Date.now(); // 当前毫秒时间戳 + const aimTurntableTime = new Date(record.lastTurntableTime.getTime() + 24 * 60 * 60 * 1000).getTime(); + /* ---------- 计算下次可转盘时间 ---------- */ + if (aimTurntableTime - now > 0) { + log.info(`转盘时间还未到!!!`); + recordsTime.turntableTime = false; + } else { + log.info(`转盘时间已到,请准备转盘!`); + recordsTime.turntableTime = true; + }; + }; + + /* ---------- 判断领菜时间 ---------- */ + if (settings.todayLuck) { + const now = Date.now(); // 当前毫秒时间戳 + const aimTodayLuckTime = new Date(record.lastTodayLuckTime.getTime() + 24 * 60 * 60 * 1000).getTime(); + /* ---------- 计算下次可领菜时间 ---------- */ + if (aimTodayLuckTime - now > 0) { + log.info(`领菜时间还未到!!!`); + recordsTime.todayLuckTime = false; + } else { + log.info(`领菜时间已到,请准备领菜!`); + recordsTime.todayLuckTime = true; + }; + }; + + /* ---------- 判断领糖时间 ---------- */ + if (settings.sweetStatue) { + const now = Date.now(); // 当前毫秒时间戳 + const aimSweetStatueTime = new Date(record.lastSweetStatueTime.getTime() + 24 * 60 * 60 * 1000).getTime(); + /* ---------- 计算下次可领糖时间 ---------- */ + if (aimSweetStatueTime - now > 0) { + log.info(`领糖时间还未到!!!`); + recordsTime.sweetStatueTime = false; + } else { + log.info(`领糖时间已到,请准备领糖!`); + recordsTime.sweetStatueTime = true; + }; + }; + } else { let recordFilePath = `records/${accountName}.txt`; let lines = [ `上次运行日期: ${record.lastRunDate}`, - `上次上香时间: ${record.lastActivateTime.toISOString()}`, + `上次取水时间: ${record.lastWaterTime.toISOString().slice(0, 10) + ' ' + record.lastWaterTime.toTimeString().slice(0, 8)}`, + `上次上香时间: ${record.lastSticksTime.toISOString().slice(0, 10) + ' ' + record.lastSticksTime.toTimeString().slice(0, 8)}`, + `上次抽签时间: ${record.lastLotsTime.toISOString().slice(0, 10) + ' ' + record.lastLotsTime.toTimeString().slice(0, 8)}`, + `上次拾螺时间: ${record.lastConchsTime.toISOString().slice(0, 10) + ' ' + record.lastConchsTime.toTimeString().slice(0, 8)}`, + `上次探监时间: ${record.lastMealTime.toISOString().slice(0, 10) + ' ' + record.lastMealTime.toTimeString().slice(0, 8)}`, + `上次拾蛋时间: ${record.lastEggsTime.toISOString().slice(0, 10) + ' ' + record.lastEggsTime.toTimeString().slice(0, 8)}`, + `上次转盘时间: ${record.lastTurntableTime.toISOString().slice(0, 10) + ' ' + record.lastTurntableTime.toTimeString().slice(0, 8)}`, + `上次领菜时间: ${record.lastTodayLuckTime.toISOString().slice(0, 10) + ' ' + record.lastTodayLuckTime.toTimeString().slice(0, 8)}`, + `上次领糖时间: ${record.lastSweetStatueTime.toISOString().slice(0, 10) + ' ' + record.lastSweetStatueTime.toTimeString().slice(0, 8)}`, `背包龙蛋数目: ${record.lastDragonEggsNum}`, ...record.records.filter(Boolean) ]; - let content = lines.join('\n'); try { @@ -433,7 +669,7 @@ async function chcekDragonEggs() { // { min: DragonEgg.coordinates[0]-46, max: DragonEgg.coordinates[0]+34 }, { min: DragonEgg.coordinates[1]+56, max: DragonEgg.coordinates[1]+83 }, true); // // log.info(`第二次识别到的数字:${ocrEggNum.text}`); // }; - let eggNum = await numberTemplateMatch('assets/backpackNumber', DragonEgg.coordinates[0]-46, DragonEgg.coordinates[1]+56, 80, 27); + let eggNum = await numberTemplateMatch('assets/backpackNumber', { min: DragonEgg.coordinates[0]-46, max: DragonEgg.coordinates[0]+34 }, { min: DragonEgg.coordinates[1]+56, max: DragonEgg.coordinates[1]+83 }); log.info(`识别到的数字:${eggNum}`); DragonEggs[index] = Number(eggNum); }else{ @@ -446,10 +682,7 @@ async function chcekDragonEggs() { for (let index = 0; index < 6; index++) { let DragonEgg = await findImgIcon(`assets/RecognitionObject/DragonEgg${index}.png`, { min: 99, max: 1295 }, { min: 104, max: 967 }, true, 0.95); if (DragonEgg.success) { - let eggNum = await numberTemplateMatch('assets/backpackNumber', DragonEgg.coordinates[0]-46, DragonEgg.coordinates[1]+56, 80, 27); - if (eggNum == "") { - eggNum = 1; - }; + let eggNum = await numberTemplateMatch('assets/backpackNumber', { min: DragonEgg.coordinates[0]-46, max: DragonEgg.coordinates[0]+34 }, { min: DragonEgg.coordinates[1]+56, max: DragonEgg.coordinates[1]+83 }); DragonEggs[index] = eggNum; }else{ DragonEggs[index] = 0; @@ -528,12 +761,13 @@ async function checkExpire() { * @returns {number} 识别出的整数;若没有任何有效数字框则返回 -1 * * @example - * const mora = await numberTemplateMatch('摩拉数字', 860, 70, 200, 40); + * const mora = await numberTemplateMatch('摩拉数字', { min: 1482, max: 1630 }, { min: 912, max: 957 }); * if (mora >= 0) console.log(`当前摩拉:${mora}`); */ async function numberTemplateMatch( numberPngFilePath, - x = 0, y = 0, w = 1920, h = 1080, + xRange = { min: 0, max: 1920 }, + yRange = { min: 0, max: 1080 }, maxThreshold = 0.95, minThreshold = 0.8, splitCount = 3, @@ -542,7 +776,7 @@ async function numberTemplateMatch( let ros = []; for (let i = 0; i <= 9; i++) { ros[i] = RecognitionObject.TemplateMatch( - file.ReadImageMatSync(`${numberPngFilePath}/${i}.png`), x, y, w, h); + file.ReadImageMatSync(`${numberPngFilePath}/${i}.png`), xRange.min, yRange.min, xRange.max - xRange.min, yRange.max - yRange.min); }; function setThreshold(roArr, newThreshold) { @@ -624,6 +858,8 @@ async function numberTemplateMatch( return 0; }; await setGameMetrics(1920,1080,1); + await dispatcher.AddTrigger(new RealtimeTimer("AutoSkip")); + await dispatcher.clearAllTriggers(); // 判定文件名的合法性,以及初始化相关文件 await recordForFile(true); // 更新日期信息 @@ -632,11 +868,12 @@ async function numberTemplateMatch( .replace(/\//g, '/'); await recordForFile(false); // 蒙德清泉镇圣水 - if (settings.water) { + if (recordsTime.waterTime) { await fakeLog("蒙德清泉镇圣水", false, true, 0); await genshin.returnMainUi(); + await pathingScript.runFile("assets/调为白天.json"); await pathingScript.runFile("assets/蒙德清泉镇路线.json"); - await genshin.setTime(8,0); + await keyMouseScript.runFile("assets/滚动滚轮.json"); await sleep(700); //识别对话位置,并点击 let ocrResults = await performOcr("神奇的", dialogZone.x, dialogZone.y, false); @@ -649,7 +886,7 @@ async function numberTemplateMatch( if (ocrOver.success) { log.info("已售罄!!!"); } else { - const mora = await numberTemplateMatch('assets/moraNumber', 1600, 30, 180, 30); + const mora = await numberTemplateMatch('assets/moraNumber', { min: 1600, max: 1780 }, { min: 30, max: 60 }); if (BigInt(mora) >= 300) { await sleep(800); await click(1636,1019); @@ -661,18 +898,21 @@ async function numberTemplateMatch( }; }; }; + record.lastWaterTime = new Date();; + await recordForFile(false); await genshin.returnMainUi(); await fakeLog("蒙德清泉镇圣水", false, false, 0); }; // 璃月璃沙娇上香 - if (sticksTime) { + if (recordsTime.sticksTime) { await fakeLog("璃月璃沙娇上香", false, true, 0); await genshin.returnMainUi(); // 更新上香时间 record.lastActivateTime = new Date(); await recordForFile(false); await pathingScript.runFile("assets/璃月璃沙娇路线.json"); + await keyMouseScript.runFile("assets/滚动滚轮.json"); await sleep(1000); // 识别区域 let ocrResults = await performOcr("王平安", dialogZone.x, dialogZone.y, false); @@ -695,15 +935,18 @@ async function numberTemplateMatch( } else { log.error(`识别图像时发生异常: ${error.message}`); }; + record.lastSticksTime = new Date();; + await recordForFile(false); await genshin.returnMainUi(); await fakeLog("璃月璃沙娇上香", false, false, 0); }; // 稻妻鸣神大社抽签 - if (settings.lots) { + if (recordsTime.lotsTime) { await fakeLog("稻妻鸣神大社抽签", false, true, 0) await genshin.returnMainUi(); await pathingScript.runFile("assets/稻妻鸣神大社路线.json"); + await keyMouseScript.runFile("assets/滚动滚轮.json"); await sleep(1000); // 识别对话位置,并点击 let ocrResults = await performOcr("御神签箱", dialogZone.x, dialogZone.y, false); @@ -842,15 +1085,18 @@ async function numberTemplateMatch( log.error(`识别图像时发生异常: ${error.message}`); // await genshin.returnMainUi(); }; + record.lastLotsTime = new Date();; + await recordForFile(false); await genshin.returnMainUi(); await fakeLog("稻妻鸣神大社抽签", false, true, 0) }; // 稻妻踏鞴砂海螺 - if (settings.conchs) { + if (recordsTime.conchsTime) { await fakeLog("稻妻踏鞴砂海螺", false, true, 0) await genshin.returnMainUi(); await pathingScript.runFile("assets/稻妻踏鞴砂路线.json"); + await keyMouseScript.runFile("assets/滚动滚轮.json"); await sleep(1000); if (settings.doYouOpen) { await pathingScript.runFile("assets/阿敬.json"); @@ -890,15 +1136,18 @@ async function numberTemplateMatch( log.error(`识别图像时发生异常: ${error.message}`); }; }; + record.lastConchsTime = new Date();; + await recordForFile(false); await genshin.returnMainUi(); await fakeLog("稻妻踏鞴砂海螺", false, false, 0) }; //枫丹梅洛彼得堡福利餐 - if(settings.meal){ + if(recordsTime.mealTime){ await fakeLog("枫丹梅洛彼得堡福利餐", false, true, 0) await genshin.returnMainUi(); await pathingScript.runFile("assets/枫丹梅洛彼得堡路线.json"); + await keyMouseScript.runFile("assets/滚动滚轮.json"); await sleep(1500); let ocrResults = await performOcr("布兰", dialogZone.x, dialogZone.y, false); if (ocrResults.success) { @@ -979,7 +1228,8 @@ async function numberTemplateMatch( record.records[0] = `幸运签内容: ${text}`; if (settings.notify) { notification.Send(`幸运签内容: ${text}`); - } + }; + record.lastMealTime = new Date();; await recordForFile(false);// 修改记录文件 }; @@ -992,7 +1242,7 @@ async function numberTemplateMatch( }; // 纳塔悠悠集市龙蛋 - if(settings.eggs){ + if(recordsTime.eggsTime){ await fakeLog("纳塔悠悠集市龙蛋", false, true, 0) // 保留打开背包识别龙蛋信息 let nowDragonEggsNum = record.lastDragonEggsNum; @@ -1003,6 +1253,7 @@ async function numberTemplateMatch( let nowDragonEggs = nowDragonEggsNum.match(/\d+/g).map(Number); await genshin.returnMainUi(); await pathingScript.runFile("assets/纳塔悠悠集市路线.json"); + await keyMouseScript.runFile("assets/滚动滚轮.json"); let ocrResults = await performOcr("察尔瓦", dialogZone.x, dialogZone.y, false); if (ocrResults.success) { await sleep(700); @@ -1102,7 +1353,7 @@ async function numberTemplateMatch( settings.dragonEggsNum = `${nowDragonEggs[0]}-${nowDragonEggs[1]}-${nowDragonEggs[2]}-${nowDragonEggs[3]}-${nowDragonEggs[4]}-${nowDragonEggs[5]}`; record.lastDragonEggsNum = `【山之血:${nowDragonEggs[0]},飞澜鲨鲨:${nowDragonEggs[1]},圣龙君临:${nowDragonEggs[2]},太阳的轰鸣:${nowDragonEggs[3]},献给小酒杯:${nowDragonEggs[4]},菲耶蒂娜:${nowDragonEggs[5]}】`; await recordForFile(false); - moveMouseTo(coordinates[figure][0],coordinates[figure][1]); + moveMouseTo(eggCoordinates[figure][0],eggCoordinates[figure][1]); await sleep(100); leftButtonClick(); await sleep(3000); @@ -1112,16 +1363,18 @@ async function numberTemplateMatch( } else { log.error(`识别图像时发生异常: ${error.message}`); }; - + record.lastEggsTime = new Date();; + await recordForFile(false); await genshin.returnMainUi(); await fakeLog("纳塔悠悠集市龙蛋", false, false, 0) }; //挪德卡莱那夏镇好运转盘 - if (settings.turntable) { + if (recordsTime.turntableTime) { await fakeLog("挪德卡莱那夏镇好运转盘", false, true, 0) await genshin.returnMainUi(); await pathingScript.runFile("assets/挪德卡莱那夏镇好运转盘路线.json"); + await keyMouseScript.runFile("assets/滚动滚轮.json"); await sleep(1500); let text = ""; @@ -1142,7 +1395,6 @@ async function numberTemplateMatch( ocrText = await performOcr("", { min: 555, max: 1365 }, { min: 902, max: 1000 }, true); }; log.info(`转盘运势:${ocrText.text}`); - // writeContentToFile(`转盘的运势:${recognizedText}\n`, false); text = ocrText.text.replace(/\r\n|\n|\r/g, ""); switch (settings.selectLuckTendency) { case "林狼啸月,魔物环伺": @@ -1248,16 +1500,18 @@ async function numberTemplateMatch( if (settings.notify) { notification.Send(`转盘的运势: ${text}`); }; + record.lastTurntableTime = new Date();; await recordForFile(false);// 修改记录文件 await genshin.returnMainUi(); await fakeLog("挪德卡莱那夏镇好运转盘", false, false, 0) }; // 挪德卡莱那夏镇今日收获 - if (settings.todayLuck) { + if (recordsTime.todayLuckTime) { await fakeLog("挪德卡莱那夏镇美味的今日收获", false, true, 0) await genshin.returnMainUi(); await pathingScript.runFile("assets/挪德卡莱那夏镇美味的今日收获路线.json"); + await keyMouseScript.runFile("assets/滚动滚轮.json"); await sleep(1000); let ocrResults = await performOcr("莉莉希", dialogZone.x, dialogZone.y, false); if (ocrResults.success) { @@ -1281,14 +1535,17 @@ async function numberTemplateMatch( } else { log.error(`识别图像时发生异常: ${error.message}`); }; + record.lastTodayLuckTime = new Date();; + await recordForFile(false); await genshin.returnMainUi(); await fakeLog("挪德卡莱那夏镇美味的今日收获", false, false, 0) }; // 挪德卡莱那夏镇糖雕 - if (settings.sweetStatue) { + if (recordsTime.sweetStatueTime) { await fakeLog("挪德卡莱那夏镇糖雕", false, true, 0) await pathingScript.runFile("assets/挪德卡莱那夏镇糖雕路线.json"); + await keyMouseScript.runFile("assets/滚动滚轮.json"); await sleep(1000); if (settings.partyName == "") { let ocrResults = await performOcr("乌娜亚塔", dialogZone.x, dialogZone.y, false); @@ -1389,6 +1646,8 @@ async function numberTemplateMatch( }; }; }; + record.lastSweetStatueTime = new Date();; + await recordForFile(false); await genshin.returnMainUi(); await fakeLog("挪德卡莱那夏镇糖雕", false, false, 0) }; @@ -1402,5 +1661,4 @@ async function numberTemplateMatch( await fakeLog("AutoPickLitter脚本", true, false, 2333); -})(); - +})(); \ No newline at end of file diff --git a/repo/js/AutoPickLitter/manifest.json b/repo/js/AutoPickLitter/manifest.json index d909b2d12..a4f1ec073 100644 --- a/repo/js/AutoPickLitter/manifest.json +++ b/repo/js/AutoPickLitter/manifest.json @@ -1,7 +1,7 @@ { "manifest_version": 1, "name": "提瓦特杂事(收集)", - "version": "2.1.2", + "version": "2.1.3", "tags": [ "玄学", "收集", @@ -9,7 +9,6 @@ ], "description": "买圣水、抽签、海螺、上香、领福利餐、领闪闪礼蛋、好运转盘、今日收获", "saved_files": [ - "records/默认账户.txt" ], "authors": [ { diff --git a/repo/js/AutoPickLitter/records/历史更新记录.txt b/repo/js/AutoPickLitter/records/历史更新记录.txt index f1136f8f4..2f8d87483 100644 --- a/repo/js/AutoPickLitter/records/历史更新记录.txt +++ b/repo/js/AutoPickLitter/records/历史更新记录.txt @@ -1,3 +1,7 @@ +### 版本:2.1.2 +更换识别方式,让龙蛋数量进行准确识别 +回退为打开背包识别龙蛋 + ### 版本:2.1.1 修复龙蛋平均模式 diff --git a/repo/js/AutoPickLitter/records/默认账户.txt b/repo/js/AutoPickLitter/records/默认账户.txt index 1352daeaf..ca3b28960 100644 --- a/repo/js/AutoPickLitter/records/默认账户.txt +++ b/repo/js/AutoPickLitter/records/默认账户.txt @@ -1,25 +1,12 @@ -上次运行日期: 2026/02/14 -上次上香时间: 2026-01-18T11:07:47.147Z -背包龙蛋数目: 【山之血:1,飞澜鲨鲨:1,圣龙君临:3,太阳的轰鸣:3,献给小酒杯:2,菲耶蒂娜:5】 ->>>>>>>>>> 2026年02月14日 ->>>>>>>>>> 2026年02月14日 ->>>>>>>>>> 2026年02月14日 ->>>>>>>>>> 2026年02月14日 ->>>>>>>>>> 2026年02月14日 ->>>>>>>>>> 2026年02月01日 ->>>>>>>>>> 2026年01月31日 ->>>>>>>>>> 2026年01月31日 ->>>>>>>>>> 2026年01月18日 ->>>>>>>>>> 2026年01月18日 -转盘的运势: 「『旭日瞳瞳,驱散迷雾。』就是遇到困难也没关系,一定会得到帮助的意思!」 -幸运签内容: 「遇到障碍也别退缩,先来一份福利餐。障碍不会因此消失,但至少你填饱了肚子 -获得的食物: 美味的塔塞斯杂烩 -抽签的结果: 末吉 ->>>>>>>>>> 2026年01月18日 ->>>>>>>>>> 2025年11月26日 -转盘的运势: 「『雷鸣风骤,摧枯拉朽。』就是之前的成果有可能被糟蹋掉的意思。」 -转盘的运势: 「『海蛇翻腾,风暴虐。』就是不管做什么都会遇到阻碍的意思。」 -幸运签内容: 「我只是一张幸运签,不能为你遇到的困难提供解答。你得靠自己振作起来。」 -获得的食物: 薄荷果冻 -抽签的结果: 吉 ->>>>>>>>>> 2025年11月22日 \ No newline at end of file +上次运行日期: 1970/01/01 +上次取水时间: 1970-01-01 20:00:00 +上次上香时间: 1970-01-01 20:00:00 +上次抽签时间: 1970-01-01 20:00:00 +上次拾螺时间: 1970-01-01 20:00:00 +上次探监时间: 1970-01-01 20:00:00 +上次拾蛋时间: 1970-01-01 20:00:00 +上次转盘时间: 1970-01-01 20:00:00 +上次领菜时间: 1970-01-01 20:00:00 +上次领糖时间: 1970-01-01 20:00:00 +背包龙蛋数目: 【山之血:0,飞澜鲨鲨:0,圣龙君临:0,太阳的轰鸣:0,献给小酒杯:0,菲耶蒂娜:0】 +>>>>>>>>>> 1970年01月01日 \ No newline at end of file diff --git a/repo/js/AutoPickLitter/settings.json b/repo/js/AutoPickLitter/settings.json index 531e84066..1481e7c72 100644 --- a/repo/js/AutoPickLitter/settings.json +++ b/repo/js/AutoPickLitter/settings.json @@ -4,16 +4,34 @@ "type": "checkbox", "label": " 按自身情况选择相关内容 \n有打开背包的操作,运行前将世界权限设为【不允许加入】\n\n-----------------蒙德清泉镇圣水---------------" }, + { + "type":"separator" + }, + { + "type":"separator" + }, { "name": "sticks", "type": "checkbox", "label": "\n-----------------璃月铜雀庙上香---------------\n注意:请完成相关系列任务" }, + { + "type":"separator" + }, + { + "type":"separator" + }, { "name": "lots", "type": "checkbox", "label": "\n---------------稻妻鸣神大社抽签---------------\n注意:勾选前,请去看readme" }, + { + "type":"separator" + }, + { + "type":"separator" + }, { "name": "conchs", "type": "checkbox", @@ -34,11 +52,23 @@ ], "default": "0" }, + { + "type":"separator" + }, + { + "type":"separator" + }, { "name": "meal", "type": "checkbox", "label": "\n-------------枫丹梅洛彼得堡福利餐-------------\n注意:开图啊,喂!!!" }, + { + "type":"separator" + }, + { + "type":"separator" + }, { "name": "eggs", "type": "checkbox", @@ -74,6 +104,12 @@ "label": "是否更新背包各龙蛋数目(默认否),勾选上后,下次运行前记得取消", "default": "false" }, + { + "type":"separator" + }, + { + "type":"separator" + }, { "name": "turntable", "type": "checkbox", @@ -102,11 +138,23 @@ "label": "最大转次数(默认是10次)", "default": "10" }, + { + "type":"separator" + }, + { + "type":"separator" + }, { "name": "todayLuck", "type": "checkbox", "label": "\n-------------挪德卡莱那夏镇今日收获------------\n注意:开图,并且完成【餐食大事】的任务!!!" }, + { + "type":"separator" + }, + { + "type":"separator" + }, { "name": "sweetStatue", "type": "checkbox", @@ -133,11 +181,23 @@ ], "default": "" }, + { + "type":"separator" + }, + { + "type":"separator" + }, { "name": "notify", "type": "checkbox", "label": "\n---------------------通知---------------------\n是否开启通知" }, + { + "type":"separator" + }, + { + "type":"separator" + }, { "name": "accountName", "type": "input-text",