From 9432cd1fe6d3fb0224e671bcc56d4b9f718ec57c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=BA=81=E5=8A=A8=E7=9A=84=E6=B0=A8=E6=B0=94?= <131591012+zaodonganqi@users.noreply.github.com> Date: Mon, 1 Dec 2025 22:17:03 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8D=83=E6=98=9F=E6=94=AF=E6=8C=81=E9=9D=9E?= =?UTF-8?q?=E6=88=90=E5=B0=B1=E6=A8=A1=E5=BC=8F=E4=B8=8E=E6=94=B6=E8=97=8F?= =?UTF-8?q?=E6=A8=A1=E5=BC=8F=20(#2423)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- repo/js/WeeklyThousandStarRealm/README.md | 27 +++-- repo/js/WeeklyThousandStarRealm/main.js | 110 +++++++++++++++--- repo/js/WeeklyThousandStarRealm/manifest.json | 2 +- repo/js/WeeklyThousandStarRealm/settings.json | 21 +++- 4 files changed, 127 insertions(+), 33 deletions(-) diff --git a/repo/js/WeeklyThousandStarRealm/README.md b/repo/js/WeeklyThousandStarRealm/README.md index ca52af7dc..443260cd1 100644 --- a/repo/js/WeeklyThousandStarRealm/README.md +++ b/repo/js/WeeklyThousandStarRealm/README.md @@ -25,18 +25,22 @@ - 🧹 自动删除存档,实现成就经验可重复获取 - 📅 自动监测每周经验上限,到达后自动停止 - 🏞️ 完成后自动返回提瓦特大陆,不影响其他自动化脚本 +- ⭐ 可刷收藏地图,支持自定义地图名称 --- ## 🛠️ 脚本设置项说明 -| 配置项 | 描述 | 默认值 | -|--------------|-------------------------------|---------------| -| **runJS** | 我已阅读免责声明(未勾选无法执行) | `否` | -| **room** | 奇域关卡关键词或 GUID(仅支持单个;空则使用默认地图) | `37135473336` | -| **thisAttempts** | 指定通关次数(`0` = 无限,直到达到每周上限) | `0` | -| **weekMaxExp** | 每周可获取的经验值上限 | `4000` | -| **singleExp** | 每次通关可获得的经验值(不可为零) | `270` | +| 配置项 | 描述 | 默认值 | +|------------------|------------------------------------|----------------| +| **runJS** | 我已阅读免责声明(未勾选无法执行) | `否` | +| **room** | 奇域关卡关键词或 GUID(仅支持单个,空则使用默认地图) | `37135473336` | +| **achievementMode** | 成就模式(请确保地图有成就) | `是` | +| **starMode** | 收藏模式(请确保地图未失效,并确保地图已被收藏) | `否` | +| **starRoomName** | 收藏模式所使用的地图名称(不是房间ID,是地图名字,需先开启收藏模式) | `碰碰墙` | +| **thisAttempts** | 指定通关次数(`0` = 无限,直到达到每周上限) | `0` | +| **weekMaxExp** | 每周可获取的经验值上限 | `4000` | +| **singleExp** | 每次通关可获得的经验值(不可为零) | `270` | --- @@ -45,12 +49,7 @@ - 游戏窗口需保持 **16:9** 的宽高比例,否则可能影响图像识别。 - `singleExp` 请填写正确,否则脚本的剩余次数计算会不准确。 - 若默认地图下架,请手动输入可游玩的地图号。 - ---- - -## 📅 更新计划 - -未来可能会支持运行“收藏页面”中的奇域地图。 -但由于收藏地图状态不稳定且不适合大多数用户,**暂不确定是否正式加入**。 +- 勾选收藏模式后,请确保 `starRoomName` 填写正确地图名称。 +- 成就模式和收藏模式可以同时开启,但请确保地图符合对应要求。 --- diff --git a/repo/js/WeeklyThousandStarRealm/main.js b/repo/js/WeeklyThousandStarRealm/main.js index 362870c65..5a3c6ae88 100644 --- a/repo/js/WeeklyThousandStarRealm/main.js +++ b/repo/js/WeeklyThousandStarRealm/main.js @@ -4,7 +4,10 @@ const duration = 1000; // 默认点击等待延时 const storePath = "data/store.json" const runJS = settings.runJS || false; +const achievementMode = settings.achievementMode || true; +const starMode = settings.starMode || false; const roomID = settings.room || "37135473336"; +const starRoomName = settings.starRoomName || "碰碰墙"; const userAttempts = Number(settings.thisAttempts || "0"); const useFixedAttempts = userAttempts > 0; const weekMaxExp = Number(settings.weekMaxExp || "4000"); @@ -131,21 +134,23 @@ async function findImageAndClick(path, x, y, w, h, imgAttempts = attempts) { // 清除游玩数据 async function deleteSource() { - await sleep(duration); - await genshin.returnMainUi(); - log.info("开始清除地图数据"); - await sleep(duration); - keyPress("VK_B"); - await sleep(duration); - await findTextAndClick("管理关卡", 960, 0, 960, 100); - await findTextAndClick("管理", 960, 980, 960, 100); - await findImageAndClick("check_box", 0, 0, 1480, 340); - await findTextAndClick("删除",960, 980, 960, 100); - await findTextAndClick("确认", 960, 600, 960, 400); - await findTextAndClick("确认", 960, 600, 960, 400); - log.info("数据清除完成"); - await sleep(duration); - await genshin.returnMainUi(); + if (achievementMode) { + await sleep(duration); + await genshin.returnMainUi(); + log.info("开始清除地图数据"); + await sleep(duration); + keyPress("VK_B"); + await sleep(duration); + await findTextAndClick("管理关卡", 960, 0, 960, 100); + await findTextAndClick("管理", 960, 980, 960, 100); + await findImageAndClick("check_box", 0, 0, 1480, 340); + await findTextAndClick("删除",960, 980, 960, 100); + await findTextAndClick("确认", 960, 600, 960, 400); + await findTextAndClick("确认", 960, 600, 960, 400); + log.info("数据清除完成"); + await sleep(duration); + await genshin.returnMainUi(); + } } // 进入千星奇域的全部奇域页面 @@ -166,6 +171,26 @@ async function enterSourcePage() { await sleep(duration); } +// 进入千星奇域的收藏奇域页面 +async function enterStarSourcePage() { + // 1. 检测是否在房间内,在则退出 + const inRoom = await findText("房间", 1500, 0, 420, 500, 5); + if (inRoom) { + keyPress("VK_P"); + await sleep(duration); + await findImageAndClick("exit_room", 960, 0, 960, 540); + await findTextAndClick("确认", 960, 600, 960, 400); + await genshin.returnMainUi(); + keyPress("VK_B"); + } else { + keyPress("VK_F6"); + await sleep(duration); + await findTextAndClick("收藏", 0, 850, 300, 230); + } + + await sleep(duration); +} + // 创建关卡 async function createMap() { await findTextAndClick("全部", 1320, 0, 600, 95); @@ -196,12 +221,47 @@ async function createMap() { await sleep(duration); } +// 从收藏创建关卡 +async function createStarMap() { + await findTextAndClick("搜索", 0, 0, 1920, 120); + inputText(starRoomName); + await sleep(1000); + await findTextAndClick("搜索", 0, 0, 1920, 120); + await sleep(duration); + click(420, 830); + await sleep(duration); + while (true) { + const result = await findText("房间", 960, 100, 960, 200, 2); + if (result) { + await sleep(duration); + result.click(); + await sleep(duration); + break; + } else { + const result2 = await findText("大厅", 960, 600, 960, 400, 2); + if (result2) { + result2.click(); + await sleep(duration); + } + } + } + await findText("开始游戏", 960, 540, 960, 540); + click(770, 275); + await sleep(duration); +} + // 游玩关卡 async function playMap() { const stored = loadWeekData(); const leave = stored ? stored.weekTotal : weekTotal; const total = useFixedAttempts ? userAttempts : leave; - await createMap(); + + if (starMode) { + await createStarMap(); + } else { + await createMap(); + } + while (true) { await sleep(duration); const result = await findText("开始游戏", 960, 540, 960, 540, 5); @@ -217,6 +277,12 @@ async function playMap() { } let firstOutputCount = 0; while (true) { + const whiteText = await findText("空白处", 610, 950, 700, 60, 1); + if (whiteText) { + await sleep(duration); + click(610, 950); + } + const result = await findText("返回大厅", 960, 540, 960, 540, 1); if (result) { await sleep(duration); @@ -262,6 +328,11 @@ async function playMap() { } let outputCount = 0; while (true) { + const whiteText = await findText("空白处", 610, 950, 700, 60, 1); + if (whiteText) { + await sleep(duration); + click(610, 950); + } const result = await findText("返回大厅", 960, 540, 960, 540, 1); if (result) { await sleep(duration); @@ -328,7 +399,12 @@ async function exitToTeyvat() { ); } - await enterSourcePage(); + if (starMode) { + log.info("已使用收藏模式"); + await enterStarSourcePage(); + } else { + await enterSourcePage(); + } await playMap(); await exitToTeyvat(); })(); diff --git a/repo/js/WeeklyThousandStarRealm/manifest.json b/repo/js/WeeklyThousandStarRealm/manifest.json index b85343cc5..a7b08c293 100644 --- a/repo/js/WeeklyThousandStarRealm/manifest.json +++ b/repo/js/WeeklyThousandStarRealm/manifest.json @@ -1,7 +1,7 @@ { "manifest_version": 1, "name": "千星奇域每周成就经验刷取", - "version": "1.0", + "version": "2.0", "bgi_version": "0.53.0", "description": "可用于利用成就高经验值刷取经验,默认配置每周刷满需要24分钟", "authors": [ diff --git a/repo/js/WeeklyThousandStarRealm/settings.json b/repo/js/WeeklyThousandStarRealm/settings.json index 99198f0e7..2c5ec4e20 100644 --- a/repo/js/WeeklyThousandStarRealm/settings.json +++ b/repo/js/WeeklyThousandStarRealm/settings.json @@ -2,7 +2,8 @@ { "name": "runJS", "type": "checkbox", - "label": "我已阅读说明中的免责声明" + "label": "我已阅读说明中的免责声明", + "default": false }, { "type": "input-text", @@ -10,6 +11,24 @@ "label": "奇域关卡关键词或关卡GUID\n(仅支持单个,默认为作者特供地图)", "default": "37135473336" }, + { + "name": "achievementMode", + "type": "checkbox", + "label": "成就模式(请确保地图有成就)", + "default": true + }, + { + "name": "starMode", + "type": "checkbox", + "label": "收藏模式(请确保地图未失效)", + "default": false + }, + { + "type": "input-text", + "name": "starRoomName", + "label": "收藏模式所使用的地图名称(不是房间ID,是地图名字)\n请确保收藏模式的开关已开启", + "default": "碰碰墙" + }, { "type": "input-text", "name": "thisAttempts",