-
Notifications
You must be signed in to change notification settings - Fork 505
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Balance64 to WalletInfoCallback #607
Conversation
|
Sure, why not, if you consider it better. |
Codecov Report
@@ Coverage Diff @@
## master #607 +/- ##
=========================================
Coverage ? 23.46%
=========================================
Files ? 85
Lines ? 8675
Branches ? 719
=========================================
Hits ? 2036
Misses ? 6508
Partials ? 131
Continue to review full report at Codecov.
|
/// <summary> | ||
/// Gets the balance of the wallet, in cents. | ||
/// Gets the balance of the wallet as a 32-bit integer, in cents. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know that stating data type in the doc is a bit excessive and unneeded, but I wanted to point out the difference between those two for people that might not recall at first. I think it's OK in this case where consumer might wonder which one to use.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we know what actually happens to this field when an account has a balance of $42m?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it in USD or users currency?
Because with vietnamese dong a game can cost 1.300.000₫ which is 130000000 cents.
This https://store.steampowered.com/sub/252061/?cc=vn costs 1359250000 cents in dong.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well do we know what happens in that scenario too?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No clue, but I pointed it out to ease the checking it out if anyone wants to.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't check myself but very likely it caps at int.MaxValue
and stays there. This would be the solution that makes the most sense in terms of backwards compatibility.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@JustArchi Just saw your comment - yeah, but it's Valve. I'd be quite unsurprised if it's just the lower 32 bits of the actual balance, and wraps around to the negatives.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@yaakov-h you're totally right and it also wouldn't shock me, but I'm not rich enough to check 😀.
And BTW yes, this balance is in local currency (ECurrencyCode
) which is user's local currency, if supported by Steam. It counts from full cents or other smallest monetary value.
I think "in cents" in the xmldoc is slightly misleading, because with some |
They're all still multiplied by 100, aren't they? |
I don't think Yen has a hundredth value. |
It depends on the currency. For "traditional" western currencies like USD, CAD, PLN, EUR, the minimum monetary value is 0.01 of that currency and this amount is what Steam uses as integer. In other words, 10 USD will have Not all currencies follow traditional way though, yen is a good example of that, there is no 0.01th of yen. I'm actually wondering now if Valve decided to go easy route and just record everything as * 100, or there is per-currency-parsing where yen balance should not be divided by 100 to present actual one. If somebody is interested in checking that out, I'd be interested in knowing that as well, because that routine has to be included in the Steam client itself. If there is more logic to that, it could be a good idea to reverse-engineer it and add directly in SK2's callback for easier access to actual balance. Right now this is just a wrapper over protobuf message - works fine, but the logic is expected from the consumer. |
From IRC:
|
I was afraid they might go this route... 😀 Thanks! |
This can be needed if
int
won't be enough to display the account balance, i.e. when balance reaches more than21474836.47
in local currency.Unlikely to happen, but won't hurt to add considering Steam provides this.