|
Before Width: | Height: | Size: 6.8 KiB After Width: | Height: | Size: 2.8 KiB |
|
Before Width: | Height: | Size: 7.0 KiB After Width: | Height: | Size: 2.9 KiB |
|
Before Width: | Height: | Size: 6.8 KiB After Width: | Height: | Size: 2.7 KiB |
|
Before Width: | Height: | Size: 6.1 KiB After Width: | Height: | Size: 2.7 KiB |
|
Before Width: | Height: | Size: 6.1 KiB After Width: | Height: | Size: 2.8 KiB |
|
Before Width: | Height: | Size: 6.3 KiB After Width: | Height: | Size: 3.1 KiB |
@@ -12,7 +12,6 @@
|
|||||||
// 定义矿物名称和图片文件名的映射表
|
// 定义矿物名称和图片文件名的映射表
|
||||||
const ingredientImageMap = {
|
const ingredientImageMap = {
|
||||||
萃凝晶: "assets/Picture/CondessenceCrystal.png",
|
萃凝晶: "assets/Picture/CondessenceCrystal.png",
|
||||||
|
|
||||||
紫晶块: "assets/Picture/AmethystLump.png",
|
紫晶块: "assets/Picture/AmethystLump.png",
|
||||||
水晶块: "assets/Picture/CrystalChunk.png",
|
水晶块: "assets/Picture/CrystalChunk.png",
|
||||||
星银矿石: "assets/Picture/Starsilver.png",
|
星银矿石: "assets/Picture/Starsilver.png",
|
||||||
@@ -44,8 +43,8 @@
|
|||||||
// 计算每个行列组合的坐标
|
// 计算每个行列组合的坐标
|
||||||
for (const row of rows) {
|
for (const row of rows) {
|
||||||
for (const col of cols) {
|
for (const col of cols) {
|
||||||
const ProcessingX = Math.round(135 + (col - 1) * 145);
|
const ProcessingX = Math.round(150 + (col - 1) * 145);
|
||||||
const ProcessingY = Math.round(245 + (row - 1) * 170);
|
const ProcessingY = Math.round(230 + (row - 1) * 170);
|
||||||
gridCoordinates.push({ row, col, x: ProcessingX, y: ProcessingY });
|
gridCoordinates.push({ row, col, x: ProcessingX, y: ProcessingY });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -63,13 +62,15 @@
|
|||||||
);
|
);
|
||||||
|
|
||||||
// 设置识别阈值和通道
|
// 设置识别阈值和通道
|
||||||
recognitionObject.threshold = 0.9; // 设置识别阈值为 0.9
|
recognitionObject.threshold = 0.9; // 设置识别阈值
|
||||||
recognitionObject.Use3Channels = true; // 使用三通道匹配
|
recognitionObject.Use3Channels = true; // 使用三通道匹配
|
||||||
|
|
||||||
let result = captureGameRegion().find(recognitionObject);
|
let result = captureGameRegion().find(recognitionObject);
|
||||||
return result.isExist() ? result : null;
|
return result.isExist() ? result : null;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
log.error(`图像识别失败,路径: ${imagePath}, 错误: ${error.message}`);
|
log.error(
|
||||||
|
`图像识别失败,路径: ${imagePath}, 错误: ${error.message}`
|
||||||
|
);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -141,7 +142,13 @@
|
|||||||
const scanX = coordinate.x + scanOffset.x;
|
const scanX = coordinate.x + scanOffset.x;
|
||||||
const scanY = coordinate.y + scanOffset.y;
|
const scanY = coordinate.y + scanOffset.y;
|
||||||
|
|
||||||
const imageResult = recognizeImage(imagePath, scanX, scanY, 70, 70);
|
const imageResult = recognizeImage(
|
||||||
|
imagePath,
|
||||||
|
scanX,
|
||||||
|
scanY,
|
||||||
|
70,
|
||||||
|
70
|
||||||
|
);
|
||||||
if (imageResult) {
|
if (imageResult) {
|
||||||
log.info(`通过图像识别找到矿石: ${chineseDescription}`);
|
log.info(`通过图像识别找到矿石: ${chineseDescription}`);
|
||||||
imageResult.click();
|
imageResult.click();
|
||||||
@@ -150,11 +157,11 @@
|
|||||||
|
|
||||||
// 点击“开始锻造”3次
|
// 点击“开始锻造”3次
|
||||||
click(1645, 1015);
|
click(1645, 1015);
|
||||||
await sleep(3000);
|
await sleep(1500);
|
||||||
click(1645, 1015);
|
click(1645, 1015);
|
||||||
await sleep(3000);
|
await sleep(1500);
|
||||||
click(1645, 1015);
|
click(1645, 1015);
|
||||||
await sleep(3000);
|
await sleep(1500);
|
||||||
break; // 找到矿石后退出循环
|
break; // 找到矿石后退出循环
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -169,4 +176,10 @@
|
|||||||
};
|
};
|
||||||
await autoSmithy(smithyName); //寻路函数
|
await autoSmithy(smithyName); //寻路函数
|
||||||
await forgeOre(smithyName);
|
await forgeOre(smithyName);
|
||||||
|
|
||||||
|
await genshin.returnMainUi(); // 返回主界面
|
||||||
|
keyDown("S");
|
||||||
|
await sleep(1000);
|
||||||
|
keyUp("S");
|
||||||
|
await sleep(1000);
|
||||||
})();
|
})();
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
{
|
{
|
||||||
"manifest_version": 1,
|
"manifest_version": 1,
|
||||||
"name": "自动锻造魔矿",
|
"name": "自动锻造魔矿(识图)",
|
||||||
"version": "1.1(2025.05.01版)",
|
"version": "1.2(2025.05.12版)",
|
||||||
"description": "自动选择铁匠铺和使用矿物去锻造魔矿。\n注1:默认选择枫丹铁匠铺,可选择其他地区铁匠铺。由于地图追踪功能不支持室内定位,所以不支持纳塔铁匠铺;\n注2:可选使用水晶矿(默认)、紫晶矿、萃凝晶。\n鸣谢:寒露,蜜柑魚",
|
"description": "自动选择铁匠铺和使用矿物去锻造魔矿。\n使用前请阅读“readme”文件\n鸣谢:寒露,蜜柑魚",
|
||||||
"authors": [
|
"authors": [
|
||||||
{
|
{
|
||||||
"name": "呱呱z"
|
"name": "呱呱z"
|
||||||
|
|||||||
57
repo/js/铁匠铺/readme(25.05.12).md
Normal file
@@ -0,0 +1,57 @@
|
|||||||
|
// ==UserScript==
|
||||||
|
// @name 自动锻造魔矿脚本
|
||||||
|
// @version 1.2
|
||||||
|
// @description 自动前往铁匠铺并锻造魔矿,通过识图模式自动选择矿石
|
||||||
|
// @author 呱呱 z
|
||||||
|
// @match 原神版本:5.6;BGI 版本:0.45.1
|
||||||
|
// ==/UserScript==
|
||||||
|
|
||||||
|
/**
|
||||||
|
* === 重要免责声明 ===
|
||||||
|
* 1. 使用风险
|
||||||
|
* - 本脚本为开源学习项目,禁止用于商业用途或违反游戏条款的行为。
|
||||||
|
* - 滥用可能导致游戏账号封禁,开发者不承担任何直接或间接责任。
|
||||||
|
*
|
||||||
|
* 2. 责任限制
|
||||||
|
* - 本脚本按“现状”提供,不承诺兼容性、安全性或功能完整性。
|
||||||
|
* - 因使用本脚本导致的账号、数据、设备损失,开发者概不负责。
|
||||||
|
*
|
||||||
|
* 3. 禁止条款
|
||||||
|
* - 严禁逆向工程、恶意篡改或用于外挂等非法用途。
|
||||||
|
* - 如游戏运营商提出要求,开发者保留随时停止维护的权利。
|
||||||
|
*
|
||||||
|
* 使用即表示您已阅读并同意上述条款。
|
||||||
|
*
|
||||||
|
* Last Updated: 2025-05-12
|
||||||
|
*/
|
||||||
|
|
||||||
|
# 自动锻造魔矿脚本
|
||||||
|
|
||||||
|
## 简介
|
||||||
|
本脚本可自动前往铁匠铺并锻造魔矿,利用识图模式智能选择需要的矿石,让自定义操作更加便捷。
|
||||||
|
|
||||||
|
## 文件结构
|
||||||
|
- **main.js**:负责核心业务逻辑,包括前往铁匠铺和执行锻造任务。
|
||||||
|
- **manifest.json**:脚本配置文件,记录基本信息和设置。
|
||||||
|
- **settings.json**:用户配置文件,用于选择目标铁匠铺和指定矿石。
|
||||||
|
|
||||||
|
## 使用方法
|
||||||
|
1. 将脚本添加至调度器。
|
||||||
|
2. 右键点击脚本以修改JS自定义配置。
|
||||||
|
3. 在配置文件中选择目标城市的铁匠铺(默认选择枫丹铁匠铺),并设定所需矿石(默认:水晶矿)。
|
||||||
|
- 注意:由于地图追踪功能尚不支持室内定位,故纳塔铁匠铺不可用。
|
||||||
|
- 可选矿石:
|
||||||
|
- 默认:水晶矿
|
||||||
|
- 其他:紫晶矿、萃凝晶
|
||||||
|
- 如需使用“星银矿石”、“白铁块”或“铁块”,请打开 `settings.json`,删除对应矿石前的 `//` 注释后保存配置。
|
||||||
|
|
||||||
|
## 后言
|
||||||
|
本脚本目前处于测试阶段,欢迎反馈问题至 QQ:1765137214。
|
||||||
|
|
||||||
|
## 更新日志
|
||||||
|
|
||||||
|
### 1.2
|
||||||
|
- 修复选择“萃凝晶”时无法识别的 bug
|
||||||
|
|
||||||
|
### 1.1
|
||||||
|
- 优化矿石选取方式,改用识图模式
|
||||||