diff --git a/repo/js/首领讨伐一条龙/assets/RecognitionObject/ConfirmButton.png b/repo/js/首领讨伐一条龙/assets/RecognitionObject/ConfirmButton.png new file mode 100644 index 00000000..9186b5bc Binary files /dev/null and b/repo/js/首领讨伐一条龙/assets/RecognitionObject/ConfirmButton.png differ diff --git a/repo/js/首领讨伐一条龙/assets/RecognitionObject/FragileResin.png b/repo/js/首领讨伐一条龙/assets/RecognitionObject/FragileResin.png new file mode 100644 index 00000000..e2d7b736 Binary files /dev/null and b/repo/js/首领讨伐一条龙/assets/RecognitionObject/FragileResin.png differ diff --git a/repo/js/首领讨伐一条龙/assets/RecognitionObject/PlusButton.png b/repo/js/首领讨伐一条龙/assets/RecognitionObject/PlusButton.png new file mode 100644 index 00000000..1ca05aa5 Binary files /dev/null and b/repo/js/首领讨伐一条龙/assets/RecognitionObject/PlusButton.png differ diff --git a/repo/js/首领讨伐一条龙/assets/RecognitionObject/QuickUsePlusButton.png b/repo/js/首领讨伐一条龙/assets/RecognitionObject/QuickUsePlusButton.png new file mode 100644 index 00000000..0dcffc16 Binary files /dev/null and b/repo/js/首领讨伐一条龙/assets/RecognitionObject/QuickUsePlusButton.png differ diff --git a/repo/js/首领讨伐一条龙/main.js b/repo/js/首领讨伐一条龙/main.js index 7891a350..d2c4ce66 100644 --- a/repo/js/首领讨伐一条龙/main.js +++ b/repo/js/首领讨伐一条龙/main.js @@ -1,3 +1,12 @@ +const PlusButtonRo = RecognitionObject.TemplateMatch(file.ReadImageMatSync("Assets/RecognitionObject/PlusButton.png"), 1000, 0, 300, 100); +const FragileResinRo = RecognitionObject.TemplateMatch(file.ReadImageMatSync("Assets/RecognitionObject/FragileResin.png"), 800, 400, 200, 200); +const ConfirmButtonRo = RecognitionObject.TemplateMatch(file.ReadImageMatSync("Assets/RecognitionObject/ConfirmButton.png"), 900, 700, 200, 200); +const QuickUsePlusButtonRo = RecognitionObject.TemplateMatch(file.ReadImageMatSync("Assets/RecognitionObject/QuickUsePlusButton.png"), 1200, 600, 200, 100); + +/** + * @returns {Promise} + */ + (async function () { let challengeNum = settings.challengeNum ?? 1;//挑战次数 let challengeName = settings.challengeName ?? 0;//挑战首领名称 @@ -85,25 +94,37 @@ if (challengeName) { //使用树脂 if (resinNum) { - await genshin.returnMainUi(); - keyPress("M");//打开地图 - await sleep(1200); - click(2476 / 2, 96 / 2);// 点击添加体力 - await sleep(600); - click(1660 / 2, 950 / 2)// 选择脆弱树脂 - await sleep(600); - click(2350 / 2, 1550 / 2);// 点击使用 - await sleep(600); - for (let i = 1; i < resinNum; ++i) { - click(2586 / 2, 1296 / 2);// 点击使用数量 + try { + await genshin.returnMainUi(); + keyPress("M");//打开地图 + await sleep(1200); + captureGameRegion().find(PlusButtonRo).click();// 点击添加体力 await sleep(600); + captureGameRegion().find(FragileResinRo).click();// 选择脆弱树脂 + await sleep(600); + captureGameRegion().find(ConfirmButtonRo).click();// 点击使用 + await sleep(600); + + let QuickUsePlusButton = captureGameRegion().find(QuickUsePlusButtonRo); + if (isNaN(settings.resinNum) || settings.resinNum <= 0) { + number = 1 + } else { + for (let i = 1; i < settings.resinNum; ++i) { + QuickUsePlusButton.click();// 点击使用数量 + await sleep(300); + } + } + + captureGameRegion().find(ConfirmButtonRo).click();// 点击使用 + await sleep(600); + click(960, 1000);// 点击空白处 + await genshin.returnMainUi(); + } catch { + log.warn(`没有脆弱树脂了!!!`) + } finally { + await genshin.returnMainUi(); } } - click(2350 / 2, 1550 / 2);// 点击使用 - await sleep(600); - click(1920 / 2, 1500 / 2);// 点击空白处 - await sleep(600); - keyPress("VK_ESCAPE");//关闭地图 } if (samePlace == "YES") log.info(`已启用原地连续挑战模式`); log.info(`前往第1次恢复状态`);