Skip to content

fix: Remove combined transferable and regular coins#729

Open
jprzimba wants to merge 4 commits into
mainfrom
coin-store
Open

fix: Remove combined transferable and regular coins#729
jprzimba wants to merge 4 commits into
mainfrom
coin-store

Conversation

@jprzimba
Copy link
Copy Markdown
Collaborator

Add support for atomically removing coins across two coin types (primary then secondary).

  • Introduce Account::removeCoins overload to remove an amount using two distinct coin types and register separate transactions for each type.
  • Implement AccountRepositoryDB::removeCoins to lock rows, deduct from primary then secondary, record transactions, and return proper AccountErrors_t results; add DB helper executeWithinTransactionRollbackOnFailure to simplify transactional operations.
  • Update account repository header and in-memory test fixture to support the new removeCoins API.
  • Update gamestore Lua and player logic to treat transferable + regular Tibia coins as a combined balance (send total to older clients, add canPayForOffer logic, and prefer combined removal when paying transferable offers); add Lua binding Player:removeTransferableAndTibiaCoins.
  • Adjust Player methods to propagate actual removal result and send balance updates only on success.
  • Add unit tests to verify combined removal, insufficient funds behavior, and repository failure handling.

These changes allow transferable-coin offers to be paid using transferable coins first and regular coins as a fallback, while ensuring consistency via transactional DB updates and updated APIs.

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