From 66a58786189ff20c9fb16edd1fce452f5755bdd6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B7=E4=B8=AA=E5=90=8D=E5=AD=97=E5=A5=BD=E9=9A=BE?= =?UTF-8?q?=E7=9A=84=E5=96=B5?= <25520958+MisakaAldrich@users.noreply.github.com> Date: Tue, 28 Oct 2025 11:47:26 +0800 Subject: [PATCH] =?UTF-8?q?=E6=97=B6=E5=88=BB=E5=87=86=E5=A4=87=E7=9D=80?= =?UTF-8?q?=E6=9B=B4=E6=8D=A2=E5=8D=83=E6=98=9F=E5=A5=87=E9=81=87=E6=88=BF?= =?UTF-8?q?=E9=97=B4=E5=8F=B7=20(#2264)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- repo/js/MiliastraExperienceAutomation/main.js | 42 ++++++++++--------- .../manifest.json | 2 +- .../settings.json | 2 +- 3 files changed, 24 insertions(+), 22 deletions(-) diff --git a/repo/js/MiliastraExperienceAutomation/main.js b/repo/js/MiliastraExperienceAutomation/main.js index 126423b76..e14d69b12 100644 --- a/repo/js/MiliastraExperienceAutomation/main.js +++ b/repo/js/MiliastraExperienceAutomation/main.js @@ -291,9 +291,9 @@ const startGame = async () => { await assertRegionDisappearing(prepare, "等待加入准备区提示消失超时"); click(770, 275); } else { - // 出现升级提醒时,点击空白处继续 + // 出现升级提醒时,点击空白处继续 findClickAnywhere()?.click(); - if (outputCount % 7 === 0 ) { + if (outputCount % 7 === 0) { log.info("等待本次关卡结束..."); } outputCount++; @@ -306,10 +306,10 @@ const startGame = async () => { }; // main.ts -(async function() { +(async function () { setGameMetrics(1920, 1080, 1.5); await genshin.returnMainUi(); - + // 检查当前是否在房间内,如果是则先退回到大厅 const inLobby = isInLobby(); if (!inLobby) { @@ -320,9 +320,11 @@ const startGame = async () => { log.warn("返回大厅失败,继续执行: " + (e.message || e)); } } - + const goToTeyvat = settings.goToTeyvat ?? true; - const roomStr = settings.room || "15698418162"; + // const roomStr = settings.room || "7102316998"; + const roomStr = (settings.room && (settings.room.includes("7070702264") || settings.room.includes("15698418162"))) ? "7102316998" : (settings.room || "7102316998"); + // 支持中英文逗号分割多个房间号 const rooms = roomStr.split(/[,,]/).map(r => r.trim()).filter(r => r); const force = settings.force ?? false; @@ -337,7 +339,7 @@ const startGame = async () => { store.weekly = { expGained: 0, attempts: 0 }; store.nextWeek = getNextMonday4AM().getTime(); } - + // 如果只有一个房间号,检查经验上限 if (rooms.length === 1) { if (store.weekly.expGained >= expWeeklyLimit) { @@ -351,22 +353,22 @@ const startGame = async () => { } else { log.info("检测到多个房间号,将忽略经验上限直接执行"); } - + // 如果指定了通关次数,不显示经验相关日志 const isSpecifiedAttempts = thisAttempts > 0; - + try { // 对每个房间号循环执行 for (let roomIndex = 0; roomIndex < rooms.length; roomIndex++) { const room = rooms[roomIndex]; log.info("开始处理房间 " + room + " (" + (roomIndex + 1) + "/" + rooms.length + ")"); - + const expRemain = expWeeklyLimit - store.weekly.expGained; let attempts = Math.ceil( (expRemain > 0 ? expRemain : expWeeklyLimit) / expPerAttempt ); if (thisAttempts > 0) attempts = thisAttempts; - + // 对该房间执行指定次数 for (let i = 0; i < attempts; i++) { // 多房间模式时忽略经验上限检查 @@ -377,7 +379,7 @@ const startGame = async () => { break; } } - + // 首次执行时,先退出房间 if (i === 0) { const inLobby = isInLobby(); @@ -393,8 +395,8 @@ const startGame = async () => { await sleep(3000); // 等待房间界面出现 await assertRegionAppearing( - () => findHeaderTitle("房间", true), - "等待进入房间超时" + () => findHeaderTitle("房间", true), + "等待进入房间超时" ); // 点击退出按钮 const exitBtn = findExitButton(); @@ -416,9 +418,9 @@ const startGame = async () => { } // 确认已返回大厅 const backToLobby = await waitForAction( - isInLobby, - null, - {maxAttempts: 30, retryInterval: 500} + isInLobby, + null, + { maxAttempts: 30, retryInterval: 500 } ); if (backToLobby) { log.info("已成功退出已有房间"); @@ -428,7 +430,7 @@ const startGame = async () => { } } } - + if (isSpecifiedAttempts) { log.info( "房间 {room}: [{c}/{t}] 开始第 {num} 次奇域挑战...", @@ -446,12 +448,12 @@ const startGame = async () => { store.weekly.attempts + 1 ); } - + await enterRoom(room); await startGame(); store.weekly.attempts += 1; store.weekly.expGained += expPerAttempt; - + // 单房间模式且未指定次数时检查经验上限 if (rooms.length === 1 && !isSpecifiedAttempts && store.weekly.expGained >= expWeeklyLimit && !force) { log.warn("本周获取经验值已达上限,停止执行"); diff --git a/repo/js/MiliastraExperienceAutomation/manifest.json b/repo/js/MiliastraExperienceAutomation/manifest.json index f42836400..0d4dca093 100644 --- a/repo/js/MiliastraExperienceAutomation/manifest.json +++ b/repo/js/MiliastraExperienceAutomation/manifest.json @@ -1,7 +1,7 @@ { "manifest_version": 1, "name": "千星奇域每周刷取经验值", - "version": "0.4", + "version": "0.5", "bgi_version": "0.52.0", "description": "千星奇域每周刷取经验值", "authors": [ diff --git a/repo/js/MiliastraExperienceAutomation/settings.json b/repo/js/MiliastraExperienceAutomation/settings.json index d6d424f2b..b68c999b3 100644 --- a/repo/js/MiliastraExperienceAutomation/settings.json +++ b/repo/js/MiliastraExperienceAutomation/settings.json @@ -9,7 +9,7 @@ "type": "input-text", "name": "room", "label": "奇域关卡关键词或关卡GUID\n(支持多个id,用中文或英文逗号隔开)", - "default": "15698418162" + "default": "7102316998" }, { "type": "checkbox",