diff --git a/repo/js/AutoFontaineLeyLine/README.md b/repo/js/AutoFontaineLeyLine/README.md index d743609ff..4b8340d08 100644 --- a/repo/js/AutoFontaineLeyLine/README.md +++ b/repo/js/AutoFontaineLeyLine/README.md @@ -23,9 +23,21 @@ 6. **直跑模式**:当打完一个地脉花后,如下一个地脉花比较近,直接跑过去而不是重新传送。 +7. **异步检测战斗**:默认打开,请把配置组中的“更快检测结束战斗”和“旋转寻找敌人”关掉,否则可能会出错。 + ## 三、更新说明 +### v.3.9版本:20250910 + +- **新功能**: +1、添加原石购买体力功能,在设定的树脂使用完的前提下,如设定次数大于0,会继续使用原石购买体力领取奖励。 + +- **优化**: +1. 适配6.0领取界面。 +2. 优化开书找地脉花的时序,添加确认大地图打开后才进行寻找。 +3. 优化树脂识别正确性。 + ### v.3.8版本:20250830 - **新功能**: diff --git a/repo/js/AutoFontaineLeyLine/assets/model/cilun.bmp b/repo/js/AutoFontaineLeyLine/assets/model/cilun.bmp new file mode 100644 index 000000000..6460289af Binary files /dev/null and b/repo/js/AutoFontaineLeyLine/assets/model/cilun.bmp differ diff --git a/repo/js/AutoFontaineLeyLine/assets/model/five.png b/repo/js/AutoFontaineLeyLine/assets/model/five.png index 551f41567..d5fea0cad 100644 Binary files a/repo/js/AutoFontaineLeyLine/assets/model/five.png and b/repo/js/AutoFontaineLeyLine/assets/model/five.png differ diff --git a/repo/js/AutoFontaineLeyLine/assets/model/four.png b/repo/js/AutoFontaineLeyLine/assets/model/four.png index ac4e17f3d..a83e9a0ae 100644 Binary files a/repo/js/AutoFontaineLeyLine/assets/model/four.png and b/repo/js/AutoFontaineLeyLine/assets/model/four.png differ diff --git a/repo/js/AutoFontaineLeyLine/assets/model/one.png b/repo/js/AutoFontaineLeyLine/assets/model/one.png index 14d143cea..da41773c2 100644 Binary files a/repo/js/AutoFontaineLeyLine/assets/model/one.png and b/repo/js/AutoFontaineLeyLine/assets/model/one.png differ diff --git a/repo/js/AutoFontaineLeyLine/assets/model/three.png b/repo/js/AutoFontaineLeyLine/assets/model/three.png index 869e2f674..140b9c63b 100644 Binary files a/repo/js/AutoFontaineLeyLine/assets/model/three.png and b/repo/js/AutoFontaineLeyLine/assets/model/three.png differ diff --git a/repo/js/AutoFontaineLeyLine/assets/model/two.png b/repo/js/AutoFontaineLeyLine/assets/model/two.png index e7f8c3065..efbef9fb4 100644 Binary files a/repo/js/AutoFontaineLeyLine/assets/model/two.png and b/repo/js/AutoFontaineLeyLine/assets/model/two.png differ diff --git a/repo/js/AutoFontaineLeyLine/assets/model/zero.png b/repo/js/AutoFontaineLeyLine/assets/model/zero.png new file mode 100644 index 000000000..790d193bb Binary files /dev/null and b/repo/js/AutoFontaineLeyLine/assets/model/zero.png differ diff --git a/repo/js/AutoFontaineLeyLine/main.js b/repo/js/AutoFontaineLeyLine/main.js index 42034de90..86bb600c3 100644 --- a/repo/js/AutoFontaineLeyLine/main.js +++ b/repo/js/AutoFontaineLeyLine/main.js @@ -6,14 +6,16 @@ async function imageRecognition(imagefilePath="空参数",timeout=10,afterBehavior=0,debugmodel=0,xa=0,ya=0,wa=1920,ha=1080,tt=0.8) { // if (xa+wa > 1920 || ya+ha > 1080){ log.info("图片区域超出屏幕范围");return} const startTime = new Date(); - // const recognitionObject = new RecognitionObject(); - // recognitionObject.UseMask = false; // 设置 UseMask 为 true - // 下个版本BGI才支持带UseMask的构造函数RecognitionObject.RegionOfInterest = new Rect(xa, ya, wa, ha); + // 支持带UseMask的构造函数 const Imagidentify = RecognitionObject.TemplateMatch(file.ReadImageMatSync(imagefilePath),true); if (tt !== 0.8){ Imagidentify.Threshold=tt; Imagidentify.InitTemplate(); } + + // Imagidentify.Name = "测试"; + // Imagidentify.DrawOnWindow=true; + // Imagidentify.InitTemplate(); for (let ii = 0; ii < 10; ii++) { captureRegion = captureGameRegion(); // 获取一张截图 @@ -117,26 +119,44 @@ const ocrRegion3 = { x: 906, y: 928, width: 161, height: 100 }; // 下方区域 const ocrRo3 = RecognitionObject.ocr(ocrRegion3.x, ocrRegion3.y, ocrRegion3.width, ocrRegion3.height); var method= settings.method ? settings.method : "冒险之证"; - var Rewardsuse = settings.Rewardsuse ? settings.Rewardsuse : "1/2"; + var Rewardsuse = settings.Rewardsuse ? settings.Rewardsuse : "1/2/5"; var resinTypes = Rewardsuse.split("/"); var rewards = []; - var onerewards, secendrewards, threendrewards, fourdrewards; + var reBigMap = false;//大地图缩放标志 + var onerewards, secendrewards, threendrewards, fourdrewards,fiverewards; for (var i = 0; i < resinTypes.length; i++) { var resinType = parseInt(resinTypes[i]); - if (isNaN(resinType) || resinType < 1 || resinType > 4) { + if (isNaN(resinType) || resinType < 1 || resinType > 5) { throw new Error("设定的树脂类型无效或缺失,请重新配置"); } rewards.push(resinType); } - const resinTypeMap = ["","使用1个浓缩树脂,获取2倍产出", "使用20个原粹树脂", "使用1个脆弱树脂,获取3倍产出", "使用1个须臾树脂,获取3倍产出"]; + const resinTypeMap = ["","使用1个浓缩树脂,获取3次产出", "使用40个原粹树脂,获取2次产出", "使用1个脆弱树脂,获取3次产出", "使用1个须臾树脂,获取3次产出","使用20个原粹树脂"]; + const resinTypeMap2 = ["使用50原石,获取3次产出", "使用100原石,获取3次产出", "使用150原石,获取3次产出", "使用200原石,获取3次产出"]; + //原石使用 + var primogemUseCount = settings.primogemUseCount ? settings.primogemUseCount : 0; + if (primogemUseCount === undefined || primogemUseCount === null) { + throw new Error("原石使用 参数无效,请设置0到6之间的整数值"); + } + primogemUseCount = parseInt(primogemUseCount); + if (isNaN(primogemUseCount) || !Number.isInteger(primogemUseCount) || primogemUseCount < 0 || primogemUseCount > 6) { + throw new Error("原石使用 数量设置无效,请设置0到6之间的整数值"); + } + primogemUseCount = (isNaN(primogemUseCount)) ? 0 : primogemUseCount; + var primogemUseDone = 0; + var resinDone = false; + const golbalRewards = ["","浓缩树脂","原粹树脂","脆弱树脂","须臾树脂"]; // 对应四种树脂 // 根据 rewards 数组长度,依次赋值给对应的变量 if (rewards.length > 0) onerewards = golbalRewards[rewards[0]]; if (rewards.length > 1) secendrewards = golbalRewards[rewards[1]]; if (rewards.length > 2) threendrewards = golbalRewards[rewards[2]]; if (rewards.length > 3) fourdrewards = golbalRewards[rewards[3]]; - const golbalRewardText = [onerewards, secendrewards, threendrewards, fourdrewards].filter(Boolean);//过滤树脂使用类型 + if (rewards.length > 4) fiverewards = golbalRewards[rewards[4]]; + const golbalRewardText = [onerewards, secendrewards, threendrewards, fourdrewards,fiverewards].filter(Boolean);//过滤树脂使用类型 + if(primogemUseCount>0){golbalRewardText.push("原石")} + // 根据 rewards 数组长度,依次赋值给对应的变量 var doneCount = 0; @@ -168,7 +188,7 @@ : 0.8; log.warn(`屏幕分辨率${genshin.width},识别阈值调整为${Threshold}...`); - log.warn(`全自动枫丹地脉花: v3.8 - ${SHUV}.${color}.${rawTimes}`);//调试LOG + log.warn(`全自动枫丹地脉花: v3.9 - ${SHUV}.${color}.${rawTimes}`);//调试LOG log.warn(`使用树脂类型数量:${rewards.length}`); log.warn(`使用树脂顺序:${golbalRewardText.join(" ->")}`); @@ -181,8 +201,10 @@ var originalResin = "assets/model/original_resin_count.png"; var fragileResin = "assets/model/fragile_resin_count.png"; var momentResin = "assets/model/moment_resin_count.png"; + var cilun = "assets/model/cilun.bmp"; var resinImages = [ + "assets/model/zero.png", "assets/model/one.png", "assets/model/two.png", "assets/model/three.png", @@ -193,6 +215,7 @@ if (Rewards){log.warn("结束后领励练点和提交每日...");if(settings.nh === undefined || settings.nh === "") {log.warn("好感队未配置,领奖励时不切换队伍..")}} if (SHUV == 1) {log.warn(`线路模式 : <<按次数刷取>> ${timesConfig.value/2} 次 `);}else{log.warn("线路模式 : 设定使用的树脂类型<<耗尽模式>>(最多99次)");timesConfig.value = 198;} if (color == 1) {log.warn("地脉类型 : <<蓝色-经验花>>...");}else{log.warn("地脉类型 : <<黄色-摩拉花>>...")} + if (primogemUseCount>0)log.warn("{t}设置了 {d} 使用次数:{1} !!","请注意!!","原石",primogemUseCount); if (settings.n === undefined || settings.n === "") { log.warn("队伍名称未配置,不更换队伍...");SHUOVER=1;} if (settings.nh === undefined || settings.nh === "") { log.warn("好感队禁用...");haoganq=0}else{var haogandui = settings.nh;haoganq=1;if(settings.n === undefined ) {throw new Error("好感队已经设置,请填战斗队伍...")}} let nowuidString = settings.nowuid ? settings.nowuid : ""; @@ -349,9 +372,8 @@ async function PathCheak0() { - repeatRoute = false; + repeatRoute = false; var bigMapPosition={x:0,y:0}; - await genshin.returnMainUi(); log.info("重置地图中,打开冒险之证寻找地脉花..."); await genshin.tp(2297.60, -824.45); @@ -453,17 +475,31 @@ } } - try{ - bigMapPosition = genshin.getPositionFromBigMap(); - if (bigMapPosition.x >= 2900 && bigMapPosition.y <= 5100 ){ - log.info("区域正确..."); - break; - }else{ - log.info("区域错误..."); + try{ + let cilun2 = await imageRecognition(cilun,3,0,0,13,971,85,78); + if (!cilun2.found){ + log.info("大地图打开错误..."); } + else{ + await sleep(500); + if (reBigMap){ + await genshin.setBigMapZoomLevel(2.5); + await sleep(1000); + } + bigMapPosition = genshin.getPositionFromBigMap(); + if (bigMapPosition.x >= 2900 && bigMapPosition.y <= 5100 ){ + log.info("区域正确..."); + break; + }else{ + log.info("区域错误..."); + } + } } catch(error){ log.info("冒险之证打开错误G...", error); + reBigMap = true; + await genshin.returnMainUi(); + await sleep(1100); continue; } } @@ -495,7 +531,7 @@ else{ return false } - } + } // 输出选择的线路 async function PathCheak1() { @@ -797,20 +833,38 @@ } await sleep(500); + //确保转换按键,根据数字2和5的顺序,判断是否要点 + if(doneCount == 0){ + let index2 = resinTypes.indexOf("2"); + let index5 = resinTypes.indexOf("5"); + + if (index2 !== -1 && (index5 === -1 || index2 < index5)) { + let SHU = await Textocr(resinTypeMap[5], 0.1, 0, 0, 510, 380, 640, 600); + if (SHU.found) { + await click(SHU.x + 480, SHU.y + 15); + } + }else{ + let SHU = await Textocr(resinTypeMap[2], 0.1, 0, 0, 510, 380, 640, 600); + if (SHU.found) { + await click(SHU.x + 480, SHU.y + 15); + } + } + } for (let j = 0;j < 2;j++) { - for (let i = 0;i < rewards.length;i++) { + for (let i = 0;i < rewards.length && !resinDone;i++) { let SHU = await Textocr(resinTypeMap[rewards[i]],0.1,0,0,510,380,640,600); if (SHU.found){ - if (resinTypeMap[rewards[i]] == "使用20个原粹树脂") - { - let BUC = await Textocr("补充",0.1,0,0,1150,440,210,130); + if (resinTypeMap[rewards[i]] == "使用20个原粹树脂" || resinTypeMap[rewards[i]] == "使用40个原粹树脂,获取2次产出") + { + let BUC = await Textocr("补充",0.1,0,0,1150,440,210,130); if (BUC.found) {continue;} } await sleep(1000); + let shouldExit = true; let { condensedResinCount, originalResinCount, fragileResinCount, momentResinCount } = await getRemainResinStatus(); switch (rewards[i]) { @@ -826,9 +880,7 @@ case 4: momentResinCount--; break; - } - - let shouldExit = true; + } if (resinTypes.includes("1")) { @@ -848,25 +900,64 @@ } log.info(`${resinTypeMap[rewards[i]]} ...`); - let dimai2 = await Textocr("地脉之花", 1, 0, 0, 840,225, 230, 125); - if (!dimai2.found) { await keyPress("F");await sleep(700);await keyPress("F");await sleep(700);await keyPress("F") ; } + let dimai2 = await Textocr("地脉之花",1, 0, 0, 840,225, 230, 125); + if (!dimai2.found) { await keyPress("F");await sleep(700);await keyPress("F");await sleep(700);await keyPress("F") ; } await click(SHU.x+550,SHU.y) await click(SHU.x+550,SHU.y) if (shouldExit) { - log.warn("树脂耗尽,停止执行..."); - await sleep(1000); - SHUOVER=2; - return false; + if(primogemUseCount <= 0){ + log.warn("树脂耗尽,停止执行..."); + await sleep(1000); + SHUOVER=2; + return false; + } + else{ + log.warn("树脂耗尽,后续尝试使用原石 {0} 次...", primogemUseCount); + resinDone = true; + } } return true; } - } - await sleep(500); + } } - log.warn("未找到树脂,结束地脉花..."); + + resinDone = true; + if(primogemUseCount > 0 && resinDone){ + + log.warn("树脂耗尽,尝试使用原石 {0}/{1} ...", primogemUseDone+1, primogemUseCount); + + for (let k = 0; k < resinTypeMap2.length; k++) { + let SHU = await Textocr(resinTypeMap2[k],0.1,0,0,510,380,640,600); + if (SHU.found){ + log.warn("{t}","原石使用啦!!!!!!!!!..."); + await click(SHU.x+550,SHU.y) + + let dimai2 = await Textocr("确认",0.5, 0, 0, 960,720, 400, 80); + if (dimai2.found) { + await click(865,630)//不再提示 + await sleep(1000); + // await moveMouseTo(dimai2.x,dimai2.y+10); + await click(dimai2.x,dimai2.y+10) + } + + primogemUseDone ++; + primogemUseCount--; + if (primogemUseCount <= 0) { + log.warn("原石使用次数耗尽,停止执行..."); + break; + } + return true; + }else{ + log.warn("未找到原石使用选项,停止执行..."); + break; + } + } + } + + log.warn("结束全自动枫丹地脉花..."); await sleep(1000); await keyPress("VK_ESCAPE"); await sleep(1000); @@ -885,9 +976,9 @@ if (condensedResinCountRa.found) { for (let i = 0; i < resinImages.length; i++) { if(i==0){await sleep(1000);} - let countArea = await imageRecognition(resinImages[i],0.2, 0, 0,condensedResinCountRa.x+condensedResinCountRa.w*0.9,condensedResinCountRa.y,condensedResinCountRa.w*2,condensedResinCountRa.h,Threshold); + let countArea = await imageRecognition(resinImages[i],0.1, 0, 0,condensedResinCountRa.x+condensedResinCountRa.w,condensedResinCountRa.y,condensedResinCountRa.w*2,condensedResinCountRa.h,Threshold); if (countArea.found){ - condensedResinCount =i+1; + condensedResinCount =i; break; } if (i==4){log.info("未检测到浓缩数量,强制为1"); condensedResinCount=1;} @@ -897,7 +988,8 @@ log.info("未检测到浓缩树脂图标"); } - var originalResinCountRa = await imageRecognition(originalResin,0.1, 0, 0,1555,0,100,100,Threshold); + //脆弱树脂 + var originalResinCountRa = await imageRecognition(originalResin,0.1, 0, 0,1325,0,100,500,Threshold); if (originalResinCountRa.found) { // await moveMouseTo(originalResinCountRa.x,originalResinCountRa.y); let countArea = await Textocr("",0.5, 0, 2,originalResinCountRa.x+originalResinCountRa.w,originalResinCountRa.y,originalResinCountRa.w*3,originalResinCountRa.h,Threshold);// @@ -922,16 +1014,17 @@ log.info("未检测到原粹树脂图标"); } - var momentResinCountRa = await imageRecognition(momentResin,0.2, 0, 1,1170,0,500,100,0.7,Threshold); + // 须臾树脂 + var momentResinCountRa = await imageRecognition(momentResin,0.1, 0, 1,960,0,500,100,Threshold); if (momentResinCountRa.found) { for (let i = 0; i < resinImages.length; i++) { - let countArea = await imageRecognition(resinImages[i],0.2, 0, 0,momentResinCountRa.x+momentResinCountRa.w,momentResinCountRa.y,momentResinCountRa.w*2,momentResinCountRa.h,Threshold); + let countArea = await imageRecognition(resinImages[i],0.1, 0, 0,momentResinCountRa.x+momentResinCountRa.w,momentResinCountRa.y,momentResinCountRa.w*2,momentResinCountRa.h,Threshold); if (countArea.found){ - momentResinCount =i+1; + momentResinCount =i; break; } - if (i==4){log.info("未检测到须臾图标,强制为1"); momentResinCount=1;} + if (i==4){log.info("未检测到须臾数量,强制为1"); momentResinCount=1;} } fragileResinCount = "1"; @@ -941,10 +1034,12 @@ { log.info("未检测到须臾树脂图标"); - var fragileResinCountRa = await imageRecognition(fragileResin,0.1, 0, 1,1170,0,300,100,Threshold); + // 脆弱树脂 + var fragileResinCountRa = await imageRecognition(fragileResin,0.1, 0, 1,960,0,500,100,Threshold); if (fragileResinCountRa.found) { - // await moveMouseTo(fragileResinCountRa.x+fragileResinCountRa.w+20,fragileResinCountRa.y-15); - let countArea = await Textocr("",0.5, 0, 2,fragileResinCountRa.x+fragileResinCountRa.w,fragileResinCountRa.y,fragileResinCountRa.w*2,fragileResinCountRa.h,Threshold);// + // await moveMouseTo(fragileResinCountRa.x+fragileResinCountRa.w+20,fragileResinCountRa.y-15); + + let countArea = await Textocr("",0.1, 0, 2,fragileResinCountRa.x+fragileResinCountRa.w,fragileResinCountRa.y,fragileResinCountRa.w*2,fragileResinCountRa.h,Threshold);// if (countArea.found){ // log.info("脆弱树脂识别数量结果:"+ countArea.text); fragileResinCount = countArea.text @@ -1323,12 +1418,11 @@ return isUpdated; } - // // 树脂测试 + // //测试 // while (true) { - // await getRemainResinStatus(); + // await getRemainResinStatus(); // await sleep(500); // } - // return; // UID获取存在概率不成功,慎用!请更换背景纯色的名片提高OCR成功率 diff --git a/repo/js/AutoFontaineLeyLine/manifest.json b/repo/js/AutoFontaineLeyLine/manifest.json index a15f23a54..e82bb84aa 100644 --- a/repo/js/AutoFontaineLeyLine/manifest.json +++ b/repo/js/AutoFontaineLeyLine/manifest.json @@ -1,7 +1,7 @@ { "manifest_version": 1, "name": "全自动枫丹地脉花", - "version": "3.8", + "version": "3.9", "bgi_version": "0.47.1", "description": "枫丹地脉花,蓝花金花通用。生存压力大,请带盾奶;避免纯水输出,请注意说明文件。如有BUG请联系作者QQ:119996800", "tags": [ diff --git a/repo/js/AutoFontaineLeyLine/settings.json b/repo/js/AutoFontaineLeyLine/settings.json index 11f82426f..f6cb819a5 100644 --- a/repo/js/AutoFontaineLeyLine/settings.json +++ b/repo/js/AutoFontaineLeyLine/settings.json @@ -48,13 +48,28 @@ { "name": "Rewardsuse", "type": "input-text", - "label": "树脂设定:1=浓缩/2=原粹/3=脆弱/4=须臾\n用`/`隔开:填写对应的树脂<数字>即可\n默认:1/2 (表示先用浓缩后原粹,直至用完,不填的不使用)", - "default": "1/2" + "label": "树脂设定:1=浓缩/2=40原粹/3=脆弱/4=须臾/5=20原粹\n用`/`隔开:填写对应的树脂<数字>即可\n默认:1/2/5 (先用浓缩后原粹,直至用完,不填的不使用 ↓↓)", + "default": "1/2/5" + }, + { + "name": "primogemUseCount", + "type": "select", + "label": "原石购买体力次数(0~6次),上面设置的树脂用完后才会使用 ↓↓", + "options": [ + "0", + "1", + "2", + "3", + "4", + "5", + "6" + ], + "default": "0" }, { "name": "Fightquick", "type": "checkbox", - "label": "默认开启:异步检测战斗结束,即地脉花长出后马上停止战斗\n开启后,建议关闭配置组中的<自动检测战斗结束>选项\n不启用:使用传统<打开队伍界面>判断战斗结束 ↓↓", + "label": "默认开启:异步检测战斗结束,即地脉花长出后马上停止战斗\n开启后,请关闭配置组中的<自动检测战斗结束>选项\n不启用:使用传统<打开队伍界面>判断战斗结束 ↓↓", "default": "true" },