Repository navigation
fix(npc): don't fail a map because of a merchant item without place - #1612
Conversation
When an item of a merchant store found no place, e.g. because the size of its item definition grew, the Storage constructor threw an ArgumentException. Because the merchant is created with its map, the map failed to load, e.g. the Crywolf event map. The merchant now leaves such an item out of its storage and logs a warning with the merchant, the item and the slot. The item stays in the store in the database, so an administrator can move or remove it. Fixes MUnique#1489 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011xNc75fJTee8EPxDxQxuGi
Codex Review Summary: ❌ FailedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 0 |
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
sven-n
left a comment
There was a problem hiding this comment.
LGTM. A merchant store item without a place is now left out with a warning that tells the operator what to fix, instead of failing the merchant and its whole map.
I built it on current master and ran the tests (all except the slow initialization tests). The only failure was the Web test LateResultOfPreviousSelectionDoesNotOverwriteCurrentOne, a timing-sensitive UI test which this PR doesn't touch (it only changes MerchantNpc and its creation in the game logic).
Generated by Claude Code
Fixes #1489
What
A merchant store item which finds no place, e.g. because the size of its
item definition grew and no other free place is left, no longer makes the
merchant and its map fail.
Why
MerchantNpcbuilds aStorageover the merchant store. Since #1487 theStorageconstructor first moves such an item to another free place, butwhen there is none and no
putAsideItemWithoutPlacefunction is given, itstill throws an
ArgumentException. The merchant is created during the mapinitialization, so the map failed to load, e.g. the Crywolf event map after
the Kris grew to 4x4.
Changes
MerchantNpcpasses aputAsideItemWithoutPlacefunction to theStorageconstructor. It logs a warning with the merchant, the item andthe slot and returns
false, so the item stays in the store in thedatabase and an administrator can move or remove it in the admin panel.
Players only buy copies of store items, so nothing is placed over it.
MapInitializergives its logger to the merchant.Tests
MerchantNpcTest.ItemWithoutPlaceDoesNotFailCreation: an item widerthan a row doesn't fail the creation, isn't in the merchant storage and
stays in the store.
MUnique.OpenMU.Tests3465 passed, 3 skipped;all other test projects pass apart from the admin panel test
EditItemDropsTests.AddedMapGroupIsAssignedToAllMaps, which this changedoesn't touch.