Skip to content

Conversation

@jidingcai
Copy link
Contributor

@jidingcai jidingcai commented Dec 2, 2025

2.4.0(2025-11-29)

  • 优化:纳塔铁匠铺路线可能出现跑过头的问题
  • 新增
    1. 支持月国铁匠铺,矿石虹滴晶的使用
    2. 重构全新的矿石使用排序方式
    3. 选择矿石排序为0时,可以排除对应矿石

Summary by CodeRabbit

版本 2.4.0 发布说明

  • 新功能

    • 矿石优先级配置系统:支持自定义矿石选择顺序(0表示禁用,1-4为优先级)
    • 新增虹滴晶矿石支持
    • 支持挪德卡莱铁匠铺位置
  • 文档

    • 更新矿石配置说明,详细说明优先级含义和约束条件

✏️ Tip: You can customize this high-level summary in your review settings.

### 2.4.0`(2025-11-29)`
- **优化**:纳塔铁匠铺路线可能出现跑过头的问题
- **新增**:
  1. 支持月国铁匠铺,矿石虹滴晶的使用
  2. 重构全新的矿石使用排序方式
  3. 选择矿石排序为0时,可以排除对应矿石
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 2, 2025

Important

Review skipped

Auto reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

总览

该PR将矿石选择系统从主要/次要/第三矿石结构重构为基于优先级的方案。在main.js中引入矿石优先级排序逻辑,更新设置和清单以支持四种矿石类型的数字优先级(0-4),为路径文件添加新的铁匠铺位置,并相应更新文档。

改动

内聚组 / 文件 改动摘要
文档与版本更新
repo/js/铁匠铺/README.md, repo/js/铁匠铺/manifest.json
将矿石配置说明从"扩展矿石配置"更新为"矿石优先级说明",新增优先级数值释义(0表示不使用,1-4越小越高)。版本从2.3.2升级至2.4.0,新增2.4.0更新日志条目。
矿石优先级系统
repo/js/铁匠铺/main.js, repo/js/铁匠铺/settings.json
引入两个新函数getSortedOresByPriority()getOreOrder()实现优先级排序。将设置键oresecondaryOretertiaryOre分别重命名为CondessenceCrystalCrystalChunkAmethystLump,添加RainbowdropCrystal新矿石。选项从矿石名称改为数字优先级0-4。增强OCR识别和错误处理日志,新增优先级全为0时的脚本停止验证。
路径与位置数据
repo/js/铁匠铺/assets/Pathing/挪德卡莱铁匠铺.json, repo/js/铁匠铺/assets/Pathing/纳塔铁匠铺.json
新增挪德卡莱铁匠铺位置文件(5个路径点),更新纳塔铁匠铺文件:bgi_version降至0.45.0,版本号升至1.1,位置点从2个扩展至3个并调整坐标与移动方式。设置中新增"挪德卡莱铁匠铺"选项。

代码审查工作量估计

🎯 4 (复杂) | ⏱️ ~45 分钟

需要重点关注的区域:

  • main.js 中的优先级排序逻辑:新增getSortedOresByPriority()getOreOrder()函数的正确性,特别是优先级过滤、顺序稳定性和级联逻辑
  • 挖矿流程集成:验证优先级系统与现有的矿石识别、UI交互和锻造流程的无缝集成
  • settings.json 的键名重构:确保所有配置键重命名在脚本中的引用已完全更新,无遗漏
  • 全为零优先级的验证:检查预运行验证逻辑是否正确拦截无效配置
  • 新路径文件的坐标准确性:确保两个JSON路径文件中的坐标值与游戏内实际位置匹配

🐰✨ 优先级排序的魔法,
把矿石整得齐又齐,
挪德卡莱铁匠铺登场,
虹滴晶也来凑热闹,
脚本2.4焕新彩!

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed PR标题清晰准确地反映了主要变更,明确标注了版本更新号2.4.0,与PR详述的多个功能更新(支持月国铁匠铺、矿石排序重构、矿石排除功能)以及manifest.json、settings.json、main.js等文件的版本号变更保持一致。
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@zaodonganqi
Copy link
Collaborator

@coderabbitai review

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 2, 2025

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
repo/js/铁匠铺/main.js (1)

256-262: 逗号运算符导致返回值错误

这里使用了逗号运算符,JavaScript 会返回逗号后的最后一个值(false),前面的对象会被创建但直接丢弃。调用方期望接收包含错误信息的对象,但实际收到的是 false

-            return {
-                ...resultTemplate,
-                attempts: attemptCount,
-                elapsed: Date.now() - startTime,
-                error: lastError?.message
-            },
-                false;
+            return {
+                ...resultTemplate,
+                success: false,
+                attempts: attemptCount,
+                elapsed: Date.now() - startTime,
+                error: lastError?.message
+            };
🧹 Nitpick comments (2)
repo/js/铁匠铺/README.md (1)

102-103: 文档行结构建议

第 102 行的内容较长,可以考虑拆分成多行以提高可读性。此外,根据静态分析提示,"模式一矿物识别部分" 中的 "模式一" 与 "矿物" 之间可能缺少量词(如 "的")。

repo/js/铁匠铺/main.js (1)

763-764: 不可达代码

getSortedOresByPriority 函数只返回有效的矿石名称字符串,因此 oreName 始终为真值,if (!oreName) continue; 永远不会执行。可以移除这个多余的检查。

                         for (const oreName of orderedOres) {
-                            if (!oreName) continue;
                             log.info(`按优先级尝试锻造矿石: ${oreName}`);
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6bac544 and ddd9bb9.

⛔ Files ignored due to path filters (2)
  • repo/js/铁匠铺/assets/Picture/RainbowdropCrystal.png is excluded by !**/*.png
  • repo/js/铁匠铺/assets/RecognitionObject/ItemImage/RainbowdropCrystal.png is excluded by !**/*.png
📒 Files selected for processing (6)
  • repo/js/铁匠铺/README.md (5 hunks)
  • repo/js/铁匠铺/assets/Pathing/挪德卡莱铁匠铺.json (1 hunks)
  • repo/js/铁匠铺/assets/Pathing/纳塔铁匠铺.json (1 hunks)
  • repo/js/铁匠铺/main.js (15 hunks)
  • repo/js/铁匠铺/manifest.json (2 hunks)
  • repo/js/铁匠铺/settings.json (3 hunks)
🧰 Additional context used
🪛 Biome (2.1.2)
repo/js/铁匠铺/main.js

[error] 763-763: This code is unreachable

(lint/correctness/noUnreachable)

🪛 LanguageTool
repo/js/铁匠铺/README.md

[uncategorized] ~102-~102: 数词与名词之间一般应存在量词,可能缺少量词。
Context: ...保快捷键为默认值。例如纳塔铁匠铺以及仅领取锻造前检查,使用地图快捷键"M";模式一矿物识别部分,使用背包快捷键"B"。因为模式一调用了OCR,数字识别部分可能出现错误...

(wa5)

🔇 Additional comments (9)
repo/js/铁匠铺/manifest.json (1)

1-30: LGTM!

版本号更新到 2.4.0,与 README 中的更新日志一致。

repo/js/铁匠铺/assets/Pathing/挪德卡莱铁匠铺.json (1)

1-67: LGTM!

新增的挪德卡莱铁匠铺路径文件结构正确,位置点配置合理,移动模式(walk → fly → run → run → dash)符合导航逻辑。

repo/js/铁匠铺/assets/Pathing/纳塔铁匠铺.json (1)

20-47: 路径优化符合预期

新增的中间路径点可以帮助解决"跑过头"的问题。请确认第一个位置点从 teleport 类型改为 path 类型是否符合预期,这意味着角色不会先传送到起点。

repo/js/铁匠铺/settings.json (1)

42-93: 矿石配置重构

新的矿石优先级配置系统设计合理,0-4 的数值范围清晰易懂。需要注意这是一个破坏性变更,现有用户的旧配置(使用矿石名称)将不再兼容。

请确认 main.js 中是否有处理旧配置格式的兼容逻辑,或者用户是否需要手动重新配置。

repo/js/铁匠铺/main.js (5)

5-8: LGTM!

矿石优先级配置变量定义正确,与 settings.json 中的键名和默认值保持一致。


244-249: LGTM!

增加了 dispose 的错误处理,避免资源释放异常影响主流程。


297-351: LGTM!

矿石排序函数逻辑正确:过滤优先级大于 0 的矿石,按优先级升序排序,同优先级时按预定义顺序决定先后。去重逻辑虽然在当前场景下冗余(因为输入键本身唯一),但作为防御性编程可以保留。


833-849: LGTM!

添加了所有矿石优先级为 0 时的检查,及时停止脚本并给出清晰的错误提示,避免用户困惑。


364-373: getOreOrder 函数的排序方向不一致,建议确认是否被使用

getOreOrder 函数的排序方向(降序:pb - pa)与 getSortedOresByPriority 函数(升序:pa - pb)相反。如果两个函数在逻辑上都应该使用相同的排序方向,这种不一致可能导致预期外的行为。请确认此函数的使用位置和意图,并根据需要统一排序逻辑。

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

空值合并运算符使用不当

Number(value) ?? 0 的写法存在问题:Number() 不会返回 nullundefined,对于无效输入会返回 NaN。而 ?? 运算符只检查 null/undefined,不检查 NaN,所以 NaN ?? 0 的结果是 NaN 而非 0

建议使用 || 0 或显式处理 NaN

 const orePriorityConfig = {
-    "萃凝晶": Number(CondessenceCrystal) ?? 0,
-    "水晶块": Number(CrystalChunk) ?? 0,
-    "紫晶块": Number(AmethystLump) ?? 0,
-    "虹滴晶": Number(RainbowdropCrystal) ?? 0
+    "萃凝晶": Number(CondessenceCrystal) || 0,
+    "水晶块": Number(CrystalChunk) || 0,
+    "紫晶块": Number(AmethystLump) || 0,
+    "虹滴晶": Number(RainbowdropCrystal) || 0
 };
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const orePriorityConfig = {
"萃凝晶": Number(CondessenceCrystal) ?? 0,
"水晶块": Number(CrystalChunk) ?? 0,
"紫晶块": Number(AmethystLump) ?? 0,
"虹滴晶": Number(RainbowdropCrystal) ?? 0
};
const orePriorityConfig = {
"萃凝晶": Number(CondessenceCrystal) || 0,
"水晶块": Number(CrystalChunk) || 0,
"紫晶块": Number(AmethystLump) || 0,
"虹滴晶": Number(RainbowdropCrystal) || 0
};
🤖 Prompt for AI Agents
In repo/js/铁匠铺/main.js around lines 354-359, the expressions using Number(value)
?? 0 are incorrect because Number(...) yields NaN for invalid input and the
nullish coalescing operator (??) does not handle NaN; replace these with a safe
fallback such as using logical OR (Number(value) || 0) or an explicit
finite-number check (use Number.isFinite(Number(value)) ? Number(value) : 0) so
NaN becomes 0 while preserving valid numeric values.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

资源未释放导致内存泄漏

captureGameRegion() 的返回值未调用 dispose() 释放资源。此外,这里创建的 ocrResults 变量似乎未被使用。

             const ocrRegion = { x: 185, y: 125, width: 670 - 185, height: 175 - 125 };
-            let ocrResults = captureGameRegion().find(
+            let tempRo = captureGameRegion();
+            let ocrResults = tempRo.find(
                 RecognitionObject.ocr(ocrRegion.x, ocrRegion.y, ocrRegion.width, ocrRegion.height)
             );
+            tempRo.dispose();

如果 ocrResults 确实未使用,建议删除这段代码。

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const ocrRegion = { x: 185, y: 125, width: 670 - 185, height: 175 - 125 };
let ocrResults = captureGameRegion().find(
RecognitionObject.ocr(ocrRegion.x, ocrRegion.y, ocrRegion.width, ocrRegion.height)
);
const ocrRegion = { x: 185, y: 125, width: 670 - 185, height: 175 - 125 };
let tempRo = captureGameRegion();
let ocrResults = tempRo.find(
RecognitionObject.ocr(ocrRegion.x, ocrRegion.y, ocrRegion.width, ocrRegion.height)
);
tempRo.dispose();
🤖 Prompt for AI Agents
In repo/js/铁匠铺/main.js around lines 700 to 703, captureGameRegion()'s returned
object is never disposed (causing a resource/memory leak) and the created
ocrResults variable appears unused; either call dispose() on the capture result
after use or, if ocrResults is truly unnecessary, remove the whole capture/ocr
call block; if you need OCR, assign the capture to a variable, use it, then call
its dispose() in a finally block or after processing to ensure resources are
freed.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

文件末尾内容不完整

文件以 **矿石优先级说明**: 结尾,但后面没有任何内容。这可能是意外遗留的不完整内容,建议删除或补充完整。

 > 💡 提示:建议定期检查更新以获取最佳体验和最新功能
-
-**矿石优先级说明**:
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
> 💡 提示:建议定期检查更新以获取最佳体验和最新功能
**矿石优先级说明**
> 💡 提示:建议定期检查更新以获取最佳体验和最新功能
🤖 Prompt for AI Agents
In repo/js/铁匠铺/README.md around lines 182-184 the README ends with an orphaned
heading "**矿石优先级说明**:" with no following content; fix this by either removing
the heading if it was left by mistake, or replace it with the intended content
describing ore priority (brief explanation, rules or table/examples) so the
document no longer ends abruptly.

修复背包界面内矿物识别不到的问题
@zaodonganqi
Copy link
Collaborator

上面ai找的错都修复一下

@zaodonganqi zaodonganqi marked this pull request as draft December 2, 2025 13:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants