archive JS

This commit is contained in:
起个名字好难
2025-05-08 01:24:49 +08:00
parent 70cd42d376
commit 7a9f3296bb
33 changed files with 4832 additions and 4832 deletions

View File

@@ -1,398 +1,398 @@
{
"macroEvents": [
{
"type": 3,
"mouseX": 7,
"mouseY": -10,
"time": 507.5978
},
{
"type": 3,
"mouseX": 10,
"mouseY": -9,
"time": 530.3774
},
{
"type": 3,
"mouseX": 11,
"mouseY": -11,
"time": 553.5057
},
{
"type": 3,
"mouseX": 20,
"mouseY": -14,
"time": 580.3496
},
{
"type": 3,
"mouseX": 16,
"mouseY": -10,
"time": 602.692
},
{
"type": 3,
"mouseX": 13,
"mouseY": -6,
"time": 625.0354
},
{
"type": 3,
"mouseX": 15,
"mouseY": -7,
"time": 652.6616
},
{
"type": 3,
"mouseX": 19,
"mouseY": -6,
"time": 675.7784
},
{
"type": 3,
"mouseX": 16,
"mouseY": -7,
"time": 699.4606
},
{
"type": 3,
"mouseX": 14,
"mouseY": -4,
"time": 721.9512
},
{
"type": 3,
"mouseX": 10,
"mouseY": -4,
"time": 749.8809
},
{
"type": 3,
"mouseX": 11,
"mouseY": -3,
"time": 771.7238
},
{
"type": 3,
"mouseX": 3,
"mouseY": 0,
"time": 798.9946
},
{
"type": 3,
"mouseX": 5,
"mouseY": -1,
"time": 838.0122
},
{
"type": 3,
"mouseX": 10,
"mouseY": -4,
"time": 860.9122
},
{
"type": 3,
"mouseX": 9,
"mouseY": -3,
"time": 887.8467
},
{
"type": 3,
"mouseX": 10,
"mouseY": -4,
"time": 910.604
},
{
"type": 3,
"mouseX": 8,
"mouseY": -3,
"time": 933.7889
},
{
"type": 3,
"mouseX": 15,
"mouseY": -5,
"time": 966.7797
},
{
"type": 3,
"mouseX": 17,
"mouseY": -6,
"time": 994.9369
},
{
"type": 3,
"mouseX": 4,
"mouseY": -3,
"time": 1016.2168
},
{
"type": 3,
"mouseX": 1,
"mouseY": 0,
"time": 1087.1571
},
{
"type": 3,
"mouseX": 1,
"mouseY": -1,
"time": 1165.9255
},
{
"type": 3,
"mouseX": 7,
"mouseY": -20,
"time": 1189.5971
},
{
"type": 3,
"mouseX": 9,
"mouseY": -20,
"time": 1212.1569
},
{
"type": 3,
"mouseX": 12,
"mouseY": -29,
"time": 1239.2237
},
{
"type": 3,
"mouseX": 8,
"mouseY": -35,
"time": 1261.541
},
{
"type": 3,
"mouseX": 9,
"mouseY": -31,
"time": 1282.9399
},
{
"type": 3,
"mouseX": 6,
"mouseY": -27,
"time": 1310.8353
},
{
"type": 0,
"keyCode": 32,
"mouseX": 0,
"mouseY": 0,
"time": 1326.1869
},
{
"type": 3,
"mouseX": 5,
"mouseY": -24,
"time": 1333.4788
},
{
"type": 3,
"mouseX": 3,
"mouseY": -18,
"time": 1355.189
},
{
"type": 3,
"mouseX": 1,
"mouseY": -15,
"time": 1382.325
},
{
"type": 3,
"mouseX": 1,
"mouseY": -11,
"time": 1404.9371
},
{
"type": 3,
"mouseX": 1,
"mouseY": -4,
"time": 1428.1381
},
{
"type": 3,
"mouseX": 0,
"mouseY": -8,
"time": 1450.6075
},
{
"type": 3,
"mouseX": 0,
"mouseY": -6,
"time": 1474.3844
},
{
"type": 3,
"mouseX": 1,
"mouseY": -12,
"time": 1496.0174
},
{
"type": 3,
"mouseX": 1,
"mouseY": -10,
"time": 1525.1301
},
{
"type": 3,
"mouseX": 1,
"mouseY": -9,
"time": 1547.37
},
{
"type": 3,
"mouseX": 1,
"mouseY": -12,
"time": 1574.451
},
{
"type": 3,
"mouseX": 1,
"mouseY": -12,
"time": 1597.8639
},
{
"type": 3,
"mouseX": 2,
"mouseY": -17,
"time": 1619.8618
},
{
"type": 3,
"mouseX": 3,
"mouseY": -22,
"time": 1641.7182
},
{
"type": 3,
"mouseX": 4,
"mouseY": -25,
"time": 1669.2743
},
{
"type": 3,
"mouseX": 2,
"mouseY": -32,
"time": 1691.053
},
{
"type": 3,
"mouseX": -2,
"mouseY": -44,
"time": 1713.796
},
{
"type": 3,
"mouseX": -1,
"mouseY": -50,
"time": 1741.0761
},
{
"type": 3,
"mouseX": 2,
"mouseY": -59,
"time": 1762.626
},
{
"type": 3,
"mouseX": 6,
"mouseY": -64,
"time": 1785.3462
},
{
"type": 3,
"mouseX": 12,
"mouseY": -69,
"time": 1813.6425
},
{
"type": 3,
"mouseX": 11,
"mouseY": -60,
"time": 1836.3858
},
{
"type": 3,
"mouseX": 4,
"mouseY": -42,
"time": 1858.8535
},
{
"type": 3,
"mouseX": 2,
"mouseY": -23,
"time": 1881.591
},
{
"type": 3,
"mouseX": 0,
"mouseY": -13,
"time": 1908.3465
},
{
"type": 3,
"mouseX": 0,
"mouseY": -1,
"time": 1980.1002
},
{
"type": 3,
"mouseX": 0,
"mouseY": 2,
"time": 2111.6914
},
{
"type": 3,
"mouseX": -4,
"mouseY": 11,
"time": 2136.3181
},
{
"type": 3,
"mouseX": -10,
"mouseY": 22,
"time": 2165.6564
},
{
"type": 3,
"mouseX": -14,
"mouseY": 31,
"time": 2194.7638
},
{
"type": 3,
"mouseX": -24,
"mouseY": 46,
"time": 2216.4018
},
{
"type": 3,
"mouseX": -51,
"mouseY": 69,
"time": 2239.0885
},
{
"type": 3,
"mouseX": -55,
"mouseY": 62,
"time": 2265.9616
},
{
"type": 1,
"keyCode": 32,
"mouseX": 0,
"mouseY": 0,
"time": 2274.8891
}
],
"info": {
"name": "",
"description": "",
"x": 319,
"y": 192,
"width": 1920,
"height": 1080
}
{
"macroEvents": [
{
"type": 3,
"mouseX": 7,
"mouseY": -10,
"time": 507.5978
},
{
"type": 3,
"mouseX": 10,
"mouseY": -9,
"time": 530.3774
},
{
"type": 3,
"mouseX": 11,
"mouseY": -11,
"time": 553.5057
},
{
"type": 3,
"mouseX": 20,
"mouseY": -14,
"time": 580.3496
},
{
"type": 3,
"mouseX": 16,
"mouseY": -10,
"time": 602.692
},
{
"type": 3,
"mouseX": 13,
"mouseY": -6,
"time": 625.0354
},
{
"type": 3,
"mouseX": 15,
"mouseY": -7,
"time": 652.6616
},
{
"type": 3,
"mouseX": 19,
"mouseY": -6,
"time": 675.7784
},
{
"type": 3,
"mouseX": 16,
"mouseY": -7,
"time": 699.4606
},
{
"type": 3,
"mouseX": 14,
"mouseY": -4,
"time": 721.9512
},
{
"type": 3,
"mouseX": 10,
"mouseY": -4,
"time": 749.8809
},
{
"type": 3,
"mouseX": 11,
"mouseY": -3,
"time": 771.7238
},
{
"type": 3,
"mouseX": 3,
"mouseY": 0,
"time": 798.9946
},
{
"type": 3,
"mouseX": 5,
"mouseY": -1,
"time": 838.0122
},
{
"type": 3,
"mouseX": 10,
"mouseY": -4,
"time": 860.9122
},
{
"type": 3,
"mouseX": 9,
"mouseY": -3,
"time": 887.8467
},
{
"type": 3,
"mouseX": 10,
"mouseY": -4,
"time": 910.604
},
{
"type": 3,
"mouseX": 8,
"mouseY": -3,
"time": 933.7889
},
{
"type": 3,
"mouseX": 15,
"mouseY": -5,
"time": 966.7797
},
{
"type": 3,
"mouseX": 17,
"mouseY": -6,
"time": 994.9369
},
{
"type": 3,
"mouseX": 4,
"mouseY": -3,
"time": 1016.2168
},
{
"type": 3,
"mouseX": 1,
"mouseY": 0,
"time": 1087.1571
},
{
"type": 3,
"mouseX": 1,
"mouseY": -1,
"time": 1165.9255
},
{
"type": 3,
"mouseX": 7,
"mouseY": -20,
"time": 1189.5971
},
{
"type": 3,
"mouseX": 9,
"mouseY": -20,
"time": 1212.1569
},
{
"type": 3,
"mouseX": 12,
"mouseY": -29,
"time": 1239.2237
},
{
"type": 3,
"mouseX": 8,
"mouseY": -35,
"time": 1261.541
},
{
"type": 3,
"mouseX": 9,
"mouseY": -31,
"time": 1282.9399
},
{
"type": 3,
"mouseX": 6,
"mouseY": -27,
"time": 1310.8353
},
{
"type": 0,
"keyCode": 32,
"mouseX": 0,
"mouseY": 0,
"time": 1326.1869
},
{
"type": 3,
"mouseX": 5,
"mouseY": -24,
"time": 1333.4788
},
{
"type": 3,
"mouseX": 3,
"mouseY": -18,
"time": 1355.189
},
{
"type": 3,
"mouseX": 1,
"mouseY": -15,
"time": 1382.325
},
{
"type": 3,
"mouseX": 1,
"mouseY": -11,
"time": 1404.9371
},
{
"type": 3,
"mouseX": 1,
"mouseY": -4,
"time": 1428.1381
},
{
"type": 3,
"mouseX": 0,
"mouseY": -8,
"time": 1450.6075
},
{
"type": 3,
"mouseX": 0,
"mouseY": -6,
"time": 1474.3844
},
{
"type": 3,
"mouseX": 1,
"mouseY": -12,
"time": 1496.0174
},
{
"type": 3,
"mouseX": 1,
"mouseY": -10,
"time": 1525.1301
},
{
"type": 3,
"mouseX": 1,
"mouseY": -9,
"time": 1547.37
},
{
"type": 3,
"mouseX": 1,
"mouseY": -12,
"time": 1574.451
},
{
"type": 3,
"mouseX": 1,
"mouseY": -12,
"time": 1597.8639
},
{
"type": 3,
"mouseX": 2,
"mouseY": -17,
"time": 1619.8618
},
{
"type": 3,
"mouseX": 3,
"mouseY": -22,
"time": 1641.7182
},
{
"type": 3,
"mouseX": 4,
"mouseY": -25,
"time": 1669.2743
},
{
"type": 3,
"mouseX": 2,
"mouseY": -32,
"time": 1691.053
},
{
"type": 3,
"mouseX": -2,
"mouseY": -44,
"time": 1713.796
},
{
"type": 3,
"mouseX": -1,
"mouseY": -50,
"time": 1741.0761
},
{
"type": 3,
"mouseX": 2,
"mouseY": -59,
"time": 1762.626
},
{
"type": 3,
"mouseX": 6,
"mouseY": -64,
"time": 1785.3462
},
{
"type": 3,
"mouseX": 12,
"mouseY": -69,
"time": 1813.6425
},
{
"type": 3,
"mouseX": 11,
"mouseY": -60,
"time": 1836.3858
},
{
"type": 3,
"mouseX": 4,
"mouseY": -42,
"time": 1858.8535
},
{
"type": 3,
"mouseX": 2,
"mouseY": -23,
"time": 1881.591
},
{
"type": 3,
"mouseX": 0,
"mouseY": -13,
"time": 1908.3465
},
{
"type": 3,
"mouseX": 0,
"mouseY": -1,
"time": 1980.1002
},
{
"type": 3,
"mouseX": 0,
"mouseY": 2,
"time": 2111.6914
},
{
"type": 3,
"mouseX": -4,
"mouseY": 11,
"time": 2136.3181
},
{
"type": 3,
"mouseX": -10,
"mouseY": 22,
"time": 2165.6564
},
{
"type": 3,
"mouseX": -14,
"mouseY": 31,
"time": 2194.7638
},
{
"type": 3,
"mouseX": -24,
"mouseY": 46,
"time": 2216.4018
},
{
"type": 3,
"mouseX": -51,
"mouseY": 69,
"time": 2239.0885
},
{
"type": 3,
"mouseX": -55,
"mouseY": 62,
"time": 2265.9616
},
{
"type": 1,
"keyCode": 32,
"mouseX": 0,
"mouseY": 0,
"time": 2274.8891
}
],
"info": {
"name": "",
"description": "",
"x": 319,
"y": 192,
"width": 1920,
"height": 1080
}
}

View File

@@ -1,443 +1,443 @@
(async function () {
const startTime = Date.now(); //记录启动时间
setGameMetrics(1920, 1080, 1); // 设置游戏运行的分辨率和缩放
//基础延迟
let delay = settings.delay || 2000;
//定义合成台and凯瑟琳的选择路径
let hct_filePath = settings.hsc_selectValue || "枫丹合成台";
let ksl_filePath = settings.ksl_selectValue || "枫丹凯瑟琳";
async function hct_AutoPath(locationName) {
log.info(`即将前往 ${locationName}`);
try {
let filePath = `assets/合成台位置/${locationName}.json`;
await pathingScript.runFile(filePath);
} catch (error) {
log.error(`执行 ${locationName} 路径时发生错误`);
}
log.info(`已到达 ${locationName}`);
}
async function ksl_AutoPath(locationName) {
log.info(`即将前往 ${locationName}`);
try {
let filePath = `assets/凯瑟琳位置/${locationName}.json`;
await pathingScript.runFile(filePath);
} catch (error) {
log.error(`执行 ${locationName} 路径时发生错误`);
}
log.info(`已到达 ${locationName}`);
}
async function prt_AutoPath(locationName) {
log.info(`即将前往 ${locationName}`);
try {
let filePath = `assets/烹饪台位置/${locationName}.json`;
await pathingScript.runFile(filePath);
} catch (error) {
log.error(`执行 ${locationName} 路径时发生错误`);
}
log.info(`已到达 ${locationName}`);
}
// 领取邮件
keyPress("Escape");
await sleep(1500);
click(50, 605);
await sleep(1500);
click(150, 1015);
await sleep(1000);
click(150, 1015);
await sleep(1000);
keyPress("Escape");
await sleep(1000);
keyPress("Escape");
log.info("已完成 领取邮件");
await sleep(delay);
// 设置世界权限
let domainName = settings.domainName;
if (domainName != "默认当前") {
keyPress("VK_F2")
await sleep(1000);
click(160, 1020); // 点击世界权限
await sleep(1000);
switch (domainName) {
case "不允许加入":
click(330, 870);
log.info("权限设置为 不允许加入");
break;
case "直接加入":
click(330, 920);
log.info("权限设置为 直接加入");
break;
case "确认后可加入":
click(330, 970);
log.info("权限设置为 确认后可加入");
break;
default:
click(330, 870); // 为空不允许
log.info("锁门");
await sleep(2000);
keyPress("Escape");
break;
}
}
// 前往_合成台
await hct_AutoPath(hct_filePath);
await sleep(1000);
// 合成浓缩树脂
keyPress("F");
await sleep(2000);
click(960, 540);
await sleep(1000);
click(960, 540);
await sleep(1000);
click(1750, 1010); //点击合成
await sleep(5000);
keyPress("Escape");
await sleep(1000);
keyPress("Escape"); // 确保完全退出合成
log.info("已完成 合成浓缩树脂");
await sleep(delay);
// 自动秘境
if (settings.autoInstance == "是" | settings.autoInstance == undefined) {
while (true) {
try {
await dispatcher.runTask(new SoloTask("AutoDomain"));
await sleep(500);
break;
} catch (ex) {
if (ex.message.includes("检测到复苏界面")) {
log.info("复活后,继续执行自动秘境。");
continue;
}
else {
// 如果不包含 "检测到复苏界面",则继续抛出异常
throw ex;
}
}
}
}
// 分解狗粮
if (settings.decomposeDogFood == "是" | settings.decomposeDogFood == undefined) {
keyPress("B");
await sleep(1000);
click(670, 40);
await sleep(1000);
click(660, 1010);
await sleep(1000);
click(300, 1020);
await sleep(500);
click(300, 380);
await sleep(50);
click(300, 300);
await sleep(50);
click(300, 220);
await sleep(50);
click(300, 150);
await sleep(500);
click(340, 1010);
await sleep(800);
click(1740, 1020);
await sleep(800);
click(1180, 750);
await sleep(800);
click(950, 800);
await sleep(800);
keyPress("Escape");
await sleep(1000);
keyPress("Escape");
log.info("已完成 分解狗粮");
await sleep(1000);
}
// 前往_凯瑟琳
await ksl_AutoPath(ksl_filePath);
await sleep(1000);
// 领取历练点
keyPress("F1");
await sleep(2000);
click(290, 345);
await sleep(1000);
click(1550, 755);
await sleep(1000);
click(1550, 755);
await sleep(1500);
// click(1670, 235);
keyPress("Escape");
log.info("已完成 领取历练点");
await sleep(delay);
// 领取每日委托奖励
keyPress("F");
log.info("按下F键");
await sleep(1000);
click(960, 540);
await sleep(1000);
click(1380, 425);// 点击坐标(1380, 425)(领取「每日委托」奖励)
await sleep(1000);
click(960, 540);
await sleep(2000);
click(960, 960);// 点击坐标(960, 960)(关闭奖励弹出页面)
log.info("已完成 领取每日委托奖励");
await sleep(delay);
// 重新探索派遣
keyPress("F");
await sleep(1800);
click(960, 540);
await sleep(1000);
click(1400, 580);
await sleep(1000);
click(160, 1010);
await sleep(1000);
click(1160, 1020);
await sleep(1000);
keyPress("Escape");
log.info("已完成 重新探索派遣");
await sleep(delay);
// 领取纪行奖励
keyPress("F4");
await sleep(1500);
click(960, 50);
await sleep(1000);
click(1720, 980);
await sleep(2000);
click(860, 50);
await sleep(1000);
click(1720, 980);
await sleep(1000);
keyPress("Escape");
await sleep(1000);
keyPress("Escape");
log.info("已完成 领取纪行奖励");
await sleep(delay);
// 前往_凯瑟琳
await genshin.tp(4515, 3630);
await sleep(1000);
//切换至抓晶蝶队伍
if (settings.catchButterfly == "是" | settings.catchButterfly == undefined) {
keyPress("L");
await sleep(3000);
click(75, 1020);
await sleep(200);
click(700, 115);
await sleep(200);
click(700, 115);
await sleep(300);
click(75, 200);
await sleep(800);
click(75, 1020);
await sleep(800);
let tempVar = settings.number || 5;
if (tempVar < 9) { // 向右点击
for (let i = 1; i < tempVar; i++) {
click(1850, 540);
await sleep(50);
}
} else { // 向左点击
tempVar = 16 - tempVar
for (let i = 0; i < tempVar; i++) {
click(75, 540);
await sleep(50);
}
}
click(1555, 1020);
await sleep(1000);
keyPress("Escape");
log.info("已切换至第" + settings.number || 5 + "队");
await sleep(delay);
}
//切换角色
keyPress("1");
log.info("已切换至第1个角色");
// 进入尘歌壶
keyPress("B");
await sleep(1000);
click(1060, 50);
await sleep(500);
click(770, 180);
await sleep(300);
click(1690, 1010);
await sleep(1000);
keyPress("F");
await sleep(10000);
log.info("已完成 进入尘歌壶");
// 如果延迟时间大于3000ms 执行防止加载卡岩
if (delay > 3000) {
await sleep(3000);
log.info("当前基础延迟大于{time},已等待防止加载卡岩", "3000ms");
}
// 尘歌壶找阿圆
(async function () {
// 绘绮庭路径
const pathingA = async function () {
keyDown("S"); // 按下 S 键
await sleep(500); // 等待 500ms
keyUp("S"); // 松开 S 键
await sleep(500); // 等待 500ms
keyDown("S"); // 按下 S 键
keyDown("A"); // 按下 A 键
await sleep(2100); // 等待 2100ms
keyUp("S"); // 松开 S 键
keyUp("A"); // 松开 A 键
log.info("绮庭路径执行完毕");
};
// 妙香林路径
const pathingB = async function () {
keyDown("D"); // 按下 D 键
await sleep(1500); // 等待 1500ms
keyUp("D"); // 松开 D 键
log.info("妙香林路径执行完毕");
};
// 黛翠峰&罗浮洞路径
const pathingC = async function () {
keyDown("D"); // 按下 D 键
await sleep(500); // 等待 500ms
keyUp("D"); // 松开 D 键
log.info("黛翠峰&罗浮洞路径执行完毕");
};
// 清琼岛路径
const pathingD = async function () {
keyDown("D");
await sleep(500);
keyUp("D");
log.info("清琼岛路径执行完毕");
};
// 读取用户设置
let path = settings.path !== undefined ? settings.path : ''; // 使用设置的路径
log.debug(`path: ${path}`);
// 根据选择的路径执行相应操作默认执行路径A绘绮庭路径
if (path === '绘绮庭') {
log.info('开始执行绮庭路径');
await pathingA(); // 执行绘绮庭路径
} else if (path === '妙香林') {
log.info('开始执行妙香林路径');
await pathingB(); // 执行妙香林路径
} else if (path === '黛翠峰&罗浮洞') {
log.info('开始执行黛翠峰&罗浮洞路径');
await pathingC(); // 执行黛翠峰or罗浮洞路径
} else if (path === '清琼岛') {
log.info('开始执行清琼岛路径');
await pathingD(); // 执行清琼岛路径
} else {
log.info('未选择有效路径执行默认路径D清琼岛');
await pathingD(); // 默认执行路径A清琼岛
}
})();
//领取洞天宝钱和好感度
await sleep(1000);
keyPress("F");
await sleep(2000);
click(1370, 420);
await sleep(1500);
click(1370, 420);
await sleep(800);
click(1800, 710); //领取好感
await sleep(200);
click(1345, 300); //点击x
await sleep(200);
click(1080, 960); //领取洞天宝钱
await sleep(200);
click(1345, 300); //点击x
await sleep(500);
click(1865, 44); //点击右上角x退出
await sleep(3000);
click(1300, 800);
await sleep(1000);
click(1300, 800);
log.info("已完成 领取洞天宝钱和好感");
await sleep(3000);
//抓晶蝶
if (settings.catchButterfly == "是" | settings.catchButterfly == undefined) {
dispatcher.addTimer(new RealtimeTimer("AutoPick", { "forceInteraction": true })); // 启用自动拾取的实时任务
log.info('开始捕捉晶蝶,请在队伍中务必携带{zyyy},使用成男/成女角色', '早柚/瑶瑶');
async function captureCrystalfly(locationName, x, y, num) {
log.info('前往 {name}', locationName);
await genshin.tp(x, y);
await sleep(1000);
log.info('尝试捕捉晶蝶, {num}只', num);
let filePath = `assets/晶蝶位置/${locationName}.json`;
await keyMouseScript.runFile(filePath);
}
await captureCrystalfly('枫丹-塔拉塔海谷', 4328, 3960, 4);
await captureCrystalfly('枫丹-枫丹廷区', 4822, 3628, 3);
await captureCrystalfly('枫丹-苍白的遗荣', 4188, 2992, 2);
await captureCrystalfly('枫丹-幽林雾道', 3376, 3290, 2);
await captureCrystalfly('枫丹-卡布狄斯堡遗迹上方', 3554, 3024, 4);
await captureCrystalfly('枫丹-卡布狄斯堡遗迹下方_优化', 3374, 2699, 3);
await captureCrystalfly('枫丹-莫尔泰区', 3810, 2334, 2);
await captureCrystalfly('枫丹-特别温暖的地方', 4790, 2520, 3);
await captureCrystalfly('须弥-化城郭左侧', 2699, -767, 2);
await captureCrystalfly('须弥-下风蚀地', 4452, -2456, 3);
dispatcher.addTimer(new RealtimeTimer("AutoPick", { "forceInteraction": false })); // 关闭自动拾取的实时任务
}
const endTime = Date.now();
const totalTimeInSeconds = (endTime - startTime) / 1000;
const minutes = Math.floor(totalTimeInSeconds / 60);
const seconds = totalTimeInSeconds % 60;
const formattedTime = `${minutes}${seconds.toFixed(0).padStart(2, '0')}`;
log.info(`已完成总耗时: ${formattedTime}`);
await sleep(2000);
log.info("已完成 所有内容 结束-Tzi");
await sleep(2000);
// 结束游戏
if (settings.exitGame == "是" | settings.exitGame == undefined) {
for (let i = 0; i < 5; i++) {
log.info('即将在 {num}s 后退出', 5 - i + "s");
await sleep(1000);
}
keyDown("MENU");
keyDown("F4");
await sleep(50);
keyUp("MENU");
keyUp("F4");
}
})();
(async function () {
const startTime = Date.now(); //记录启动时间
setGameMetrics(1920, 1080, 1); // 设置游戏运行的分辨率和缩放
//基础延迟
let delay = settings.delay || 2000;
//定义合成台and凯瑟琳的选择路径
let hct_filePath = settings.hsc_selectValue || "枫丹合成台";
let ksl_filePath = settings.ksl_selectValue || "枫丹凯瑟琳";
async function hct_AutoPath(locationName) {
log.info(`即将前往 ${locationName}`);
try {
let filePath = `assets/合成台位置/${locationName}.json`;
await pathingScript.runFile(filePath);
} catch (error) {
log.error(`执行 ${locationName} 路径时发生错误`);
}
log.info(`已到达 ${locationName}`);
}
async function ksl_AutoPath(locationName) {
log.info(`即将前往 ${locationName}`);
try {
let filePath = `assets/凯瑟琳位置/${locationName}.json`;
await pathingScript.runFile(filePath);
} catch (error) {
log.error(`执行 ${locationName} 路径时发生错误`);
}
log.info(`已到达 ${locationName}`);
}
async function prt_AutoPath(locationName) {
log.info(`即将前往 ${locationName}`);
try {
let filePath = `assets/烹饪台位置/${locationName}.json`;
await pathingScript.runFile(filePath);
} catch (error) {
log.error(`执行 ${locationName} 路径时发生错误`);
}
log.info(`已到达 ${locationName}`);
}
// 领取邮件
keyPress("Escape");
await sleep(1500);
click(50, 605);
await sleep(1500);
click(150, 1015);
await sleep(1000);
click(150, 1015);
await sleep(1000);
keyPress("Escape");
await sleep(1000);
keyPress("Escape");
log.info("已完成 领取邮件");
await sleep(delay);
// 设置世界权限
let domainName = settings.domainName;
if (domainName != "默认当前") {
keyPress("VK_F2")
await sleep(1000);
click(160, 1020); // 点击世界权限
await sleep(1000);
switch (domainName) {
case "不允许加入":
click(330, 870);
log.info("权限设置为 不允许加入");
break;
case "直接加入":
click(330, 920);
log.info("权限设置为 直接加入");
break;
case "确认后可加入":
click(330, 970);
log.info("权限设置为 确认后可加入");
break;
default:
click(330, 870); // 为空不允许
log.info("锁门");
await sleep(2000);
keyPress("Escape");
break;
}
}
// 前往_合成台
await hct_AutoPath(hct_filePath);
await sleep(1000);
// 合成浓缩树脂
keyPress("F");
await sleep(2000);
click(960, 540);
await sleep(1000);
click(960, 540);
await sleep(1000);
click(1750, 1010); //点击合成
await sleep(5000);
keyPress("Escape");
await sleep(1000);
keyPress("Escape"); // 确保完全退出合成
log.info("已完成 合成浓缩树脂");
await sleep(delay);
// 自动秘境
if (settings.autoInstance == "是" | settings.autoInstance == undefined) {
while (true) {
try {
await dispatcher.runTask(new SoloTask("AutoDomain"));
await sleep(500);
break;
} catch (ex) {
if (ex.message.includes("检测到复苏界面")) {
log.info("复活后,继续执行自动秘境。");
continue;
}
else {
// 如果不包含 "检测到复苏界面",则继续抛出异常
throw ex;
}
}
}
}
// 分解狗粮
if (settings.decomposeDogFood == "是" | settings.decomposeDogFood == undefined) {
keyPress("B");
await sleep(1000);
click(670, 40);
await sleep(1000);
click(660, 1010);
await sleep(1000);
click(300, 1020);
await sleep(500);
click(300, 380);
await sleep(50);
click(300, 300);
await sleep(50);
click(300, 220);
await sleep(50);
click(300, 150);
await sleep(500);
click(340, 1010);
await sleep(800);
click(1740, 1020);
await sleep(800);
click(1180, 750);
await sleep(800);
click(950, 800);
await sleep(800);
keyPress("Escape");
await sleep(1000);
keyPress("Escape");
log.info("已完成 分解狗粮");
await sleep(1000);
}
// 前往_凯瑟琳
await ksl_AutoPath(ksl_filePath);
await sleep(1000);
// 领取历练点
keyPress("F1");
await sleep(2000);
click(290, 345);
await sleep(1000);
click(1550, 755);
await sleep(1000);
click(1550, 755);
await sleep(1500);
// click(1670, 235);
keyPress("Escape");
log.info("已完成 领取历练点");
await sleep(delay);
// 领取每日委托奖励
keyPress("F");
log.info("按下F键");
await sleep(1000);
click(960, 540);
await sleep(1000);
click(1380, 425);// 点击坐标(1380, 425)(领取「每日委托」奖励)
await sleep(1000);
click(960, 540);
await sleep(2000);
click(960, 960);// 点击坐标(960, 960)(关闭奖励弹出页面)
log.info("已完成 领取每日委托奖励");
await sleep(delay);
// 重新探索派遣
keyPress("F");
await sleep(1800);
click(960, 540);
await sleep(1000);
click(1400, 580);
await sleep(1000);
click(160, 1010);
await sleep(1000);
click(1160, 1020);
await sleep(1000);
keyPress("Escape");
log.info("已完成 重新探索派遣");
await sleep(delay);
// 领取纪行奖励
keyPress("F4");
await sleep(1500);
click(960, 50);
await sleep(1000);
click(1720, 980);
await sleep(2000);
click(860, 50);
await sleep(1000);
click(1720, 980);
await sleep(1000);
keyPress("Escape");
await sleep(1000);
keyPress("Escape");
log.info("已完成 领取纪行奖励");
await sleep(delay);
// 前往_凯瑟琳
await genshin.tp(4515, 3630);
await sleep(1000);
//切换至抓晶蝶队伍
if (settings.catchButterfly == "是" | settings.catchButterfly == undefined) {
keyPress("L");
await sleep(3000);
click(75, 1020);
await sleep(200);
click(700, 115);
await sleep(200);
click(700, 115);
await sleep(300);
click(75, 200);
await sleep(800);
click(75, 1020);
await sleep(800);
let tempVar = settings.number || 5;
if (tempVar < 9) { // 向右点击
for (let i = 1; i < tempVar; i++) {
click(1850, 540);
await sleep(50);
}
} else { // 向左点击
tempVar = 16 - tempVar
for (let i = 0; i < tempVar; i++) {
click(75, 540);
await sleep(50);
}
}
click(1555, 1020);
await sleep(1000);
keyPress("Escape");
log.info("已切换至第" + settings.number || 5 + "队");
await sleep(delay);
}
//切换角色
keyPress("1");
log.info("已切换至第1个角色");
// 进入尘歌壶
keyPress("B");
await sleep(1000);
click(1060, 50);
await sleep(500);
click(770, 180);
await sleep(300);
click(1690, 1010);
await sleep(1000);
keyPress("F");
await sleep(10000);
log.info("已完成 进入尘歌壶");
// 如果延迟时间大于3000ms 执行防止加载卡岩
if (delay > 3000) {
await sleep(3000);
log.info("当前基础延迟大于{time},已等待防止加载卡岩", "3000ms");
}
// 尘歌壶找阿圆
(async function () {
// 绘绮庭路径
const pathingA = async function () {
keyDown("S"); // 按下 S 键
await sleep(500); // 等待 500ms
keyUp("S"); // 松开 S 键
await sleep(500); // 等待 500ms
keyDown("S"); // 按下 S 键
keyDown("A"); // 按下 A 键
await sleep(2100); // 等待 2100ms
keyUp("S"); // 松开 S 键
keyUp("A"); // 松开 A 键
log.info("绮庭路径执行完毕");
};
// 妙香林路径
const pathingB = async function () {
keyDown("D"); // 按下 D 键
await sleep(1500); // 等待 1500ms
keyUp("D"); // 松开 D 键
log.info("妙香林路径执行完毕");
};
// 黛翠峰&罗浮洞路径
const pathingC = async function () {
keyDown("D"); // 按下 D 键
await sleep(500); // 等待 500ms
keyUp("D"); // 松开 D 键
log.info("黛翠峰&罗浮洞路径执行完毕");
};
// 清琼岛路径
const pathingD = async function () {
keyDown("D");
await sleep(500);
keyUp("D");
log.info("清琼岛路径执行完毕");
};
// 读取用户设置
let path = settings.path !== undefined ? settings.path : ''; // 使用设置的路径
log.debug(`path: ${path}`);
// 根据选择的路径执行相应操作默认执行路径A绘绮庭路径
if (path === '绘绮庭') {
log.info('开始执行绮庭路径');
await pathingA(); // 执行绘绮庭路径
} else if (path === '妙香林') {
log.info('开始执行妙香林路径');
await pathingB(); // 执行妙香林路径
} else if (path === '黛翠峰&罗浮洞') {
log.info('开始执行黛翠峰&罗浮洞路径');
await pathingC(); // 执行黛翠峰or罗浮洞路径
} else if (path === '清琼岛') {
log.info('开始执行清琼岛路径');
await pathingD(); // 执行清琼岛路径
} else {
log.info('未选择有效路径执行默认路径D清琼岛');
await pathingD(); // 默认执行路径A清琼岛
}
})();
//领取洞天宝钱和好感度
await sleep(1000);
keyPress("F");
await sleep(2000);
click(1370, 420);
await sleep(1500);
click(1370, 420);
await sleep(800);
click(1800, 710); //领取好感
await sleep(200);
click(1345, 300); //点击x
await sleep(200);
click(1080, 960); //领取洞天宝钱
await sleep(200);
click(1345, 300); //点击x
await sleep(500);
click(1865, 44); //点击右上角x退出
await sleep(3000);
click(1300, 800);
await sleep(1000);
click(1300, 800);
log.info("已完成 领取洞天宝钱和好感");
await sleep(3000);
//抓晶蝶
if (settings.catchButterfly == "是" | settings.catchButterfly == undefined) {
dispatcher.addTimer(new RealtimeTimer("AutoPick", { "forceInteraction": true })); // 启用自动拾取的实时任务
log.info('开始捕捉晶蝶,请在队伍中务必携带{zyyy},使用成男/成女角色', '早柚/瑶瑶');
async function captureCrystalfly(locationName, x, y, num) {
log.info('前往 {name}', locationName);
await genshin.tp(x, y);
await sleep(1000);
log.info('尝试捕捉晶蝶, {num}只', num);
let filePath = `assets/晶蝶位置/${locationName}.json`;
await keyMouseScript.runFile(filePath);
}
await captureCrystalfly('枫丹-塔拉塔海谷', 4328, 3960, 4);
await captureCrystalfly('枫丹-枫丹廷区', 4822, 3628, 3);
await captureCrystalfly('枫丹-苍白的遗荣', 4188, 2992, 2);
await captureCrystalfly('枫丹-幽林雾道', 3376, 3290, 2);
await captureCrystalfly('枫丹-卡布狄斯堡遗迹上方', 3554, 3024, 4);
await captureCrystalfly('枫丹-卡布狄斯堡遗迹下方_优化', 3374, 2699, 3);
await captureCrystalfly('枫丹-莫尔泰区', 3810, 2334, 2);
await captureCrystalfly('枫丹-特别温暖的地方', 4790, 2520, 3);
await captureCrystalfly('须弥-化城郭左侧', 2699, -767, 2);
await captureCrystalfly('须弥-下风蚀地', 4452, -2456, 3);
dispatcher.addTimer(new RealtimeTimer("AutoPick", { "forceInteraction": false })); // 关闭自动拾取的实时任务
}
const endTime = Date.now();
const totalTimeInSeconds = (endTime - startTime) / 1000;
const minutes = Math.floor(totalTimeInSeconds / 60);
const seconds = totalTimeInSeconds % 60;
const formattedTime = `${minutes}${seconds.toFixed(0).padStart(2, '0')}`;
log.info(`已完成总耗时: ${formattedTime}`);
await sleep(2000);
log.info("已完成 所有内容 结束-Tzi");
await sleep(2000);
// 结束游戏
if (settings.exitGame == "是" | settings.exitGame == undefined) {
for (let i = 0; i < 5; i++) {
log.info('即将在 {num}s 后退出', 5 - i + "s");
await sleep(1000);
}
keyDown("MENU");
keyDown("F4");
await sleep(50);
keyUp("MENU");
keyUp("F4");
}
})();