From 4a530748c7a4dafe3ee67def5cb0a2e02202a75f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=BA=81=E5=8A=A8=E7=9A=84=E5=B0=8F=E6=B0=A8=E6=B0=94?= Date: Mon, 12 Jan 2026 15:27:06 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BD=92=E6=A1=A3=E9=87=8D=E5=A4=8D=E6=88=96?= =?UTF-8?q?=E6=97=A0=E7=94=A8=E8=84=9A=E6=9C=AC=EF=BC=8C=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E8=B0=83=E6=95=B4=E6=97=B6=E9=97=B4=E8=84=9A=E6=9C=AC=20(#2662?= =?UTF-8?q?)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../assets/RecognitionObject/ConfirmButton.png | Bin .../main.js | 0 .../manifest.json | 0 .../settings.json | 0 archive/js/SetTime/main.js | 70 ++++++ archive/js/SetTime/manifest.json | 14 ++ archive/js/SetTime/settings.json | 7 + {repo => archive}/js/SetTimeMinute/main.js | 126 +++++------ .../js/SetTimeMinute/manifest.json | 28 +-- .../js/SetTimeMinute}/settings.json | 0 .../assets/Picture/image1.png | Bin .../assets/icon/Comfirm.png | Bin .../分解圣遗物 带背包过期弹窗自动点击/main.js | 194 ++++++++--------- .../manifest.json | 26 +-- .../settings.json | 0 .../js/多层文件夹处理/assets/文件1.txt | 0 .../js/多层文件夹处理/assets/文件2.json | 0 .../js/多层文件夹处理/assets/文件3.json | 0 .../assets/文件夹1/子文件夹1/文件6.json | 0 .../多层文件夹处理/assets/文件夹1/文件4.json | 0 .../多层文件夹处理/assets/文件夹1/文件5.json | 0 .../多层文件夹处理/assets/文件夹2/文件7.json | 0 {repo => archive}/js/多层文件夹处理/main.js | 0 .../js/多层文件夹处理/manifest.json | 0 .../js/多层文件夹处理/settings.json | 0 .../js/设置时间并跳过调整动画/main.js | 0 .../js/设置时间并跳过调整动画/manifest.json | 0 .../js/设置时间并跳过调整动画}/settings.json | 22 +- .../js/食材加工/assets/Cooking.png | Bin .../js/食材加工/assets/E_Dialogue.png | Bin .../js/食材加工/assets/F_Dialogue.png | Bin .../js/食材加工/assets/Picture/Bacon.png | Bin .../js/食材加工/assets/Picture/Butter.png | Bin .../js/食材加工/assets/Picture/Cheese.png | Bin .../js/食材加工/assets/Picture/Crab-Roe.png | Bin .../js/食材加工/assets/Picture/Fish.png | Bin .../js/食材加工/assets/Picture/Flour.png | Bin .../js/食材加工/assets/Picture/Ham.png | Bin .../js/食材加工/assets/Picture/Jam.png | Bin .../js/食材加工/assets/Picture/Lard.png | Bin .../assets/Picture/Mysterious-Meat.png | Bin .../js/食材加工/assets/Picture/Raw-Meat.png | Bin .../js/食材加工/assets/Picture/Rye-Flour.png | Bin .../js/食材加工/assets/Picture/Sausage.png | Bin .../assets/Picture/Smoked-Poultry.png | Bin .../js/食材加工/assets/Picture/Sour-Cream.png | Bin .../js/食材加工/assets/Picture/Spices.png | Bin .../js/食材加工/assets/Picture/Sugar.png | Bin .../js/食材加工/assets/pageScroll.json | 0 .../js/食材加工/assets/pageScroll2.json | 0 .../js/食材加工/assets/滚轮下翻.json | 0 .../食材加工/assets/璃月杂货商东升旁灶台.json | 0 {repo => archive}/js/食材加工/main.js | 0 {repo => archive}/js/食材加工/manifest.json | 0 {repo => archive}/js/食材加工/settings.json | 202 +++++++++--------- build/author_config.json | 2 +- .../js/JoinFriendsWorld/{index.js => main.js} | 0 repo/js/JoinFriendsWorld/manifest.json | 2 +- repo/js/SetTime/main.js | 76 +------ repo/js/SetTime/manifest.json | 37 ++-- repo/js/SetTime/settings.json | 25 ++- 61 files changed, 442 insertions(+), 389 deletions(-) rename {repo => archive}/js/AutoArtifactsSalvageOrDestroy(1-4star)/assets/RecognitionObject/ConfirmButton.png (100%) rename {repo => archive}/js/AutoArtifactsSalvageOrDestroy(1-4star)/main.js (100%) rename {repo => archive}/js/AutoArtifactsSalvageOrDestroy(1-4star)/manifest.json (100%) rename {repo => archive}/js/AutoArtifactsSalvageOrDestroy(1-4star)/settings.json (100%) create mode 100644 archive/js/SetTime/main.js create mode 100644 archive/js/SetTime/manifest.json create mode 100644 archive/js/SetTime/settings.json rename {repo => archive}/js/SetTimeMinute/main.js (96%) rename {repo => archive}/js/SetTimeMinute/manifest.json (96%) rename {repo/js/设置时间并跳过调整动画 => archive/js/SetTimeMinute}/settings.json (100%) rename {repo => archive}/js/分解圣遗物 带背包过期弹窗自动点击/assets/Picture/image1.png (100%) rename {repo => archive}/js/分解圣遗物 带背包过期弹窗自动点击/assets/icon/Comfirm.png (100%) rename {repo => archive}/js/分解圣遗物 带背包过期弹窗自动点击/main.js (97%) rename {repo => archive}/js/分解圣遗物 带背包过期弹窗自动点击/manifest.json (96%) rename {repo => archive}/js/分解圣遗物 带背包过期弹窗自动点击/settings.json (100%) rename {repo => archive}/js/多层文件夹处理/assets/文件1.txt (100%) rename {repo => archive}/js/多层文件夹处理/assets/文件2.json (100%) rename {repo => archive}/js/多层文件夹处理/assets/文件3.json (100%) rename {repo => archive}/js/多层文件夹处理/assets/文件夹1/子文件夹1/文件6.json (100%) rename {repo => archive}/js/多层文件夹处理/assets/文件夹1/文件4.json (100%) rename {repo => archive}/js/多层文件夹处理/assets/文件夹1/文件5.json (100%) rename {repo => archive}/js/多层文件夹处理/assets/文件夹2/文件7.json (100%) rename {repo => archive}/js/多层文件夹处理/main.js (100%) rename {repo => archive}/js/多层文件夹处理/manifest.json (100%) rename {repo => archive}/js/多层文件夹处理/settings.json (100%) rename {repo => archive}/js/设置时间并跳过调整动画/main.js (100%) rename {repo => archive}/js/设置时间并跳过调整动画/manifest.json (100%) rename {repo/js/SetTimeMinute => archive/js/设置时间并跳过调整动画}/settings.json (95%) rename {repo => archive}/js/食材加工/assets/Cooking.png (100%) rename {repo => archive}/js/食材加工/assets/E_Dialogue.png (100%) rename {repo => archive}/js/食材加工/assets/F_Dialogue.png (100%) rename {repo => archive}/js/食材加工/assets/Picture/Bacon.png (100%) rename {repo => archive}/js/食材加工/assets/Picture/Butter.png (100%) rename {repo => archive}/js/食材加工/assets/Picture/Cheese.png (100%) rename {repo => archive}/js/食材加工/assets/Picture/Crab-Roe.png (100%) rename {repo => archive}/js/食材加工/assets/Picture/Fish.png (100%) rename {repo => archive}/js/食材加工/assets/Picture/Flour.png (100%) rename {repo => archive}/js/食材加工/assets/Picture/Ham.png (100%) rename {repo => archive}/js/食材加工/assets/Picture/Jam.png (100%) rename {repo => archive}/js/食材加工/assets/Picture/Lard.png (100%) rename {repo => archive}/js/食材加工/assets/Picture/Mysterious-Meat.png (100%) rename {repo => archive}/js/食材加工/assets/Picture/Raw-Meat.png (100%) rename {repo => archive}/js/食材加工/assets/Picture/Rye-Flour.png (100%) rename {repo => archive}/js/食材加工/assets/Picture/Sausage.png (100%) rename {repo => archive}/js/食材加工/assets/Picture/Smoked-Poultry.png (100%) rename {repo => archive}/js/食材加工/assets/Picture/Sour-Cream.png (100%) rename {repo => archive}/js/食材加工/assets/Picture/Spices.png (100%) rename {repo => archive}/js/食材加工/assets/Picture/Sugar.png (100%) rename {repo => archive}/js/食材加工/assets/pageScroll.json (100%) rename {repo => archive}/js/食材加工/assets/pageScroll2.json (100%) rename {repo => archive}/js/食材加工/assets/滚轮下翻.json (100%) rename {repo => archive}/js/食材加工/assets/璃月杂货商东升旁灶台.json (100%) rename {repo => archive}/js/食材加工/main.js (100%) rename {repo => archive}/js/食材加工/manifest.json (100%) rename {repo => archive}/js/食材加工/settings.json (96%) rename repo/js/JoinFriendsWorld/{index.js => main.js} (100%) diff --git a/repo/js/AutoArtifactsSalvageOrDestroy(1-4star)/assets/RecognitionObject/ConfirmButton.png b/archive/js/AutoArtifactsSalvageOrDestroy(1-4star)/assets/RecognitionObject/ConfirmButton.png similarity index 100% rename from repo/js/AutoArtifactsSalvageOrDestroy(1-4star)/assets/RecognitionObject/ConfirmButton.png rename to archive/js/AutoArtifactsSalvageOrDestroy(1-4star)/assets/RecognitionObject/ConfirmButton.png diff --git a/repo/js/AutoArtifactsSalvageOrDestroy(1-4star)/main.js b/archive/js/AutoArtifactsSalvageOrDestroy(1-4star)/main.js similarity index 100% rename from repo/js/AutoArtifactsSalvageOrDestroy(1-4star)/main.js rename to archive/js/AutoArtifactsSalvageOrDestroy(1-4star)/main.js diff --git a/repo/js/AutoArtifactsSalvageOrDestroy(1-4star)/manifest.json b/archive/js/AutoArtifactsSalvageOrDestroy(1-4star)/manifest.json similarity index 100% rename from repo/js/AutoArtifactsSalvageOrDestroy(1-4star)/manifest.json rename to archive/js/AutoArtifactsSalvageOrDestroy(1-4star)/manifest.json diff --git a/repo/js/AutoArtifactsSalvageOrDestroy(1-4star)/settings.json b/archive/js/AutoArtifactsSalvageOrDestroy(1-4star)/settings.json similarity index 100% rename from repo/js/AutoArtifactsSalvageOrDestroy(1-4star)/settings.json rename to archive/js/AutoArtifactsSalvageOrDestroy(1-4star)/settings.json diff --git a/archive/js/SetTime/main.js b/archive/js/SetTime/main.js new file mode 100644 index 000000000..ed97723d3 --- /dev/null +++ b/archive/js/SetTime/main.js @@ -0,0 +1,70 @@ +(async function () { + setGameMetrics(1920, 1080, 2); // 设置游戏窗口大小和DPI + //拖动鼠标 + async function moveMouseSmoothly(x1, y1, x2, y2) { + const deltaX = x2 - x1; + const deltaY = y2 - y1; + const steps = Math.max(Math.abs(deltaX), Math.abs(deltaY)); + const stepX = deltaX / steps; + const stepY = deltaY / steps; + await moveMouseTo(x1, y1); + await leftButtonDown(); + for (let i = 1; i <= steps; i++) { + const newX = x1 + stepX * i; + const newY = y1 + stepY * i; + const validX = Math.round(newX); + const validY = Math.round(newY); + await moveMouseTo(validX, validY); + await sleep(10); + } + await leftButtonUp(); + } + //设定时间 + async function settime(time) { + const centerX = 1441; + const centerY = 501; + const radius = 100; + let angle; + angle = (90 + time * 15) % 360; + angle = angle >= 0 ? angle : 360 + angle; + const angle1 = (angle + 90) % 360; + const angle2 = (angle + 180) % 360; + const angle3 = (angle + 270) % 360; + const radians = angle * (Math.PI / 180); + const radians1 = angle1 * (Math.PI / 180); + const radians2 = angle2 * (Math.PI / 180); + const radians3 = angle3 * (Math.PI / 180); + const x = centerX + radius * Math.cos(radians); + const y = centerY + radius * Math.sin(radians); + const x1 = centerX + radius * Math.cos(radians1); + const y1 = centerY + radius * Math.sin(radians1); + const x2 = centerX + radius * Math.cos(radians2); + const y2 = centerY + radius * Math.sin(radians2); + const x3 = centerX + radius * Math.cos(radians3); + const y3 = centerY + radius * Math.sin(radians3); + + // 输出最终的坐标 + await sleep(2000); + await moveMouseSmoothly(centerX,centerY, x1,y1); + await sleep(2000); + await moveMouseSmoothly(centerX,centerY, x2,y2); + await sleep(2000); + await moveMouseSmoothly(centerX,centerY, x3,y3); + await sleep(2000); + await moveMouseSmoothly(centerX,centerY, x,y); + } + //设置时间 + log.info('设置时间到{xy}点',settings.time); + await keyPress("Escape"); + await sleep(1000); + await click(50,700); + await sleep(2000); + await settime(settings.time) + await sleep(3000); + await click(1500,1000);//确认 + await sleep(20000); + await keyPress("Escape"); + await sleep(2000); + await keyPress("Escape"); + await sleep(2000); +})(); \ No newline at end of file diff --git a/archive/js/SetTime/manifest.json b/archive/js/SetTime/manifest.json new file mode 100644 index 000000000..2815a32d5 --- /dev/null +++ b/archive/js/SetTime/manifest.json @@ -0,0 +1,14 @@ +{ + "manifest_version": 1, + "name": "调整游戏时间", + "version": "1.0", + "description": "用于调整游戏时间,请在调度器中使用", + "authors": [ + { + "name": "愚溪", + "links": "https://github.com/Kupder" + } + ], + "settings_ui": "settings.json", + "main": "main.js" +} \ No newline at end of file diff --git a/archive/js/SetTime/settings.json b/archive/js/SetTime/settings.json new file mode 100644 index 000000000..252794cfa --- /dev/null +++ b/archive/js/SetTime/settings.json @@ -0,0 +1,7 @@ +[ + { + "name": "time", + "type": "input-text", + "label": "输入时间 [0-24] " + } +] \ No newline at end of file diff --git a/repo/js/SetTimeMinute/main.js b/archive/js/SetTimeMinute/main.js similarity index 96% rename from repo/js/SetTimeMinute/main.js rename to archive/js/SetTimeMinute/main.js index 650fbf71f..87b490381 100644 --- a/repo/js/SetTimeMinute/main.js +++ b/archive/js/SetTimeMinute/main.js @@ -1,64 +1,64 @@ -(async function () { - // 设置游戏分辨率和DPI缩放 - setGameMetrics(1920, 1080, 1); - // 圆心坐标 - const centerX = 1441; - const centerY = 501.6; - // 半径 - const r1 = 30; - const r2 = 150; - const r3 = 300; - const stepDuration = 50; - - function getPosition(r, index) { - let angle = index * Math.PI / 720; - return [Math.round(centerX + r * Math.cos(angle)), Math.round(centerY + r * Math.sin(angle))]; - } - async function mouseClick(x, y) { - moveMouseTo(x, y); - await sleep(50); - leftButtonDown(); - await sleep(50); - leftButtonUp(); - await sleep(stepDuration); - } - async function mouseClickAndMove(x1, y1, x2, y2) { - moveMouseTo(x1, y1); - await sleep(50); - leftButtonDown(); - await sleep(50); - moveMouseTo(x2, y2); - await sleep(50); - leftButtonUp(); - await sleep(stepDuration); - } - async function setTime(hour, minute) { - const end = (hour + 6) * 60 + minute-20; - const n = 3; - for (let i = - n + 1; i < 1; i++) { - let [x,y] = getPosition(r1, end + i * 1440 / n); - await mouseClick(x, y); - } - let [x1,y1] = getPosition(r2, end + 5); - let [x2, y2] = getPosition(r3, end + 20 + 0.5); - await mouseClickAndMove(x1, y1, x2, y2); - } - const hour = Number(settings.hour); - const minute = Number(settings.minute); - let h = Math.floor(hour+minute/60); - const m = Math.floor(hour*60+minute)-h*60; - h = ((h % 24) + 24) % 24; - log.info(`设置时间到 ${h} 点 ${m} 分`); - await keyPress("Escape"); - await sleep(1000); - await click(50,700); - await sleep(2000); - await setTime(h, m); - await sleep(1000); - await click(1500,1000);//确认 - await sleep(18000); - await keyPress("Escape"); - await sleep(2000); - await keyPress("Escape"); - await sleep(2000); +(async function () { + // 设置游戏分辨率和DPI缩放 + setGameMetrics(1920, 1080, 1); + // 圆心坐标 + const centerX = 1441; + const centerY = 501.6; + // 半径 + const r1 = 30; + const r2 = 150; + const r3 = 300; + const stepDuration = 50; + + function getPosition(r, index) { + let angle = index * Math.PI / 720; + return [Math.round(centerX + r * Math.cos(angle)), Math.round(centerY + r * Math.sin(angle))]; + } + async function mouseClick(x, y) { + moveMouseTo(x, y); + await sleep(50); + leftButtonDown(); + await sleep(50); + leftButtonUp(); + await sleep(stepDuration); + } + async function mouseClickAndMove(x1, y1, x2, y2) { + moveMouseTo(x1, y1); + await sleep(50); + leftButtonDown(); + await sleep(50); + moveMouseTo(x2, y2); + await sleep(50); + leftButtonUp(); + await sleep(stepDuration); + } + async function setTime(hour, minute) { + const end = (hour + 6) * 60 + minute-20; + const n = 3; + for (let i = - n + 1; i < 1; i++) { + let [x,y] = getPosition(r1, end + i * 1440 / n); + await mouseClick(x, y); + } + let [x1,y1] = getPosition(r2, end + 5); + let [x2, y2] = getPosition(r3, end + 20 + 0.5); + await mouseClickAndMove(x1, y1, x2, y2); + } + const hour = Number(settings.hour); + const minute = Number(settings.minute); + let h = Math.floor(hour+minute/60); + const m = Math.floor(hour*60+minute)-h*60; + h = ((h % 24) + 24) % 24; + log.info(`设置时间到 ${h} 点 ${m} 分`); + await keyPress("Escape"); + await sleep(1000); + await click(50,700); + await sleep(2000); + await setTime(h, m); + await sleep(1000); + await click(1500,1000);//确认 + await sleep(18000); + await keyPress("Escape"); + await sleep(2000); + await keyPress("Escape"); + await sleep(2000); })(); \ No newline at end of file diff --git a/repo/js/SetTimeMinute/manifest.json b/archive/js/SetTimeMinute/manifest.json similarity index 96% rename from repo/js/SetTimeMinute/manifest.json rename to archive/js/SetTimeMinute/manifest.json index 60cc2ebd3..40b4690a6 100644 --- a/repo/js/SetTimeMinute/manifest.json +++ b/archive/js/SetTimeMinute/manifest.json @@ -1,15 +1,15 @@ -{ - "manifest_version": 1, - "name": "精确调整游戏时间到分钟", - "version": "1.0", - "bgi_version": "0.36.0", - "description": "用于调整游戏时间,精确到分钟,请在调度器中使用", - "authors": [ - { - "name": "Tim", - "links": "https://github.com/Limint" - } - ], - "settings_ui": "settings.json", - "main": "main.js" +{ + "manifest_version": 1, + "name": "精确调整游戏时间到分钟", + "version": "1.0", + "bgi_version": "0.36.0", + "description": "用于调整游戏时间,精确到分钟,请在调度器中使用", + "authors": [ + { + "name": "Tim", + "links": "https://github.com/Limint" + } + ], + "settings_ui": "settings.json", + "main": "main.js" } \ No newline at end of file diff --git a/repo/js/设置时间并跳过调整动画/settings.json b/archive/js/SetTimeMinute/settings.json similarity index 100% rename from repo/js/设置时间并跳过调整动画/settings.json rename to archive/js/SetTimeMinute/settings.json diff --git a/repo/js/分解圣遗物 带背包过期弹窗自动点击/assets/Picture/image1.png b/archive/js/分解圣遗物 带背包过期弹窗自动点击/assets/Picture/image1.png similarity index 100% rename from repo/js/分解圣遗物 带背包过期弹窗自动点击/assets/Picture/image1.png rename to archive/js/分解圣遗物 带背包过期弹窗自动点击/assets/Picture/image1.png diff --git a/repo/js/分解圣遗物 带背包过期弹窗自动点击/assets/icon/Comfirm.png b/archive/js/分解圣遗物 带背包过期弹窗自动点击/assets/icon/Comfirm.png similarity index 100% rename from repo/js/分解圣遗物 带背包过期弹窗自动点击/assets/icon/Comfirm.png rename to archive/js/分解圣遗物 带背包过期弹窗自动点击/assets/icon/Comfirm.png diff --git a/repo/js/分解圣遗物 带背包过期弹窗自动点击/main.js b/archive/js/分解圣遗物 带背包过期弹窗自动点击/main.js similarity index 97% rename from repo/js/分解圣遗物 带背包过期弹窗自动点击/main.js rename to archive/js/分解圣遗物 带背包过期弹窗自动点击/main.js index bdfb093ac..87eaeb3cb 100644 --- a/repo/js/分解圣遗物 带背包过期弹窗自动点击/main.js +++ b/archive/js/分解圣遗物 带背包过期弹窗自动点击/main.js @@ -1,97 +1,97 @@ -// 自定义 basename 函数 -function basename(filePath) { - const lastSlashIndex = filePath.lastIndexOf('\\'); // 或者使用 '/',取决于你的路径分隔符 - return filePath.substring(lastSlashIndex + 1); -} - -(async function () { - setGameMetrics(1920, 1080, 1); // 设置游戏分辨率 - await genshin.returnMainUi(); - keyPress("B"); await sleep(1000); - - // 定义图标文件夹路径 - const iconDir = "assets/icon"; - const pictureDir = "assets/Picture"; - - const iconFilePaths = file.ReadPathSync(iconDir); - const pictureFilePaths = file.ReadPathSync(pictureDir); - - const iconRecognitionObjects = []; - for (const filePath of iconFilePaths) { - const mat = file.readImageMatSync(filePath); - if (mat.empty()) { - log.error(`加载图标失败:${filePath}`); - continue; - } - const recognitionObject = RecognitionObject.TemplateMatch(mat, 0, 0, 1920, 1080); - iconRecognitionObjects.push({ name: basename(filePath), ro: recognitionObject }); - } - - const pictureRegions = []; - for (const filePath of pictureFilePaths) { - const mat = file.readImageMatSync(filePath); - if (mat.empty()) { - log.error(`加载图库失败:${filePath}`); - continue; - } - pictureRegions.push({ name: basename(filePath), region: new ImageRegion(mat, 0, 0) }); - } - - const foundRegions = []; - - for (const picture of pictureRegions) { - for (const icon of iconRecognitionObjects) { - // 在图库中查找图标信息 - const foundRegion = picture.region.find(icon.ro); - if (foundRegion.isExist()) { - foundRegions.push({ - pictureName: picture.name, - iconName: icon.name, - region: foundRegion - }); - } - } - } - - for (const foundRegion of foundRegions) { - - const ra = captureGameRegion(); - const tolerance = 1; // 容错区间 - const iconMat = file.ReadImageMatSync(`assets/icon/${foundRegion.iconName}`); - const recognitionObject = RecognitionObject.TemplateMatch(iconMat, foundRegion.region.x-tolerance, foundRegion.region.y-tolerance, foundRegion.region.width+2*tolerance, foundRegion.region.height+2*tolerance); - recognitionObject.threshold = 0.85; // 设置识别阈值为 0.9 - const result = ra.find(recognitionObject); - if (result.isExist() && result.x > 0 && result.y > 0) { - // 获取图标的中心坐标并取整 - const x = Math.round(foundRegion.region.x + foundRegion.region.width / 2); - const y = Math.round(foundRegion.region.y + foundRegion.region.height / 2); - - await click(x, y); - log.info(`点击 ${foundRegion.iconName}成功,位置: (${x}, ${y})`); - await sleep(500); // 等待一段时间 - } else { - // 如果未找到图标,打印警告信息 - log.info(`未发现背包弹窗:${foundRegion.iconName}`); - } - ra.dispose(); - } - - const coords = [ - [670, 40], [660, 1010], [300, 1020], - // [200, 150, 500], [200, 220, 500], - [200, 300, 500, settings.autoSalvage3 === '否'], - [200, 380, 500, settings.autoSalvage4 === '否'], - [340, 1000], [1720, 1015], [1320, 756], - [1840, 45, 1500], [1840, 45], [1840, 45] - ]; - - for (const coord of coords) { - const [x, y, delay = 1000, condition = true] = coord; // 默认值处理 - if (condition) { - click(x, y); - await sleep(delay); - } - } -})(); - - +// 自定义 basename 函数 +function basename(filePath) { + const lastSlashIndex = filePath.lastIndexOf('\\'); // 或者使用 '/',取决于你的路径分隔符 + return filePath.substring(lastSlashIndex + 1); +} + +(async function () { + setGameMetrics(1920, 1080, 1); // 设置游戏分辨率 + await genshin.returnMainUi(); + keyPress("B"); await sleep(1000); + + // 定义图标文件夹路径 + const iconDir = "assets/icon"; + const pictureDir = "assets/Picture"; + + const iconFilePaths = file.ReadPathSync(iconDir); + const pictureFilePaths = file.ReadPathSync(pictureDir); + + const iconRecognitionObjects = []; + for (const filePath of iconFilePaths) { + const mat = file.readImageMatSync(filePath); + if (mat.empty()) { + log.error(`加载图标失败:${filePath}`); + continue; + } + const recognitionObject = RecognitionObject.TemplateMatch(mat, 0, 0, 1920, 1080); + iconRecognitionObjects.push({ name: basename(filePath), ro: recognitionObject }); + } + + const pictureRegions = []; + for (const filePath of pictureFilePaths) { + const mat = file.readImageMatSync(filePath); + if (mat.empty()) { + log.error(`加载图库失败:${filePath}`); + continue; + } + pictureRegions.push({ name: basename(filePath), region: new ImageRegion(mat, 0, 0) }); + } + + const foundRegions = []; + + for (const picture of pictureRegions) { + for (const icon of iconRecognitionObjects) { + // 在图库中查找图标信息 + const foundRegion = picture.region.find(icon.ro); + if (foundRegion.isExist()) { + foundRegions.push({ + pictureName: picture.name, + iconName: icon.name, + region: foundRegion + }); + } + } + } + + for (const foundRegion of foundRegions) { + + const ra = captureGameRegion(); + const tolerance = 1; // 容错区间 + const iconMat = file.ReadImageMatSync(`assets/icon/${foundRegion.iconName}`); + const recognitionObject = RecognitionObject.TemplateMatch(iconMat, foundRegion.region.x-tolerance, foundRegion.region.y-tolerance, foundRegion.region.width+2*tolerance, foundRegion.region.height+2*tolerance); + recognitionObject.threshold = 0.85; // 设置识别阈值为 0.9 + const result = ra.find(recognitionObject); + if (result.isExist() && result.x > 0 && result.y > 0) { + // 获取图标的中心坐标并取整 + const x = Math.round(foundRegion.region.x + foundRegion.region.width / 2); + const y = Math.round(foundRegion.region.y + foundRegion.region.height / 2); + + await click(x, y); + log.info(`点击 ${foundRegion.iconName}成功,位置: (${x}, ${y})`); + await sleep(500); // 等待一段时间 + } else { + // 如果未找到图标,打印警告信息 + log.info(`未发现背包弹窗:${foundRegion.iconName}`); + } + ra.dispose(); + } + + const coords = [ + [670, 40], [660, 1010], [300, 1020], + // [200, 150, 500], [200, 220, 500], + [200, 300, 500, settings.autoSalvage3 === '否'], + [200, 380, 500, settings.autoSalvage4 === '否'], + [340, 1000], [1720, 1015], [1320, 756], + [1840, 45, 1500], [1840, 45], [1840, 45] + ]; + + for (const coord of coords) { + const [x, y, delay = 1000, condition = true] = coord; // 默认值处理 + if (condition) { + click(x, y); + await sleep(delay); + } + } +})(); + + diff --git a/repo/js/分解圣遗物 带背包过期弹窗自动点击/manifest.json b/archive/js/分解圣遗物 带背包过期弹窗自动点击/manifest.json similarity index 96% rename from repo/js/分解圣遗物 带背包过期弹窗自动点击/manifest.json rename to archive/js/分解圣遗物 带背包过期弹窗自动点击/manifest.json index c9d42d530..a3ee88bf4 100644 --- a/repo/js/分解圣遗物 带背包过期弹窗自动点击/manifest.json +++ b/archive/js/分解圣遗物 带背包过期弹窗自动点击/manifest.json @@ -1,14 +1,14 @@ -{ - "manifest_version": 1, - "name": "选择级别 分解圣遗物 背包过期弹窗版", - "version": "1.0", - "description": "可选是否分解三四级圣遗物,附带打开背包时,自动点击过期物品弹窗", - "authors": [ - { - "name": "吉吉喵", - "links": "https://github.com/JJMdzh" - } - ], - "settings_ui": "settings.json", - "main": "main.js" +{ + "manifest_version": 1, + "name": "选择级别 分解圣遗物 背包过期弹窗版", + "version": "1.0", + "description": "可选是否分解三四级圣遗物,附带打开背包时,自动点击过期物品弹窗", + "authors": [ + { + "name": "吉吉喵", + "links": "https://github.com/JJMdzh" + } + ], + "settings_ui": "settings.json", + "main": "main.js" } \ No newline at end of file diff --git a/repo/js/分解圣遗物 带背包过期弹窗自动点击/settings.json b/archive/js/分解圣遗物 带背包过期弹窗自动点击/settings.json similarity index 100% rename from repo/js/分解圣遗物 带背包过期弹窗自动点击/settings.json rename to archive/js/分解圣遗物 带背包过期弹窗自动点击/settings.json diff --git a/repo/js/多层文件夹处理/assets/文件1.txt b/archive/js/多层文件夹处理/assets/文件1.txt similarity index 100% rename from repo/js/多层文件夹处理/assets/文件1.txt rename to archive/js/多层文件夹处理/assets/文件1.txt diff --git a/repo/js/多层文件夹处理/assets/文件2.json b/archive/js/多层文件夹处理/assets/文件2.json similarity index 100% rename from repo/js/多层文件夹处理/assets/文件2.json rename to archive/js/多层文件夹处理/assets/文件2.json diff --git a/repo/js/多层文件夹处理/assets/文件3.json b/archive/js/多层文件夹处理/assets/文件3.json similarity index 100% rename from repo/js/多层文件夹处理/assets/文件3.json rename to archive/js/多层文件夹处理/assets/文件3.json diff --git a/repo/js/多层文件夹处理/assets/文件夹1/子文件夹1/文件6.json b/archive/js/多层文件夹处理/assets/文件夹1/子文件夹1/文件6.json similarity index 100% rename from repo/js/多层文件夹处理/assets/文件夹1/子文件夹1/文件6.json rename to archive/js/多层文件夹处理/assets/文件夹1/子文件夹1/文件6.json diff --git a/repo/js/多层文件夹处理/assets/文件夹1/文件4.json b/archive/js/多层文件夹处理/assets/文件夹1/文件4.json similarity index 100% rename from repo/js/多层文件夹处理/assets/文件夹1/文件4.json rename to archive/js/多层文件夹处理/assets/文件夹1/文件4.json diff --git a/repo/js/多层文件夹处理/assets/文件夹1/文件5.json b/archive/js/多层文件夹处理/assets/文件夹1/文件5.json similarity index 100% rename from repo/js/多层文件夹处理/assets/文件夹1/文件5.json rename to archive/js/多层文件夹处理/assets/文件夹1/文件5.json diff --git a/repo/js/多层文件夹处理/assets/文件夹2/文件7.json b/archive/js/多层文件夹处理/assets/文件夹2/文件7.json similarity index 100% rename from repo/js/多层文件夹处理/assets/文件夹2/文件7.json rename to archive/js/多层文件夹处理/assets/文件夹2/文件7.json diff --git a/repo/js/多层文件夹处理/main.js b/archive/js/多层文件夹处理/main.js similarity index 100% rename from repo/js/多层文件夹处理/main.js rename to archive/js/多层文件夹处理/main.js diff --git a/repo/js/多层文件夹处理/manifest.json b/archive/js/多层文件夹处理/manifest.json similarity index 100% rename from repo/js/多层文件夹处理/manifest.json rename to archive/js/多层文件夹处理/manifest.json diff --git a/repo/js/多层文件夹处理/settings.json b/archive/js/多层文件夹处理/settings.json similarity index 100% rename from repo/js/多层文件夹处理/settings.json rename to archive/js/多层文件夹处理/settings.json diff --git a/repo/js/设置时间并跳过调整动画/main.js b/archive/js/设置时间并跳过调整动画/main.js similarity index 100% rename from repo/js/设置时间并跳过调整动画/main.js rename to archive/js/设置时间并跳过调整动画/main.js diff --git a/repo/js/设置时间并跳过调整动画/manifest.json b/archive/js/设置时间并跳过调整动画/manifest.json similarity index 100% rename from repo/js/设置时间并跳过调整动画/manifest.json rename to archive/js/设置时间并跳过调整动画/manifest.json diff --git a/repo/js/SetTimeMinute/settings.json b/archive/js/设置时间并跳过调整动画/settings.json similarity index 95% rename from repo/js/SetTimeMinute/settings.json rename to archive/js/设置时间并跳过调整动画/settings.json index 6e214bbb6..a09634da8 100644 --- a/repo/js/SetTimeMinute/settings.json +++ b/archive/js/设置时间并跳过调整动画/settings.json @@ -1,12 +1,12 @@ -[ - { - "name": "hour", - "type": "input-text", - "label": "输入小时(0-24)" - }, - { - "name": "minute", - "type": "input-text", - "label": "输入分钟(0-60)" - } +[ + { + "name": "hour", + "type": "input-text", + "label": "输入小时(0-24)" + }, + { + "name": "minute", + "type": "input-text", + "label": "输入分钟(0-60)" + } ] \ No newline at end of file diff --git a/repo/js/食材加工/assets/Cooking.png b/archive/js/食材加工/assets/Cooking.png similarity index 100% rename from repo/js/食材加工/assets/Cooking.png rename to archive/js/食材加工/assets/Cooking.png diff --git a/repo/js/食材加工/assets/E_Dialogue.png b/archive/js/食材加工/assets/E_Dialogue.png similarity index 100% rename from repo/js/食材加工/assets/E_Dialogue.png rename to archive/js/食材加工/assets/E_Dialogue.png diff --git a/repo/js/食材加工/assets/F_Dialogue.png b/archive/js/食材加工/assets/F_Dialogue.png similarity index 100% rename from repo/js/食材加工/assets/F_Dialogue.png rename to archive/js/食材加工/assets/F_Dialogue.png diff --git a/repo/js/食材加工/assets/Picture/Bacon.png b/archive/js/食材加工/assets/Picture/Bacon.png similarity index 100% rename from repo/js/食材加工/assets/Picture/Bacon.png rename to archive/js/食材加工/assets/Picture/Bacon.png diff --git a/repo/js/食材加工/assets/Picture/Butter.png b/archive/js/食材加工/assets/Picture/Butter.png similarity index 100% rename from repo/js/食材加工/assets/Picture/Butter.png rename to archive/js/食材加工/assets/Picture/Butter.png diff --git a/repo/js/食材加工/assets/Picture/Cheese.png b/archive/js/食材加工/assets/Picture/Cheese.png similarity index 100% rename from repo/js/食材加工/assets/Picture/Cheese.png rename to archive/js/食材加工/assets/Picture/Cheese.png diff --git a/repo/js/食材加工/assets/Picture/Crab-Roe.png b/archive/js/食材加工/assets/Picture/Crab-Roe.png similarity index 100% rename from repo/js/食材加工/assets/Picture/Crab-Roe.png rename to archive/js/食材加工/assets/Picture/Crab-Roe.png diff --git a/repo/js/食材加工/assets/Picture/Fish.png b/archive/js/食材加工/assets/Picture/Fish.png similarity index 100% rename from repo/js/食材加工/assets/Picture/Fish.png rename to archive/js/食材加工/assets/Picture/Fish.png diff --git a/repo/js/食材加工/assets/Picture/Flour.png b/archive/js/食材加工/assets/Picture/Flour.png similarity index 100% rename from repo/js/食材加工/assets/Picture/Flour.png rename to archive/js/食材加工/assets/Picture/Flour.png diff --git a/repo/js/食材加工/assets/Picture/Ham.png b/archive/js/食材加工/assets/Picture/Ham.png similarity index 100% rename from repo/js/食材加工/assets/Picture/Ham.png rename to archive/js/食材加工/assets/Picture/Ham.png diff --git a/repo/js/食材加工/assets/Picture/Jam.png b/archive/js/食材加工/assets/Picture/Jam.png similarity index 100% rename from repo/js/食材加工/assets/Picture/Jam.png rename to archive/js/食材加工/assets/Picture/Jam.png diff --git a/repo/js/食材加工/assets/Picture/Lard.png b/archive/js/食材加工/assets/Picture/Lard.png similarity index 100% rename from repo/js/食材加工/assets/Picture/Lard.png rename to archive/js/食材加工/assets/Picture/Lard.png diff --git a/repo/js/食材加工/assets/Picture/Mysterious-Meat.png b/archive/js/食材加工/assets/Picture/Mysterious-Meat.png similarity index 100% rename from repo/js/食材加工/assets/Picture/Mysterious-Meat.png rename to archive/js/食材加工/assets/Picture/Mysterious-Meat.png diff --git a/repo/js/食材加工/assets/Picture/Raw-Meat.png b/archive/js/食材加工/assets/Picture/Raw-Meat.png similarity index 100% rename from repo/js/食材加工/assets/Picture/Raw-Meat.png rename to archive/js/食材加工/assets/Picture/Raw-Meat.png diff --git a/repo/js/食材加工/assets/Picture/Rye-Flour.png b/archive/js/食材加工/assets/Picture/Rye-Flour.png similarity index 100% rename from repo/js/食材加工/assets/Picture/Rye-Flour.png rename to archive/js/食材加工/assets/Picture/Rye-Flour.png diff --git a/repo/js/食材加工/assets/Picture/Sausage.png b/archive/js/食材加工/assets/Picture/Sausage.png similarity index 100% rename from repo/js/食材加工/assets/Picture/Sausage.png rename to archive/js/食材加工/assets/Picture/Sausage.png diff --git a/repo/js/食材加工/assets/Picture/Smoked-Poultry.png b/archive/js/食材加工/assets/Picture/Smoked-Poultry.png similarity index 100% rename from repo/js/食材加工/assets/Picture/Smoked-Poultry.png rename to archive/js/食材加工/assets/Picture/Smoked-Poultry.png diff --git a/repo/js/食材加工/assets/Picture/Sour-Cream.png b/archive/js/食材加工/assets/Picture/Sour-Cream.png similarity index 100% rename from repo/js/食材加工/assets/Picture/Sour-Cream.png rename to archive/js/食材加工/assets/Picture/Sour-Cream.png diff --git a/repo/js/食材加工/assets/Picture/Spices.png b/archive/js/食材加工/assets/Picture/Spices.png similarity index 100% rename from repo/js/食材加工/assets/Picture/Spices.png rename to archive/js/食材加工/assets/Picture/Spices.png diff --git a/repo/js/食材加工/assets/Picture/Sugar.png b/archive/js/食材加工/assets/Picture/Sugar.png similarity index 100% rename from repo/js/食材加工/assets/Picture/Sugar.png rename to archive/js/食材加工/assets/Picture/Sugar.png diff --git a/repo/js/食材加工/assets/pageScroll.json b/archive/js/食材加工/assets/pageScroll.json similarity index 100% rename from repo/js/食材加工/assets/pageScroll.json rename to archive/js/食材加工/assets/pageScroll.json diff --git a/repo/js/食材加工/assets/pageScroll2.json b/archive/js/食材加工/assets/pageScroll2.json similarity index 100% rename from repo/js/食材加工/assets/pageScroll2.json rename to archive/js/食材加工/assets/pageScroll2.json diff --git a/repo/js/食材加工/assets/滚轮下翻.json b/archive/js/食材加工/assets/滚轮下翻.json similarity index 100% rename from repo/js/食材加工/assets/滚轮下翻.json rename to archive/js/食材加工/assets/滚轮下翻.json diff --git a/repo/js/食材加工/assets/璃月杂货商东升旁灶台.json b/archive/js/食材加工/assets/璃月杂货商东升旁灶台.json similarity index 100% rename from repo/js/食材加工/assets/璃月杂货商东升旁灶台.json rename to archive/js/食材加工/assets/璃月杂货商东升旁灶台.json diff --git a/repo/js/食材加工/main.js b/archive/js/食材加工/main.js similarity index 100% rename from repo/js/食材加工/main.js rename to archive/js/食材加工/main.js diff --git a/repo/js/食材加工/manifest.json b/archive/js/食材加工/manifest.json similarity index 100% rename from repo/js/食材加工/manifest.json rename to archive/js/食材加工/manifest.json diff --git a/repo/js/食材加工/settings.json b/archive/js/食材加工/settings.json similarity index 96% rename from repo/js/食材加工/settings.json rename to archive/js/食材加工/settings.json index 9cfa965f9..b8d71f521 100644 --- a/repo/js/食材加工/settings.json +++ b/archive/js/食材加工/settings.json @@ -1,102 +1,102 @@ -[ - { - "name": "CookingTimes", - "type": "input-text", - "label": "【料理制作】:\n\n烹饪次数(默认0,即跳过)", - }, - { - "name": "Cooking", - "type": "input-text", - "label": "输入料理名", - }, - { - "name": "PrepCount", - "type": "input-text", - "label": "\n====================\n\n【食材加工】:\n\n加工数量(不填默认99)" - }, - { - "name": "Processing11", - "type": "checkbox", - "label": "如勾选:面粉,黄油,糖\n上方填入88,66\n则加工面粉88,黄油66,糖88\n-----------------\n\n1小麦=面粉" - }, - { - "name": "Processing15", - "type": "checkbox", - "label": "-----------------\n\n1黑麦=黑麦粉" - }, - { - "name": "Processing24", - "type": "checkbox", - "label": "-----------------\n\n1牛奶=酸奶油" - }, - { - "name": "Processing16", - "type": "checkbox", - "label": "-----------------\n\n1牛奶=奶油" - }, - { - "name": "Processing18", - "type": "checkbox", - "label": "-----------------\n\n2牛奶=黄油" - }, - { - "name": "Processing27", - "type": "checkbox", - "label": "-----------------\n\n3牛奶=奶酪" - }, - { - "name": "Processing21", - "type": "checkbox", - "label": "-----------------\n\n2兽肉+1盐=火腿" - }, - { - "name": "Processing31", - "type": "checkbox", - "label": "-----------------\n\n3兽肉=香肠" - }, - { - "name": "Processing17", - "type": "checkbox", - "label": "--------------------\n\n3禽肉+1盐=熏禽肉" - }, - { - "name": "Processing28", - "type": "checkbox", - "label": "-----------------\n\n4兽肉+2盐=培根" - }, - { - "name": "Processing22", - "type": "checkbox", - "label": "-----------------\n\n2甜甜花=糖" - }, - { - "name": "Processing23", - "type": "checkbox", - "label": "-----------------\n\n2香辛果=香辛料" - }, - { - "name": "Processing26", - "type": "checkbox", - "label": "----------------------------\n\n3日落果+2树莓+1糖=果酱" - }, - { - "name": "Processing25", - "type": "checkbox", - "label": "-----------------\n\n4螃蟹=蟹黄" - }, - { - "name": "Processing12", - "type": "checkbox", - "label": "--------------------\n\n冷鲜肉 转化成 兽肉" - }, - { - "name": "Processing14", - "type": "checkbox", - "label": "-----------------------------\n\n神秘的肉 转化成 肉加工产物" - }, - { - "name": "Processing13", - "type": "checkbox", - "label": "--------------------------------\n\n鱼 转化成 鱼肉,排除 红色花鳉" - } +[ + { + "name": "CookingTimes", + "type": "input-text", + "label": "【料理制作】:\n\n烹饪次数(默认0,即跳过)", + }, + { + "name": "Cooking", + "type": "input-text", + "label": "输入料理名", + }, + { + "name": "PrepCount", + "type": "input-text", + "label": "\n====================\n\n【食材加工】:\n\n加工数量(不填默认99)" + }, + { + "name": "Processing11", + "type": "checkbox", + "label": "如勾选:面粉,黄油,糖\n上方填入88,66\n则加工面粉88,黄油66,糖88\n-----------------\n\n1小麦=面粉" + }, + { + "name": "Processing15", + "type": "checkbox", + "label": "-----------------\n\n1黑麦=黑麦粉" + }, + { + "name": "Processing24", + "type": "checkbox", + "label": "-----------------\n\n1牛奶=酸奶油" + }, + { + "name": "Processing16", + "type": "checkbox", + "label": "-----------------\n\n1牛奶=奶油" + }, + { + "name": "Processing18", + "type": "checkbox", + "label": "-----------------\n\n2牛奶=黄油" + }, + { + "name": "Processing27", + "type": "checkbox", + "label": "-----------------\n\n3牛奶=奶酪" + }, + { + "name": "Processing21", + "type": "checkbox", + "label": "-----------------\n\n2兽肉+1盐=火腿" + }, + { + "name": "Processing31", + "type": "checkbox", + "label": "-----------------\n\n3兽肉=香肠" + }, + { + "name": "Processing17", + "type": "checkbox", + "label": "--------------------\n\n3禽肉+1盐=熏禽肉" + }, + { + "name": "Processing28", + "type": "checkbox", + "label": "-----------------\n\n4兽肉+2盐=培根" + }, + { + "name": "Processing22", + "type": "checkbox", + "label": "-----------------\n\n2甜甜花=糖" + }, + { + "name": "Processing23", + "type": "checkbox", + "label": "-----------------\n\n2香辛果=香辛料" + }, + { + "name": "Processing26", + "type": "checkbox", + "label": "----------------------------\n\n3日落果+2树莓+1糖=果酱" + }, + { + "name": "Processing25", + "type": "checkbox", + "label": "-----------------\n\n4螃蟹=蟹黄" + }, + { + "name": "Processing12", + "type": "checkbox", + "label": "--------------------\n\n冷鲜肉 转化成 兽肉" + }, + { + "name": "Processing14", + "type": "checkbox", + "label": "-----------------------------\n\n神秘的肉 转化成 肉加工产物" + }, + { + "name": "Processing13", + "type": "checkbox", + "label": "--------------------------------\n\n鱼 转化成 鱼肉,排除 红色花鳉" + } ] \ No newline at end of file diff --git a/build/author_config.json b/build/author_config.json index 275781b76..7b304cf44 100644 --- a/build/author_config.json +++ b/build/author_config.json @@ -58,7 +58,7 @@ "芝士贝果": "https://github.com/cheese-bagel", "MissDan": "https://github.com/MisDandan23", "白白喵": "https://github.com/taotao568685", - "躁动的氨气": "https://github.com/zaodonganqi", + "躁动的氨气": "https://github.com/A-Little-AnQi", "海豹穹穹队": "https: //github.com/OhmyPaoPao", "李小璐的假奶量": "https://github.com/FZR1314521", "Annijang": "https://github.com/Annijang", diff --git a/repo/js/JoinFriendsWorld/index.js b/repo/js/JoinFriendsWorld/main.js similarity index 100% rename from repo/js/JoinFriendsWorld/index.js rename to repo/js/JoinFriendsWorld/main.js diff --git a/repo/js/JoinFriendsWorld/manifest.json b/repo/js/JoinFriendsWorld/manifest.json index 8ce2cb68a..4aaf8bc75 100644 --- a/repo/js/JoinFriendsWorld/manifest.json +++ b/repo/js/JoinFriendsWorld/manifest.json @@ -2,7 +2,7 @@ "manifest_version": 1, "name": "加入好友的世界", "description": "快让我访问!", - "version": "0.0.3", + "version": "0.0.4", "main": "index.js", "settings_ui": "settings.json", "authors": [ diff --git a/repo/js/SetTime/main.js b/repo/js/SetTime/main.js index b4d0af0f4..b4a220a31 100644 --- a/repo/js/SetTime/main.js +++ b/repo/js/SetTime/main.js @@ -1,70 +1,8 @@ -(async function () { - setGameMetrics(1920, 1080, 2); // 设置游戏窗口大小和DPI - //拖动鼠标 - async function moveMouseSmoothly(x1, y1, x2, y2) { - const deltaX = x2 - x1; - const deltaY = y2 - y1; - const steps = Math.max(Math.abs(deltaX), Math.abs(deltaY)); - const stepX = deltaX / steps; - const stepY = deltaY / steps; - await moveMouseTo(x1, y1); - await leftButtonDown(); - for (let i = 1; i <= steps; i++) { - const newX = x1 + stepX * i; - const newY = y1 + stepY * i; - const validX = Math.round(newX); - const validY = Math.round(newY); - await moveMouseTo(validX, validY); - await sleep(10); - } - await leftButtonUp(); - } - //设定时间 - async function settime(time) { - const centerX = 1441; - const centerY = 501; - const radius = 100; - let angle; - angle = (90 + time * 15) % 360; - angle = angle >= 0 ? angle : 360 + angle; - const angle1 = (angle + 90) % 360; - const angle2 = (angle + 180) % 360; - const angle3 = (angle + 270) % 360; - const radians = angle * (Math.PI / 180); - const radians1 = angle1 * (Math.PI / 180); - const radians2 = angle2 * (Math.PI / 180); - const radians3 = angle3 * (Math.PI / 180); - const x = centerX + radius * Math.cos(radians); - const y = centerY + radius * Math.sin(radians); - const x1 = centerX + radius * Math.cos(radians1); - const y1 = centerY + radius * Math.sin(radians1); - const x2 = centerX + radius * Math.cos(radians2); - const y2 = centerY + radius * Math.sin(radians2); - const x3 = centerX + radius * Math.cos(radians3); - const y3 = centerY + radius * Math.sin(radians3); - - // 输出最终的坐标 - await sleep(2000); - await moveMouseSmoothly(centerX,centerY, x1,y1); - await sleep(2000); - await moveMouseSmoothly(centerX,centerY, x2,y2); - await sleep(2000); - await moveMouseSmoothly(centerX,centerY, x3,y3); - await sleep(2000); - await moveMouseSmoothly(centerX,centerY, x,y); - } - //设置时间 - log.info('设置时间到{xy}点',settings.time); - await keyPress("Escape"); - await sleep(1000); - await click(50,700); - await sleep(2000); - await settime(settings.time) - await sleep(3000); - await click(1500,1000);//确认 - await sleep(20000); - await keyPress("Escape"); - await sleep(2000); - await keyPress("Escape"); - await sleep(2000); +(async function () { + const hour = Number(settings.hour || "6"); + const minute = Number(settings.minute || "0"); + const skip = settings.skip; + setGameMetrics(1920, 1080, 1); + await genshin.returnMainUi(); + await genshin.setTime(hour, minute, skip); })(); \ No newline at end of file diff --git a/repo/js/SetTime/manifest.json b/repo/js/SetTime/manifest.json index 57085512a..8f47721d6 100644 --- a/repo/js/SetTime/manifest.json +++ b/repo/js/SetTime/manifest.json @@ -1,14 +1,25 @@ -{ - "manifest_version": 1, - "name": "调整游戏时间", - "version": "1.0", - "description": "用于调整游戏时间,请在调度器中使用", - "authors": [ - { - "name": "愚溪", - "links": "https://github.com/Kupder" - } - ], - "settings_ui": "settings.json", - "main": "main.js" +{ + "manifest_version": 1, + "name": "调整游戏时间", + "version": "1.0", + "description": "用于调整游戏时间", + "authors": [ + { + "name": "Tim", + "links": "https://github.com/Limint" + }, + { + "name": "子寻" + }, + { + "name": "愚溪", + "links": "https://github.com/Kupder" + }, + { + "name": "躁动的氨气", + "links": "https://github.com/A-Little-AnQi" + } + ], + "settings_ui": "settings.json", + "main": "main.js" } \ No newline at end of file diff --git a/repo/js/SetTime/settings.json b/repo/js/SetTime/settings.json index 554d13cdb..8217479ec 100644 --- a/repo/js/SetTime/settings.json +++ b/repo/js/SetTime/settings.json @@ -1,7 +1,20 @@ -[ - { - "name": "time", - "type": "input-text", - "label": "输入时间 [0-24] " - } +[ + { + "name": "hour", + "type": "input-text", + "label": "输入小时 [0-24] ", + "default": "6" + }, + { + "name": "minute", + "type": "input-text", + "label": "输入分钟 [0-59] ", + "default": "0" + }, + { + "name": "skip", + "type": "checkbox", + "label": "是否跳过动画", + "default": true + } ] \ No newline at end of file