Package com.bitheads.braincloud.services
Class UserItemsService
java.lang.Object
com.bitheads.braincloud.services.UserItemsService
public class UserItemsService extends Object
-
Constructor Summary
Constructors Constructor Description UserItemsService(BrainCloudClient client) -
Method Summary
Modifier and Type Method Description voidawardUserItem(String defId, int quantity, boolean includeDef, IServerCallback callback)Allows item(s) to be awarded to a user without collecting the purchase amount.voiddropUserItem(String itemId, int quantity, boolean includeDef, IServerCallback callback)Allows a quantity of a specified user item to be dropped, without any recovery of the money paid for the item.voidgetUserItem(String itemId, boolean includeDef, IServerCallback callback)Retrieves the identified user item from the server.voidgetUserItemsPage(String context, boolean includeDef, IServerCallback callback)Retrieves the page of user's items from the server based on the context.voidgetUserItemsPageOffset(String context, int pageOffset, boolean includeDef, IServerCallback callback)Retrieves the page of user's items from the server based on the encoded context.voidgiveUserItemTo(String profileId, String itemId, int version, int quantity, boolean immediate, IServerCallback callback)Gifts item to the specified player.voidpublishUserItemToBlockchain(String itemId, int version, IServerCallback callback)Publishes the specified item to the item management attached blockchain.voidpurchaseUserItem(String defId, int quantity, String shopId, boolean includeDef, IServerCallback callback)Retrieves the identified user item from the server.voidreceiveUserItemFrom(String profileId, String itemId, IServerCallback callback)Retrieves and transfers the gift item from the specified player, who must have previously called giveUserItemTo.voidrefreshBlockchainUserItems(IServerCallback callback)Syncs the caller's user items with the item management attached blockchain.voidremoveUserItemFromBlockchain(String itemId, int version, IServerCallback callback)Removes the specified item from the item management attached blockchain.voidsellUserItem(String itemId, int version, int quantity, String shopId, boolean includeDef, IServerCallback callback)Allows a quantity of a specified user item to be sold.voidupdateUserItemData(String itemId, int version, String newItemData, IServerCallback callback)Updates the item data on the specified user item.voiduseUserItem(String itemId, int version, String newItemData, boolean includeDef, IServerCallback callback)Uses the specified item, potentially consuming it.
-
Constructor Details
-
UserItemsService
-
-
Method Details
-
awardUserItem
public void awardUserItem(String defId, int quantity, boolean includeDef, IServerCallback callback)Allows item(s) to be awarded to a user without collecting the purchase amount. If includeDef is true, response includes associated itemDef with language fields limited to the current or default language. Service Name - userItems Service Operation - AWARD_USER_ITEM- Parameters:
defId- The unique id of the item definition to award.quantity- The quantity of the item to award.includeDef- If true, the associated item definition will be included in the response.callback- The callback handler
-
dropUserItem
public void dropUserItem(String itemId, int quantity, boolean includeDef, IServerCallback callback)Allows a quantity of a specified user item to be dropped, without any recovery of the money paid for the item. If any quantity of the user item remains, it will be returned, potentially with the associated itemDef (with language fields limited to the current or default language). Service Name - userItems Service Operation - DROP_USER_ITEM- Parameters:
itemId- The unique id of the user item.quantity- The quantity of the user item to drop.includeDef- If true and any quantity of the user item remains, the associated item definition will be included in the response.callback- The callback handler
-
getUserItemsPage
Retrieves the page of user's items from the server based on the context. If includeDef is true, response includes associated itemDef with each user item, with language fields limited to the current or default language. Service Name - userItems Service Operation - GET_USER_ITEMS_PAGE- Parameters:
context- The json context for the page request.includeDef- If true, the associated item definition will be included in the response.callback- The callback handler
-
getUserItemsPageOffset
public void getUserItemsPageOffset(String context, int pageOffset, boolean includeDef, IServerCallback callback)Retrieves the page of user's items from the server based on the encoded context. If includeDef is true, response includes associated itemDef with each user item, with language fields limited to the current or default language. Service Name - userItems Service Operation - GET_USER_ITEMS_PAGE_OFFSET- Parameters:
context- The context string returned from the server from a previous call to SysGetCatalogItemsPage or SysGetCatalogItemsPageOffset.pageOffset- The positive or negative page offset to fetch. Uses the last page retrieved using the context string to determine a starting point.includeDef- If true, the associated item definition will be included in the response.callback- The callback handler
-
getUserItem
Retrieves the identified user item from the server. If includeDef is true, response includes associated itemDef with language fields limited to the current or default language. Service Name - userItems Service Operation - GET_USER_ITEM- Parameters:
itemId- The unique id of the user item.includeDef- If true, the associated item definition will be included in the response.callback- The method to be invoked when the server response is received
-
giveUserItemTo
public void giveUserItemTo(String profileId, String itemId, int version, int quantity, boolean immediate, IServerCallback callback)Gifts item to the specified player. Service Name - userItems Service Operation - GIVE_USER_ITEM_TO- Parameters:
profileId- The ID of the recipient's user profile.itemId- The ID uniquely identifying the user item to be transferred.version- The version of the user item being transferred.quantity- The quantity of the user item to transfer.immediate- Flag set to true if item is to be immediately transferred, otherwise false to have the sender send an event and transfers item(s) only when recipient calls receiveUserItemFrom.callback- The callback handler
-
purchaseUserItem
public void purchaseUserItem(String defId, int quantity, String shopId, boolean includeDef, IServerCallback callback)Retrieves the identified user item from the server. If includeDef is true, response includes associated itemDef with language fields limited to the current or default language. Service Name - userItems Service Operation - PURCHASE_USER_ITEM- Parameters:
defId- The unique id of the item definition to purchase.quantity- The quantity of the item to purchase.shopId- The id identifying the store the item is being purchased from (not yet supported) Use null or empty string to specify the default shop price.includeDef- If true, the associated item definition will be included in the response.callback- The callback handler
-
receiveUserItemFrom
Retrieves and transfers the gift item from the specified player, who must have previously called giveUserItemTo. Service Name - userItems Service Operation - RECEVIE_USER_ITEM_FROM- Parameters:
profileId- The profile ID of the user who is giving the item.itemId- The ID uniquely identifying the user item to be transferred.callback- The callback handler
-
sellUserItem
public void sellUserItem(String itemId, int version, int quantity, String shopId, boolean includeDef, IServerCallback callback)Allows a quantity of a specified user item to be sold. If any quantity of the user item remains, it will be returned, potentially with the associated itemDef (with language fields limited to the current or default language), along with the currency refunded and currency balances. Service Name - userItems Service Operation - SELL_USER_ITEM- Parameters:
itemId- The unique id of the user item.version- The version of the user item being sold.quantity- The quantity of the user item to sell.shopId- The id identifying the store the item is being purchased from (not yet supported) Use null or empty string to specify the default shop price.includeDef- If true and any quantity of the user item remains, the associated item definition will be included in the response.callback- The callback handler
-
updateUserItemData
public void updateUserItemData(String itemId, int version, String newItemData, IServerCallback callback)Updates the item data on the specified user item. Service Name - userItems Service Operation - UPDATE_USER_ITEM_DATA- Parameters:
itemId- The unique id of the user item.version- The version of the user item being updated.newItemData- New item data to replace existing user item data.callback- The callback handler
-
useUserItem
public void useUserItem(String itemId, int version, String newItemData, boolean includeDef, IServerCallback callback)Uses the specified item, potentially consuming it. Service Name - userItems Service Operation - USE_USER_ITEM- Parameters:
itemId- The unique id of the user item.version- The version of the user item being used.newItemData- Optional item data to replace existing user item data. Specify null to leave item data unchanged. Specify empty map to clear item data.includeDef- If true, the associated item definition will be included in the response.callback- The callback handler
-
publishUserItemToBlockchain
Publishes the specified item to the item management attached blockchain. Results are reported asynchronously via an RTT event. Service Name - userItems Service Operation - PUBLISH_USER_ITEM_TO_BLOCKCHAIN- Parameters:
itemId- The unique id of the user item.version- The version of the user item being published.callback- The callback handler
-
refreshBlockchainUserItems
Syncs the caller's user items with the item management attached blockchain. Results are reported asynchronously via an RTT event. Service Name - userItems Service Operation - REFRESH_BLOCKCHAIN_USER_ITEMS- Parameters:
callback- The callback handler
-
removeUserItemFromBlockchain
Removes the specified item from the item management attached blockchain. Results are reported asynchronously via an RTT event. Service Name - userItems Service Operation - REMOVE_USER_ITEM_FROM_BLOCKCHAIN- Parameters:
itemId- The unique id of the user item.version- The version of the user item being removed.callback- The callback handler
-