Skip to content

fix(npc): don't fail a map because of a merchant item without place - #1612

Merged
sven-n merged 1 commit into
MUnique:masterfrom
icheat2win:fix/merchant-item-without-place
Nov 24, 2026
Merged

sven-n merged 1 commit into
MUnique:masterfrom
icheat2win:fix/merchant-item-without-place

Conversation

@icheat2win

Copy link
Copy Markdown
Contributor

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

MerchantNpc builds a Storage over the merchant store. Since #1487 the
Storage constructor first moves such an item to another free place, but
when there is none and no putAsideItemWithoutPlace function is given, it
still throws an ArgumentException. The merchant is created during the map
initialization, so the map failed to load, e.g. the Crywolf event map after
the Kris grew to 4x4.

Changes

  • MerchantNpc passes a putAsideItemWithoutPlace function to the
    Storage constructor. It logs a warning with the merchant, the item and
    the slot and returns false, so the item stays in the store in the
    database 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.
  • MapInitializer gives its logger to the merchant.

Tests

  • New MerchantNpcTest.ItemWithoutPlaceDoesNotFailCreation: an item wider
    than a row doesn't fail the creation, isn't in the merchant storage and
    stays in the store.
  • CI run of the branch: MUnique.OpenMU.Tests 3465 passed, 3 skipped;
    all other test projects pass apart from the admin panel test
    EditItemDropsTests.AddedMapGroupIsAssignedToAllMaps, which this change
    doesn't touch.

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
@chatgpt-codex-connector

Copy link
Copy Markdown
Codex Review Summary: ❌ Failed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ❌ Failed 2026-11-24T02:38:16.139229Z
We couldn’t complete this review. Comment @codex review to try again.
5dcdc66 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 0 complexity

Metric Results
Complexity 0

View in Codacy

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 sven-n left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@sven-n
sven-n merged commit be00531 into MUnique:master Nov 24, 2026
1 check 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.

A merchant store item which no longer fits makes its map fail to load

3 participants