Skip to main content

Timeline for RPG Currency System

Current License: CC BY-SA 4.0

11 events
when toggle format what by license comment
S Mar 27, 2019 at 13:22 history suggested Glorfindel CC BY-SA 4.0
typos corrected
Mar 27, 2019 at 12:49 review Suggested edits
S Mar 27, 2019 at 13:22
Mar 19, 2016 at 17:48 comment added Zane @Krythic Another way of putting his point (which you seem to have misunderstood) is that the business logic of storing and modifying money should be in a different class from the logic of displaying said money. One reason you might want this: it would become trivial to have multiple extensions of the CurrencyConverter (for instance) for different languages. Perhaps in one language you only want 3 forms of currency. Either way, your business logic for modifying a user's money shouldn't also have to deal with the conversion of currency - that should be up to another class.
Mar 16, 2016 at 18:58 comment added Erik @Krythic not if you just have a single currency formatter class. That way you can reuse the logic or extend it easily. This would be DRY, follow the SRP, and respect the Open/Closed principle.
Mar 16, 2016 at 13:22 comment added Krythic @Falco But then I would need to do the same thing for other parts of the game that need that same logic for their algorithms. Doing it your way would violate DRY patterns.
Mar 16, 2016 at 12:15 comment added Falco @Krythic The most important point of this answer is: Why do you even bother with all this in your code? You should only use a single integer for money everywhere. And in the UI there will be a single Method "displayMoneyParts" which will render the money for the player.
Mar 16, 2016 at 10:49 comment added Krythic Wasn't trying to be a dick, but thanks for stopping by!
Mar 16, 2016 at 10:38 comment added Nikita B @Krythic, no, I understood it just fine. You do use long internally (thats why I suggested it, you should probably be using uint instead). But you also use CoinTypes, you have properties such as Silver, and you have methods such as AddCoins on your MoneyBag. The question I was asking is why would you want to deal with all those different currencies and convertions in YOUR BUSINESS LAYER, When you could have had just one currecny. And no, there is no recursion in equlity methods. But you are clearly not open for cirticism, so I will just live it at that. Have a nice day.
Mar 16, 2016 at 10:34 comment added Krythic Your suggestion on equality would also cause a stack overflow due to infinite recursion.
Mar 16, 2016 at 10:17 history edited Nikita B CC BY-SA 3.0
added 211 characters in body
Mar 16, 2016 at 10:10 history answered Nikita B CC BY-SA 3.0