question

Matt Rochon avatar image
Matt Rochon asked

Economy v2 purchase item bundle stack values

The title is a bit wordy but the issue I am facing is as follows:

I have a number of bundles available in a store. A bundle could consist of multiple different types of items.

Currently the PurchaseInventoryItems api accepts a 'NewStackValues', but theres no way to create the proper stack values for each individual item.

I could do this using execute operations on each discrete item in the bundle, but i wanted to use purchaseItem for a number of reasons.

  1. So that this is tracked as a purchase, and I can use the same code for virtual and real money purchases and the tracking would be consistent.

  2. Prevent from having to split the executions if the number of operations exceeds the limits, and having to rollback partial transactions if something fails.

  3. Significantly reduce the amount of calls I need to make per-purchase, as I dont need to validate each item independently. <- this one is largely use-case specific.

Whats the best approach here?

apisIn-Game Economy
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.

Matt Rochon avatar image Matt Rochon commented ·

Also, how can I get the stack ids of items that were added as a result of this purchase.

0 Likes 0 ·
Xiao Zha avatar image
Xiao Zha answered

The PurchaseInventoryItem API is not able to specify stackId for each item in a Bundle. For each Item, you can add a default StackId when you create it. Not sure if the default stack id can meet your requirement.

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.

Matt Rochon avatar image Matt Rochon commented ·

i was referring to stack values, not the stack id

0 Likes 0 ·
Xiao Zha avatar image Xiao Zha Matt Rochon commented ·

My mistake. And the PurchaseInventoryItem API is not able to specify DisplayProperties individually for each item in the Bundle.

0 Likes 0 ·
kylemc@microsoft.com avatar image
kylemc@microsoft.com answered

Out of curiosity, what DisplayProperties do you vary across items purchased in the same bundle?

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.

Matt Rochon avatar image Matt Rochon commented ·

A bundle could have currency, items, lootboxes, etc inside it.

0 Likes 0 ·
Matt Rochon avatar image Matt Rochon Matt Rochon commented ·

So an item might have information about the power and duration of a buff, or the number of charges left. A lootbox might have information about the loot table in effect when the item was purchased. A character might have information about stats and levels, etc. Gear might have information about random rolled properties applied to it.

The list goes on.

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.