-
Notifications
You must be signed in to change notification settings - Fork 333
铁匠铺2.4.0更新 #2426
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
铁匠铺2.4.0更新 #2426
Conversation
### 2.4.0`(2025-11-29)` - **优化**:纳塔铁匠铺路线可能出现跑过头的问题 - **新增**: 1. 支持月国铁匠铺,矿石虹滴晶的使用 2. 重构全新的矿石使用排序方式 3. 选择矿石排序为0时,可以排除对应矿石
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the 总览该PR将矿石选择系统从主要/次要/第三矿石结构重构为基于优先级的方案。在main.js中引入矿石优先级排序逻辑,更新设置和清单以支持四种矿石类型的数字优先级(0-4),为路径文件添加新的铁匠铺位置,并相应更新文档。 改动
代码审查工作量估计🎯 4 (复杂) | ⏱️ ~45 分钟 需要重点关注的区域:
诗
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
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. Comment |
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
There was a problem hiding this 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
⛔ Files ignored due to path filters (2)
repo/js/铁匠铺/assets/Picture/RainbowdropCrystal.pngis excluded by!**/*.pngrepo/js/铁匠铺/assets/RecognitionObject/ItemImage/RainbowdropCrystal.pngis 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)相反。如果两个函数在逻辑上都应该使用相同的排序方向,这种不一致可能导致预期外的行为。请确认此函数的使用位置和意图,并根据需要统一排序逻辑。
repo/js/铁匠铺/main.js
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
空值合并运算符使用不当
Number(value) ?? 0 的写法存在问题:Number() 不会返回 null 或 undefined,对于无效输入会返回 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.
| 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.
repo/js/铁匠铺/main.js
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
资源未释放导致内存泄漏
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.
| 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.
repo/js/铁匠铺/README.md
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
文件末尾内容不完整
文件以 **矿石优先级说明**: 结尾,但后面没有任何内容。这可能是意外遗留的不完整内容,建议删除或补充完整。
> 💡 提示:建议定期检查更新以获取最佳体验和最新功能
-
-**矿石优先级说明**:📝 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.
| > 💡 提示:建议定期检查更新以获取最佳体验和最新功能 | |
| **矿石优先级说明**: | |
| > 💡 提示:建议定期检查更新以获取最佳体验和最新功能 |
🤖 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.
修复背包界面内矿物识别不到的问题
|
上面ai找的错都修复一下 |
2.4.0
(2025-11-29)Summary by CodeRabbit
版本 2.4.0 发布说明
新功能
文档
✏️ Tip: You can customize this high-level summary in your review settings.