Skip to content

Fix issue with inefficient skill to craft first seed#2

Open
papadakis-k wants to merge 1 commit intoIdrinth:masterfrom
papadakis-k:master
Open

Fix issue with inefficient skill to craft first seed#2
papadakis-k wants to merge 1 commit intoIdrinth:masterfrom
papadakis-k:master

Conversation

@papadakis-k
Copy link

@papadakis-k papadakis-k commented Jan 10, 2026

When you have selected the "First" option and have a seed in your inventory that is higher than your current skill, as the first seed, then it shouldn't be selected, otherwise it causes errors on the client (and crafting stops).

Summary by CodeRabbit

  • Bug Fixes
    • Fixed crafting system to properly validate skill requirements. Items will no longer be available for crafting if your character doesn't meet the required skill level.

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

When you have selected the "First" option and have a seed in your
inventory that is higher than your current skill, as the first seed,
then it shouldn't be selected, otherwise it causes errors on the
client (and crafting stops).
@coderabbitai
Copy link

coderabbitai bot commented Jan 10, 2026

Walkthrough

A single-line conditional modification in the getFirst function now requires max to be greater than or equal to itemdata.craftingSkillRequirement, in addition to existing cultivationType validation. This restricts item selection until the crafting skill requirement threshold is satisfied.

Changes

Cohort / File(s) Summary
Crafting Skill Requirement Validation
MiracleGrowLight.lua
Modified getFirst function conditional to add craftingSkillRequirement check alongside cultivationType validation, preventing item return unless skill requirement is met

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 A gardener's wisdom, now refined and sound,
With skill requirements planted on this ground,
No miracles bloom without the craft to care,
The light grows brighter when rewards are fair! ✨🌱

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: fixing the issue where seeds with higher skill requirements than the player's current skill were being inefficiently selected as the first seed, causing errors.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

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.

Copy link

@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: 0

🧹 Nitpick comments (1)
MiracleGrowLight.lua (1)

77-126: Consider extracting common predicates to reduce duplication.

The cultivation type check and skill requirement validation appear in multiple functions. Extracting these into small helper functions could improve maintainability.

♻️ Optional refactoring to reduce code duplication

Consider adding helper functions at the top of the local function section:

local function isSeedOrSpore(itemdata)
    return itemdata.cultivationType == GameData.CultivationTypes.SPORE or 
           itemdata.cultivationType == GameData.CultivationTypes.SEED
end

local function meetsSkillRequirement(itemdata, playerSkill)
    return playerSkill >= itemdata.craftingSkillRequirement
end

Then update the functions to use these helpers:

 local function getSeed(items, max)
     local i=1;
     local out={};
     local positions = {}
     for index,itemdata in pairs(items) do
-        if itemdata.cultivationType==GameData.CultivationTypes.SPORE or itemdata.cultivationType==GameData.CultivationTypes.SEED then
-            if max >= itemdata.craftingSkillRequirement then
+        if isSeedOrSpore(itemdata) then
+            if meetsSkillRequirement(itemdata, max) then
                 -- ... rest of function

Similar changes would apply to getLiniment and getFirst.

📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 47a04e8 and 323e23f.

📒 Files selected for processing (1)
  • MiracleGrowLight.lua
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Codacy Static Code Analysis
🔇 Additional comments (1)
MiracleGrowLight.lua (1)

119-126: LGTM! The skill requirement check fixes the reported issue.

The addition of max >= itemdata.craftingSkillRequirement prevents selecting seeds that exceed the player's skill level, which directly addresses the client errors and crafting interruption described in the PR. The logic is consistent with the getSeed function (line 83) and the parentheses grouping is correct.

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.

1 participant

Comments