DropUserItem
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 | Operation |
---|---|
userItems | DROP_USER_ITEM |
Method Parameters
Parameter | Description |
---|---|
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. |
Usage
http://localhost:3000
- C#
- C++
- Objective-C
- Java
- JavaScript
- Dart
- Cloud Code
- Raw
string itemId = "aaa-bbb-ccc-ddd";
int quantity = 1;
bool includeDef = true;
SuccessCallback successCallback = (response, cbObject) =>
{
Debug.Log(string.Format("Success | {0}", response));
};
FailureCallback failureCallback = (status, code, error, cbObject) =>
{
Debug.Log(string.Format("Failed | {0} {1} {2}", status, code, error));
};
_bc.UserItemsService.DropUserItem(itemId, quantity, includeDef, successCallback, failureCallback);
const char *itemId = "aaa-bbb-ccc-ddd";
int quantity = 1;
bool includeDef = true;
_bc->getUserItemsService()->dropUserItem(itemId, quantity, includeDef, this);
NSString *itemId = @"aaa-bbb-ccc-ddd";
int quantity = 1;
bool includeDef = true;
BCCompletionBlock successBlock; // define callback
BCErrorCompletionBlock failureBlock; // define callback
[[_bc userItemsService] dropUserItem:itemId
quantity:quantity
includeDef:includeDef
completionBlock:successBlock
errorCompletionBlock:failureBlock
cbObject:nil];
String itemId = "aaa-bbb-ccc-ddd";
int quantity = 1;
boolean includeDef = true;
this; // implements IServerCallback
_bc.getUserItemsService().dropUserItem(itemId, quantity, includeDef, this);
public void serverCallback(ServiceName serviceName, ServiceOperation serviceOperation, JSONObject jsonData)
{
System.out.print(String.format("Success | %s", jsonData.toString()));
}
public void serverError(ServiceName serviceName, ServiceOperation serviceOperation, int statusCode, int reasonCode, String jsonError)
{
System.out.print(String.format("Failed | %d %d %s", statusCode, reasonCode, jsonError.toString()));
}
var itemId = "aaa-bbb-ccc-ddd";
var quantity = 1;
var includeDef = true;
_bc.userItems.dropUserItem(itemId, quantity, includeDef, result =>
{
var status = result.status;
console.log(status + " : " + JSON.stringify(result, null, 2));
});
var itemId = "aaa-bbb-ccc-ddd";
var quantity = 1;
var includeDef = true;
ServerResponse result = await _bc.userItemsService.dropUserItem(itemId:itemId, quantity:quantity, includeDef:includeDef);
if (result.statusCode == 200) {
print("Success");
} else {
print("Failed ${result.error['status_message'] ?? result.error}");
}
var itemId = "aaa-bbb-ccc-ddd";
var quantity = 1;
var includeDef = true;
var userItemsProxy = bridge.getUserItemsServiceProxy();
var postResult = userItemsProxy.dropUserItem(itemId, quantity, includeDef);
if (postResult.status == 200) {
// Success!
}
{
"service": "userItems",
"operation": "DROP_USER_ITEM",
"data": {
"itemId": "aaa-bbb-ccc-ddd",
"quantity": 1,
"includeDef": true
}
}
JSON Response
{
"data": {
"item": {}
},
"status": 200
}