归档一个千星奇域,调整一个千星奇域 (#2246)

This commit is contained in:
躁动的氨气
2025-10-26 15:11:24 +08:00
committed by GitHub
parent a419d85488
commit 42c01336a8
15 changed files with 13 additions and 132 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

View File

@@ -1,86 +0,0 @@
// 主逻辑
let content = settings.content || "7108700065";
let maxAttempts = (+settings.maxAttempts) || 15;
let delay = (+settings.delay) || 250;
let attempts = 0;
let entered = false;
(async function () {
//循环指定次数
while (attempts < maxAttempts) {
await genshin.returnMainUi();
attempts++;
log.info(`开始第${attempts}次循环`);
await sleep(2000);
keyPress("F6");
await sleep(250);
if (!await ClickPNG("全部奇域")) {
await sleep(250);
await genshin.returnMainUi();
keyPress("F6");
if (!await ClickPNG("全部奇域")) {
continue;
}
}
await sleep(250);
if (!await ClickPNG("搜索奇域")) continue;
await sleep(250);
log.info(`搜索${content}`);
await sleep(1000);
inputText(content);
await sleep(500);
if (!await ClickPNG("搜索")) continue;
await sleep(250);
const result = await ClickPNG("进入");
await sleep(250);
//log.info(`结果是${result}`);
if (!result) {
log.warn("未找到标识,尝试点击固定位置");
click(400, 300);
}
await sleep(250);
if (!entered) {
entered = await ClickPNG("前往大厅");
if (!await ClickPNG("开始游戏", 600)) {
continue;
} else {
entered = true;
}
} else {
await sleep(250);
await ClickPNG("开始游戏")
}
await sleep(250);
if (!await ClickPNG("返回大厅", 600)) continue;
await sleep(250);
}
if (settings.returnGenshin) {
log.info("勾选了返回提瓦特,开始返回");
await genshin.returnMainUi();
await sleep(1000);
keyPress("F2");
await ClickPNG("返回提瓦特");
await ClickPNG("确认返回");
}
})();
async function ClickPNG(png, maxAttempts = 40) {
log.info(`尝试找到并点击${png},等待至多${maxAttempts * 50}毫秒`);
moveMouseTo(1920, 1080);
const pngRo = RecognitionObject.TemplateMatch(file.ReadImageMatSync(`assets/RecognitionObject/${png}.png`));
pngRo.Threshold = 0.95;
pngRo.InitTemplate();
return await findAndClick(pngRo, maxAttempts);
}
async function findAndClick(target, maxAttempts = 5) {
for (let i = 0; i < maxAttempts; i++) {
const rg = captureGameRegion();
try {
const res = rg.find(target);
if (res.isExist()) { await sleep(delay); res.click(); return true; }
} finally { rg.dispose(); }
if (i < maxAttempts - 1) await sleep(50);
}
return false;
}

View File

@@ -1,16 +0,0 @@
{
"manifest_version": 1,
"name": "千星奇域循环",
"version": "1.0",
"description": "重复进入指定千星奇域关卡并循环一定次数",
"authors": [
{
"name": "mno"
}
],
"tags": [
"千星奇域"
],
"settings_ui": "settings.json",
"main": "main.js"
}

View File

@@ -1,25 +0,0 @@
[
{
"name": "content",
"type": "input-text",
"label": "输入搜索内容名称或GUID"
},
{
"name": "maxAttempts",
"type": "input-text",
"label": "循环次数",
"default": 15
},
{
"name": "returnGenshin",
"type": "checkbox",
"label": "结束后是否返回提瓦特",
"default": true
},
{
"name": "delay",
"type": "input-text",
"label": "按键延迟(毫秒),观察到卡住时适当调大",
"default": 250
}
]

View File

@@ -275,6 +275,7 @@ var enterRoom = async (room) => {
await createRoom(room);
};
var startGame = async () => {
let outputCount = 0;
await assertRegionAppearing(
() => findBottomButton("大厅", true),
"等待游戏结束超时",
@@ -287,7 +288,10 @@ var startGame = async () => {
await assertRegionDisappearing(prepare, "等待加入准备区提示消失超时");
click(770, 275);
} else {
log.info("等待本次关卡结束...");
if (outputCount % 7 === 0 ) {
log.info("等待本次关卡结束...");
}
outputCount++;
}
},
{ maxAttempts: 120 }
@@ -301,7 +305,7 @@ var startGame = async () => {
setGameMetrics(1920, 1080, 1.5);
await genshin.returnMainUi();
const goToTeyvat = settings.goToTeyvat ?? true;
const room = settings.room || "7015200164";
const room = settings.room || "7070702264";
const force = settings.force ?? false;
const thisAttempts = Math.max(0, Number(settings.thisAttempts || "0"));
const expWeeklyLimit = Math.max(1, Number(settings.expWeeklyLimit || "5000"));

View File

@@ -1,13 +1,17 @@
{
"manifest_version": 1,
"name": "千星奇域每周刷取经验值",
"version": "0.1.2",
"bgi_version": "0.48.0",
"version": "0.1.3",
"bgi_version": "0.52.0",
"description": "千星奇域每周刷取经验值",
"authors": [
{
"name": "breadgrocery",
"link": "https://github.com/breadgrocery"
},
{
"name": "躁动的氨气",
"link": "https://github.com/zaodonganqi"
}
],
"main": "main.js",

View File

@@ -9,7 +9,7 @@
"type": "input-text",
"name": "room",
"label": "奇域关卡关键词或关卡GUID",
"default": "7015200164"
"default": "7070702264"
},
{
"type": "checkbox",