question

Max Guernsey, III avatar image
Max Guernsey, III asked

Can can I detect that an expired bundle has been purchased?

I have a set of boards players can purchase independently or they can buy them in a bundle. Right now, when they buy the bundle, the boards show up as bought but not the bundle. I am sure this is a product of my store logic failing to take into account some detail.

My first instinct is to make the store filter out bundles that contain only durable items that the player already possesses. This would have the side effect of a player who bought all five boards independently no longer seeing the item (which is preferable).

Is there a standard PlayFab way to do this or should I be implementing my own filtration logic along the lines of the above?

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

Seth Du avatar image
Seth Du answered

Is this bundle a one-time purchase item for each player? If so, in my point of view, you may set flags in Player Read-Only/Internal Data for later reference.

In fact, if the game doesn’t have many this kind of items, you may also consider setting the bundle as stackable and durable. Because when a bundle is granted, bundle itself (as an item instance), along with all the contained items will be granted to the player at the same time. We usually set the bundle as consumable by time and so that it will be expired soon so that players only notice that the contained items stay. If you set the bundle as durable, you may remain it in the inventory and it can be used for later reference. However, please note that the inventory has limit on counts. In terms of stackable, it is optional but very practical option, because when this kind of items are granted duplicately, there won't be other item instance occupies the limit counts.

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.

Max Guernsey, III avatar image Max Guernsey, III commented ·

I thought about the durable and stackable route. The problem is it doesn't manage the complexity of what if the user buys each individual component within the bundle. I thought about writing information down in one of the metadata fields of the item but not recording it in the user's data. That's a good idea.

I went with what I described in my own answer because it addresses my root concern. Your answer is the correct answer for the question as asked, though.

0 Likes 0 ·
Max Guernsey, III avatar image
Max Guernsey, III answered

Continued research shows this to be nontrivial, although it's not very hard. The response to GetCatalogItems contains the list of bundled item ids but that doesn't make sense to use as an indicator of ownership because items are catalog/store concepts. If you are using the store items in a manner consistent with (what appears to be) indicated as intended by the UI, you are using the class as the identifier of an object and, therefore, as the thing that is "owned".

GetCatalogItems doesn't seem to provide this information as part of the bundle info for an item.

It's not hard to conclude what you need to do. GetCatalogItems gives you all the items available. So you can fish through that body of data for the items with each of the item ids in the bundle info. Then you can check those items classes against the players' inventory to see if they are owned.

This has to be done recursively so that items that are transitively part of a bundle can be checked for ownership.

Like I said, not hard. Just tedious.

I'll leave this open for a little bit to see if anyone from PlayFab has a better answer.

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.