From 77d3bfdc16ed1bae9fff4b164ec5ae4027c24ed7 Mon Sep 17 00:00:00 2001 From: this-Fish Date: Wed, 23 Jul 2025 11:12:46 +0800 Subject: [PATCH] =?UTF-8?q?JS=20:=20=E5=8E=86=E7=BB=83=E7=82=B9=E5=8F=8C?= =?UTF-8?q?=E5=80=8D=E5=A5=BD=E6=84=9F=20=E6=96=B0=E5=A2=9E=E5=8A=9F?= =?UTF-8?q?=E8=83=BD=20(#1387)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * JS : 历练点双倍好感 新增功能 支持进入好友尘歌壶后,让指定位置角色离队 * format --------- Co-authored-by: 起个名字好难的喵 <25520958+MisakaAldrich@users.noreply.github.com> --- .../DoubleFriendshipEncounterPoints/main.js | 79 ++++++++++++++++++- .../manifest.json | 4 +- .../settings.json | 19 +++++ 3 files changed, 97 insertions(+), 5 deletions(-) diff --git a/repo/js/DoubleFriendshipEncounterPoints/main.js b/repo/js/DoubleFriendshipEncounterPoints/main.js index 37ce10a6..6d29c7d6 100644 --- a/repo/js/DoubleFriendshipEncounterPoints/main.js +++ b/repo/js/DoubleFriendshipEncounterPoints/main.js @@ -22,11 +22,16 @@ const MiddleSliderBottomRo = RecognitionObject.TemplateMatch(file.ReadImageMatSy const RightSliderTopRo = RecognitionObject.TemplateMatch(file.ReadImageMatSync("Assets/RecognitionObject/Slider Top.png"), 1750, 100, 100, 100); const RightSliderBottomRo = RecognitionObject.TemplateMatch(file.ReadImageMatSync("Assets/RecognitionObject/Slider Bottom.png"), 1750, 100, 100, 900); +// 取得需要离队角色資訊 +const removedCharacters1 = typeof (settings.removedCharacters1) === 'undefined' ? false : settings.removedCharacters1; +const removedCharacters2 = typeof (settings.removedCharacters2) === 'undefined' ? false : settings.removedCharacters2; +const removedCharacters3 = typeof (settings.removedCharacters3) === 'undefined' ? false : settings.removedCharacters3; +const removedCharacters4 = typeof (settings.removedCharacters4) === 'undefined' ? false : settings.removedCharacters4; /** * @returns {Promise} */ -(async function() { +(async function () { // 切换队伍 if (!settings.disableNotice) { for (let n = 0; n < 10; n++) { @@ -193,7 +198,7 @@ const RightSliderBottomRo = RecognitionObject.TemplateMatch(file.ReadImageMatSyn if (res.text.includes(settings.appointFriendName)) { log.info("指定好友名字位置:({x},{y},{w},{h}), 识别内容:{text}", res.x, res.y, res.Width, res.Height, res.text); click(res.x - 100, res.y + 50); - await sleep(500); + await sleep(1000); // 申请造访尘歌壶 let captureRegion = captureGameRegion(); @@ -207,6 +212,7 @@ const RightSliderBottomRo = RecognitionObject.TemplateMatch(file.ReadImageMatSyn } } } + await sleep(1000); // 翻页继续尝试&模板匹配的方式等待加载 let SliderBottom = captureGameRegion().find(RightSliderBottomRo); if (SliderBottom.isExist()) { @@ -284,7 +290,7 @@ const RightSliderBottomRo = RecognitionObject.TemplateMatch(file.ReadImageMatSyn if (i % 2 === 0) { // 偶数索引,递增 y_avatar y_avatar += avatar_increment; - log.info(`正在申请造访第 ${i/2+1} 位好友尘歌壶`); + log.info(`正在申请造访第 ${i / 2 + 1} 位好友尘歌壶`); click(x_avatar, y_avatar); await sleep(250); click(x_avatar, y_avatar); @@ -325,6 +331,10 @@ const RightSliderBottomRo = RecognitionObject.TemplateMatch(file.ReadImageMatSyn // 模板匹配领取历练点奖励 async function claimEncounterPointsRewards() { + await sleep(2000); + log.info("正在让指定位置角色离队"); + await removeSpecifiedRole(); + await sleep(2000); log.info("正在打开冒险之证领取历练点奖励"); await sleep(2000); keyPress("VK_ESCAPE"); @@ -397,6 +407,69 @@ const RightSliderBottomRo = RecognitionObject.TemplateMatch(file.ReadImageMatSyn } } + // 让指定位置角色离队 + async function removeSpecifiedRole() { + try { + if (removedCharacters1 || removedCharacters2 || removedCharacters3 || removedCharacters4) { + // 打開配隊介面 + keyPress("l"); + await sleep(3500); + + // 让4号位角色离队 + if (removedCharacters4) { + // 第4名角色位置 + click(1460, 600); + await sleep(750); + click(430, 1020); + await sleep(750); + log.info("4号位角色已离队"); + + } + + // 让3号位角色离队 + if (removedCharacters3) { + // 第3名角色位置 + click(1130, 600); + await sleep(750); + click(430, 1020); + await sleep(750); + log.info("3号位角色已离队"); + } + + // 让2号位角色离队 + if (removedCharacters2) { + // 第2名角色位置 + click(790, 600); + await sleep(750); + click(430, 1020); + await sleep(750); + log.info("2号位角色已离队"); + } + + // 让1号位角色离队 + if (removedCharacters1) { + if (removedCharacters4 && removedCharacters3 && removedCharacters2) { + log.warn("2,3,4号位已离队,1号位角色不能离队"); + } else { + // 第1名角色位置 + click(480, 600); + await sleep(750); + click(430, 1020); + await sleep(750); + log.info("1号位角色已离队"); + } + } + + // 返回主界面 + await genshin.returnMainUi(); + } else { + log.info("无需让角色离队"); + } + } catch (error) { + log.error("出错: {0}", error); + } + } + // 向下一页 async function pageDown(SliderBottomRo) { let SliderBottom = captureGameRegion().find(SliderBottomRo); diff --git a/repo/js/DoubleFriendshipEncounterPoints/manifest.json b/repo/js/DoubleFriendshipEncounterPoints/manifest.json index af3747f0..0a8d0c61 100644 --- a/repo/js/DoubleFriendshipEncounterPoints/manifest.json +++ b/repo/js/DoubleFriendshipEncounterPoints/manifest.json @@ -1,9 +1,9 @@ { "manifest_version": 1, "name": "历练点双倍好感", - "version": "2.1.1", + "version": "2.1.2", "bgi_version": "0.44.1", - "description": "进入好友尘歌壶,用历练点领取双倍好感\n目前支持游戏语言:简体、繁体中文、英文\n!!!此版本基于图像识别&OCR,Build日期早于2025年4月2日的BetterGI无法使用", + "description": "进入好友尘歌壶,用历练点领取双倍好感\n目前支持游戏语言:简体、繁体中文、英文\n支持进入好友尘歌壶后,让指定位置角色离队", "authors": [ { "name": "起个名字好难的喵", diff --git a/repo/js/DoubleFriendshipEncounterPoints/settings.json b/repo/js/DoubleFriendshipEncounterPoints/settings.json index 1475a48d..4995c9cd 100644 --- a/repo/js/DoubleFriendshipEncounterPoints/settings.json +++ b/repo/js/DoubleFriendshipEncounterPoints/settings.json @@ -13,6 +13,25 @@ "name": "request_times", "type": "input-text", "label": "(选填)申请好友数,需小于等于7,不支持翻页" + },{ + "name": "removedCharacters4", + "type": "checkbox", + "label": "让4号位角色离队" + }, + { + "name": "removedCharacters3", + "type": "checkbox", + "label": "让3号位角色离队" + }, + { + "name": "removedCharacters2", + "type": "checkbox", + "label": "让2号位角色离队" + }, + { + "name": "removedCharacters1", + "type": "checkbox", + "label": "让1号位角色离队" }, { "name": "disableGoStatue",