Skip to content

A job-level gate says the job level, not the class - #2294

Merged
erwan-joly merged 2 commits into
NosCoreIO:masterfrom
denislauri1999:pr/wear-job-level-message
Aug 26, 2026
Merged

A job-level gate says the job level, not the class#2294
erwan-joly merged 2 commits into
NosCoreIO:masterfrom
denislauri1999:pr/wear-job-level-message

Conversation

@denislauri1999

@denislauri1999 denislauri1999 commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

The check is JobLevel < LevelJobMinimum and the answer was CanNotBeWornDifferentClass — "you do not belong to the required class", accusing the one thing that was fine.

The two messages are crossed. The class restriction is part of the combined level/sex/class gate further up, which sends CanNotWearThat:

if (item.LevelMinimum > ... || (item.Sex != 0 && ...) || (item.Class != 0 && ...))
{
    // -> CanNotWearThat
}
...
if (session.Character.JobLevel < item.LevelJobMinimum)
{
    // -> CanNotBeWornDifferentClass   <- here
}

Game18NConstString.CanNotBeWornLowJobLevel already exists and was unused. OpenNos answers LOW_JOB_LVL ("Your joblevel is too low!") on this same condition.

Where it shows up in play: a Wild Keeper card needs job level 55, and a class change resets the job level to 1 — so the player is told they are the wrong class right after changing class, which is the most misleading moment possible.

The test asserts both halves: the job-level message is sent, and the class message is not. Being wrong here sends a real message on the right condition, so nothing raises — the player is just told the wrong reason.

Summary by CodeRabbit

  • Bug Fixes

    • Corrected the message shown when an item cannot be worn because the character’s job level is too low.
    • Items rejected for insufficient job level no longer display the unrelated class restriction message.
  • Tests

    • Added coverage to verify the correct message and rejection behavior.

The check is `JobLevel < LevelJobMinimum` and the answer was "you do not belong
to the required class" - accusing the one thing that was fine. Reported from
play as "NosCore will not let me wear an SP", with a reason pointing away from
the cause: a Wild Keeper card needs job level 55, and a class change resets the
job level to 1.

The two messages were crossed. The class restriction is part of the combined
level/sex/class gate further up, which sends CanNotWearThat; the job-level gate
had the class message. Game18NConstString.CanNotBeWornLowJobLevel already
existed and was unused. The sibling codebase answers "Your joblevel is too low!"
on this same condition.

The test asserts both halves: the job-level message is sent, and the class
message is not. Being wrong here sends a real message on the right condition, so
nothing raises - the player is just told the wrong reason.
@coderabbitai

coderabbitai Bot commented Aug 24, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: bc0a6b0c-8c7b-4ca8-a043-fe951ad812ff

📥 Commits

Reviewing files that changed from the base of the PR and between 55dc38c and f459fe2.

📒 Files selected for processing (2)
  • src/NosCore.GameObject/Messaging/Handlers/UseItem/WearHandler.cs
  • test/NosCore.GameObject.Tests/Messaging/Handlers/UseItem/WearHandlerTests.cs

Included review availability: Your plan provides up to 2 included reviews per hour; 1 remains after this review.


Walkthrough

WearHandler now returns the low-job-level message for items rejected because the character's job level is too low. Tests verify the new message and confirm that the different-class message is absent.

Changes

Wear item job-level validation

Layer / File(s) Summary
Job-level rejection response and test coverage
src/NosCore.GameObject/Messaging/Handlers/UseItem/WearHandler.cs, test/NosCore.GameObject.Tests/Messaging/Handlers/UseItem/WearHandlerTests.cs
WearHandler now uses CanNotBeWornLowJobLevel for insufficient job level. Tests configure the job-level requirement and verify the expected message without CanNotBeWornDifferentClass.

Estimated code review effort: 2 (Simple) | ~10 minutes

Merge Risk: ⚪ Minimal · up to f459f

The change corrects the message shown for insufficient job level and adds regression coverage for the affected behavior. No actionable merge-blocking risk remains beyond normal checks and review.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 9.09% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 11 functions across 2 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the main change: the job-level restriction now reports the job-level message instead of the class-related message.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
  • Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@erwan-joly
erwan-joly merged commit c4f60b7 into NosCoreIO:master Aug 26, 2026
2 checks passed
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