question

Sumit Singh avatar image
Sumit Singh asked

How do I fetch a specific Currency from player's Inventory V2

What I am trying to do here is build a drop table for a reward in my game which can be purchased in exchange of the game's virtual currency. The goal here that I am trying to achieve is I want to create a system where I can just define the Reward Items and their chances of Getting them (in percent ). When the user purchases the reward any three reward items will be granted to user based on the chance/Percent.

Since I am using the playfab's Catalog V2 there are no drop tables in there. The way I did it is I created an Azure function script in which I fetch a catalog bundle with my raw JSON data in it did the necessary calculations and Granted three rewards to the player. This process is costing me two API calls

But I also want to verify in the script that the user has enough virtual currencies to purchase the reward. I was wondering is there any better way of doing this or making a system like this If not how can I fetch the amount of a Specific virtual currency from the player's Inventory V2.

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

·
Neils Shi avatar image
Neils Shi answered

As you said, Economy v2 doesn't support Drop Table, you should implement the random drop feature with Azure Function. And you can fetch a specific Currency from the player's Inventory via API GetInventoryItems. Here is the request body you can refer to:

 {
   "Entity": {
                 "Id": " ",
                 "Type": "title_player_account",
                 "TypeString": "title_player_account"
             },
   "Filter":"id eq 'the Item ID of the Currency you want'"
 }
1 comment
10 |1200

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

kylemc@microsoft.com avatar image kylemc@microsoft.com commented ·

@Neils Shi please remove "GenerateReceipt" from the example above. That is a private preview property that we did not publicly release (and doesn't do anything). Can you follow up with me on discord? I'd love to figure out what title and tools you're using to avoid confusion in the future.

1 Like 1 ·

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.