Skip to content

Commit

Permalink
Merge pull request #49 from PlayFab/nightly
Browse files Browse the repository at this point in the history
Weekly Versioning PR: 160208
  • Loading branch information
zac-playfab committed Feb 8, 2016
2 parents 2e8e765 + df064ee commit b9332ea
Show file tree
Hide file tree
Showing 18 changed files with 621 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4406,7 +4406,65 @@ private static PlayFabResult<ModifyUserVirtualCurrencyResult> privateSubtractUse
}

/**
* Unlocks a container item in the user's inventory and consumes a key item of the type indicated by the container item
* Opens the specified container, with the specified key (when required), and returns the contents of the opened container. If the container (and key when relevant) are consumable (RemainingUses > 0), their RemainingUses will be decremented, consistent with the operation of ConsumeItem.
*/
@SuppressWarnings("unchecked")
public static FutureTask<PlayFabResult<UnlockContainerItemResult>> UnlockContainerInstanceAsync(final UnlockContainerInstanceRequest request) {
return new FutureTask(new Callable<PlayFabResult<UnlockContainerItemResult>>() {
public PlayFabResult<UnlockContainerItemResult> call() throws Exception {
return privateUnlockContainerInstanceAsync(request);
}
});
}

/**
* Opens the specified container, with the specified key (when required), and returns the contents of the opened container. If the container (and key when relevant) are consumable (RemainingUses > 0), their RemainingUses will be decremented, consistent with the operation of ConsumeItem.
*/
@SuppressWarnings("unchecked")
public static PlayFabResult<UnlockContainerItemResult> UnlockContainerInstance(final UnlockContainerInstanceRequest request) {
FutureTask<PlayFabResult<UnlockContainerItemResult>> task = new FutureTask(new Callable<PlayFabResult<UnlockContainerItemResult>>() {
public PlayFabResult<UnlockContainerItemResult> call() throws Exception {
return privateUnlockContainerInstanceAsync(request);
}
});
try {
task.run();
return task.get();
} catch(Exception e) {
return null;
}
}

/**
* Opens the specified container, with the specified key (when required), and returns the contents of the opened container. If the container (and key when relevant) are consumable (RemainingUses > 0), their RemainingUses will be decremented, consistent with the operation of ConsumeItem.
*/
@SuppressWarnings("unchecked")
private static PlayFabResult<UnlockContainerItemResult> privateUnlockContainerInstanceAsync(final UnlockContainerInstanceRequest request) throws Exception {
if (_authKey == null) throw new Exception ("Must be logged in to call this method");

FutureTask<Object> task = PlayFabHTTP.doPost(PlayFabSettings.GetURL() + "/Client/UnlockContainerInstance", request, "X-Authorization", _authKey);
task.run();
Object httpResult = task.get();
if(httpResult instanceof PlayFabError) {
PlayFabError error = (PlayFabError)httpResult;
if (PlayFabSettings.GlobalErrorHandler != null)
PlayFabSettings.GlobalErrorHandler.callback(error);
PlayFabResult result = new PlayFabResult<UnlockContainerItemResult>();
result.Error = error;
return result;
}
String resultRawJson = (String) httpResult;

PlayFabJsonSuccess<UnlockContainerItemResult> resultData = gson.fromJson(resultRawJson, new TypeToken<PlayFabJsonSuccess<UnlockContainerItemResult>>(){}.getType());
UnlockContainerItemResult result = resultData.data;

PlayFabResult<UnlockContainerItemResult> pfResult = new PlayFabResult<UnlockContainerItemResult>();
pfResult.Result = result;
return pfResult;
}

/**
* Searches target inventory for an ItemInstance matching the given CatalogItemId, if necessary unlocks it using an appropriate key, and returns the contents of the opened container. If the container (and key when relevant) are consumable (RemainingUses > 0), their RemainingUses will be decremented, consistent with the operation of ConsumeItem.
*/
@SuppressWarnings("unchecked")
public static FutureTask<PlayFabResult<UnlockContainerItemResult>> UnlockContainerItemAsync(final UnlockContainerItemRequest request) {
Expand All @@ -4418,7 +4476,7 @@ public PlayFabResult<UnlockContainerItemResult> call() throws Exception {
}

/**
* Unlocks a container item in the user's inventory and consumes a key item of the type indicated by the container item
* Searches target inventory for an ItemInstance matching the given CatalogItemId, if necessary unlocks it using an appropriate key, and returns the contents of the opened container. If the container (and key when relevant) are consumable (RemainingUses > 0), their RemainingUses will be decremented, consistent with the operation of ConsumeItem.
*/
@SuppressWarnings("unchecked")
public static PlayFabResult<UnlockContainerItemResult> UnlockContainerItem(final UnlockContainerItemRequest request) {
Expand All @@ -4436,7 +4494,7 @@ public PlayFabResult<UnlockContainerItemResult> call() throws Exception {
}

/**
* Unlocks a container item in the user's inventory and consumes a key item of the type indicated by the container item
* Searches target inventory for an ItemInstance matching the given CatalogItemId, if necessary unlocks it using an appropriate key, and returns the contents of the opened container. If the container (and key when relevant) are consumable (RemainingUses > 0), their RemainingUses will be decremented, consistent with the operation of ConsumeItem.
*/
@SuppressWarnings("unchecked")
private static PlayFabResult<UnlockContainerItemResult> privateUnlockContainerItemAsync(final UnlockContainerItemRequest request) throws Exception {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3220,13 +3220,33 @@ public static class UnlinkXboxAccountResult {

}

public static class UnlockContainerInstanceRequest {
/**
* Unique PlayFab assigned ID for a specific character owned by a user
*/
public String CharacterId;
/**
* ItemInstanceId of the container to unlock.
*/
public String ContainerItemInstanceId;
/**
* ItemInstanceId of the key that will be consumed by unlocking this container. If the container requires a key, this parameter is required.
*/
public String KeyItemInstanceId;
/**
* Specifies the catalog version that should be used to determine container contents. If unspecified, uses catalog associated with the item instance.
*/
public String CatalogVersion;

}

public static class UnlockContainerItemRequest {
/**
* Category ItemId of the container type to unlock.
* Catalog ItemId of the container type to unlock.
*/
public String ContainerItemId;
/**
* Catalog version of the container.
* Specifies the catalog version that should be used to determine container contents. If unspecified, uses default/primary catalog.
*/
public String CatalogVersion;
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,8 @@ public static enum PlayFabErrorCode {
InvalidDropTable(1201),
StatisticVersionAlreadyIncrementedForScheduledInterval(1202),
StatisticCountLimitExceeded(1203),
StatisticVersionIncrementRateExceeded(1204);
StatisticVersionIncrementRateExceeded(1204),
ContainerKeyInvalid(1205);

public int id;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.playfab.internal;

public class PlayFabVersion {
public static String SdkRevision = "0.15.160208";
public static String SdkRevision = "0.16.160208";
public static String getVersionString() {
return "JavaSDK-" + SdkRevision;
}
Expand Down
64 changes: 61 additions & 3 deletions PlayFabClientSDK/src/com/playfab/PlayFabClientAPI.java
Original file line number Diff line number Diff line change
Expand Up @@ -4405,7 +4405,65 @@ private static PlayFabResult<ModifyUserVirtualCurrencyResult> privateSubtractUse
}

/**
* Unlocks a container item in the user's inventory and consumes a key item of the type indicated by the container item
* Opens the specified container, with the specified key (when required), and returns the contents of the opened container. If the container (and key when relevant) are consumable (RemainingUses > 0), their RemainingUses will be decremented, consistent with the operation of ConsumeItem.
*/
@SuppressWarnings("unchecked")
public static FutureTask<PlayFabResult<UnlockContainerItemResult>> UnlockContainerInstanceAsync(final UnlockContainerInstanceRequest request) {
return new FutureTask(new Callable<PlayFabResult<UnlockContainerItemResult>>() {
public PlayFabResult<UnlockContainerItemResult> call() throws Exception {
return privateUnlockContainerInstanceAsync(request);
}
});
}

/**
* Opens the specified container, with the specified key (when required), and returns the contents of the opened container. If the container (and key when relevant) are consumable (RemainingUses > 0), their RemainingUses will be decremented, consistent with the operation of ConsumeItem.
*/
@SuppressWarnings("unchecked")
public static PlayFabResult<UnlockContainerItemResult> UnlockContainerInstance(final UnlockContainerInstanceRequest request) {
FutureTask<PlayFabResult<UnlockContainerItemResult>> task = new FutureTask(new Callable<PlayFabResult<UnlockContainerItemResult>>() {
public PlayFabResult<UnlockContainerItemResult> call() throws Exception {
return privateUnlockContainerInstanceAsync(request);
}
});
try {
task.run();
return task.get();
} catch(Exception e) {
return null;
}
}

/**
* Opens the specified container, with the specified key (when required), and returns the contents of the opened container. If the container (and key when relevant) are consumable (RemainingUses > 0), their RemainingUses will be decremented, consistent with the operation of ConsumeItem.
*/
@SuppressWarnings("unchecked")
private static PlayFabResult<UnlockContainerItemResult> privateUnlockContainerInstanceAsync(final UnlockContainerInstanceRequest request) throws Exception {
if (_authKey == null) throw new Exception ("Must be logged in to call this method");

FutureTask<Object> task = PlayFabHTTP.doPost(PlayFabSettings.GetURL() + "/Client/UnlockContainerInstance", request, "X-Authorization", _authKey);
task.run();
Object httpResult = task.get();
if(httpResult instanceof PlayFabError) {
PlayFabError error = (PlayFabError)httpResult;
if (PlayFabSettings.GlobalErrorHandler != null)
PlayFabSettings.GlobalErrorHandler.callback(error);
PlayFabResult result = new PlayFabResult<UnlockContainerItemResult>();
result.Error = error;
return result;
}
String resultRawJson = (String) httpResult;

PlayFabJsonSuccess<UnlockContainerItemResult> resultData = gson.fromJson(resultRawJson, new TypeToken<PlayFabJsonSuccess<UnlockContainerItemResult>>(){}.getType());
UnlockContainerItemResult result = resultData.data;

PlayFabResult<UnlockContainerItemResult> pfResult = new PlayFabResult<UnlockContainerItemResult>();
pfResult.Result = result;
return pfResult;
}

/**
* Searches target inventory for an ItemInstance matching the given CatalogItemId, if necessary unlocks it using an appropriate key, and returns the contents of the opened container. If the container (and key when relevant) are consumable (RemainingUses > 0), their RemainingUses will be decremented, consistent with the operation of ConsumeItem.
*/
@SuppressWarnings("unchecked")
public static FutureTask<PlayFabResult<UnlockContainerItemResult>> UnlockContainerItemAsync(final UnlockContainerItemRequest request) {
Expand All @@ -4417,7 +4475,7 @@ public PlayFabResult<UnlockContainerItemResult> call() throws Exception {
}

/**
* Unlocks a container item in the user's inventory and consumes a key item of the type indicated by the container item
* Searches target inventory for an ItemInstance matching the given CatalogItemId, if necessary unlocks it using an appropriate key, and returns the contents of the opened container. If the container (and key when relevant) are consumable (RemainingUses > 0), their RemainingUses will be decremented, consistent with the operation of ConsumeItem.
*/
@SuppressWarnings("unchecked")
public static PlayFabResult<UnlockContainerItemResult> UnlockContainerItem(final UnlockContainerItemRequest request) {
Expand All @@ -4435,7 +4493,7 @@ public PlayFabResult<UnlockContainerItemResult> call() throws Exception {
}

/**
* Unlocks a container item in the user's inventory and consumes a key item of the type indicated by the container item
* Searches target inventory for an ItemInstance matching the given CatalogItemId, if necessary unlocks it using an appropriate key, and returns the contents of the opened container. If the container (and key when relevant) are consumable (RemainingUses > 0), their RemainingUses will be decremented, consistent with the operation of ConsumeItem.
*/
@SuppressWarnings("unchecked")
private static PlayFabResult<UnlockContainerItemResult> privateUnlockContainerItemAsync(final UnlockContainerItemRequest request) throws Exception {
Expand Down
24 changes: 22 additions & 2 deletions PlayFabClientSDK/src/com/playfab/PlayFabClientModels.java
Original file line number Diff line number Diff line change
Expand Up @@ -3220,13 +3220,33 @@ public static class UnlinkXboxAccountResult {

}

public static class UnlockContainerInstanceRequest {
/**
* Unique PlayFab assigned ID for a specific character owned by a user
*/
public String CharacterId;
/**
* ItemInstanceId of the container to unlock.
*/
public String ContainerItemInstanceId;
/**
* ItemInstanceId of the key that will be consumed by unlocking this container. If the container requires a key, this parameter is required.
*/
public String KeyItemInstanceId;
/**
* Specifies the catalog version that should be used to determine container contents. If unspecified, uses catalog associated with the item instance.
*/
public String CatalogVersion;

}

public static class UnlockContainerItemRequest {
/**
* Category ItemId of the container type to unlock.
* Catalog ItemId of the container type to unlock.
*/
public String ContainerItemId;
/**
* Catalog version of the container.
* Specifies the catalog version that should be used to determine container contents. If unspecified, uses default/primary catalog.
*/
public String CatalogVersion;
/**
Expand Down
3 changes: 2 additions & 1 deletion PlayFabClientSDK/src/com/playfab/PlayFabErrors.java
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,8 @@ public static enum PlayFabErrorCode {
InvalidDropTable(1201),
StatisticVersionAlreadyIncrementedForScheduledInterval(1202),
StatisticCountLimitExceeded(1203),
StatisticVersionIncrementRateExceeded(1204);
StatisticVersionIncrementRateExceeded(1204),
ContainerKeyInvalid(1205);

public int id;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.playfab.internal;

public class PlayFabVersion {
public static String SdkRevision = "0.15.160208";
public static String SdkRevision = "0.16.160208";
public static String getVersionString() {
return "JavaSDK-" + SdkRevision;
}
Expand Down
Loading

0 comments on commit b9332ea

Please sign in to comment.