question

samo avatar image
samo asked

Gift Inbox

I want to implement "Gift Inbox" in my game. I would be grateful if you could teach me a good way.

  • A gift list with messages that players can receive.
  • The types of gifts are items, virtual currency, and characters.
  • Gifts that can be received within the period can be set and will not be displayed in "Gift Inbox".
  • After the gift has been received or expired, you will see a history for a period of time.

Like these, https://www.reddit.com/r/RaidShadowLegends/comments/dsf4qp/a_little_gift_of_plarium_for_us_check_your_inbox/

https://imgur.com/r/DragaliaLost/Ds7y9te

*These images are for illustration purposes and nothing to do with our game.

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

·
Sarah Zhang avatar image
Sarah Zhang answered

>> A gift list with messages that players can receive.

You can use PlayFab container items to implement the “gift”. PlayFab containers are collections of items and virtual currency that remain as an item in the player's inventory until opened. Please refer to this selection New Catalog Container fields to create a new container item. Game administrators can grant locked container items to players as gifts. Then players can use client API UnlockContainerItem to open it.

Implementing the “gift list” need to depend on the client code, because unopened containers will be in the inventory like normal items. You need to get the inventory list and filter the unopened containers by client code. For example, you can add a prefix(like “Gift”) in the container’s name, get the inventory list via client API GetUserInventory, then only show the item whose name has a “Gift” prefix in the game client UI list.

>> The types of gifts are items, virtual currency, and characters.

PlayFab containers can be collections of items or virtual currency. About the character gift, you need to create an item who can be a token for character creation in advance, then add the item to the container. After players open the container, clients should call the API GrantCharacterToUser to grant the corresponding character to the player.

>> Gifts that can be received within the period can be set and will not be displayed in “Gift Inbox”.

Do you mean players can choose the gift in advance? PlayFab doesn’t natively support such features. Game developers need to design a “gift choosing” system by themselves. For instance, store the chosen gifts in the player data, grant the gifts via CloudScript and Scheduled Tasks, every time when CloudScript grants a gift, let it determine the corresponding player data firstly.

>> After the gift has been received or expired, you will see a history for a period of time.

In the New Catalog Container or Container Edit page, you can check [Consumable] option and set the expired time. Please check this selection New Catalog Item fields for more fields’ explanations.

PlayFab doesn’t natively support such history recording features. The possible workaround is tracking events via Rules, store a pair of history record to player data, when player_inventory_item_added event happens. You need to manage the deletion and adding of these history records by yourself. Please modify and use this solution based on the actual situations.

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.