铁匠铺更新 (#829)

* Add files via upload

* 计算机js增加标签

* 铁匠铺原图片图换位

原图片替换为更准确细小的图片

* 铁匠铺更新2025.05.15

-   修复选择“萃凝晶”时无法识别的 bug。
-   仓库内新增标签。

* Delete repo/js/铁匠铺/readme(25.05.12).md
This commit is contained in:
呱呱z
2025-05-15 19:58:11 +08:00
committed by GitHub
parent f241fb3e02
commit ac20d4122b
10 changed files with 41 additions and 55 deletions

View File

@@ -3,6 +3,7 @@
"name": "计算机自动睡眠、关机等操作",
"version": "1.0",
"description": "计算机的自动关机、注销、休眠等操作(默认注销)",
"tags": ["计算机", "关机", "注销", "休眠", "重启"],
"authors": [
{
"name": "呱呱z",

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.7 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.7 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

@@ -53,24 +53,17 @@
function recognizeImage(imagePath, x, y, searchWidth, searchHeight) {
try {
let template = file.ReadImageMatSync(imagePath);
let recognitionObject = RecognitionObject.TemplateMatch(
template,
x,
y,
searchWidth,
searchHeight
);
let recognitionObject = RecognitionObject.TemplateMatch(template, x, y, searchWidth, searchHeight);
// 设置识别阈值和通道
recognitionObject.threshold = 0.9; // 设置识别阈值
/* prettier-ignore */
recognitionObject.threshold = 0.85; // 设置识别阈值
recognitionObject.Use3Channels = true; // 使用三通道匹配
let result = captureGameRegion().find(recognitionObject);
return result.isExist() ? result : null;
} catch (error) {
log.error(
`图像识别失败,路径: ${imagePath}, 错误: ${error.message}`
);
log.error(`图像识别失败,路径: ${imagePath}, 错误: ${error.message}`);
return null;
}
}
@@ -102,31 +95,27 @@
// 锻造矿石操作
const forgeOre = async function (smithyName) {
await sleep(1000);
keyPress("F");
await sleep(1000); // 开始交互
await click(960, 600);
await sleep(1000); // 跳过第一个对话
await click(960, 600);
await sleep(1000); // 跳过第一个对话
await click(1375, 500);
await sleep(1000);
await click(960, 600);
await sleep(1000); // 跳过第二个对话
await click(960, 600);
await sleep(1000); // 跳过第二个对话
// 对话
/* prettier-ignore */
{
await sleep(1000);keyPress("F"); // 开始交互
await sleep(1000);await click(960, 600); //
await sleep(1000);await click(960, 600); // 跳过第一个对话
await sleep(1000);await click(1375, 500); // 跳过第一个对话
await sleep(1000);await click(960, 600);await sleep(1000); // 跳过第二个对话
await click(960, 600);await sleep(1000); // 跳过第二个对话
}
log.info("已进入锻造界面,准备锻造");
// 锻造领取
await click(520, 140);
await sleep(1000); // 选择锻造队列
await click(170, 1010);
await sleep(1000); // 领取全部
await click(960, 900);
await sleep(1000); // 确认
/* prettier-ignore */
{
await click(520, 140);await sleep(1000); // 选择锻造队列
await click(170, 1010);await sleep(1000); // 领取全部
await click(960, 900);await sleep(1000); // 确认
click(220, 150);await sleep(1000); // 点击"配方"
}
click(220, 150);
await sleep(1000); // 点击"配方"
determineOre();
// 根据用户选择的矿石进行锻造
@@ -141,27 +130,18 @@
for (const coordinate of gridCoordinates) {
const scanX = coordinate.x + scanOffset.x;
const scanY = coordinate.y + scanOffset.y;
const imageResult = recognizeImage(imagePath, scanX, scanY, 70, 70);
const imageResult = recognizeImage(
imagePath,
scanX,
scanY,
70,
70
);
if (imageResult) {
log.info(`通过图像识别找到矿石: ${chineseDescription}`);
imageResult.click();
await sleep(2000); // 等待点击生效
foundIngredient = true;
/* prettier-ignore */
// 点击“开始锻造”3次
click(1645, 1015);
await sleep(1500);
click(1645, 1015);
await sleep(1500);
click(1645, 1015);
await sleep(1500);
{ await sleep(1000); click(1645, 1015); await sleep(1000); click(1645, 1015); await sleep(1000); }
break; // 找到矿石后退出循环
}
}
@@ -174,12 +154,11 @@
log.info("锻造结束,退出界面");
keyPress("ESCAPE");
};
await autoSmithy(smithyName); //寻路函数
await forgeOre(smithyName);
await autoSmithy(smithyName); // 寻路函数
await forgeOre(smithyName); // 锻造函数
await genshin.returnMainUi(); // 返回主界面
keyDown("S");
await sleep(1000);
keyUp("S");
await sleep(1000);
/* prettier-ignore */
{keyDown("S");await sleep(1000);keyUp("S");await sleep(1000); } // 后退两步
})();

View File

@@ -1,8 +1,10 @@
{
"manifest_version": 1,
"name": "自动锻造魔矿(识图)",
"version": "1.2(2025.05.12版)",
"description": "自动选择铁匠铺和使用矿物去锻造魔矿。\n使用前请阅读“readme”文件\n鸣谢:寒露,蜜柑魚",
"version": "1.3(2025.05.15版)",
"bgi_version": "0.44.0",
"description": "自动选择铁匠铺和使用矿物去锻造精锻矿。\n使用前请阅读“readme”文件。\n鸣谢:寒露,蜜柑魚",
"tags": ["铁匠铺", "锻造", "精锻用矿"],
"authors": [
{
"name": "呱呱z"

View File

@@ -50,8 +50,12 @@
## 更新日志
### 1.2
### 1.22025.05.15
- 修复选择“萃凝晶”时无法识别的问题
- 仓库内新增标签。
### 1.22025.05.12
- 修复选择“萃凝晶”时无法识别的 bug
### 1.1
### 1.12025.05.01
- 优化矿石选取方式,改用识图模式