铁匠铺更新 (#829)
* Add files via upload * 计算机js增加标签 * 铁匠铺原图片图换位 原图片替换为更准确细小的图片 * 铁匠铺更新2025.05.15 - 修复选择“萃凝晶”时无法识别的 bug。 - 仓库内新增标签。 * Delete repo/js/铁匠铺/readme(25.05.12).md
@@ -3,6 +3,7 @@
|
|||||||
"name": "计算机自动睡眠、关机等操作",
|
"name": "计算机自动睡眠、关机等操作",
|
||||||
"version": "1.0",
|
"version": "1.0",
|
||||||
"description": "计算机的自动关机、注销、休眠等操作(默认注销)",
|
"description": "计算机的自动关机、注销、休眠等操作(默认注销)",
|
||||||
|
"tags": ["计算机", "关机", "注销", "休眠", "重启"],
|
||||||
"authors": [
|
"authors": [
|
||||||
{
|
{
|
||||||
"name": "呱呱z",
|
"name": "呱呱z",
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 2.8 KiB After Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 2.7 KiB After Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 2.7 KiB After Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 2.8 KiB After Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 3.1 KiB After Width: | Height: | Size: 1.3 KiB |
@@ -53,24 +53,17 @@
|
|||||||
function recognizeImage(imagePath, x, y, searchWidth, searchHeight) {
|
function recognizeImage(imagePath, x, y, searchWidth, searchHeight) {
|
||||||
try {
|
try {
|
||||||
let template = file.ReadImageMatSync(imagePath);
|
let template = file.ReadImageMatSync(imagePath);
|
||||||
let recognitionObject = RecognitionObject.TemplateMatch(
|
let recognitionObject = RecognitionObject.TemplateMatch(template, x, y, searchWidth, searchHeight);
|
||||||
template,
|
|
||||||
x,
|
|
||||||
y,
|
|
||||||
searchWidth,
|
|
||||||
searchHeight
|
|
||||||
);
|
|
||||||
|
|
||||||
// 设置识别阈值和通道
|
// 设置识别阈值和通道
|
||||||
recognitionObject.threshold = 0.9; // 设置识别阈值
|
/* prettier-ignore */
|
||||||
|
recognitionObject.threshold = 0.85; // 设置识别阈值
|
||||||
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(
|
log.error(`图像识别失败,路径: ${imagePath}, 错误: ${error.message}`);
|
||||||
`图像识别失败,路径: ${imagePath}, 错误: ${error.message}`
|
|
||||||
);
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -102,31 +95,27 @@
|
|||||||
|
|
||||||
// 锻造矿石操作
|
// 锻造矿石操作
|
||||||
const forgeOre = async function (smithyName) {
|
const forgeOre = async function (smithyName) {
|
||||||
await sleep(1000);
|
// 对话
|
||||||
keyPress("F");
|
/* prettier-ignore */
|
||||||
await sleep(1000); // 开始交互
|
{
|
||||||
await click(960, 600);
|
await sleep(1000);keyPress("F"); // 开始交互
|
||||||
await sleep(1000); // 跳过第一个对话
|
await sleep(1000);await click(960, 600); //
|
||||||
await click(960, 600);
|
await sleep(1000);await click(960, 600); // 跳过第一个对话
|
||||||
await sleep(1000); // 跳过第一个对话
|
await sleep(1000);await click(1375, 500); // 跳过第一个对话
|
||||||
await click(1375, 500);
|
await sleep(1000);await click(960, 600);await sleep(1000); // 跳过第二个对话
|
||||||
await sleep(1000);
|
await click(960, 600);await sleep(1000); // 跳过第二个对话
|
||||||
await click(960, 600);
|
}
|
||||||
await sleep(1000); // 跳过第二个对话
|
|
||||||
await click(960, 600);
|
|
||||||
await sleep(1000); // 跳过第二个对话
|
|
||||||
|
|
||||||
log.info("已进入锻造界面,准备锻造");
|
log.info("已进入锻造界面,准备锻造");
|
||||||
// 锻造领取
|
// 锻造领取
|
||||||
await click(520, 140);
|
/* prettier-ignore */
|
||||||
await sleep(1000); // 选择锻造队列
|
{
|
||||||
await click(170, 1010);
|
await click(520, 140);await sleep(1000); // 选择锻造队列
|
||||||
await sleep(1000); // 领取全部
|
await click(170, 1010);await sleep(1000); // 领取全部
|
||||||
await click(960, 900);
|
await click(960, 900);await sleep(1000); // 确认
|
||||||
await sleep(1000); // 确认
|
click(220, 150);await sleep(1000); // 点击"配方"
|
||||||
|
}
|
||||||
|
|
||||||
click(220, 150);
|
|
||||||
await sleep(1000); // 点击"配方"
|
|
||||||
determineOre();
|
determineOre();
|
||||||
|
|
||||||
// 根据用户选择的矿石进行锻造
|
// 根据用户选择的矿石进行锻造
|
||||||
@@ -141,27 +130,18 @@
|
|||||||
for (const coordinate of gridCoordinates) {
|
for (const coordinate of gridCoordinates) {
|
||||||
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();
|
||||||
await sleep(2000); // 等待点击生效
|
await sleep(2000); // 等待点击生效
|
||||||
foundIngredient = true;
|
foundIngredient = true;
|
||||||
|
|
||||||
|
/* prettier-ignore */
|
||||||
// 点击“开始锻造”3次
|
// 点击“开始锻造”3次
|
||||||
click(1645, 1015);
|
{ await sleep(1000); click(1645, 1015); await sleep(1000); click(1645, 1015); await sleep(1000); }
|
||||||
await sleep(1500);
|
|
||||||
click(1645, 1015);
|
|
||||||
await sleep(1500);
|
|
||||||
click(1645, 1015);
|
|
||||||
await sleep(1500);
|
|
||||||
break; // 找到矿石后退出循环
|
break; // 找到矿石后退出循环
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -174,12 +154,11 @@
|
|||||||
log.info("锻造结束,退出界面");
|
log.info("锻造结束,退出界面");
|
||||||
keyPress("ESCAPE");
|
keyPress("ESCAPE");
|
||||||
};
|
};
|
||||||
await autoSmithy(smithyName); //寻路函数
|
|
||||||
await forgeOre(smithyName);
|
|
||||||
|
|
||||||
|
await autoSmithy(smithyName); // 寻路函数
|
||||||
|
await forgeOre(smithyName); // 锻造函数
|
||||||
await genshin.returnMainUi(); // 返回主界面
|
await genshin.returnMainUi(); // 返回主界面
|
||||||
keyDown("S");
|
|
||||||
await sleep(1000);
|
/* prettier-ignore */
|
||||||
keyUp("S");
|
{keyDown("S");await sleep(1000);keyUp("S");await sleep(1000); } // 后退两步
|
||||||
await sleep(1000);
|
|
||||||
})();
|
})();
|
||||||
|
|||||||
@@ -1,8 +1,10 @@
|
|||||||
{
|
{
|
||||||
"manifest_version": 1,
|
"manifest_version": 1,
|
||||||
"name": "自动锻造魔矿(识图)",
|
"name": "自动锻造魔矿(识图)",
|
||||||
"version": "1.2(2025.05.12版)",
|
"version": "1.3(2025.05.15版)",
|
||||||
"description": "自动选择铁匠铺和使用矿物去锻造魔矿。\n使用前请阅读“readme”文件\n鸣谢:寒露,蜜柑魚",
|
"bgi_version": "0.44.0",
|
||||||
|
"description": "自动选择铁匠铺和使用矿物去锻造精锻矿。\n使用前请阅读“readme”文件。\n鸣谢:寒露,蜜柑魚",
|
||||||
|
"tags": ["铁匠铺", "锻造", "精锻用矿"],
|
||||||
"authors": [
|
"authors": [
|
||||||
{
|
{
|
||||||
"name": "呱呱z"
|
"name": "呱呱z"
|
||||||
|
|||||||
@@ -50,8 +50,12 @@
|
|||||||
|
|
||||||
## 更新日志
|
## 更新日志
|
||||||
|
|
||||||
### 1.2
|
### 1.2(2025.05.15)
|
||||||
|
- 修复选择“萃凝晶”时无法识别的问题
|
||||||
|
- 仓库内新增标签。
|
||||||
|
|
||||||
|
### 1.2(2025.05.12)
|
||||||
- 修复选择“萃凝晶”时无法识别的 bug
|
- 修复选择“萃凝晶”时无法识别的 bug
|
||||||
|
|
||||||
### 1.1
|
### 1.1(2025.05.01)
|
||||||
- 优化矿石选取方式,改用识图模式
|
- 优化矿石选取方式,改用识图模式
|
||||||