question

mreza mnejad avatar image
mreza mnejad asked

hi , why SecondsToRecharge in VirtualCurrencyRechargeTimes always return same value?

apis
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

brendan avatar image
brendan answered

It isn't. The recharge time always reflects the amount of time remaining to the next recharge of the currency. If you've specified a very high recharge rate, it's entirely possible that you're seeing numbers that are very close to each other, since it's telling you the time to the next single increment of the VC. Can you provide specifics about your test case - Title ID and Virtual Currency ID?

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

mreza mnejad avatar image
mreza mnejad answered

tnx for reply,
it's very wierd, i have a meat currency, with recharge rate of 144 and a max of 5,

return value of "seccondToRecharge" always equal to 600...
titleId=349C

currency code="MT"

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

brendan avatar image
brendan answered

That's not what I'm seeing when I look at players in your Title ID. For example, when I request the inventory for PlayFab ID E1ACB24FE279DC3E, this is what I see:

{
    "code": 200,
    "status": "OK",
    "data": {
        "PlayFabId": "E1ACB24FE279DC3E",
        "Inventory": [],
        "VirtualCurrency": {
            "BM": 0,
            "GD": 1000,
            "GM": 0,
            "MT": 5
        },
        "VirtualCurrencyRechargeTimes": {
            "MT": {
                "SecondsToRecharge": 0,
                "RechargeTime": "2016-12-31T16:13:58.057Z",
                "RechargeMax": 5
            }
        }
    }
}

So, the SecondsToRecharge for this player is 0, since he's at the RechargeMax (meaning he can't get any more).

4 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

mreza mnejad avatar image mreza mnejad commented ·

again ty,
can you request character currency with "GetCharacterInventory" ?

still same response with character inventory

idk what problem is!

0 Likes 0 ·
brendan avatar image brendan mreza mnejad commented ·

Sorry, I don't follow. There isn't a recharge time returned on Character inventory.

0 Likes 0 ·
Show more comments
mreza mnejad avatar image
mreza mnejad answered

seccond to reharge in 2 request is 600,

fire character have 5 "MT" !!!!!!!!!!!!


debug.jpg (72.3 KiB)
debug1.jpg (47.6 KiB)
3 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

brendan avatar image brendan commented ·

Okay, I see the issue. Regenerating currencies are designed for the User, not the Character. So what you're seeing is the max recharge time on the regeneration time when querying for the Character inventory - so, if you set the recharge rate to be 24 (once per hour), you'd see 2400 currently, when using the Client API (I was testing with the Server API, hence the difference). I'll open a bug on this to get the recharge rate info removed from the Character, so that it's not confusing.

0 Likes 0 ·
mreza mnejad avatar image mreza mnejad brendan commented ·

ty @Brendan
so , should i do some math for timer of character regenerating currency ?

(last app close date , seccond to recharge , login date ...)

0 Likes 0 ·
brendan avatar image brendan mreza mnejad commented ·

Since VC regeneration doesn't apply to Character VC balances, yes, if you want to regenerate VC on a Character, I would recommend using Cloud Script for that calculation. I've opened a backlog item to provide an option to titles to turn on VC regeneration on Characters, so that titles that do want this will be able to in future (without breaking existing titles).

0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.