晶蝶诱捕装置 (#554)
BIN
repo/js/CrystalflyTrap/assets/icon/星银矿石.png
Normal file
|
After Width: | Height: | Size: 6.4 KiB |
BIN
repo/js/CrystalflyTrap/assets/icon/晶蝶诱捕装置.png
Normal file
|
After Width: | Height: | Size: 6.4 KiB |
BIN
repo/js/CrystalflyTrap/assets/icon/水晶块.png
Normal file
|
After Width: | Height: | Size: 7.0 KiB |
BIN
repo/js/CrystalflyTrap/assets/icon/白铁块.png
Normal file
|
After Width: | Height: | Size: 6.2 KiB |
BIN
repo/js/CrystalflyTrap/assets/icon/紫晶块.png
Normal file
|
After Width: | Height: | Size: 6.5 KiB |
BIN
repo/js/CrystalflyTrap/assets/icon/萃凝晶.png
Normal file
|
After Width: | Height: | Size: 7.5 KiB |
BIN
repo/js/CrystalflyTrap/assets/icon/铁块.png
Normal file
|
After Width: | Height: | Size: 5.0 KiB |
BIN
repo/js/CrystalflyTrap/assets/icon/魔晶块.png
Normal file
|
After Width: | Height: | Size: 6.9 KiB |
118
repo/js/CrystalflyTrap/main.js
Normal file
@@ -0,0 +1,118 @@
|
|||||||
|
(async function () {
|
||||||
|
try {
|
||||||
|
setGameMetrics(1920, 1080, 1)
|
||||||
|
await genshin.returnMainUi();
|
||||||
|
|
||||||
|
let enable = settings.enable;
|
||||||
|
let type = settings.type;
|
||||||
|
let ore = settings.ore;
|
||||||
|
|
||||||
|
if (!enable) {
|
||||||
|
throw new Error("请配置好脚本配置!");
|
||||||
|
}
|
||||||
|
if (!ore) {
|
||||||
|
throw new Error("不是吧,哥们,你配置好了吗?用什么矿石啊?");
|
||||||
|
}
|
||||||
|
log.info(`当前动作: ${type}`);
|
||||||
|
log.info("传送至枫丹冒险家协会锚点");
|
||||||
|
await genshin.tp(4509, 3631);
|
||||||
|
await sleep(1000);
|
||||||
|
if (type == "放置") {
|
||||||
|
log.info("放置晶蝶诱捕装置");
|
||||||
|
keyPress("B");
|
||||||
|
await sleep(1000);
|
||||||
|
let backpackTitle = captureGameRegion();
|
||||||
|
let resList = backpackTitle.findMulti(RecognitionObject.ocr(130, 0, 200, 50));
|
||||||
|
for (let i = 0; i < resList.count; i++) {
|
||||||
|
let res = resList[i];
|
||||||
|
if (!res.text.includes("小道")) {
|
||||||
|
log.info("点击小道具栏");
|
||||||
|
click(1060, 40);
|
||||||
|
await sleep(1000);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
let crystalflyTrap = captureGameRegion().find(RecognitionObject.TemplateMatch(file.ReadImageMatSync("assets/icon/晶蝶诱捕装置.png")))
|
||||||
|
if (crystalflyTrap) {
|
||||||
|
log.info("选择晶蝶诱捕装置");
|
||||||
|
crystalflyTrap.click();
|
||||||
|
await sleep(1000);
|
||||||
|
log.info("点击放置");
|
||||||
|
click(1700, 1010);
|
||||||
|
} else {
|
||||||
|
log.error("背包内未找到晶蝶诱捕装置,请检查背包内是否拥有该道具!");
|
||||||
|
throw new Error("背包内未找到晶蝶诱捕装置");
|
||||||
|
}
|
||||||
|
await genshin.returnMainUi();
|
||||||
|
await sleep(1000);
|
||||||
|
let captureRegion = captureGameRegion();
|
||||||
|
let resList2 = captureRegion.findMulti(RecognitionObject.ocr(1210, 510, 210, 50));
|
||||||
|
for (let i = 0; i < resList2.count; i++) {
|
||||||
|
let res = resList2[i];
|
||||||
|
if (!res.text.includes("晶蝶") || !res.text.includes("诱捕") || !res.text.includes("装置")) {
|
||||||
|
log.error("当前光标不是晶蝶诱捕装置");
|
||||||
|
throw new Error("当前光标不是晶蝶诱捕装置");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
log.info("添加矿石");
|
||||||
|
keyPress("F");
|
||||||
|
await sleep(1000);
|
||||||
|
let oreIcon = captureGameRegion().find(RecognitionObject.TemplateMatch(file.ReadImageMatSync(`assets/icon/${ore}.png`)))
|
||||||
|
if (oreIcon) {
|
||||||
|
let oreCount = captureGameRegion().find(RecognitionObject.ocr(oreIcon.x - 20, 240, 90, 30));
|
||||||
|
if (oreCount.text < 30) {
|
||||||
|
log.error(`${ore}数量不足30个!`);
|
||||||
|
throw new Error(`${ore}数量不足30个!`);
|
||||||
|
}
|
||||||
|
log.info(`选择${ore}`);
|
||||||
|
oreIcon.click();
|
||||||
|
await sleep(200);
|
||||||
|
log.info("数量拉满");
|
||||||
|
click(460, 1010);
|
||||||
|
await sleep(200);
|
||||||
|
log.info("启动!");
|
||||||
|
click(1750, 1020);
|
||||||
|
await sleep(200);
|
||||||
|
log.info("启动!!!");
|
||||||
|
click(1200, 750);
|
||||||
|
await sleep(200);
|
||||||
|
await genshin.returnMainUi();
|
||||||
|
} else {
|
||||||
|
log.error(`未找到${ore},请检查背包内是否拥有该矿石!`);
|
||||||
|
throw new Error(`未找到${ore}`);
|
||||||
|
}
|
||||||
|
log.info(`当前时间: ${new Date().toLocaleString()}`);
|
||||||
|
let collectionTime = new Date().getTime() + 7 * 24 * 60 * 60 * 1000;
|
||||||
|
log.info(`领取时间: ${new Date(collectionTime).toLocaleString()}`);
|
||||||
|
await file.WriteTextSync("time.txt", collectionTime.toString());
|
||||||
|
log.info("时间保存成功");
|
||||||
|
} else if (type == "收集") {
|
||||||
|
const content = file.readTextSync("time.txt");
|
||||||
|
log.info(`读取领取时间成功`);
|
||||||
|
const readableTime = new Date(parseInt(content)).toLocaleString();
|
||||||
|
log.info(`领取时间: ${readableTime}`);
|
||||||
|
const now = new Date().getTime();
|
||||||
|
if (now < parseInt(content)) {
|
||||||
|
log.error("还没到领取时间");
|
||||||
|
throw new Error(`还没到领取时间,领取时间: ${readableTime}`);
|
||||||
|
}
|
||||||
|
let captureRegion = captureGameRegion();
|
||||||
|
let resList = captureRegion.findMulti(RecognitionObject.ocr(1210, 510, 210, 50));
|
||||||
|
for (let i = 0; i < resList.count; i++) {
|
||||||
|
let res = resList[i];
|
||||||
|
if (!res.text.includes("晶蝶") || !res.text.includes("诱捕") || !res.text.includes("装置")) {
|
||||||
|
log.error("当前光标不是晶蝶诱捕装置");
|
||||||
|
throw new Error("当前光标不是晶蝶诱捕装置");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
log.info("收获晶蝶");
|
||||||
|
keyPress("F");
|
||||||
|
await file.WriteTextSync("time.txt", "");
|
||||||
|
await sleep(3000);
|
||||||
|
keyPress("VK_ESCAPE");
|
||||||
|
} else {
|
||||||
|
throw new Error("不是吧,哥们,你配置好了吗?放置还是收集啊?");
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
log.error(`执行脚本时出错:${e}`, e.message);
|
||||||
|
}
|
||||||
|
})();
|
||||||
16
repo/js/CrystalflyTrap/manifest.json
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
{
|
||||||
|
"manifest_version": 1,
|
||||||
|
"name": "晶蝶诱捕装置",
|
||||||
|
"version": "1.0",
|
||||||
|
"bgi_version": "0.44.3",
|
||||||
|
"description": "自动放置和收集晶蝶诱捕装置。\n\n----------使用说明----------\n●BetterGI 版本必须大于0.44.3,低于此版本无法使用!\n●请在调度器内添加两次脚本,一个收集,一个放置。\n●请确保背包内有「晶蝶诱捕装置」。\n●晶蝶诱捕装置放在枫丹冒险家协会锚点。\n●请确保背包内所选择的矿石数量大于30个。\n●请勿删除\"time.txt\"文件,里面保存的是收集奖励的时间,删除后将无法通过脚本领取晶核!",
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "ddaodan",
|
||||||
|
"link": "https://github.com/ddaodan"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"settings_ui": "settings.json",
|
||||||
|
"main": "main.js"
|
||||||
|
}
|
||||||
|
|
||||||
31
repo/js/CrystalflyTrap/settings.json
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
[
|
||||||
|
{
|
||||||
|
"name": "enable",
|
||||||
|
"type": "checkbox",
|
||||||
|
"label": "是否启用\n防止不加调度器运行"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "type",
|
||||||
|
"type": "select",
|
||||||
|
"label": "放置还是收集?",
|
||||||
|
"options": [
|
||||||
|
"放置",
|
||||||
|
"收集"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "ore",
|
||||||
|
"type": "select",
|
||||||
|
"label": "消耗的矿石,一次消耗30个",
|
||||||
|
"options": [
|
||||||
|
"铁块",
|
||||||
|
"白铁块",
|
||||||
|
"水晶块",
|
||||||
|
"魔晶块",
|
||||||
|
"星银矿石",
|
||||||
|
"紫晶块",
|
||||||
|
"萃凝晶"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
1
repo/js/CrystalflyTrap/time.txt
Normal file
@@ -0,0 +1 @@
|
|||||||
|
1744916234293
|
||||||