JS脚本:摧毁圣遗物换摩拉 图像识别改造;JS/地图追踪归档 (#641)

* JS/地图追踪归档

* JS脚本:摧毁圣遗物换摩拉 图像识别改造
This commit is contained in:
起个名字好难的喵
2025-04-25 00:46:06 +08:00
committed by GitHub
parent 6901e9f02f
commit 25397b45c8
43 changed files with 238 additions and 126 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

View File

@@ -0,0 +1,70 @@
const ArtifactsButtonRo = RecognitionObject.TemplateMatch(file.ReadImageMatSync("Assets/RecognitionObject/ArtifactsButton.png"));
const DeleteButtonRo = RecognitionObject.TemplateMatch(file.ReadImageMatSync("Assets/RecognitionObject/DeleteButton.png"));
const AutoAddButtonRo = RecognitionObject.TemplateMatch(file.ReadImageMatSync("Assets/RecognitionObject/AutoAddButton.png"));
const ConfirmButtonRo = RecognitionObject.TemplateMatch(file.ReadImageMatSync("Assets/RecognitionObject/ConfirmButton.png"));
const DestoryButtonRo = RecognitionObject.TemplateMatch(file.ReadImageMatSync("Assets/RecognitionObject/DestoryButton.png"));
/**
* @returns {Promise<void>}
*/
(async function() {
await genshin.returnMainUi();
keyPress("B");
await sleep(1500);
let ArtifactsButton = captureGameRegion().find(ArtifactsButtonRo);
if (ArtifactsButton.isExist()) {
log.info("识别到圣遗物按钮");
ArtifactsButton.click();
await sleep(1500);
}
//计算摧毁次数
if (settings.number > 21){
times = Math.ceil(settings.number/100)
} else if (settings.number <= 21){
times = settings.number
} else {
times = 1
}
try {
for (let i=0 ;i < times ; i++) {
captureGameRegion().find(DeleteButtonRo).click();// 点击摧毁
await sleep(600);
captureGameRegion().find(AutoAddButtonRo).click();// 点击自动添加
await sleep(600);
if (settings.oneStar) {
await sleep(300);
click(150,150);
}
if (settings.twoStar) {
await sleep(300);
click(150,220);
}
if (settings.threeStar) {
await sleep(300);
click(150,300);
}
if (settings.fourStar) {
await sleep(300);
click(150,370);
}
captureGameRegion().find(ConfirmButtonRo).click();// 点击快捷放入
await sleep(600);
captureGameRegion().find(DestoryButtonRo).click();// 点击摧毁
await sleep(600);
captureGameRegion().find(DestoryButtonRo).click();// 弹出页面点击摧毁
await sleep(600);
click(960, 1000);// 点击空白处
await sleep(1000);
}
} catch(ex) {
log.info("背包里的圣遗物已摧毁完毕,提前结束")
} finally {
await genshin.returnMainUi();
}
})();

View File

@@ -0,0 +1,15 @@
{
"manifest_version": 1,
"name": "摧毁圣遗物换摩拉",
"version": "1.0",
"bgiVersion": "0.44.6",
"description": "图像识别改造版",
"authors": [
{
"name": "起个名字好难的喵",
"links":"https://github.com/MisakaAldrich"
}
],
"main": "main.js",
"settings_ui": "settings.json"
}

View File

@@ -0,0 +1,27 @@
[
{
"name": "number",
"type": "input-text",
"label": "摧毁数量(百) 或 摧毁次数"
},
{
"name": "oneStar",
"type": "checkbox",
"label": "摧毁一星圣遗物"
},
{
"name": "twoStar",
"type": "checkbox",
"label": "摧毁二星圣遗物"
},
{
"name": "threeStar",
"type": "checkbox",
"label": "摧毁三星圣遗物"
},
{
"name": "fourStar",
"type": "checkbox",
"label": "摧毁四星圣遗物"
}
]