Js脚本:角色养成一条龙Pro版#3068
Hidden character warning
Conversation
由原来的角色养成一条龙改编,该项目是一个自动养成角色的脚本,它可以自动获取养成角色的材料,包括刷取天赋和武器(的秘境材料、怪物材料)、BOSS 材料,地图追踪采集区域特产与魔物材料、经验书、摩拉等。
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Walkthrough添加了一个完整的新项目"角色养成一条龙Pro版",这是一个全自动游戏辅助脚本,支持角色识别、材料计算、秘境自动刷取、地脉花管理、多账号支持等核心功能,包含丰富的配置数据、库模块和主程序入口。 Changes
Sequence Diagram(s)sequenceDiagram
participant Main as Main Script
participant TaskMgr as TaskManager
participant Farming as Farming Module
participant Inventory as Inventory
participant Calculator as Calculator
participant Navigation as Navigation
participant Game as Game UI
Main->>TaskMgr: loadCompletedTasks()
TaskMgr-->>Main: tasks{}
Main->>Inventory: queryStaminaValue()
Inventory->>Game: Open UI, OCR stamina
Game-->>Inventory: stamina value
Inventory-->>Main: current stamina
Main->>Calculator: calculateExpBookRequirements()
Calculator-->>Main: exp needed, run counts
alt Task Not Completed
Main->>Farming: getTalentBook(bookName, counts)
Farming->>Navigation: gotoAutoDomain(domain, party)
Navigation->>Game: Enter domain
Game-->>Navigation: domain opened
Navigation-->>Farming: domain ready
Farming->>Game: Run domain auto-fight
Game-->>Farming: domain complete
Farming->>TaskMgr: addCompletedTask()
TaskMgr-->>Main: task marked done
end
Main->>Main: runMaterialCollection()
Main->>Game: Execute pathing scripts
Game-->>Main: collection complete
Estimated code review effort🎯 5 (Critical) | ⏱️ ~120 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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.
Actionable comments posted: 4
Note
Due to the large number of review comments, Critical severity comments were prioritized as inline comments.
🟠 Major comments (19)
repo/js/角色养成一条龙Pro版/assets/goToBoss/雷音权现前往.json-1-3 (1)
1-3:⚠️ Potential issue | 🟠 Major文件名与配置名称不一致
文件名为
雷音权现前往.json,但配置中的name字段为"雷音权观前往"("观"与"现"不一致)。根据原神游戏中的 BOSS 名称,正确的应为"雷音权现"。这种不一致可能导致:
- 程序无法正确识别或加载该配置文件
- 用户界面显示名称与实际配置不匹配
🔧 建议修正
{ "info": { - "name": "雷音权观前往", + "name": "雷音权现前往", "type": "collect",🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@repo/js/角色养成一条龙Pro版/assets/goToBoss/雷音权现前往.json` around lines 1 - 3, The "name" field in the JSON ("雷音权观前往") mismatches the filename and correct boss name; update the name property in the JSON (the "name" key inside this file) to "雷音权现前往" so the configuration matches the filename and the in-game boss name.repo/js/角色养成一条龙Pro版/assets/goToBoss/古岩龙蜥前往.json-2-8 (1)
2-8:⚠️ Potential issue | 🟠 Major修正 info 元数据结构的不一致性
此文件的
info结构与其他同目录文件存在以下不一致:
- 字段名不一致:使用
"author"(Line 5) 而非"authors"数组(其他所有文件均使用authors数组)- 缺失标准字段:缺少其他文件中存在的字段:
map_name(应为"Teyvat"或其他地图名)tags数组last_modified_time时间戳enable_monster_loot_split布尔标志这些不一致可能导致运行时解析器无法正确处理此配置文件。
🔧 建议的结构修正
{ "info": { "name": "前往古岩龙蜥", "type": "collect", - "author": "柒叶子", + "authors": [ + { + "name": "柒叶子", + "links": "" + } + ], "version": "1.0", "description": "前往古岩龙蜥", - "bgi_version": "0.42.3" + "map_name": "Teyvat", + "bgi_version": "0.42.3", + "tags": [], + "last_modified_time": 1753793052904, + "enable_monster_loot_split": false },🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@repo/js/角色养成一条龙Pro版/assets/goToBoss/古岩龙蜥前往.json` around lines 2 - 8, Update the "info" object in the JSON: replace the singular "author" field with an "authors" array (e.g., ["柒叶子"]) and add the missing standard fields inside the same "info" object — include "map_name" (e.g., "Teyvat"), "tags" (an array of relevant tags), "last_modified_time" (a timestamp string/ISO), and "enable_monster_loot_split" (true/false) so the structure matches other files; ensure field names and types exactly match the existing convention used across the directory.repo/js/角色养成一条龙Pro版/assets/goToBoss/掣电树前往.json-44-45 (1)
44-45:⚠️ Potential issue | 🟠 Major这里的
stop_flying也缺少参数,建议与其他路线保持一致。为避免执行器对空参数产生非预期行为,建议填入明确时长(毫秒)或去掉该动作。
🔧 建议修复
- "action": "stop_flying", - "action_params": "" + "action": "stop_flying", + "action_params": "1000"🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@repo/js/角色养成一条龙Pro版/assets/goToBoss/掣电树前往.json` around lines 44 - 45, The "stop_flying" action in the JSON entry currently has an empty "action_params" which may cause unexpected behavior; update the "stop_flying" item so its "action_params" matches other routes by either supplying an explicit duration in milliseconds (e.g., a numeric timeout) or removing the entire "stop_flying" action; locate the object with "action": "stop_flying" and set a concrete parameter value (or delete that action node) to ensure the executor receives consistent, non-empty parameters.repo/js/角色养成一条龙Pro版/assets/goToBoss/爆炎树前往.json-44-45 (1)
44-45:⚠️ Potential issue | 🟠 Major
stop_flying缺少参数,建议显式填写action_params。这里触发了
stop_flying,但参数为空字符串。若执行器按数值解析停飞时长,可能出现默认值异常或动作时序不稳定。🔧 建议修复
- "action": "stop_flying", - "action_params": "" + "action": "stop_flying", + "action_params": "1000"🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@repo/js/角色养成一条龙Pro版/assets/goToBoss/爆炎树前往.json` around lines 44 - 45, The "stop_flying" action currently has an empty "action_params" which can cause default/ timing issues; update the entry with an explicit parameter (e.g., a duration or required options) in the "action_params" field so the executor gets a deterministic value. Locate the JSON object where "action": "stop_flying" and set "action_params" to the expected format used by the runner (for example a numeric duration like "1" or a serialized object like "{\"duration\":0}") ensuring it matches the executor's schema.repo/js/角色养成一条龙Pro版/data/Mapping.json-219-283 (1)
219-283:⚠️ Potential issue | 🟠 Major别名存在多对一冲突,映射结果会变成“按顺序命中”。
同一别名被分配到多个
id(如龙蜥相关、丘丘王/暴徒、遗迹猎者/守卫),会导致 OCR 命中后标准名不稳定,进而影响材料分类与任务调度。建议保证alias全局唯一,或新增明确的优先级/分组规则。🔧 建议修复方向(示例)
- { - "alias": ["岩龙蜥","幼岩龙蜥","深海龙蜥","小型深海龙蜥","龙蜥"], - "id": "0041", - "name": "岩龙蜥", - "nameEn": "Rock Dragon Lizard" - }, + { + "alias": ["岩龙蜥"], + "id": "0041", + "name": "岩龙蜥", + "nameEn": "Rock Dragon Lizard" + },其他冲突项(如 0042/0046、0044/0047)建议同样做去重或规则化处理。
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@repo/js/角色养成一条龙Pro版/data/Mapping.json` around lines 219 - 283, 多个条目(例如 id: "0037" 名称 "深海龙蜥", id: "0041" 名称 "岩龙蜥", id: "0043" 名称 "幼岩龙蜥",以及 id: "0042"/"0046" 丘丘王/丘丘暴徒、id: "0044"/"0047" 遗迹猎者/遗迹守卫)共享相同别名,导致 OCR 映射冲突并产生不稳定命中;请在 Mapping.json 中去重并保证 alias 全局唯一:为每个别名只保留一个目标 id(例如 将“龙蜥”“幼岩龙蜥”“岩龙蜥”“深海龙蜥”等按实际实体归入对应单一 id),或者为冲突组引入优先级/分组字段(如 priority 或 group)并在使用方匹配逻辑中实现优先级决策;同时清理重复别名列表(检查 id "0037","0041","0043","0042","0046","0044","0047" 等条目)以确保 OCR 命中稳定。repo/js/角色养成一条龙Pro版/assets/goToBoss/无相之岩前往.json-1-1 (1)
1-1:⚠️ Potential issue | 🟠 Major补全
info.name与info.type,避免路线被调度器忽略。当前这两个字段为空,而同目录其他路线都使用了完整元数据(例如
type: "collect")。如果主流程按info.type/info.name过滤任务,这条路线可能无法被识别执行。🔧 建议修复
-{"info":{"name":"","type":""},"positions":[...]} +{"info":{"name":"无相之岩前往","type":"collect"},"positions":[...]}🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@repo/js/角色养成一条龙Pro版/assets/goToBoss/无相之岩前往.json` at line 1, Populate the missing metadata by setting info.name to a descriptive route name (e.g., "无相之岩前往") and info.type to the appropriate task type consistent with other routes (e.g., "collect" or "path") so the dispatcher can recognize it; edit the JSON's info block (info.name and info.type) in this file (the positions array can remain unchanged) to match the project's naming/type convention.repo/js/角色养成一条龙Pro版/assets/goToBoss/深黯魇语之主前往.json-1-1 (1)
1-1:⚠️ Potential issue | 🟠 Major移除此文件及相关 goToBoss JSON 文件中的 UTF-8 BOM。
该文件包含 UTF-8 BOM (EF BB BF)。虽然构建脚本在处理时会自动移除,但建议在源文件中就移除 BOM,避免不必要的处理步骤。
goToBoss目录下的多数 JSON 文件都存在此问题,应统一转为 UTF-8 无 BOM 编码。🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@repo/js/角色养成一条龙Pro版/assets/goToBoss/深黯魇语之主前往.json` at line 1, The JSON file 深黯魇语之主前往.json (and other files in the goToBoss directory) contains a UTF-8 BOM (EF BB BF); remove the BOM and save each file as UTF-8 without BOM so the source files no longer include the BOM. Locate files in the goToBoss folder (including 深黯魇语之主前往.json), open them in an editor or run a bulk re-save/encoding conversion to "UTF-8 without BOM" (or strip the first three bytes programmatically), verify valid JSON after conversion, and commit the updated files.repo/js/角色养成一条龙Pro版/assets/goToBoss/蕴光月守宫前往.json-1-1 (1)
1-1:⚠️ Potential issue | 🟠 Major移除 UTF-8 BOM,避免路线文件加载失败。
JavaScript 的
JSON.parse()无法解析包含 UTF-8 BOM 的 JSON。Line 1 的两个 goToBoss 路线文件(蕴光月守宫前往.json 和深黯魇语之主前往.json)都包含 BOM 字符。当pathingScript.runFile()尝试解析这些文件时,会因 JSON 语法错误而导致脚本中断。🔧 建议修复
-{ +{🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@repo/js/角色养成一条龙Pro版/assets/goToBoss/蕴光月守宫前往.json` at line 1, Remove the UTF-8 BOM from the two route JSON files (蕴光月守宫前往.json and 深黯魇语之主前往.json) by re-saving them as UTF-8 without BOM (or stripping the leading U+FEFF) so JSON.parse() in pathingScript.runFile() won't fail; optionally add a defensive strip of a leading BOM in pathingScript.runFile() before parsing (trim leading '\uFEFF') to handle any future files that still contain a BOM.repo/js/角色养成一条龙Pro版/lib/combat.js-63-86 (1)
63-86:⚠️ Potential issue | 🟠 Major用真实经过时间做挑战超时判断。
这里每轮只给
challengeTime加 200,但内层四名角色的整套输出和 OCR 检测本身就要跑好几秒,所以“5000ms 超时”实际上会拖到几十秒。能量恢复失败时脚本会在这里卡很久。🛠️ 建议修改
- let challengeTime = 0; - while (challengeTime < 5000) { + const challengeStart = Date.now(); + while (Date.now() - challengeStart < 5000) { for (let i = 1; i < 5; i++) { keyPress(i.toString()); await sleep(300); leftButtonClick(); @@ if (res.text.includes("自动退出")) { log.info("检测到挑战成功"); return; } } - challengeTime = challengeTime + 200; await sleep(100); }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@repo/js/角色养成一条龙Pro版/lib/combat.js` around lines 63 - 86, The timeout uses a simulated counter (challengeTime += 200) that doesn't reflect real elapsed time; replace it with a real-time check: record a startTime (e.g., Date.now()) before the while-loop and change the loop condition to check (Date.now() - startTime) < 5000 so the timeout accounts for the actual awaits in the inner loop (symbols to update: challengeTime, the while (...) loop), and remove the artificial challengeTime increment; keep existing calls like keyPress, sleep, captureGameRegion, keyDown/keyUp and return on OCR match.repo/js/角色养成一条龙Pro版/lib/image_recognition.js-157-169 (1)
157-169:⚠️ Potential issue | 🟠 Major这里不要把
deriveCrop()的返回值直接传给ocrRecognize()。
ocrRecognize()的契约是接收{X, Y, Width, Height}并自己重新截图裁剪;Line 166 传进去的是已经裁好的 RO。当前实现很容易直接走异常/空结果分支,导致经验书数量一直识别不到。🛠️ 建议修改
- const croppedRegion = screenRO.deriveCrop( - result.X - 30, - result.Y + result.Height - 20, - result.Width + 30, - result.Height + 70 - ); - - // OCR识别数字 - let ocrResult = ImageRecognition.ocrRecognize(2000, croppedRegion); + const quantityRegion = { + X: result.X - 30, + Y: result.Y + result.Height - 20, + Width: result.Width + 30, + Height: result.Height + 70 + }; + + // OCR识别数字 + let ocrResult = ImageRecognition.ocrRecognize(2000, quantityRegion); @@ - // 清理资源 - croppedRegion.dispose(); found = true;🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@repo/js/角色养成一条龙Pro版/lib/image_recognition.js` around lines 157 - 169, The issue is passing the RO returned by screenRO.deriveCrop (croppedRegion) directly into ImageRecognition.ocrRecognize which expects a plain rect object; change the call so ocrRecognize receives an object with numeric bounds (e.g. {X, Y, Width, Height}) instead of the RO. Locate deriveCrop/croppedRegion and replace the second argument to ImageRecognition.ocrRecognize to pass the croppedRegion's X, Y, Width, Height values (or compute them from result/screenRO) so ocrRecognize performs its own screenshot crop correctly, then continue to call OcrNumberCorrector.correct on the returned string.repo/js/角色养成一条龙Pro版/lib/image_recognition.js-179-206 (1)
179-206:⚠️ Potential issue | 🟠 Major页内扫描循环会泄漏识别对象。
一旦找到目标,Line 180 的
break会直接跳过下面的result/screenRO释放;另外底部检测用的ro/res也没有释放。这段最多会跑20 × 3轮,连续识别时原生资源会越积越多。🛠️ 建议修改
- if (found) { - break; - } - - if (!found && currentPage < MAX_PAGE_TRIES) { - // 识别到划动条停止划动(已划至最下) - const ro = captureGameRegion() - const res = ro.find(DownSwipeBarIcon); - if (res.isExist()) { - await UI.scrollPageFlexible(Math.ceil(genshin.height / 5)); // 以防过早识别 - currentPage = MAX_PAGE_TRIES - } - - log.info("当前页面未找到,尝试翻页"); - await UI.scrollPageFlexible(Math.ceil(genshin.height / 5)); - await sleep(800); // 等待页面稳定 - - currentPage++; - } - - // 清理当前循环的资源 - if (result) { - result.dispose(); - result = null; - } - if (screenRO) { - screenRO.dispose(); - screenRO = null; - } + let bottomRO = null; + let bottomRes = null; + try { + if (found) { + break; + } + + if (!found && currentPage < MAX_PAGE_TRIES) { + // 识别到划动条停止划动(已划至最下) + bottomRO = captureGameRegion(); + bottomRes = bottomRO.find(DownSwipeBarIcon); + if (bottomRes && bottomRes.isExist()) { + await UI.scrollPageFlexible(Math.ceil(genshin.height / 5)); // 以防过早识别 + currentPage = MAX_PAGE_TRIES; + } + + log.info("当前页面未找到,尝试翻页"); + await UI.scrollPageFlexible(Math.ceil(genshin.height / 5)); + await sleep(800); // 等待页面稳定 + + currentPage++; + } + } finally { + if (bottomRes) bottomRes.dispose(); + if (bottomRO) bottomRO.dispose(); + if (result) { + result.dispose(); + result = null; + } + if (screenRO) { + screenRO.dispose(); + screenRO = null; + } + }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@repo/js/角色养成一条龙Pro版/lib/image_recognition.js` around lines 179 - 206, The loop leaks native resources because a break at Line 180 exits before disposing result and screenRO, and temporary objects ro/res from captureGameRegion()/ro.find(DownSwipeBarIcon) are never disposed; update the loop in image_recognition.js so that before any early break (when found) you explicitly dispose result and screenRO if non-null, and always dispose the temporary ro and res after checking res.isExist() (and after any awaited UI.scrollPageFlexible calls), ensuring nulling them afterwards; reference functions/symbols captureGameRegion, DownSwipeBarIcon, UI.scrollPageFlexible, result, screenRO, ro, res, sleep and genshin.height to locate where to add these disposals.repo/js/角色养成一条龙Pro版/lib/image_recognition.js-8-59 (1)
8-59:⚠️ Potential issue | 🟠 Major把截图对象的释放移到
finally。
deriveCrop或findMulti一旦抛错,当前轮的gameCaptureRegion/croppedRegion都不会释放,而这个循环会在超时内高频重试。这里最好把对象提到try外并在finally里统一回收。🛠️ 建议修改
ocrRecognize: function (timeout = 5000, Region) { let startTime = Date.now(); let attemptCount = 0; while (Date.now() - startTime < timeout) { attemptCount++; + let gameCaptureRegion = null; + let croppedRegion = null; try { // 捕获整个游戏区域 - const gameCaptureRegion = captureGameRegion(); + gameCaptureRegion = captureGameRegion(); // 裁剪出识别区域 - const croppedRegion = gameCaptureRegion.deriveCrop( + croppedRegion = gameCaptureRegion.deriveCrop( Region.X, Region.Y, Region.Width, Region.Height ); @@ - // 释放资源 - gameCaptureRegion.dispose(); - croppedRegion.dispose(); - if (results && results.count > 0) { let text = ""; for (let i = 0; i < results.count; i++) { if (results[i].text && results[i].text.trim()) { text += results[i].text + " "; @@ } catch (error) { if (attemptCount % 100 === 0) { log.warn(`OCR识别发生错误: ${error.message}`); } + } finally { + if (croppedRegion) croppedRegion.dispose(); + if (gameCaptureRegion) gameCaptureRegion.dispose(); } } // 超时未识别到有效内容,返回null return null; },🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@repo/js/角色养成一条龙Pro版/lib/image_recognition.js` around lines 8 - 59, The ocrRecognize function currently disposes gameCaptureRegion and croppedRegion only inside the try path, causing leaks when deriveCrop/findMulti throw; move the declarations of gameCaptureRegion and croppedRegion to just before the try (initialize to null), perform the capture and derive inside the try, and add a finally block that checks each variable and calls dispose() if non-null (wrapping each dispose in its own try/catch to avoid masking original errors), then null out the variables after disposing; keep references to ImageRecognition.cleanOcrText, captureGameRegion, deriveCrop, findMulti, gameCaptureRegion, croppedRegion and dispose in your changes.repo/js/角色养成一条龙Pro版/lib/farming.js-104-104 (1)
104-104:⚠️ Potential issue | 🟠 Major材料类型
"wepon"拼写错误,应为"weapon"。这会导致任务完成状态记录的 key 与其他地方不一致,影响任务完成检测的正确性。
🐛 修正拼写错误
- await TaskManager.addCompletedTask("wepon", materialName, weaponRequireCounts, characterName, uid); + await TaskManager.addCompletedTask("weapon", materialName, weaponRequireCounts, characterName, uid);Line 127 同样需要修正:
- await TaskManager.addCompletedTask("wepon", materialName, weaponRequireCounts, characterName, uid); + await TaskManager.addCompletedTask("weapon", materialName, weaponRequireCounts, characterName, uid);Also applies to: 127-127
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@repo/js/角色养成一条龙Pro版/lib/farming.js` at line 104, The call to TaskManager.addCompletedTask is using a misspelled material type "wepon" instead of "weapon", which causes mismatched keys; update the first argument in the TaskManager.addCompletedTask calls (the occurrences passing material type alongside materialName, weaponRequireCounts, characterName, uid) to use "weapon" and fix the identical typo in the other occurrence of the same call so all invocations use the correct "weapon" key.repo/js/角色养成一条龙Pro版/lib/navigation.js-94-124 (1)
94-124:⚠️ Potential issue | 🟠 Major先判空
iconRes再读取坐标。这里直接访问
iconRes.x/y。一旦模板匹配偶发失手,轻则把一次识别抖动变成错误转向,重则因为空结果没有有效坐标而直接抛错。🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@repo/js/角色养成一条龙Pro版/lib/navigation.js` around lines 94 - 124, The code accesses iconRes.x and iconRes.y without null-checking which can throw when template matching fails; update the loop around captureRegion/captureGameRegion so after let iconRes = captureRegion.Find(boxIconRo) you check if (!iconRes) { log.warn("iconRes not found, retrying"); await sleep(100); continue; } (or otherwise handle by skipping the coordinate logic and not calling moveMouseBy/using iconRes) so functions/variables like advanceNum, moveMouseBy, and the existing climbResult handling remain unchanged and only proceed when iconRes is valid.repo/js/角色养成一条龙Pro版/lib/character.js-21-35 (1)
21-35:⚠️ Potential issue | 🟠 Major未知元素值会点到错误的筛选位。
Constants.elements.indexOf(element)找不到时会返回-1,当前仍会继续计算clickX并点击。只要配置为空、OCR 文本异常,元素筛选就会跑偏,后面的角色识别会跟着失真。💡 建议修改
selectElement: async function(element) { if (element === "物") return; const elemIdx = Constants.elements.indexOf(element); + if (elemIdx === -1) { + log.warn(`未知元素筛选值:${element},跳过元素筛选`); + return; + } const clickX = Math.round(787 + elemIdx * 57.5); await click(960, 45);🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@repo/js/角色养成一条龙Pro版/lib/character.js` around lines 21 - 35, The selectElement function uses Constants.elements.indexOf(element) without checking for -1, which causes clickX to be wrong when the element is unknown; update selectElement to detect a missing element (elemIdx === -1 or element not in Constants.elements) and bail out early (return or log/throw) before computing clickX and performing clicks (references: selectElement, Constants.elements.indexOf, clickX), ensuring you handle the existing special-case for "物" and provide a clear error log when the element is invalid.repo/js/角色养成一条龙Pro版/lib/character.js-1344-1347 (1)
1344-1347:⚠️ Potential issue | 🟠 Major不要把完整配置直接打到日志里。
newConfig可能已经带有上次运行写入的currentUid。这里完整JSON.stringify会把原始 UID 再次写回日志,和前面做的脱敏相抵消。🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@repo/js/角色养成一条龙Pro版/lib/character.js` around lines 1344 - 1347, The second log is printing the full newConfig (which may include sensitive currentUid) via JSON.stringify; modify the code around mergeConfigGroups/newConfig and the log.info call so you do not emit the raw config—either remove the detailed JSON log or log a sanitized copy (e.g., clone newConfig and delete or mask currentUid and any other sensitive fields) before JSON.stringify, or use a JSON.stringify replacer that redacts currentUid; ensure you still call file.writeTextSync(Constants.CONFIG_PATH, JSON.stringify(newConfig, null, 2)) but never log the unredacted newConfig.repo/js/角色养成一条龙Pro版/main.js-523-531 (1)
523-531:⚠️ Potential issue | 🟠 Major地方特产在需求量为 0 时仍会继续跑图。
这里把
local排除在零需求短路之外,而调用方只要配置里存在LocalSpecialties就会进入该流程。结果是needLocalAmount = 0也会扫描并执行特产路线。💡 建议修改
- if (currentAmount <= 0 && type !== 'local') { + if (currentAmount <= 0) { log.info(`[${materialType}] 需求数量为0,跳过执行`); Utils.addNotification(`[${materialType}] 需求数量为0,跳过执行`); return false; }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@repo/js/角色养成一条龙Pro版/main.js` around lines 523 - 531, The current short-circuit check uses "if (currentAmount <= 0 && type !== 'local')" which skips skipping 'local' items and allows LocalSpecialties to run even when needLocalAmount/currentAmount is 0; update the condition in the block that reads config via Utils.readJson(Constants.CONFIG_PATH) (using configKey and materialType) so that it returns false whenever currentAmount <= 0 regardless of type (remove the "type !== 'local'" exception) or alternatively add an explicit guard that checks the specific LocalSpecialties flag before allowing execution; modify the logic around currentAmount and the caller that relies on configKey to ensure needLocalAmount=0 will short-circuit execution.repo/js/角色养成一条龙Pro版/main.js-88-90 (1)
88-90:⚠️ Potential issue | 🟠 Major初始识别失败后应立即终止主流程。
Character.findCharacterAndGetLevel()返回false时,这里仍会继续刷本、采集和跑地脉花。识别失败场景下很容易沿用上一次角色的config.json继续执行。💡 建议修改
// ========== 第一步:执行角色识别与材料计算流程 ========== log.info("📌 开始执行角色识别与材料计算流程..."); - await Character.findCharacterAndGetLevel(); + const recognized = await Character.findCharacterAndGetLevel(); + if (!recognized) { + throw new Error("角色识别失败,已终止后续流程"); + }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@repo/js/角色养成一条龙Pro版/main.js` around lines 88 - 90, Character.findCharacterAndGetLevel() can return false on failed recognition but the main flow currently continues; change the caller in main.js so it checks the returned value and immediately aborts the rest of the pipeline (e.g., return from the main async function or process.exit(1)) when false is returned to avoid using stale config; update the block around the log.info("📌 开始执行角色识别与材料计算流程...") / await Character.findCharacterAndGetLevel() to perform an if (!result) { /* stop here */ } so subsequent steps (刷本, 采集, 跑地脉花) are not executed.repo/js/角色养成一条龙Pro版/lib/navigation.js-37-57 (1)
37-57:⚠️ Potential issue | 🟠 Major
stopRo检测用的是滚动前的截图。Line 53 在滚动完成后仍然复用了 Line 37 创建的
captureRegion。这样终止图片如果是滚动后才出现,就永远不会被命中,函数会继续滚到maxAttempts才失败。💡 建议修改
for (let attempt = 0; attempt < maxAttempts; attempt++) { const captureRegion = captureGameRegion(); const targetResult = captureRegion.find(targetRo); if (!targetResult.isEmpty()) { log.info(`找到目标图片,位置: (${targetResult.x}, ${targetResult.y})`); targetResult.click(); captureRegion.dispose(); await sleep(clickDelay); return; } + captureRegion.dispose(); log.info(`第 ${attempt + 1} 次尝试未找到目标图片,将滚动画面...`); for (let i = 0; i < scrollNum; i++) { await keyMouseScript.runFile("data/滚轮下滑.json"); } - - const stopResult = captureRegion.find(stopRo); - captureRegion.dispose(); - if (!stopResult.isEmpty()) { - throw new Error(`遇到终止图片,停止寻找目标图片。终止位置: (${stopResult.x}, ${stopResult.y})`); - } + + if (stopRo) { + const stopCapture = captureGameRegion(); + const stopResult = stopCapture.find(stopRo); + stopCapture.dispose(); + if (!stopResult.isEmpty()) { + throw new Error(`遇到终止图片,停止寻找目标图片。终止位置: (${stopResult.x}, ${stopResult.y})`); + } + } }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@repo/js/角色养成一条龙Pro版/lib/navigation.js` around lines 37 - 57, 当前代码在使用 captureRegion(由 captureGameRegion() 创建)去查找 stopRo 时仍然复用滚动前的截图(captureRegion),导致滚动后出现的终止图片无法被检测到;请在执行滚动(keyMouseScript.runFile("data/滚轮下滑.json"))并完成所有 scrollNum 次滚动后重新调用 captureGameRegion() 生成新的 captureRegion,再用新的 captureRegion.find(stopRo) 来检测终止图片并在检测后 dispose;参考定位符包括 captureGameRegion, captureRegion, targetResult, stopResult, targetRo, stopRo, keyMouseScript.runFile, scrollNum, clickDelay。
🟡 Minor comments (9)
repo/js/角色养成一条龙Pro版/README.md-35-35 (1)
35-35:⚠️ Potential issue | 🟡 Minor优化文本表述以提升可读性
当前表述"在跟添加的这个脚本的名字上方有设置2字"略显拗口。建议优化为:"在添加的脚本名称上方有【设置】两个字"或"在添加的脚本名称上方可以看到【设置】",使说明更清晰易懂。
📝 建议的改进
-详细步骤:找到刚才创建的配置组名称,在跟添加的这个脚本的名字上方有设置2字,点击【设置】2个字,就可以打开调度器设置了。 +详细步骤:找到刚才创建的配置组名称,在添加的脚本名称上方有【设置】两个字,点击【设置】即可打开调度器设置。🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@repo/js/角色养成一条龙Pro版/README.md` at line 35, The sentence "在跟添加的这个脚本的名字上方有设置2字,点击【设置】2个字,就可以打开调度器设置了。" is awkward; update the README.md line to a clearer phrasing such as "在添加的脚本名称上方可以看到【设置】两个字,点击【设置】即可打开调度器设置。" — locate the exact string in the file and replace it, ensuring the new text preserves the same meaning and UI cues (the label "设置" and the action "点击...打开调度器设置").repo/js/角色养成一条龙Pro版/assets/goToBoss/霜夜巡天灵主前往.json-1-40 (1)
1-40:⚠️ Potential issue | 🟡 Minor文件末尾缺少换行符
该 JSON 文件末尾缺少换行符(POSIX 标准要求文本文件以换行符结尾)。虽然大多数 JSON 解析器可以正常处理,但缺少换行符可能会导致:
- Git diff 显示异常
- 某些文本编辑器产生警告
- 文件拼接时出现问题
建议在文件末尾添加一个换行符。
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@repo/js/角色养成一条龙Pro版/assets/goToBoss/霜夜巡天灵主前往.json` around lines 1 - 40, Add a POSIX newline at the end of the JSON document for "name": "霜夜巡天灵主前往" (root object in the provided JSON) so the file ends with a trailing '\n'; simply update the file to ensure the final character is a newline (no other content changes).repo/js/角色养成一条龙Pro版/lib/file_utils.js-200-216 (1)
200-216:⚠️ Potential issue | 🟡 Minor变量
deficit可能未初始化即被使用。
deficit在 line 200 声明但未赋值,仅在roleNames.length > 0 && bookItems.length > 0条件内赋值。然而 line 239 的返回对象中引用了deficit,当条件不满足时其值为undefined。🐛 建议初始化变量
- let deficit + let deficit = 0; if (roleNames.length > 0 && bookItems.length > 0) { deficit = totalRoleExperienceRequired - totalBookExperience;Also applies to: 239-239
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@repo/js/角色养成一条龙Pro版/lib/file_utils.js` around lines 200 - 216, The variable deficit is declared without an initial value and may be referenced later when the if (roleNames.length > 0 && bookItems.length > 0) block doesn't run; initialize deficit when declared (e.g., let deficit = 0) or assign a safe default before the conditional so any later use (including the return at the end) always has a defined numeric value; update the declaration of deficit and keep existing logic that computes deficit inside the block (references: deficit, roleNames, bookItems, totalRoleExperienceRequired, totalBookExperience, expCalculator.convertExpToBooks).repo/js/角色养成一条龙Pro版/lib/inventory.js-67-73 (1)
67-73:⚠️ Potential issue | 🟡 Minor
getBossMaterialCount在result === false时无显式返回值。当 OCR 识别失败(
result !== false为 false)时,函数只打印警告但没有返回值,会返回undefined。🐛 建议添加返回语句
if (result !== false) { const quantity = Utils.positiveIntegerJudgment(result); log.info(`识别到${bossName}材料数量: ${quantity}`); return quantity; } else { log.warn(`${bossName}材料识别失败,请检查相关设置`); + return 0; }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@repo/js/角色养成一条龙Pro版/lib/inventory.js` around lines 67 - 73, In getBossMaterialCount, when OCR fails (result === false) the function currently only logs a warning and falls through to return undefined; update the else branch to return an explicit value (e.g., return 0 or return false depending on expected caller semantics) after the log.warn to avoid undefined results—locate the else block referencing result and bossName and add the explicit return so callers of getBossMaterialCount and Utils.positiveIntegerJudgment receive a deterministic value.repo/js/角色养成一条龙Pro版/lib/inventory.js-17-24 (1)
17-24:⚠️ Potential issue | 🟡 Minor
queryStaminaValue在正则匹配失败时缺少显式返回值。当
standardMatch为null时,函数不会返回任何值,导致返回undefined。这可能会在调用方引起意外行为。🐛 建议添加默认返回值
if (standardMatch) { const currentValue = standardMatch[1]; let validatedStamina = Utils.positiveIntegerJudgment(currentValue); if (validatedStamina > 11200) validatedStamina = (validatedStamina - 1200) / 10000; log.info(`返回体力值:${validatedStamina}`); return validatedStamina; } + log.warn(`体力OCR文本未匹配到数字:${staminaText}`); + return 0; } catch (error) {🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@repo/js/角色养成一条龙Pro版/lib/inventory.js` around lines 17 - 24, The function queryStaminaValue currently returns validatedStamina only when standardMatch is truthy; if standardMatch is null it falls through and returns undefined—update queryStaminaValue to return an explicit default (e.g., 0) when standardMatch is falsy by adding a fallback return after the if block; keep use of Utils.positiveIntegerJudgment and the existing log.info call for the matched branch, and log or document the default return path if desired.repo/js/角色养成一条龙Pro版/lib/ocrHelper.js-85-105 (1)
85-105:⚠️ Potential issue | 🟡 Minor
recognizeMultiText存在潜在资源泄漏风险。如果在
capture.findMulti(ocr)或循环处理过程中抛出异常,capture对象不会被释放。建议使用try/finally确保资源清理。🛡️ 建议使用 try/finally 包装
recognizeMultiText: async function(region, name) { return await Utils.retryTask(function() { const ocr = RecognitionObject.ocr(region.x, region.y, region.width, region.height); const capture = captureGameRegion(); - const resList = capture.findMulti(ocr); - const textList = []; - - for (let i = 0; i < resList.Count; i++) { - const res = resList[i]; - let text = res.text ? res.text.trim() : ""; - for (const [wrong, correct] of Object.entries(Constants.replacementMap)) { - text = text.replace(new RegExp(wrong, 'g'), correct); + try { + const resList = capture.findMulti(ocr); + const textList = []; + + for (let i = 0; i < resList.Count; i++) { + const res = resList[i]; + let text = res.text ? res.text.trim() : ""; + for (const [wrong, correct] of Object.entries(Constants.replacementMap)) { + text = text.replace(new RegExp(wrong, 'g'), correct); + } + if (text) textList.push(text); + if (res.Dispose) res.Dispose(); } - if (text) textList.push(text); - if (res.Dispose) res.Dispose(); + + return textList; + } finally { + capture.dispose(); } - - capture.dispose(); - return textList; }, name); },🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@repo/js/角色养成一条龙Pro版/lib/ocrHelper.js` around lines 85 - 105, The recognizeMultiText function can leak the capture resource if capture.findMulti or the processing loop throws; wrap the code that uses capture (creation, findMulti, looping over resList and disposing each res) in a try/finally so capture.dispose() always runs, and also ensure each res.Dispose() is called in the loop even when an exception occurs (e.g., dispose inside a try/catch per-item or ensure res.Dispose in a finally for that item); update recognizeMultiText to create capture, try { ... } finally { capture.dispose(); } and keep the existing res.Dispose() cleanup behavior inside the loop.repo/js/角色养成一条龙Pro版/lib/ocrHelper.js-282-333 (1)
282-333:⚠️ Potential issue | 🟡 Minor
repeatOperationUntilTextFound的循环终止条件存在逻辑问题。当
stepsTaken达到maxSteps时,循环条件stepsTaken <= maxSteps仍为真,会再执行一次迭代。然后在 line 322 检查stepsTaken >= maxSteps时抛出异常。这意味着实际会尝试maxSteps + 1次。建议将循环条件改为stepsTaken < maxSteps。🐛 建议修正循环条件
- while (stepsTaken <= maxSteps) { + while (stepsTaken < maxSteps) { const captureRegion = captureGameRegion(); // ... 循环体 ... - - if (stepsTaken >= maxSteps) { - throw new Error(`检查次数超过最大限制: ${maxSteps},未查询到文字"${targetText}"`); - } - // ... 按键和等待 ... stepsTaken++; } + throw new Error(`检查次数超过最大限制: ${maxSteps},未查询到文字"${targetText}"`);🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@repo/js/角色养成一条龙Pro版/lib/ocrHelper.js` around lines 282 - 333, The loop in repeatOperationUntilTextFound currently uses while (stepsTaken <= maxSteps) which allows one extra iteration then throws when the in-loop check stepsTaken >= maxSteps triggers; change the loop condition to while (stepsTaken < maxSteps) so the function attempts exactly maxSteps iterations (keep the existing in-loop throw as a guard), referencing the variables stepsTaken, maxSteps and the existing throw check that currently reads stepsTaken >= maxSteps.repo/js/角色养成一条龙Pro版/lib/utils.js-352-380 (1)
352-380:⚠️ Potential issue | 🟡 Minor
ocrRecognize存在资源泄漏风险。如果在循环处理过程中抛出异常,
capture对象不会被释放。建议使用try/finally确保清理。🛡️ 建议使用 try/finally 包装
ocrRecognize: async function(x, y, width, height, returnCoordinates = false) { const ocr = RecognitionObject.ocr(x, y, width, height); const capture = captureGameRegion(); - const resList = capture.findMulti(ocr); - const items = []; - for (let i = 0; i < resList.Count; i++) { - // ... processing ... - } - capture.dispose(); - return items; + try { + const resList = capture.findMulti(ocr); + const items = []; + for (let i = 0; i < resList.Count; i++) { + // ... processing ... + } + return items; + } finally { + capture.dispose(); + } },🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@repo/js/角色养成一条龙Pro版/lib/utils.js` around lines 352 - 380, The ocrRecognize function currently may leak the capture object (and potentially res objects) if an exception occurs; wrap the main processing that iterates resList in a try/finally where you call capture.dispose() in the finally block, and ensure any per-result resources (res.Dispose) are also invoked in the finally or via a short try/finally around per-item processing so every res is disposed even on error; update the ocrRecognize function to use this pattern (references: ocrRecognize, capture, resList, res.Dispose).repo/js/角色养成一条龙Pro版/lib/taskManager.js-45-46 (1)
45-46:⚠️ Potential issue | 🟡 Minor数组比较使用
join(',')可能存在边界问题。如果数组元素本身包含逗号,例如
[1, "2,3"]和[1, 2, 3]都会生成"1,2,3",导致误判相等。建议使用JSON.stringify进行比较,或逐元素比对。🐛 建议使用更可靠的比较方式
if (Array.isArray(previousRequireCounts) && Array.isArray(currentRequireCounts)) { - return previousRequireCounts.join(',') === currentRequireCounts.join(','); + return JSON.stringify(previousRequireCounts) === JSON.stringify(currentRequireCounts); } else { return previousRequireCounts === currentRequireCounts; }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@repo/js/角色养成一条龙Pro版/lib/taskManager.js` around lines 45 - 46, The current equality check uses previousRequireCounts.join(',') === currentRequireCounts.join(',') which can produce false positives when elements contain commas; update the comparison in the code that handles previousRequireCounts and currentRequireCounts to a safe deep comparison (e.g., compare lengths then iterate and compare each element with ===, or use JSON.stringify on both arrays) so arrays with elements that include commas are not mis-evaluated as equal.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 7b0b67a1-2f9d-46d1-a661-41a7d8b7449a
⛔ Files ignored due to path filters (73)
repo/js/角色养成一条龙Pro版/assets/1.pngis excluded by!**/*.pngrepo/js/角色养成一条龙Pro版/assets/RecognitionObject/Bagpack.pngis excluded by!**/*.pngrepo/js/角色养成一条龙Pro版/assets/RecognitionObject/Confirm.pngis excluded by!**/*.pngrepo/js/角色养成一条龙Pro版/assets/RecognitionObject/ReturnIcon.pngis excluded by!**/*.pngrepo/js/角色养成一条龙Pro版/assets/RecognitionObject/SwipeBarIcon.pngis excluded by!**/*.pngrepo/js/角色养成一条龙Pro版/assets/RecognitionObject/closeIcon.pngis excluded by!**/*.pngrepo/js/角色养成一条龙Pro版/assets/RecognitionObject/paimon_menu.pngis excluded by!**/*.pngrepo/js/角色养成一条龙Pro版/assets/RecognitionObject/冒险家的经验.pngis excluded by!**/*.pngrepo/js/角色养成一条龙Pro版/assets/RecognitionObject/大英雄的经验.pngis excluded by!**/*.pngrepo/js/角色养成一条龙Pro版/assets/RecognitionObject/流浪者的经验.pngis excluded by!**/*.pngrepo/js/角色养成一条龙Pro版/assets/bookDomain.pngis excluded by!**/*.pngrepo/js/角色养成一条龙Pro版/assets/boss/wolf.pngis excluded by!**/*.pngrepo/js/角色养成一条龙Pro版/assets/boss/「冰风组曲」歌裴莉娅.pngis excluded by!**/*.pngrepo/js/角色养成一条龙Pro版/assets/boss/「冰风组曲」科培琉司.pngis excluded by!**/*.pngrepo/js/角色养成一条龙Pro版/assets/boss/兆载永劫龙兽.pngis excluded by!**/*.pngrepo/js/角色养成一条龙Pro版/assets/boss/千年珍珠骏麟.pngis excluded by!**/*.pngrepo/js/角色养成一条龙Pro版/assets/boss/半永恒统辖矩阵.pngis excluded by!**/*.pngrepo/js/角色养成一条龙Pro版/assets/boss/古岩龙蜥.pngis excluded by!**/*.pngrepo/js/角色养成一条龙Pro版/assets/boss/实验性场力发生装置.pngis excluded by!**/*.pngrepo/js/角色养成一条龙Pro版/assets/boss/急冻树.pngis excluded by!**/*.pngrepo/js/角色养成一条龙Pro版/assets/boss/恒常机关阵列.pngis excluded by!**/*.pngrepo/js/角色养成一条龙Pro版/assets/boss/掣电树.pngis excluded by!**/*.pngrepo/js/角色养成一条龙Pro版/assets/boss/无相之岩.pngis excluded by!**/*.pngrepo/js/角色养成一条龙Pro版/assets/boss/无相之水.pngis excluded by!**/*.pngrepo/js/角色养成一条龙Pro版/assets/boss/无相之火.pngis excluded by!**/*.pngrepo/js/角色养成一条龙Pro版/assets/boss/无相之草.pngis excluded by!**/*.pngrepo/js/角色养成一条龙Pro版/assets/boss/无相之雷.pngis excluded by!**/*.pngrepo/js/角色养成一条龙Pro版/assets/boss/无相之风.pngis excluded by!**/*.pngrepo/js/角色养成一条龙Pro版/assets/boss/水形幻人.pngis excluded by!**/*.pngrepo/js/角色养成一条龙Pro版/assets/boss/深海龙蜥之群.pngis excluded by!**/*.pngrepo/js/角色养成一条龙Pro版/assets/boss/深罪浸礼者.pngis excluded by!**/*.pngrepo/js/角色养成一条龙Pro版/assets/boss/深邃摹结株.pngis excluded by!**/*.pngrepo/js/角色养成一条龙Pro版/assets/boss/深黯魇语之主.pngis excluded by!**/*.pngrepo/js/角色养成一条龙Pro版/assets/boss/灵觉隐修的迷者.pngis excluded by!**/*.pngrepo/js/角色养成一条龙Pro版/assets/boss/熔岩辉龙像.pngis excluded by!**/*.pngrepo/js/角色养成一条龙Pro版/assets/boss/爆炎树.pngis excluded by!**/*.pngrepo/js/角色养成一条龙Pro版/assets/boss/秘源机兵·构型械.pngis excluded by!**/*.pngrepo/js/角色养成一条龙Pro版/assets/boss/秘源机兵·统御械.pngis excluded by!**/*.pngrepo/js/角色养成一条龙Pro版/assets/boss/纯水精灵.pngis excluded by!**/*.pngrepo/js/角色养成一条龙Pro版/assets/boss/翠翎恐簟.pngis excluded by!**/*.pngrepo/js/角色养成一条龙Pro版/assets/boss/蕴光月守宫.pngis excluded by!**/*.pngrepo/js/角色养成一条龙Pro版/assets/boss/蕴光月幻蝶.pngis excluded by!**/*.pngrepo/js/角色养成一条龙Pro版/assets/boss/贪食匿叶龙山王.pngis excluded by!**/*.pngrepo/js/角色养成一条龙Pro版/assets/boss/超重型陆巡舰·机动战垒.pngis excluded by!**/*.pngrepo/js/角色养成一条龙Pro版/assets/boss/遗迹巨蛇.pngis excluded by!**/*.pngrepo/js/角色养成一条龙Pro版/assets/boss/重拳出击鸭.pngis excluded by!**/*.pngrepo/js/角色养成一条龙Pro版/assets/boss/金焰绒翼龙暴君.pngis excluded by!**/*.pngrepo/js/角色养成一条龙Pro版/assets/boss/铁甲熔火帝皇.pngis excluded by!**/*.pngrepo/js/角色养成一条龙Pro版/assets/boss/隐山猊兽.pngis excluded by!**/*.pngrepo/js/角色养成一条龙Pro版/assets/boss/雷音权现.pngis excluded by!**/*.pngrepo/js/角色养成一条龙Pro版/assets/boss/霜夜巡天灵主.pngis excluded by!**/*.pngrepo/js/角色养成一条龙Pro版/assets/boss/风蚀沙虫.pngis excluded by!**/*.pngrepo/js/角色养成一条龙Pro版/assets/boss/魔像督军.pngis excluded by!**/*.pngrepo/js/角色养成一条龙Pro版/assets/boss/黄金王兽.pngis excluded by!**/*.pngrepo/js/角色养成一条龙Pro版/assets/box.pngis excluded by!**/*.pngrepo/js/角色养成一条龙Pro版/assets/itemQuantityDetection.pngis excluded by!**/*.pngrepo/js/角色养成一条龙Pro版/assets/weaponDomain.pngis excluded by!**/*.pngrepo/js/角色养成一条龙Pro版/assets/weapon_star.pngis excluded by!**/*.pngrepo/js/角色养成一条龙Pro版/assets/好感图标.pngis excluded by!**/*.pngrepo/js/角色养成一条龙Pro版/assets/挪德卡莱天赋.pngis excluded by!**/*.pngrepo/js/角色养成一条龙Pro版/assets/挪德卡莱武器.pngis excluded by!**/*.pngrepo/js/角色养成一条龙Pro版/assets/枫丹天赋.pngis excluded by!**/*.pngrepo/js/角色养成一条龙Pro版/assets/枫丹武器.pngis excluded by!**/*.pngrepo/js/角色养成一条龙Pro版/assets/璃月天赋.pngis excluded by!**/*.pngrepo/js/角色养成一条龙Pro版/assets/璃月武器.pngis excluded by!**/*.pngrepo/js/角色养成一条龙Pro版/assets/稻妻天赋.pngis excluded by!**/*.pngrepo/js/角色养成一条龙Pro版/assets/稻妻武器.pngis excluded by!**/*.pngrepo/js/角色养成一条龙Pro版/assets/纳塔天赋.pngis excluded by!**/*.pngrepo/js/角色养成一条龙Pro版/assets/纳塔武器.pngis excluded by!**/*.pngrepo/js/角色养成一条龙Pro版/assets/蒙德天赋.pngis excluded by!**/*.pngrepo/js/角色养成一条龙Pro版/assets/蒙德武器.pngis excluded by!**/*.pngrepo/js/角色养成一条龙Pro版/assets/须弥天赋.pngis excluded by!**/*.pngrepo/js/角色养成一条龙Pro版/assets/须弥武器.pngis excluded by!**/*.png
📒 Files selected for processing (64)
repo/js/角色养成一条龙Pro版/README.mdrepo/js/角色养成一条龙Pro版/assets/goToBoss/「冰风组曲」歌裴莉娅前往.jsonrepo/js/角色养成一条龙Pro版/assets/goToBoss/「冰风组曲」科培琉司前往.jsonrepo/js/角色养成一条龙Pro版/assets/goToBoss/兆载永劫龙兽前往.jsonrepo/js/角色养成一条龙Pro版/assets/goToBoss/千年珍珠骏麟前往.jsonrepo/js/角色养成一条龙Pro版/assets/goToBoss/半永恒统辖矩阵前往.jsonrepo/js/角色养成一条龙Pro版/assets/goToBoss/古岩龙蜥前往.jsonrepo/js/角色养成一条龙Pro版/assets/goToBoss/实验性场力发生装置前往.jsonrepo/js/角色养成一条龙Pro版/assets/goToBoss/急冻树前往.jsonrepo/js/角色养成一条龙Pro版/assets/goToBoss/恒常机关阵列前往.jsonrepo/js/角色养成一条龙Pro版/assets/goToBoss/掣电树前往.jsonrepo/js/角色养成一条龙Pro版/assets/goToBoss/无相之岩前往.jsonrepo/js/角色养成一条龙Pro版/assets/goToBoss/无相之水前往.jsonrepo/js/角色养成一条龙Pro版/assets/goToBoss/无相之火前往.jsonrepo/js/角色养成一条龙Pro版/assets/goToBoss/无相之草前往.jsonrepo/js/角色养成一条龙Pro版/assets/goToBoss/无相之雷前往.jsonrepo/js/角色养成一条龙Pro版/assets/goToBoss/水形幻人前往.jsonrepo/js/角色养成一条龙Pro版/assets/goToBoss/深罪浸礼者前往.jsonrepo/js/角色养成一条龙Pro版/assets/goToBoss/深邃摹结株前往.jsonrepo/js/角色养成一条龙Pro版/assets/goToBoss/深黯魇语之主前往.jsonrepo/js/角色养成一条龙Pro版/assets/goToBoss/灵觉隐修的迷者前往.jsonrepo/js/角色养成一条龙Pro版/assets/goToBoss/熔岩辉龙像前往.jsonrepo/js/角色养成一条龙Pro版/assets/goToBoss/爆炎树前往.jsonrepo/js/角色养成一条龙Pro版/assets/goToBoss/秘源机兵·构型械前往.jsonrepo/js/角色养成一条龙Pro版/assets/goToBoss/秘源机兵·统御械前往.jsonrepo/js/角色养成一条龙Pro版/assets/goToBoss/纯水精灵前往.jsonrepo/js/角色养成一条龙Pro版/assets/goToBoss/翠翎恐蕈前往.jsonrepo/js/角色养成一条龙Pro版/assets/goToBoss/蕴光月守宫前往.jsonrepo/js/角色养成一条龙Pro版/assets/goToBoss/蕴光月幻蝶前往.jsonrepo/js/角色养成一条龙Pro版/assets/goToBoss/贪食匿叶龙山王前往.jsonrepo/js/角色养成一条龙Pro版/assets/goToBoss/超重型陆巡舰·机动战垒前往.jsonrepo/js/角色养成一条龙Pro版/assets/goToBoss/遗迹巨蛇前往.jsonrepo/js/角色养成一条龙Pro版/assets/goToBoss/重拳出击鸭前往.jsonrepo/js/角色养成一条龙Pro版/assets/goToBoss/金焰绒翼龙暴君前往.jsonrepo/js/角色养成一条龙Pro版/assets/goToBoss/铁甲熔火帝皇前往.jsonrepo/js/角色养成一条龙Pro版/assets/goToBoss/隐山猊兽前往.jsonrepo/js/角色养成一条龙Pro版/assets/goToBoss/雷音权现前往.jsonrepo/js/角色养成一条龙Pro版/assets/goToBoss/霜夜巡天灵主前往.jsonrepo/js/角色养成一条龙Pro版/assets/goToBoss/风蚀沙虫前往.jsonrepo/js/角色养成一条龙Pro版/assets/goToBoss/魔偶剑鬼前往.jsonrepo/js/角色养成一条龙Pro版/assets/goToBoss/魔像督军前往.jsonrepo/js/角色养成一条龙Pro版/data/Mapping.jsonrepo/js/角色养成一条龙Pro版/data/combat_avatar.jsonrepo/js/角色养成一条龙Pro版/data/run_data/abnormal_paths.jsonrepo/js/角色养成一条龙Pro版/data/run_data/completed_tasks.jsonrepo/js/角色养成一条龙Pro版/data/滚轮下滑.jsonrepo/js/角色养成一条龙Pro版/lib/calculator.jsrepo/js/角色养成一条龙Pro版/lib/character.jsrepo/js/角色养成一条龙Pro版/lib/checkVersion.jsrepo/js/角色养成一条龙Pro版/lib/collection.jsrepo/js/角色养成一条龙Pro版/lib/combat.jsrepo/js/角色养成一条龙Pro版/lib/constants.jsrepo/js/角色养成一条龙Pro版/lib/farming.jsrepo/js/角色养成一条龙Pro版/lib/file_utils.jsrepo/js/角色养成一条龙Pro版/lib/image_recognition.jsrepo/js/角色养成一条龙Pro版/lib/inventory.jsrepo/js/角色养成一条龙Pro版/lib/navigation.jsrepo/js/角色养成一条龙Pro版/lib/ocrHelper.jsrepo/js/角色养成一条龙Pro版/lib/taskManager.jsrepo/js/角色养成一条龙Pro版/lib/ui_navigator.jsrepo/js/角色养成一条龙Pro版/lib/utils.jsrepo/js/角色养成一条龙Pro版/main.jsrepo/js/角色养成一条龙Pro版/manifest.jsonrepo/js/角色养成一条龙Pro版/settings.json
| let breakResult = "未知突破状态"; | ||
| if (breakStatus.includes("已突破")) { | ||
| breakResult = "90级已突破"; | ||
| } else { | ||
| const levelMatch = breakStatus.match(/(\d+)级/); | ||
| if (levelMatch) { | ||
| const level = `${levelMatch[1]}级未突破`; | ||
| breakResult = ["20", "40", "50", "60", "70", "80"].includes(levelMatch[1]) ? level : `${level}(非标准等级)`; | ||
| } else { |
There was a problem hiding this comment.
已突破 不能一律映射成 90级已突破。
这里一旦命中 已突破 就固定写成 90级已突破。像 40级已突破、80级已突破 这类中间状态都会被误判成满突破,后面的突破材料、地脉花和摩拉计算都会明显少算。
💡 建议修改
let breakResult = "未知突破状态";
- if (breakStatus.includes("已突破")) {
- breakResult = "90级已突破";
- } else {
- const levelMatch = breakStatus.match(/(\d+)级/);
- if (levelMatch) {
- const level = `${levelMatch[1]}级未突破`;
- breakResult = ["20", "40", "50", "60", "70", "80"].includes(levelMatch[1]) ? level : `${level}(非标准等级)`;
- } else {
- breakResult = `无法识别(${breakStatus})`;
- }
+ const levelMatch = breakStatus.match(/(\d+)级/);
+ if (levelMatch) {
+ const level = levelMatch[1];
+ if (breakStatus.includes("已突破")) {
+ breakResult = `${level}级已突破`;
+ } else {
+ breakResult = ["20", "40", "50", "60", "70", "80"].includes(level)
+ ? `${level}级未突破`
+ : `${level}级未突破(非标准等级)`;
+ }
+ } else {
+ breakResult = `无法识别(${breakStatus})`;
}📝 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.
| let breakResult = "未知突破状态"; | |
| if (breakStatus.includes("已突破")) { | |
| breakResult = "90级已突破"; | |
| } else { | |
| const levelMatch = breakStatus.match(/(\d+)级/); | |
| if (levelMatch) { | |
| const level = `${levelMatch[1]}级未突破`; | |
| breakResult = ["20", "40", "50", "60", "70", "80"].includes(levelMatch[1]) ? level : `${level}(非标准等级)`; | |
| } else { | |
| let breakResult = "未知突破状态"; | |
| const levelMatch = breakStatus.match(/(\d+)级/); | |
| if (levelMatch) { | |
| const level = levelMatch[1]; | |
| if (breakStatus.includes("已突破")) { | |
| breakResult = `${level}级已突破`; | |
| } else { | |
| breakResult = ["20", "40", "50", "60", "70", "80"].includes(level) | |
| ? `${level}级未突破` | |
| : `${level}级未突破(非标准等级)`; | |
| } | |
| } else { | |
| breakResult = `无法识别(${breakStatus})`; | |
| } |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@repo/js/角色养成一条龙Pro版/lib/character.js` around lines 897 - 905, The code
currently maps any breakStatus containing "已突破" to "90级已突破" (variables
breakStatus and breakResult), which misclassifies intermediate breakthroughs;
instead, first attempt to extract a numeric level with the existing levelMatch
regex from breakStatus, and if a level is found and the string contains "已突破"
set breakResult to "<N>级已突破" (and mark non-standard levels if N not in
["20","40","50","60","70","80","90"]); only fallback to "90级已突破" when the text
explicitly indicates 90 or when no level is present but an explicit full-break
marker exists; update the logic around levelMatch, the "已突破" check, and the
standard-level list so intermediate states like "40级已突破" or "80级已突破" are
preserved rather than coerced to 90.
There was a problem hiding this comment.
所有计算都基于6个阶段的等级,中间状态的只有经验书和摩拉需要,还有机器人你搞错了,不会算少,只会算多,多一点摩拉和经验书影响不大。
There was a problem hiding this comment.
@dcvsd24,感谢您的解释!理解了——由于材料计算本身基于固定的 6 个突破阶段,中间状态误判为 90级已突破 最多只会让经验书和摩拉多算一些,不会少算,过量估算在实际使用中是可以接受的。您的设计意图是清晰的,此处无需修改。
✏️ Learnings added
Learnt from: dcvsd24
Repo: babalae/bettergi-scripts-list PR: 3068
File: repo/js/角色养成一条龙Pro版/lib/character.js:897-905
Timestamp: 2026-04-05T09:27:44.800Z
Learning: In `repo/js/角色养成一条龙Pro版/lib/character.js`, the `breakStatus` mapping any "已突破" string to "90级已突破" is intentional. All material calculations are based on 6 fixed breakthrough stages (levels 20/40/50/60/70/80). Intermediate breakthrough states (e.g., "40级已突破") only affect exp book and mora calculations, and the overestimation (calculating slightly more than needed) is acceptable by design. Do not flag this as a bug in future reviews.
Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure review instructions. You can manage existing learnings in the app.
🧠 Learnings used
Learnt from: Kirito520Asuna
Repo: babalae/bettergi-scripts-list PR: 3053
File: repo/js/每月自动兑换抽卡资源/main.js:50-62
Timestamp: 2026-03-30T07:11:30.239Z
Learning: 在 `repo/js/每月自动兑换抽卡资源/main.js` 中,`isTaskRefreshed` 读取 `contentList` 时不需要做旧格式兼容处理,因为脚本更新后会以初始空状态运行,不存在遗留的旧格式持久化文件。现有的 `try/catch` 已足够处理文件缺失或内容异常的情况。
| fuzzyMatch: function(target, candidates, threshold) { | ||
| threshold = threshold || 0.6; | ||
| const levenshtein = function(a, b) { | ||
| const m = a.length + 1, n = b.length + 1; | ||
| const d = Array(m).fill(null).map(function() { return Array(n).fill(0); }); | ||
| for (let i = 0; i < m; i++) d[i][0] = i; | ||
| for (let j = 0; j < n; j++) d[0][j] = j; | ||
| for (let i = 1; i < m; i++) { | ||
| for (let j = 1; j < n; j++) { | ||
| const cost = a[i-1] === b[j-1] ? 0 : 1; | ||
| d[i][j] = Math.min(d[i-1][j]+1, d[i][j-1]+1, d[i-1][j-1]+cost); | ||
| } | ||
| } | ||
| return d[m-1][n-1]; | ||
| }; | ||
|
|
||
| let bestMatch = null, bestWeight = 0; | ||
| for (const cand of candidates) { | ||
| const dist = levenshtein(target, cand); | ||
| const kwMatch = cand.includes(target); | ||
| const weight = (kwMatch ? 0.8 : 0) + (1 - dist/Math.max(target.length, cand.length)) * 0.2; | ||
|
|
||
| if (weight >= threshold) return cand; | ||
| if (weight > bestWeight) { | ||
| bestWeight = weight; | ||
| bestMatch = cand; | ||
| } | ||
| } | ||
| return bestMatch; | ||
| }, |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# 检查 fuzzyMatch 的调用处如何处理返回值
rg -n -A 3 "fuzzyMatch\(" "repo/js/角色养成一条龙Pro版/"Repository: babalae/bettergi-scripts-list
Length of output: 2190
🏁 Script executed:
# Read ocrHelper.js to see how fuzzyMatch return value is being used
cat -n "repo/js/角色养成一条龙Pro版/lib/ocrHelper.js" | sed -n '45,60p'Repository: babalae/bettergi-scripts-list
Length of output: 1142
🏁 Script executed:
# Verify the fuzzyMatch implementation in utils.js
cat -n "repo/js/角色养成一条龙Pro版/lib/utils.js" | sed -n '186,215p'Repository: babalae/bettergi-scripts-list
Length of output: 1511
fuzzyMatch 返回值类型不匹配,且低于阈值时仍返回候选项。
该函数存在两个关键问题:
-
返回值类型不一致:函数返回字符串(候选项)或
null,但ocrHelper.js第 50-51 行期望返回包含.match和.score属性的对象。这会导致运行时错误,当访问fuzzyResult.score.toFixed(2)时会抛出TypeError。 -
阈值行为:当所有候选项匹配度都低于
threshold时,函数仍返回bestMatch(第 214 行),可能返回置信度很低的匹配。
建议统一函数返回值格式为 { match: string, score: number } 或修改 ocrHelper.js 以适配当前的字符串返回值。
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@repo/js/角色养成一条龙Pro版/lib/utils.js` around lines 186 - 215, The fuzzyMatch
function currently returns a string or null and still returns a low-confidence
bestMatch when below threshold; change fuzzyMatch to always return an object of
shape { match: string|null, score: number } (use fuzzyMatch as the identifier)
so callers like ocrHelper.js can safely access .match and .score; compute score
as the weight variable, return { match: cand, score: weight } immediately when
weight >= threshold, and after loop return { match: bestWeight >= threshold ?
bestMatch : null, score: bestWeight } (or simply { match: bestMatch, score:
bestWeight } but ensure match is null when below threshold) and update any early
returns to use that object shape.
| const breakConfig = configArray.find(item => item.characterBreak !== undefined); | ||
| if (breakConfig) { | ||
| const breakStr = breakConfig.characterBreak; | ||
| const match = breakStr.match(/(\d+)级/); | ||
| if (match) { | ||
| const breakLevel = parseInt(match[1]); | ||
| characterBreak = breakStr.includes("已突破") ? 90 : breakLevel; | ||
| } |
There was a problem hiding this comment.
读取配置时不要把所有 已突破 都折算成 90。
Line 993 和 Line 1014 只要包含 已突破 就强行写成 90。即便前面已经把配置保存成 40级已突破 / 80级已突破,这里也会在地脉花摩拉计算里被当作满突破。
Also applies to: 1008-1015
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@repo/js/角色养成一条龙Pro版/main.js` around lines 987 - 994, The code currently sets
characterBreak = 90 whenever breakStr.includes("已突破"), which overrides explicit
levels like "40级已突破" or "80级已突破"; change the logic in the block handling
breakConfig (variables breakConfig, breakStr, match, breakLevel, characterBreak)
so that if match is found you use the parsed breakLevel (characterBreak =
breakLevel) and only fall back to 90 when there is no numeric match but the
string contains "已突破"; apply the same fix to the equivalent handling around the
other occurrence (the block covering lines 1008-1015).
| if (moraRuns > 0) { | ||
| const moraMaxRounds = moraRuns >= 5 ? 2 : 1; | ||
| for (let i = 0; i < moraMaxRounds; i++) { | ||
| log.info(`开始执行藏金之花,次数: ${moraRuns}, 第${i + 1}轮`); | ||
|
|
||
| // 检查体力值 | ||
| const stamina = await Inventory.queryStaminaValue(); | ||
| const minStamina = 20; | ||
| if (stamina < minStamina) { | ||
| log.warn(`体力值${stamina}低于${minStamina},跳过当前轮`); | ||
| continue; | ||
| } | ||
|
|
||
| const resin = await Inventory.queryStaminaValue(); | ||
| const resinSupportedCount = Math.floor(resin / 40) + (resin % 40 >= 20 ? 1 : 0); | ||
| const actualCount = Math.min(moraRuns, resinSupportedCount); | ||
| log.info(`当前树脂: ${resin}, 树脂支持次数: ${resinSupportedCount}, 实际执行次数: ${actualCount}`); | ||
| notification.send(`当前树脂: ${resin}, 树脂支持次数: ${resinSupportedCount}, 实际执行次数: ${actualCount}`); | ||
|
|
||
| let taskParam = new AutoLeyLineOutcropParam(); | ||
| taskParam.Count = actualCount; | ||
| taskParam.Country = settings.adventurePath || "蒙德"; | ||
| taskParam.LeyLineOutcropType = "藏金之花"; | ||
| taskParam.Team = settings.teamName || ""; | ||
| taskParam.IsResinExhaustionMode = false; | ||
| taskParam.UseAdventurerHandbook = false; | ||
| taskParam.IsGoToSynthesizer = false; | ||
| taskParam.UseFragileResin = false; | ||
| taskParam.UseTransientResin = false; | ||
| taskParam.IsNotification = false; | ||
| taskParam.FightConfig.StrategyName = settings.strategyName || "auto"; | ||
| await dispatcher.RunAutoLeyLineOutcropTask(taskParam); | ||
| log.info("藏金之花完成"); | ||
| } |
There was a problem hiding this comment.
地脉轮次会重复计数,且经验分支用了过期树脂值。
moraRuns / expRuns 在每轮后都没有扣减,第二轮仍会按原始总次数再次下发;同时经验分支一直复用函数入参 stamina,不会反映前面刷摩拉后已经消耗掉的树脂。这两个问题叠加后会明显超跑。
💡 建议修改
try {
if (moraRuns > 0) {
- const moraMaxRounds = moraRuns >= 5 ? 2 : 1;
- for (let i = 0; i < moraMaxRounds; i++) {
- log.info(`开始执行藏金之花,次数: ${moraRuns}, 第${i + 1}轮`);
+ let remainingMoraRuns = moraRuns;
+ let round = 0;
+ while (remainingMoraRuns > 0 && round < 2) {
+ round++;
+ log.info(`开始执行藏金之花,剩余次数: ${remainingMoraRuns}, 第${round}轮`);
- // 检查体力值
- const stamina = await Inventory.queryStaminaValue();
- const minStamina = 20;
- if (stamina < minStamina) {
- log.warn(`体力值${stamina}低于${minStamina},跳过当前轮`);
- continue;
- }
+ const stamina = await Inventory.queryStaminaValue();
+ const minStamina = 20;
+ if (stamina < minStamina) {
+ log.warn(`体力值${stamina}低于${minStamina},跳过当前轮`);
+ break;
+ }
const resin = await Inventory.queryStaminaValue();
const resinSupportedCount = Math.floor(resin / 40) + (resin % 40 >= 20 ? 1 : 0);
- const actualCount = Math.min(moraRuns, resinSupportedCount);
+ const actualCount = Math.min(remainingMoraRuns, resinSupportedCount);
+ if (actualCount <= 0) break;
log.info(`当前树脂: ${resin}, 树脂支持次数: ${resinSupportedCount}, 实际执行次数: ${actualCount}`);
notification.send(`当前树脂: ${resin}, 树脂支持次数: ${resinSupportedCount}, 实际执行次数: ${actualCount}`);
let taskParam = new AutoLeyLineOutcropParam();
taskParam.Count = actualCount;
@@
taskParam.UseTransientResin = false;
taskParam.IsNotification = false;
taskParam.FightConfig.StrategyName = settings.strategyName || "auto";
await dispatcher.RunAutoLeyLineOutcropTask(taskParam);
+ remainingMoraRuns -= actualCount;
log.info("藏金之花完成");
}
}
if (expRuns > 0) {
- const expMaxRounds = expRuns >= 5 ? 2 : 1;
- for (let i = 0; i < expMaxRounds; i++) {
- log.info(`开始执行启示之花,次数: ${expRuns}, 第${i + 1}轮`);
-
- const resinSupportedCount = Math.floor(stamina / 40) + (stamina % 40 >= 20 ? 1 : 0);
- const actualCount = Math.min(expRuns, resinSupportedCount);
- log.info(`当前树脂: ${stamina}, 树脂支持次数: ${resinSupportedCount}, 实际执行次数: ${actualCount}`);
- notification.send(`当前树脂: ${stamina}, 树脂支持次数: ${resinSupportedCount}, 实际执行次数: ${actualCount}`);
+ let remainingExpRuns = expRuns;
+ let round = 0;
+ while (remainingExpRuns > 0 && round < 2) {
+ round++;
+ log.info(`开始执行启示之花,剩余次数: ${remainingExpRuns}, 第${round}轮`);
+
+ const resin = await Inventory.queryStaminaValue();
+ const resinSupportedCount = Math.floor(resin / 40) + (resin % 40 >= 20 ? 1 : 0);
+ const actualCount = Math.min(remainingExpRuns, resinSupportedCount);
+ if (actualCount <= 0) break;
+ log.info(`当前树脂: ${resin}, 树脂支持次数: ${resinSupportedCount}, 实际执行次数: ${actualCount}`);
+ notification.send(`当前树脂: ${resin}, 树脂支持次数: ${resinSupportedCount}, 实际执行次数: ${actualCount}`);
let taskParam = new AutoLeyLineOutcropParam();
taskParam.Count = actualCount;
@@
taskParam.UseTransientResin = false;
taskParam.IsNotification = false;
taskParam.FightConfig.StrategyName = settings.strategyName || "auto";
await dispatcher.RunAutoLeyLineOutcropTask(taskParam);
+ remainingExpRuns -= actualCount;
log.info("启示之花完成");
}
}Also applies to: 1124-1147
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@repo/js/角色养成一条龙Pro版/main.js` around lines 1088 - 1121, The loop currently
reuses the original moraRuns/expRuns and stale stamina/resin reads, causing
double-counting and wrong resin checks; inside the mora and exp loops (where
moraRuns/expRuns, Inventory.queryStaminaValue, AutoLeyLineOutcropParam and
dispatcher.RunAutoLeyLineOutcropTask are used) re-query the current
resin/stamina before each round (use the correct resin read API instead of
reusing the initial stamina variable) and decrement the remaining run counter by
the actualCount performed (e.g., moraRuns -= actualCount or expRuns -=
actualCount) so subsequent iterations reflect consumed resin; also ensure the
exp branch updates its stamina/resin read the same way rather than using the
original function parameter.
在循环执行启示之花任务时,每次迭代后应查询当前树脂值,而不是始终使用初始值。这确保了树脂消耗计算的准确性。
|
与标准版区别是什么,为什么不直接升级标准版而是新开一个脚本,若无法从原版升级也不太建议起名带pro版,会直接给人不需要用另一个脚本的认识 |
由原来的角色养成一条龙改编,新增了自动识别材料名称和数量。该项目是一个自动养成角色的脚本,它可以自动获取养成角色的材料,包括刷取天赋和武器(的秘境材料、怪物材料)、BOSS 材料,地图追踪采集区域特产与魔物材料、经验书、摩拉等。
Summary by CodeRabbit
版本更新