question

accounts-5 avatar image
accounts-5 asked

Economy V2 - Ids and Friendly Ids

I'm just getting into Economy V2 and think the usage of Friendly IDs is a bit inconsistent, maybe I'm missing sth.

Using CloudScript and the ServerAPI, granting items to users with the FriendlyId as AlternateId works fine. And using the FriendlyId, the Game Designer can maintain readable balancing/drop tables. So far so good.

But on the client, on Game Start I'm fetching the players currencies with GetInventoryItems but only get the default Ids, not the alternative ones, so I don't know which ones which, resulting in a second GetItems call. So basically, using FriendlyIds, anytime I fetch inventory items I have to make two API calls to identify them. Is this the intended behaviour?

I checked if I can get the complete catalog with ids <> alternateIds but there's no such call. I there's no suggested way to do this, I'll probably maintain a TitleData entry mapping FriendlyIds to Ids . But I'd prefer not to.

Appreciate the help :)

apisIn-Game EconomyPlayer Inventory
10 |1200

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

1 Answer

·
Simon Cui avatar image
Simon Cui answered

Using GetInventoryItems and GetItems API to retrieve details of inventory items is fine. You can cache the result of GetItems in client so that you don’t need to call that every time.

As a workaround, you can also set stackId as a friendly name of an item. In this way, you can call GetInventoryItems once to achieve your goal. You can refer to this post: How to display player inventory in Economy V2? - Playfab Community

2 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.

accounts-5 avatar image accounts-5 commented ·

Thanks for the reply. I'm not a fan of (mis-)using the stackId because maybe I'll need it later on for its intended purpose.

Looking at the accepted answer following the link, I'm considering caching the complete catalog at game start instead of using the two API calls as I'm imaging it being more cost effective? The best way to go about it is using the SearchItems API right?

0 Likes 0 ·
Simon Cui avatar image Simon Cui accounts-5 commented ·

Yes, you can use SearchItems API to cache data that you need.

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.