Merge pull request #130 from Yang-z/main

implement user settings and fine-tune
This commit is contained in:
辉鸭蛋
2024-12-02 00:02:29 +08:00
committed by GitHub
7 changed files with 135 additions and 110 deletions

View File

@@ -30,27 +30,25 @@
"move_mode": "run"
},
{
"x": -3712.8046875,
"y": -4748.9580078125,
"x": -3711.8173828125,
"y": -4749.169921875,
"type": "target",
"move_mode": "run",
"action": ""
},
{
"x": -3712.994140625,
"y": -4748.5810546875,
"x": -3710.8828125,
"y": -4747.0546875,
"type": "target",
"move_mode": "walk",
"action": ""
},
{
"x": -3711.8955078125,
"y": -4747.560546875,
"type": "target",
"move_mode": "walk",
"action": ""
"x": -3712.4990234375,
"y": -4746.32421875,
"type": "path",
"move_mode": "walk"
}
]
}

View File

@@ -11,6 +11,12 @@
"type": "teleport",
"move_mode": "walk"
},
{
"x": -3220.759765625,
"y": -6183.2890625,
"type": "path",
"move_mode": "run"
},
{
"x": -3219.5185546875,
"y": -6216.2353515625,
@@ -37,37 +43,32 @@
},
{
"x": -3260.615234375,
"y": -6212.7294921875,
"x": -3260.61328125,
"y": -6212.1015625,
"type": "path",
"move_mode": "run"
},
{
"x": -3267.4814453125,
"y": -6217.068359375,
"type": "path",
"move_mode": "walk"
"x": -3271.361328125,
"y": -6215.748046875,
"type": "target",
"move_mode": "run",
"action": "",
"#": "3"
},
{
"x": -3270.759765625,
"y": -6215.4892578125,
"type": "target",
"move_mode": "run",
"action": "",
"#": "3"
},
{
"x": -3270.759765625,
"y": -6215.4892578125,
"type": "target",
"move_mode": "run",
"action": "",
"#": "3"
},
{
"x": -3270.759765625,
"y": -6215.4892578125,
"type": "target",
"move_mode": "run",
"action": "",
"#": "3"
},
{
"x": -3269.556640625,
"y": -6212.7734375,
"x": -3270.3818359375,
"y": -6217.875,
"type": "path",
"move_mode": "walk"
}

View File

@@ -1,5 +1,5 @@
(async function () {
setGameMetrics(1920, 1080, 1);
const folderA = 'assets/狗粮A线@Yang-z/';
const folderB = 'assets/狗粮B线@Yang-z/';
const folderE = 'assets/狗粮额外@Yang-z/';
@@ -71,20 +71,27 @@
]; // 17个其中纳塔第2个似乎是一次性的
let path = ''; // 路线
function determinePath() {
try {
path = settings.path;
} catch (error) {
log.error(error.toString());
}
// 读取用户设置JS脚本直接运行已不会抛出异常但默认值还不支持[bgi0.37.1]
let path = settings.path != undefined ? settings.path : '';
let swapPath = settings.swapPath != undefined && settings.swapPath != '否' ? true : false;
let extra = settings.extra != undefined && settings.extra != '是' ? false : true;
let autoSalvage = settings.autoSalvage != undefined && settings.autoSalvage != '是' ? false : true;
let autoSalvage4 = settings.autoSalvage4 != undefined && autoSalvage4 != '否' ? true : false;
let autoSalvageSpan = settings.autoSalvageSpan != undefined && ~~settings.autoSalvageSpan > 0 ? ~~settings.autoSalvageSpan : 10;
log.debug(`path: ${path}; swapPath: ${swapPath}; extra: ${extra}; autoSalvage: ${autoSalvage}; autoSalvage4: ${autoSalvage4}; autoSalvageSpan: ${autoSalvageSpan};`);
// await sleep(30000);
// 路线
function determinePath() {
if (path != 'A' && path != 'B') {
const benchmark = new Date("2024-11-20T04:00:00");
const now = new Date();
const delta = now - benchmark;
const days = delta / (1000 * 60 * 60 * 24);
path = days % 2 < 1 ? 'A' : 'B';
if (swapPath) path = path == 'A' ? 'B' : 'A';
}
}
@@ -107,15 +114,17 @@
// 分解圣遗物
async function salvage() {
if (!autoSalvage) return;
keyPress("B"); await sleep(2000);
click(670, 40); await sleep(1000); // 圣遗物
click(660, 1010); await sleep(1000); // 分解
click(300, 1020); await sleep(1000); // 快速选择
click(200, 150); await sleep(500); // 1
click(200, 140); await sleep(500); // 1
click(200, 220); await sleep(500); // 2
click(200, 300); await sleep(500); // 3
// click(200, 380); await sleep(3000); // 4
if (autoSalvage4) click(200, 380); await sleep(500); // 4
click(340, 1000); await sleep(1000); // 确认选择
click(1720, 1015); await sleep(1500); // 分解
@@ -146,13 +155,14 @@
dispatcher.addTimer(new RealtimeTimer("AutoPick", { "forceInteraction": forceInteraction }));
for (let i = 0; i < files.length; i++) {
if (i % 10 == 0) await salvage();
if (i % autoSalvageSpan == 0) await salvage();
const filePath = folder + files[i];
await runFile(filePath);
}
}
// main
setGameMetrics(1920, 1080, 1);
determinePath();
// A or B
@@ -162,9 +172,11 @@
else await batch(folderB, pathingB);
// Extra
await init(false);
log.info(`开始执行额外线路。`);
await batch(folderE, pathingE, true); // 强制交互
if (extra) {
await init(false);
log.info(`开始执行额外线路。`);
await batch(folderE, pathingE, true); // 强制交互
}
log.info(`今日狗粮拾取任务完成。拾取路线:${path}+E`);
await sleep(3000);

View File

@@ -1,7 +1,7 @@
{
"manifest_version": 1,
"name": "狗粮ABE路线自动拾取分解",
"version": "1.5.2",
"version": "1.6",
"bgi_version": "0.37.1",
"description": "圣遗物狗粮AB路线自动轮换及额外点位拾取途中自动分解。更新纳塔5.2优质点位。",
"authors": [

View File

@@ -1,40 +1,55 @@
[
{
"name": "path",
"type": "select",
"label": "路线",
"label": "路线(默认:自动)",
"options": [
"A",
"B",
"自动"
]
},
// {
// "name": "swapPath",
// "type": "checkbox",
// "label": "自动选择路线时交换AB路线"
// },
{
"name": "swapPath",
"type": "select",
"label": "自动选择路线时交换AB路线(默认:否)",
"options": [
"是",
"否"
]
},
// {
// "name": "Extra",
// "type": "checkbox",
// "label": "拾取额外点位"
// },
{
"name": "extra",
"type": "select",
"label": "拾取额外点位(默认:是)",
"options": [
"是",
"否"
]
},
// {
// "name": "autoSalvage",
// "type": "checkbox",
// "label": "自动分解"
// },
// {
// "name": "autoSalvage4",
// "type": "checkbox",
// "label": "自动分解包括4星圣遗物"
// },
// {
// "name": "autoSalvageSpan",
// "type": "input-text",
// "label": "自动分解在多少路径后执行一次"
// }
{
"name": "autoSalvage",
"type": "select",
"label": "自动分解(默认:是)",
"options": [
"是",
"否"
]
},
{
"name": "autoSalvage4",
"type": "select",
"label": "自动分解包括4星圣遗物默认",
"options": [
"是",
"否"
]
},
{
"name": "autoSalvageSpan",
"type": "input-text",
"label": "自动分解在多少路径后执行一次默认10"
}
]

View File

@@ -30,27 +30,25 @@
"move_mode": "run"
},
{
"x": -3712.8046875,
"y": -4748.9580078125,
"x": -3711.8173828125,
"y": -4749.169921875,
"type": "target",
"move_mode": "run",
"action": ""
},
{
"x": -3712.994140625,
"y": -4748.5810546875,
"x": -3710.8828125,
"y": -4747.0546875,
"type": "target",
"move_mode": "walk",
"action": ""
},
{
"x": -3711.8955078125,
"y": -4747.560546875,
"type": "target",
"move_mode": "walk",
"action": ""
"x": -3712.4990234375,
"y": -4746.32421875,
"type": "path",
"move_mode": "walk"
}
]
}

View File

@@ -11,6 +11,12 @@
"type": "teleport",
"move_mode": "walk"
},
{
"x": -3220.759765625,
"y": -6183.2890625,
"type": "path",
"move_mode": "run"
},
{
"x": -3219.5185546875,
"y": -6216.2353515625,
@@ -37,37 +43,32 @@
},
{
"x": -3260.615234375,
"y": -6212.7294921875,
"x": -3260.61328125,
"y": -6212.1015625,
"type": "path",
"move_mode": "run"
},
{
"x": -3267.4814453125,
"y": -6217.068359375,
"type": "path",
"move_mode": "walk"
"x": -3271.361328125,
"y": -6215.748046875,
"type": "target",
"move_mode": "run",
"action": "",
"#": "3"
},
{
"x": -3270.759765625,
"y": -6215.4892578125,
"type": "target",
"move_mode": "run",
"action": "",
"#": "3"
},
{
"x": -3270.759765625,
"y": -6215.4892578125,
"type": "target",
"move_mode": "run",
"action": "",
"#": "3"
},
{
"x": -3270.759765625,
"y": -6215.4892578125,
"type": "target",
"move_mode": "run",
"action": "",
"#": "3"
},
{
"x": -3269.556640625,
"y": -6212.7734375,
"x": -3270.3818359375,
"y": -6217.875,
"type": "path",
"move_mode": "walk"
}