ddjerqq / Astro

An MMO RPG space game, with economy, clans and empires!
The Unlicense
4 stars 0 forks source link

Feature: add balance to users #2

Closed ddjerqq closed 3 months ago

ddjerqq commented 3 months ago

I want a wallet ValueObject, that will be a wrapper over decimal. I want the following methods implemented:

I want wallet to be implicitly cast to decimal, but explicitly cast to wallet. Wallet must never have a negative balance.

Davy-G commented 3 months ago

just now i pushed the first idea of how i'll implement it also a question, by wrapper you mean it should be an extention class of decimal?

ddjerqq commented 3 months ago

no by wrapper i mean:

public record Wallet(decimal Balance)
{
  // ...
}
ddjerqq commented 3 months ago

i dont see your branch, can you push it and open a [WIP] Pull request?

Davy-G commented 3 months ago

i dont see your branch, can you push it and open a [WIP] Pull request?

ok i will

Davy-G commented 3 months ago

@ddjerqq i will have to create the seperate wallet class since u want to use the users wallet what do you think?

bool TryTranfer(Wallet other)

Davy-G commented 3 months ago

@ddjerqq i will have to create the seperate wallet class since u want to use the users wallet what do you think?

bool TryTranfer(Wallet other)

nevermind i found a better way lol