Skip to content

Keep bank gold in the gold component - #2969

Merged
erwan-joly merged 1 commit into
masterfrom
claude/project-thread-suoro3-bank
Nov 13, 2026
Merged

erwan-joly merged 1 commit into
masterfrom
claude/project-thread-suoro3-bank

Conversation

@erwan-joly

@erwan-joly erwan-joly commented Nov 13, 2026 •

Copy link
Copy Markdown
Collaborator

Requested by Erwan · project thread

Follow-up to #2967: the last mutable state the player bundle read and wrote straight through a DTO.

What changed

  • BankGold was a hand-written bundle property over Account.BankMoney. It is now a field of GoldComponent next to Gold, so the bundle property is generated and no call site changes.
  • CreatePlayer takes the bank balance from the account when the character enters the world.
  • SaveService and the trade's TransferService copy it into the account row before writing it, the same way they already copy Gold into the character row. The trade's rollback restores it too.

No behaviour change is intended.

Verification

  • New SaveServiceTests.SavingCharacterPersistsTheAccountsBankGold. TransferServiceTests (bank gold traded, stored and rolled back) still pass.
  • dotnet test NosCore.sln: all green except NosCore.Parser.Tests EveryDeclaredEffectIsNamed, which fails the same way on master locally.
  • Client, master and branch: the account starts with 123,000 in the bank. Tester opens the bank at the Cuarry Bank Representative (shows 123,000), runs $SetBankGold 456000, quits, and logs in again. The account row reads 456000 on both, and the bank window then shows 456,000.

Each image shows, left to right: the bank at 123,000, after $SetBankGold 456000, and the bank after relogging.

Master:

10-master-bank

Branch:

11-branch-bank

Manual test plan checks still worth a human pass

From documentation/manual-test-plan.md: deposit and withdraw at the banker with the fee; trade bank gold between two players and relog both.


Generated by Claude Code

The account's bank balance was a bundle property reading and writing
AccountDto directly. It now sits in GoldComponent beside the character's
gold, and the save and the trade copy it into the account row.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014gSmkTzR51DzhJwrXVqDmS
@coderabbitai

coderabbitai Bot commented Nov 13, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 10 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 2 included reviews currently available.

Learn how review limits work.

Review configuration:

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 0c587ca and 0ca0dc4.

Files selected for processing: 8

  • src/NosCore.GameObject/Ecs/Components/GoldComponent.cs
  • src/NosCore.GameObject/Ecs/MapWorld.cs
  • src/NosCore.GameObject/Ecs/PlayerComponentBundle.cs
  • src/NosCore.GameObject/Services/SaveService/SaveService.cs
  • src/NosCore.GameObject/Services/TransferService/TransferService.cs
  • src/NosCore.PacketHandlers/CharacterScreen/SelectPacketHandler.cs
  • test/NosCore.GameObject.Tests/Services/SaveService/SaveServiceTests.cs
  • test/NosCore.Tests.Shared/TestWorld.cs
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

@erwan-joly erwan-joly self-assigned this Nov 13, 2026
@erwan-joly

Copy link
Copy Markdown
Collaborator Author

Client screenshots: bank at 123,000, after $SetBankGold 456000, and the bank after relogging; first image master, second branch.

10-master-bank

11-branch-bank

@erwan-joly
erwan-joly merged commit 5d3c074 into master Nov 13, 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