question

himanshu avatar image
himanshu asked

How to access actual value from container contents

Hi there, I've been trying to get all actual value from a Container in my case I've Granted a "Chest" which is a container and Unlocked it using UnlockContainerItemResult but It does only gives me strings of ID, Name and IteminstanceID etc, however I need actual Value to show them on UI to user that user have claimed these items "VC as Gold, gems and Weapon" So aforementioned contain these values but I have had tried many way to get value but none worked or I'm not sure if I had tried right way. Please help me or ping me out if I'm doing wrong way but UnlockContainerItemResult should contain a List or dictionary for ItemInstance which gives actual value if there is currency or experience level subsequently open the chest.

apisunity3d
10 |1200

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

Neils Shi avatar image
Neils Shi answered

The value of currency is contained in the “VirtualCurrency” field. And the “UsesIncrementedBy” represents the number of items that will be added to the player through the container. For more info, you can refer to my request’s response.

6065-test2.png

 "GrantedItems": [
             {
                 "ItemId": "small_experience_potion",
                 "ItemInstanceId": "80F1EC9AA4xxxxxx",
                 "PurchaseDate": "2023-06-22T02:09:23.839Z",
                 "Expiration": "2023-06-22T02:49:23.839Z",
                 "RemainingUses": 8,
                 "UsesIncrementedBy": 8,
                 "Annotation": "Unlocked Crate",
                 "CatalogVersion": "main",
                 "DisplayName": "small_experience_potion",
                 "UnitPrice": 0
             }
         ],
         "VirtualCurrency": {
             "SL": 6
         }

test2.png (21.9 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.

himanshu avatar image himanshu commented ·

Well, I tried your way and it doesn't show anything expect null and I made those callout from both side Server and Client which gives me the same result as you can refer to my screenshot6078-screenshot-2023-06-22-at-110008.png

0 Likes 0 ·
himanshu avatar image himanshu commented ·

I do must mention that I'm using drop table which gives random or depends on odds will have items "Those items comes from bundle content and they represents as virtual currency like gold, thunder etc" now I'm wondering I might have approached wrong way but I would like to mention what result I'm expecting here is once I opened the chest I'm expecting those currency and items show sequentially so I can show them on UI along with quantity.

0 Likes 0 ·
Neils Shi avatar image Neils Shi himanshu commented ·

After my test, if the content of the container is a bundle about currency, the response of API UnlockContainerItem won’t include the info of currency’s value. But it will return the bundle id, so, the client can check the catalog to know what are inside the bundle and show them in UI. Since the Catalog is usually a static data, you can cache it locally.

0 Likes 0 ·
himanshu avatar image
himanshu answered

6079-screenshot-2023-06-22-at-114228.png


10 |1200

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

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.