diff --git a/repo/js/AutoStygianOnslaught/README.md b/repo/js/AutoStygianOnslaught/README.md new file mode 100644 index 00000000..35c6834a --- /dev/null +++ b/repo/js/AutoStygianOnslaught/README.md @@ -0,0 +1,66 @@ +# 幽境危战注意事项 + +## 零、前言 + +- 当前文档处于测试阶段,注意事项可能尚不完善,敬请谅解。 +- 如发现BUG,请通过QQ:119996800联系我们,您的反馈将非常受欢迎。 +- 本脚本基于地脉花和首领一条龙脚本进行改造。 +- 脚本仅供娱乐使用,请在下载后24小时内删除。 + +## 一、省流注意事项 + +1. **使用前准备**: + - 请在`<<幽境危战>>`中配置好战斗队伍。 +2. **黑名单建议**: + - 根目录下有建议加入自动拾取黑名单的名称,请检查并添加。 +3. **战斗实力**: + - 请确保队伍具备足够的战斗实力,当前版本在战斗失败时会自动退出秘境。 +4. **自动拾取功能**: + - 为避免不必要的干扰,建议关闭自动拾取功能。 + +## 二、配置简介 + +1. **圣遗物奖励**: + - 默认设置下,脚本不会修改圣遗物奖励。 + +2. **Boss挑战关卡选择**: + - 必填项:请从上往下选择第几个Boss挑战关卡(1至3),否则脚本将退出执行。 + +3. **挑战次数**: + - 默认设置为15次,期间若树脂耗尽,脚本将自动结束。 + +4. **树脂顺序设定**: + - 使用`/`隔开数字来设定树脂使用顺序,如`1/2`表示先使用浓缩树脂,再使用原粹树脂。 + - 树脂类型对应关系: + - 1 = 浓缩树脂 + - 2 = 原粹树脂 + - 3 = 脆弱树脂 + - 4 = 须臾树脂 + - 默认设置:`1/2` + +5. **最长战斗超时时间**: + - 默认设置为240秒,一般情况下无需修改。 + +6. **开始战斗后的移动时间**: + - 默认设置为1秒(注意单位为秒)。由于开始位置离Boss较远,请根据实际情况设定,一般情况下默认设置即可。 + +## 三、更新说明 + +### v.1.0版本(20250627) + +- **功能**:脚本发布。 + +### v.1.1版本 + +- **备注**:此版本信息被省略。 + +### v.1.2版本(20250627) + +- **新增功能**: + 1. 添加圣遗物奖励选择功能。 + 2. 添加自动选择难度功能。 +- **优化**: + 1. 优化逻辑处理。 + 2. 加大战斗完成识别区域。 + +请将以上内容保存为`README.md`文件,以便在GitHub或其他支持Markdown的平台上正确显示和使用。 \ No newline at end of file diff --git a/repo/js/AutoStygianOnslaught/assets/Artifacts/artifact_1.bmp b/repo/js/AutoStygianOnslaught/assets/Artifacts/artifact_1.bmp new file mode 100644 index 00000000..e35e42ae Binary files /dev/null and b/repo/js/AutoStygianOnslaught/assets/Artifacts/artifact_1.bmp differ diff --git a/repo/js/AutoStygianOnslaught/assets/Artifacts/artifact_10.bmp b/repo/js/AutoStygianOnslaught/assets/Artifacts/artifact_10.bmp new file mode 100644 index 00000000..ffdf49d3 Binary files /dev/null and b/repo/js/AutoStygianOnslaught/assets/Artifacts/artifact_10.bmp differ diff --git a/repo/js/AutoStygianOnslaught/assets/Artifacts/artifact_10in.bmp b/repo/js/AutoStygianOnslaught/assets/Artifacts/artifact_10in.bmp new file mode 100644 index 00000000..d17f7efe Binary files /dev/null and b/repo/js/AutoStygianOnslaught/assets/Artifacts/artifact_10in.bmp differ diff --git a/repo/js/AutoStygianOnslaught/assets/Artifacts/artifact_11.bmp b/repo/js/AutoStygianOnslaught/assets/Artifacts/artifact_11.bmp new file mode 100644 index 00000000..d2b1ed2e Binary files /dev/null and b/repo/js/AutoStygianOnslaught/assets/Artifacts/artifact_11.bmp differ diff --git a/repo/js/AutoStygianOnslaught/assets/Artifacts/artifact_11in.bmp b/repo/js/AutoStygianOnslaught/assets/Artifacts/artifact_11in.bmp new file mode 100644 index 00000000..7136f127 Binary files /dev/null and b/repo/js/AutoStygianOnslaught/assets/Artifacts/artifact_11in.bmp differ diff --git a/repo/js/AutoStygianOnslaught/assets/Artifacts/artifact_12.bmp b/repo/js/AutoStygianOnslaught/assets/Artifacts/artifact_12.bmp new file mode 100644 index 00000000..5782afd4 Binary files /dev/null and b/repo/js/AutoStygianOnslaught/assets/Artifacts/artifact_12.bmp differ diff --git a/repo/js/AutoStygianOnslaught/assets/Artifacts/artifact_12in.bmp b/repo/js/AutoStygianOnslaught/assets/Artifacts/artifact_12in.bmp new file mode 100644 index 00000000..e6a79e65 Binary files /dev/null and b/repo/js/AutoStygianOnslaught/assets/Artifacts/artifact_12in.bmp differ diff --git a/repo/js/AutoStygianOnslaught/assets/Artifacts/artifact_13.bmp b/repo/js/AutoStygianOnslaught/assets/Artifacts/artifact_13.bmp new file mode 100644 index 00000000..10a44e75 Binary files /dev/null and b/repo/js/AutoStygianOnslaught/assets/Artifacts/artifact_13.bmp differ diff --git a/repo/js/AutoStygianOnslaught/assets/Artifacts/artifact_13in.bmp b/repo/js/AutoStygianOnslaught/assets/Artifacts/artifact_13in.bmp new file mode 100644 index 00000000..a5b6a286 Binary files /dev/null and b/repo/js/AutoStygianOnslaught/assets/Artifacts/artifact_13in.bmp differ diff --git a/repo/js/AutoStygianOnslaught/assets/Artifacts/artifact_14.bmp b/repo/js/AutoStygianOnslaught/assets/Artifacts/artifact_14.bmp new file mode 100644 index 00000000..fa42f199 Binary files /dev/null and b/repo/js/AutoStygianOnslaught/assets/Artifacts/artifact_14.bmp differ diff --git a/repo/js/AutoStygianOnslaught/assets/Artifacts/artifact_14in.bmp b/repo/js/AutoStygianOnslaught/assets/Artifacts/artifact_14in.bmp new file mode 100644 index 00000000..e8866aed Binary files /dev/null and b/repo/js/AutoStygianOnslaught/assets/Artifacts/artifact_14in.bmp differ diff --git a/repo/js/AutoStygianOnslaught/assets/Artifacts/artifact_15.bmp b/repo/js/AutoStygianOnslaught/assets/Artifacts/artifact_15.bmp new file mode 100644 index 00000000..c992c8e3 Binary files /dev/null and b/repo/js/AutoStygianOnslaught/assets/Artifacts/artifact_15.bmp differ diff --git a/repo/js/AutoStygianOnslaught/assets/Artifacts/artifact_15in.bmp b/repo/js/AutoStygianOnslaught/assets/Artifacts/artifact_15in.bmp new file mode 100644 index 00000000..f00bf818 Binary files /dev/null and b/repo/js/AutoStygianOnslaught/assets/Artifacts/artifact_15in.bmp differ diff --git a/repo/js/AutoStygianOnslaught/assets/Artifacts/artifact_16.bmp b/repo/js/AutoStygianOnslaught/assets/Artifacts/artifact_16.bmp new file mode 100644 index 00000000..5908a23c Binary files /dev/null and b/repo/js/AutoStygianOnslaught/assets/Artifacts/artifact_16.bmp differ diff --git a/repo/js/AutoStygianOnslaught/assets/Artifacts/artifact_16in.bmp b/repo/js/AutoStygianOnslaught/assets/Artifacts/artifact_16in.bmp new file mode 100644 index 00000000..125324b1 Binary files /dev/null and b/repo/js/AutoStygianOnslaught/assets/Artifacts/artifact_16in.bmp differ diff --git a/repo/js/AutoStygianOnslaught/assets/Artifacts/artifact_17.bmp b/repo/js/AutoStygianOnslaught/assets/Artifacts/artifact_17.bmp new file mode 100644 index 00000000..6c03f9cd Binary files /dev/null and b/repo/js/AutoStygianOnslaught/assets/Artifacts/artifact_17.bmp differ diff --git a/repo/js/AutoStygianOnslaught/assets/Artifacts/artifact_17in.bmp b/repo/js/AutoStygianOnslaught/assets/Artifacts/artifact_17in.bmp new file mode 100644 index 00000000..7ffb1a64 Binary files /dev/null and b/repo/js/AutoStygianOnslaught/assets/Artifacts/artifact_17in.bmp differ diff --git a/repo/js/AutoStygianOnslaught/assets/Artifacts/artifact_18.bmp b/repo/js/AutoStygianOnslaught/assets/Artifacts/artifact_18.bmp new file mode 100644 index 00000000..61d463d9 Binary files /dev/null and b/repo/js/AutoStygianOnslaught/assets/Artifacts/artifact_18.bmp differ diff --git a/repo/js/AutoStygianOnslaught/assets/Artifacts/artifact_18in.bmp b/repo/js/AutoStygianOnslaught/assets/Artifacts/artifact_18in.bmp new file mode 100644 index 00000000..3cde8d42 Binary files /dev/null and b/repo/js/AutoStygianOnslaught/assets/Artifacts/artifact_18in.bmp differ diff --git a/repo/js/AutoStygianOnslaught/assets/Artifacts/artifact_1in.bmp b/repo/js/AutoStygianOnslaught/assets/Artifacts/artifact_1in.bmp new file mode 100644 index 00000000..f235c80e Binary files /dev/null and b/repo/js/AutoStygianOnslaught/assets/Artifacts/artifact_1in.bmp differ diff --git a/repo/js/AutoStygianOnslaught/assets/Artifacts/artifact_2.bmp b/repo/js/AutoStygianOnslaught/assets/Artifacts/artifact_2.bmp new file mode 100644 index 00000000..7d95c5ac Binary files /dev/null and b/repo/js/AutoStygianOnslaught/assets/Artifacts/artifact_2.bmp differ diff --git a/repo/js/AutoStygianOnslaught/assets/Artifacts/artifact_2in.bmp b/repo/js/AutoStygianOnslaught/assets/Artifacts/artifact_2in.bmp new file mode 100644 index 00000000..7b2c1590 Binary files /dev/null and b/repo/js/AutoStygianOnslaught/assets/Artifacts/artifact_2in.bmp differ diff --git a/repo/js/AutoStygianOnslaught/assets/Artifacts/artifact_3.bmp b/repo/js/AutoStygianOnslaught/assets/Artifacts/artifact_3.bmp new file mode 100644 index 00000000..17d7e4e3 Binary files /dev/null and b/repo/js/AutoStygianOnslaught/assets/Artifacts/artifact_3.bmp differ diff --git a/repo/js/AutoStygianOnslaught/assets/Artifacts/artifact_3in.bmp b/repo/js/AutoStygianOnslaught/assets/Artifacts/artifact_3in.bmp new file mode 100644 index 00000000..89f7568f Binary files /dev/null and b/repo/js/AutoStygianOnslaught/assets/Artifacts/artifact_3in.bmp differ diff --git a/repo/js/AutoStygianOnslaught/assets/Artifacts/artifact_4.bmp b/repo/js/AutoStygianOnslaught/assets/Artifacts/artifact_4.bmp new file mode 100644 index 00000000..34df78ed Binary files /dev/null and b/repo/js/AutoStygianOnslaught/assets/Artifacts/artifact_4.bmp differ diff --git a/repo/js/AutoStygianOnslaught/assets/Artifacts/artifact_4in.bmp b/repo/js/AutoStygianOnslaught/assets/Artifacts/artifact_4in.bmp new file mode 100644 index 00000000..93cff47a Binary files /dev/null and b/repo/js/AutoStygianOnslaught/assets/Artifacts/artifact_4in.bmp differ diff --git a/repo/js/AutoStygianOnslaught/assets/Artifacts/artifact_5.bmp b/repo/js/AutoStygianOnslaught/assets/Artifacts/artifact_5.bmp new file mode 100644 index 00000000..26117185 Binary files /dev/null and b/repo/js/AutoStygianOnslaught/assets/Artifacts/artifact_5.bmp differ diff --git a/repo/js/AutoStygianOnslaught/assets/Artifacts/artifact_5in.bmp b/repo/js/AutoStygianOnslaught/assets/Artifacts/artifact_5in.bmp new file mode 100644 index 00000000..2101c72f Binary files /dev/null and b/repo/js/AutoStygianOnslaught/assets/Artifacts/artifact_5in.bmp differ diff --git a/repo/js/AutoStygianOnslaught/assets/Artifacts/artifact_6.bmp b/repo/js/AutoStygianOnslaught/assets/Artifacts/artifact_6.bmp new file mode 100644 index 00000000..d5cbf01d Binary files /dev/null and b/repo/js/AutoStygianOnslaught/assets/Artifacts/artifact_6.bmp differ diff --git a/repo/js/AutoStygianOnslaught/assets/Artifacts/artifact_6in.bmp b/repo/js/AutoStygianOnslaught/assets/Artifacts/artifact_6in.bmp new file mode 100644 index 00000000..6ea06555 Binary files /dev/null and b/repo/js/AutoStygianOnslaught/assets/Artifacts/artifact_6in.bmp differ diff --git a/repo/js/AutoStygianOnslaught/assets/Artifacts/artifact_7.bmp b/repo/js/AutoStygianOnslaught/assets/Artifacts/artifact_7.bmp new file mode 100644 index 00000000..13b66608 Binary files /dev/null and b/repo/js/AutoStygianOnslaught/assets/Artifacts/artifact_7.bmp differ diff --git a/repo/js/AutoStygianOnslaught/assets/Artifacts/artifact_7in.bmp b/repo/js/AutoStygianOnslaught/assets/Artifacts/artifact_7in.bmp new file mode 100644 index 00000000..ea19dd26 Binary files /dev/null and b/repo/js/AutoStygianOnslaught/assets/Artifacts/artifact_7in.bmp differ diff --git a/repo/js/AutoStygianOnslaught/assets/Artifacts/artifact_8.bmp b/repo/js/AutoStygianOnslaught/assets/Artifacts/artifact_8.bmp new file mode 100644 index 00000000..cc118d24 Binary files /dev/null and b/repo/js/AutoStygianOnslaught/assets/Artifacts/artifact_8.bmp differ diff --git a/repo/js/AutoStygianOnslaught/assets/Artifacts/artifact_8in.bmp b/repo/js/AutoStygianOnslaught/assets/Artifacts/artifact_8in.bmp new file mode 100644 index 00000000..26348179 Binary files /dev/null and b/repo/js/AutoStygianOnslaught/assets/Artifacts/artifact_8in.bmp differ diff --git a/repo/js/AutoStygianOnslaught/assets/Artifacts/artifact_9.bmp b/repo/js/AutoStygianOnslaught/assets/Artifacts/artifact_9.bmp new file mode 100644 index 00000000..e6a5eaaa Binary files /dev/null and b/repo/js/AutoStygianOnslaught/assets/Artifacts/artifact_9.bmp differ diff --git a/repo/js/AutoStygianOnslaught/assets/Artifacts/artifact_9in.bmp b/repo/js/AutoStygianOnslaught/assets/Artifacts/artifact_9in.bmp new file mode 100644 index 00000000..df3b187d Binary files /dev/null and b/repo/js/AutoStygianOnslaught/assets/Artifacts/artifact_9in.bmp differ diff --git a/repo/js/Auto自动幽境危战/assets/box.png b/repo/js/AutoStygianOnslaught/assets/box.png similarity index 100% rename from repo/js/Auto自动幽境危战/assets/box.png rename to repo/js/AutoStygianOnslaught/assets/box.png diff --git a/repo/js/Auto自动幽境危战/assets/全自动幽境危战.json b/repo/js/AutoStygianOnslaught/assets/全自动幽境危战.json similarity index 100% rename from repo/js/Auto自动幽境危战/assets/全自动幽境危战.json rename to repo/js/AutoStygianOnslaught/assets/全自动幽境危战.json diff --git a/repo/js/Auto自动幽境危战/main.js b/repo/js/AutoStygianOnslaught/main.js similarity index 71% rename from repo/js/Auto自动幽境危战/main.js rename to repo/js/AutoStygianOnslaught/main.js index ae6c976b..5c3f2b23 100644 --- a/repo/js/Auto自动幽境危战/main.js +++ b/repo/js/AutoStygianOnslaught/main.js @@ -6,7 +6,7 @@ if (challengeName === undefined || challengeName === ""){throw new Error("挑战Boss未配置,请在JS配置中选择...")} let Startforward = settings.Startforward*1000 ? settings.Startforward*1000 : 1000; var Fighttimeout = settings.timeout * 1000 ? settings.timeout * 1000 : 240000;//战斗超时时间,默认为240秒 - const ocrRegion1 = { x: 643, y: 58, width: 800, height: 400 }; // 上方挑战成功区域 + const ocrRegion1 = { x: 643, y: 58, width: 800, height: 800 }; // 上方挑战成功区域 const ocrRegion2 = { x: 780, y: 406, width: 370, height: 135 }; // 中间挑战失败区域 const ocrRo1 = RecognitionObject.ocr(ocrRegion1.x, ocrRegion1.y, ocrRegion1.width, ocrRegion1.height); const ocrRo2 = RecognitionObject.ocr(ocrRegion2.x, ocrRegion2.y, ocrRegion2.width, ocrRegion2.height); @@ -35,6 +35,30 @@ var advanceNum = 0;//前进次数 var verticalNum = 0; + var Artifacts = settings.Artifacts ? settings.Artifacts : "长夜之誓 / 深廊终曲"; + + //建立一个数值映射所有圣遗物对应需要识别的图片 + var artifactImageMap = { + "长夜之誓 / 深廊终曲": "assets/Artifacts/artifact_1.bmp", + "黑曜秘典 / 烬城勇者绘卷": "assets/Artifacts/artifact_2.bmp", + "谐律异想断章 / 未竟的遐思": "assets/Artifacts/artifact_3.bmp", + "回声之林夜话 / 昔时之歌": "assets/Artifacts/artifact_4.bmp", + "逐影猎人 / 黄金剧团": "assets/Artifacts/artifact_5.bmp", + "水仙之梦 / 花海甘露之光": "assets/Artifacts/artifact_6.bmp", + "乐园遗落之花 / 沙上楼阁史话": "assets/Artifacts/artifact_7.bmp", + "深林的记忆 / 饰金之梦": "assets/Artifacts/artifact_8.bmp", + "来歆余响 / 辰砂往生录": "assets/Artifacts/artifact_9.bmp", + "华馆梦醒形骸记 / 海染砗磲": "assets/Artifacts/artifact_10.bmp", + "绝缘之旗印 / 追忆之注连": "assets/Artifacts/artifact_11.bmp", + "昔日宗室之仪 / 染血的骑士道": "assets/Artifacts/artifact_12.bmp", + "渡过烈火的贤人 / 炽烈的炎之魔女": "assets/Artifacts/artifact_13.bmp", + "悠古的磐岩 / 逆飞的流星": "assets/Artifacts/artifact_14.bmp", + "千岩牢固 / 苍白之火": "assets/Artifacts/artifact_15.bmp", + "冰风迷途的勇士 / 沉沦之心": "assets/Artifacts/artifact_16.bmp", + "翠绿之影 / 被怜爱的少女": "assets/Artifacts/artifact_17.bmp", + "如雷的盛怒 / 平息鸣雷的尊者": "assets/Artifacts/artifact_18.bmp" + }; + async function Textocr(wenzi="空参数",chaotime=10,clickocr=0,debugcode=0,x=0,y=0,w=1920,h=1080) { const startTime = new Date(); for (let ii = 0; ii < 10; ii++) @@ -50,7 +74,7 @@ let res = resList[i]; res1=res.text if (res.text===wenzi) { - log.info(`·${res1}·找到`); + log.info(`识别到 ·${res1}·`); if (debugcode===1){if (x===0 & y===0){log.info("全图代码位置:({x},{y},{h},{w})", res.x-10, res.y-10, res.width+10, res.Height+10);return result = { text: res.text, x: res.x, y: res.y, found: true }}}else{if (x===0 & y===0){log.info("文本OCR完成'{text}'", res.text);}} if (clickocr===1){await sleep(1000);click(res.x, res.y);}else{} if (clickocr===2){await sleep(100);keyPress("F");}else{} @@ -58,11 +82,32 @@ } } const NowTime = new Date(); - if (Math.abs(NowTime - startTime)>chaotime*1000){if (x===0 & y===0){log.info(`${chaotime}秒超时退出,"${wenzi}"未找到`);}return result = {found: false };}else{ii=8;if (x !== 861){await keyPress("VK_W");};} + if (Math.abs(NowTime - startTime)>chaotime*1000){if (x===0 & y===0){log.info(`${chaotime}秒超时退出,"${wenzi}"未找到`);}return result = {found: false };}else{ii=8;if (x !== 861){if(debugcode!==3){await keyPress("VK_W");}};} await sleep(100); } } + async function imageRecognition(imagefilePath="空参数",timeout=10,afterBehavior=0,debugmodel=0,xa=0,ya=0,wa=1920,ha=1080) { + const startTime = new Date(); + const Imagidentify = RecognitionObject.TemplateMatch(file.ReadImageMatSync(imagefilePath)); + for (let ii = 0; ii < 10; ii++) { + captureRegion = captureGameRegion(); // 获取一张截图 + res = captureRegion.DeriveCrop(xa, ya, wa, ha).Find(Imagidentify); + if (res.isEmpty()) { + if (debugmodel===1 & xa===0 & ya===0){log.info("识别页面元素")}; + } else { + if (afterBehavior===1){if (xa===0 & ya===0){log.info("点击模式:开");}await sleep(1000);click(res.x+xa, res.y+ya);}else{if (debugmodel===1 & xa===0 & ya===0){log.info("点击模式:关")}} + if (afterBehavior===2){if (xa===0 & ya===0){log.info("F模式:开");}await sleep(1000);keyPress("F");}else{if (debugmodel===1 & xa===0 & ya===0){log.info("F模式:关")}} + if (debugmodel===1 & xa===0 & ya===0){log.info("全图代码位置:({x},{y},{h},{w})", res.x+xa, res.y+ya, res.width+wa, res.Height+ha);}else{ log.info("识别到图片");} + return result = { x: res.x+xa, y: res.y+ya, w:res.width+wa,h:res.Height+ha,found: true } + } + const NowTime = new Date(); + if ((NowTime - startTime)>timeout*1000){if (debugmodel===1 & xa===0 & ya===0){log.info(`${timeout}秒超时退出,未找到图片`);}return result = {found: false };}else{ii=8} + await sleep(200); + } + await sleep(1200); + } + //征讨之花领奖 const autoNavigateToReward = async () => { // 定义识别对象 @@ -152,26 +197,20 @@ var startTime = new Date(); await sleep(500); var NowTime = new Date(); - var getshu = 0; - var lastIncrementTime = 0; // 上次增加getshu的时间 - const intervalTime = 500; // 3秒的时间间隔,单位为毫秒 + keyDown("w"); while ((NowTime - startTime)<10*1000){ - const result = await Textocr("战斗准备",0.1,0,0,1198,492,150,80); - const result2 = await Textocr("开始挑战",0.1,0,0,1554,970,360, 105); + const result = await Textocr("战斗准备",0.1,0,3,1198,492,150,80); + const result2 = await Textocr("开始挑战",0.1,0,3,1554,970,360, 105); if (result.found || result2.found) { - await keyPress("F");await sleep(200); await keyPress("F"); - const currentTime = new Date().getTime(); - if (currentTime - lastIncrementTime >= intervalTime) { - getshu++; - lastIncrementTime = currentTime; - } + await keyUp("w"); + await keyPress("F");await sleep(200); await keyPress("F"); return true; } - await keyDown("w"); - await sleep(200); - await keyUp("w"); + keyDown("w"); + keyPress("F"); NowTime = new Date(); } + await keyUp("w"); await genshin.returnMainUi(); return false } @@ -193,8 +232,7 @@ (async () => { try { let startTime = Date.now(); - let noTextCount = 0; - const successKeywords = ["挑战完成"]; + const successKeywords = ["挑战完成","战斗完成"]; const failureKeywords = ["战斗失败"]; // 循环检测直到超时 @@ -215,7 +253,7 @@ } } - // 检查失败关键词--待写 + // 检查失败关键词-- for (let keyword of failureKeywords) { if (text2.includes(keyword)) { log.warn("检测到战斗失败关键词: {0}", keyword); @@ -238,7 +276,70 @@ } })(); }); - } + } + + + + // 领取奖励更换 + async function selectionHolyRelics() { + + let artifactImagePath = artifactImageMap[Artifacts]; + // 检查artifactImagePath是否存在 + if (!artifactImagePath) { + throw new Error(`未找到与Artifacts值'${Artifacts}'对应的图片路径`); + } + let modifiedPath = artifactImagePath.slice(0, -4); + let newImagePath = modifiedPath + "in.bmp"; + + await sleep(500); + await click(116,980) // 领取奖励切换按钮 + await sleep(100); + await click(116,980) // 领取奖励切换按钮 + await sleep(100); + + let rewardSettings = await Textocr("奖励设置",15,0,0,882,34,161,52);//这个时候有人申请进入世界会遮住,真是尴尬啊,不过不影响大局。 + if (!rewardSettings.found) {await genshin.returnMainUi();return false;} + await click(1642,159); + await sleep(100); + await click(1642,159); + await sleep(100); + + let YOffset = 0; // Y轴偏移量,根据需要调整 + + //滚轮预操作 + await moveMouseTo(1642,159); + await sleep(100); + await leftButtonDown(); + await sleep(100); + await moveMouseTo(1642,155); + + const maxRetries = 15; // 最大重试次数 + let retries = 0; // 当前重试次数 + while (retries < maxRetries) { + let result1 = await imageRecognition(newImagePath, 1, 0, 0,1178,148,87,857);// + if (result1.found) { + await leftButtonUp(); + await sleep(500); + await click(result.x-200,result.y); + await sleep(1000); + await keyPress("VK_ESCAPE"); + return true + } + retries++; // 重试次数加1 + //滚轮操作 + YOffset += 200; + if (retries === maxRetries || retries+YOffset > 1920) { + await leftButtonUp(); + await sleep(100); + await keyPress("VK_ESCAPE"); + await genshin.returnMainUi(); + return false;} + await moveMouseTo(1642,155+YOffset); + await sleep(500); + } + + return true; + } async function claimRewards() { log.info(`尝试领取奖励,优先${onerewards}'`); @@ -318,11 +419,11 @@ } var resinAgain = false; - log.warn("使用前请在 <<幽境危战>> 中配置好战斗队伍..."); - log.warn("使用前请在 <<幽境危战>> 中配置指定 <<奖励设置>>..."); log.warn("根目录下有建议加的黑名单的名称,建议加入自动拾取黑名单..."); log.warn("请保证队伍战斗实力,目前战斗失败会自动退出秘境..."); - log.warn("最好关闭自动拾取功能..."); + log.warn("使用前请在 <<幽境危战>> 中配置好战斗队伍..."); + log.warn("最好关闭自动拾取功能..."); + log.info(`圣遗物奖励选择:'${Artifacts}'`); // for (let j = 0;j < 2;j++) { @@ -331,25 +432,46 @@ await VeinEntrance(); try{ - //进入 + // 进入-选择难道 let intoAction = await Textocr("单人挑战",10,0,0,1554,970,360, 105); if (!intoAction.found) {await genshin.returnMainUi();throw new Error("未进入挑战页面,停止执行...")} let adjustmentType = await Textocr("常规挑战", 2, 0, 0,797,144,223,84); if (!adjustmentType.found) { - await click(890,191) - await sleep(1000); - await click(1096,186); - await sleep(1000); - await click(1093,399); - await sleep(1000); + log.warn("未找到常规挑战,尝试切换...") + await sleep(500); + await click(890,191) } - await sleep(1000); + let hardMode = await Textocr("困难", 2, 0, 0,1049,157,72,47); + if (!hardMode.found) { + log.warn("未找到困难模式,尝试切换...") + await sleep(500); + await click(1096,186); + await sleep(500); + await click(1093,399); + } + + //圣遗物奖励选择 + + if (Artifacts != "保持圣遗物奖励不变"){ + let artifact = await imageRecognition(artifactImageMap[Artifacts],0.2,0,0,186,972,71,71); + if (!artifact.found) { + log.warn("圣遗物奖励和设定不一致,尝试切换...") + if (!await selectionHolyRelics()) {throw new Error("圣遗物奖励设置错误,停止执行...")} + } + else + { + log.warn("圣遗物奖励一致,无需切换...") + } + } + + //多点击一次,保证进入挑战页面 + await sleep(500); await click(intoAction.x,intoAction.y) await sleep(1000); await click(intoAction.x,intoAction.y) //进入秘境 - let enter = await Textocr("Enter",5,0,0,18,990,156,80); + let enter = await Textocr("Enter",10,0,0,18,990,156,71,71); if (!enter.found) {await genshin.returnMainUi();throw new Error("未进入秘境,停止执行...")}//退出待写 //向前走进入挑战 @@ -371,8 +493,12 @@ await click(227,713); break; default: - throw new Error("未知的挑战怪兽类型"); + throw new Error("未知的挑战Boss类型"); } + + //选择队员-苏婷老师-待写 + // log.warn("队伍选择功能等伟大的苏苏老师考完试做...") + await Textocr("开始挑战",1,1,0,1554,970,360, 105); var resinexhaustion = false; // 条件1:树脂耗尽 @@ -473,6 +599,7 @@ catch (error) { log.error(`执行过程中发生错误:${error.message}`); }finally{ + await genshin.returnMainUi(); log.info(`Auto自动幽境危战结束...`); } // } diff --git a/repo/js/AutoStygianOnslaught/manifest.json b/repo/js/AutoStygianOnslaught/manifest.json new file mode 100644 index 00000000..565ac65d --- /dev/null +++ b/repo/js/AutoStygianOnslaught/manifest.json @@ -0,0 +1,15 @@ +{ + "manifest_version": 1, + "name": "自动幽境危战", + "version": "1.2", + "tags": ["幽境危战"], + "bgi_version": "0.44.8", + "description": "请先配置好秘境内的队伍,幽境危战战斗失败会导致卡死,请保证队伍实力,先配置好秘境内的队伍", + "authors": [ + { + "name": "LCB-茶包" + } + ], + "settings_ui": "settings.json", + "main": "main.js" +} diff --git a/repo/js/AutoStygianOnslaught/settings.json b/repo/js/AutoStygianOnslaught/settings.json new file mode 100644 index 00000000..9f101d5f --- /dev/null +++ b/repo/js/AutoStygianOnslaught/settings.json @@ -0,0 +1,58 @@ +[ +{ + "name": "Artifacts", + "type": "select", + "label": "圣遗物奖励,默认不修改圣遗物奖励", + "options": [ + "保持圣遗物奖励不变", + "长夜之誓 / 深廊终曲", + "黑曜秘典 / 烬城勇者绘卷", + "谐律异想断章 / 未竟的遐思" , + "回声之林夜话 / 昔时之歌" , + "逐影猎人 / 黄金剧团" , + "水仙之梦 / 花海甘露之光" , + "乐园遗落之花 / 沙上楼阁史话" , + "深林的记忆 / 饰金之梦" , + "来歆余响 / 辰砂往生录" , + "华馆梦醒形骸记 / 海染砗磲" , + "绝缘之旗印 / 追忆之注连" , + "昔日宗室之仪 / 染血的骑士道" , + "渡过烈火的贤人 / 炽烈的炎之魔女" , + "悠古的磐岩 / 逆飞的流星", + "千岩牢固 / 苍白之火" , + "冰风迷途的勇士 / 沉沦之心" , + "翠绿之影 / 被怜爱的少女" , + "如雷的盛怒 / 平息鸣雷的尊者" + ] +}, + { + "name": "challengeName", + "type": "select", + "label": "必填:请选择第几个Boss挑战关卡", + "options": [ + "1", + "2", + "3" + ] + }, + { + "name": "challengeNum", + "type": "input-text", + "label": "挑战次数,默认15次,期间树脂耗尽会自动结束" + }, +{ + "name": "Rewardsuse", + "type": "input-text", + "label": "树脂顺序,1=浓缩树脂/2=原粹树脂/3=脆弱树脂/4=须臾树脂\n用`/`隔开,填写对应的树脂数字即可,默认:1/2\n表示先使用浓缩树脂,再使用原粹树脂,不填的不使用" +}, + { + "name": "Fighttimeout", + "type": "input-text", + "label": "最长战斗超时时间,单位秒,默认240秒" + }, + { + "name": "Startforward", + "type": "input-text", + "label": "开始战斗后,向前移动的时间,默认1秒(注意单位:秒)" + } +] diff --git a/repo/js/Auto自动幽境危战/建议加入自动拾取黑名单.txt b/repo/js/AutoStygianOnslaught/建议加入自动拾取黑名单.txt similarity index 100% rename from repo/js/Auto自动幽境危战/建议加入自动拾取黑名单.txt rename to repo/js/AutoStygianOnslaught/建议加入自动拾取黑名单.txt diff --git a/repo/js/Auto自动幽境危战/AAA 幽境危战注意事项.txt b/repo/js/Auto自动幽境危战/AAA 幽境危战注意事项.txt deleted file mode 100644 index ec5972c8..00000000 --- a/repo/js/Auto自动幽境危战/AAA 幽境危战注意事项.txt +++ /dev/null @@ -1,18 +0,0 @@ -零、前言 -测试中,注意事项不完善请谅解,如有BUG,QQ:119996800,随时欢迎反馈。 -本脚本基于地脉花和首领一条龙脚本改造。 -脚本仅供娱乐,下载后24小时内删除。 - -一、省流注意事项: -log.warn("使用前请在 <<幽境危战>> 中配置好战斗队伍..."); -log.warn("使用前请在 <<幽境危战>> 中配置指定 <<奖励设置>>..."); -log.warn("根目录下有建议加的黑名单的名称,建议加入自动拾取黑名单..."); -log.warn("请保证队伍战斗实力,目前战斗失败会自动退出秘境..."); -log.warn("最好关闭自动拾取功能..."); - -二、配置简介: -1. - - -三、更新说明: -v.1.0版本:20250627 diff --git a/repo/js/Auto自动幽境危战/manifest.json b/repo/js/Auto自动幽境危战/manifest.json deleted file mode 100644 index d64b8f84..00000000 --- a/repo/js/Auto自动幽境危战/manifest.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "manifest_version": 1, - "name": "幽境危战-请先配置好秘境内的队伍和奖励", - "version": "1.1", - "description": "幽境危战战斗失败会导致卡死,请保证队伍实力,先配置好秘境内的队伍和奖励", - "authors": [ - { - "name": "LCB-茶包" - } - ], - "settings_ui": "settings.json", - "main": "main.js" -} diff --git a/repo/js/Auto自动幽境危战/settings.json b/repo/js/Auto自动幽境危战/settings.json deleted file mode 100644 index faf90a4d..00000000 --- a/repo/js/Auto自动幽境危战/settings.json +++ /dev/null @@ -1,32 +0,0 @@ -[ - { - "name": "challengeName", - "type": "select", - "label": "必填:请选择第几个Boss挑战关卡", - "options": [ - "1", - "2", - "3" - ] - }, - { - "name": "challengeNum", - "type": "input-text", - "label": "挑战次数,默认15次,期间树脂耗尽会自动结束" - }, -{ - "name": "Rewardsuse", - "type": "input-text", - "label": "树脂顺序,1=浓缩树脂/2=原粹树脂/3=脆弱树脂/4=须臾树脂\n用`/`隔开,填写对应的树脂数字即可,默认:1/2\n表示先使用浓缩树脂,再使用原粹树脂,不填的不使用" -}, - { - "name": "Fighttimeout", - "type": "input-text", - "label": "最长战斗超时时间,单位秒,默认240秒" - }, - { - "name": "Startforward", - "type": "input-text", - "label": "开始战斗后,向前移动的时间,默认1秒(注意单位:秒)" - } -]