Class PlayerStatisticsService

java.lang.Object
com.bitheads.braincloud.services.PlayerStatisticsService

public class PlayerStatisticsService
extends Object
  • Constructor Details

    • PlayerStatisticsService

      public PlayerStatisticsService​(BrainCloudClient client)
  • Method Details

    • readAllUserStats

      public void readAllUserStats​(IServerCallback callback)
      Read all available user statistics. Service Name - PlayerStatistics Service Operation - Read
      Parameters:
      callback - The method to be invoked when the server response is received
    • readUserStatsSubset

      public void readUserStatsSubset​(String[] statistics, IServerCallback callback)
      Reads a subset of user statistics as defined by the input collection. Service Name - PlayerStatistics Service Operation - ReadSubset
      Parameters:
      statistics - A collection containing the subset of statistics to read: ex. [ "pantaloons", "minions" ]
      callback - The method to be invoked when the server response is received
    • readUserStatsForCategory

      public void readUserStatsForCategory​(String category, IServerCallback callback)
      Method retrieves the user statistics for the given category. Service Name - PlayerStatistics Service Operation - READ_FOR_CATEGORY
      Parameters:
      category - The user statistics category
      callback - Method to be invoked when the server response is received.
    • resetAllUserStats

      public void resetAllUserStats​(IServerCallback callback)
      Reset all of the statistics for this user back to their initial value. Service Name - PlayerStatistics Service Operation - Reset
      Parameters:
      callback - The method to be invoked when the server response is received
    • incrementUserStats

      public void incrementUserStats​(String jsonData, IServerCallback callback)
      Atomically increment (or decrement) user statistics. Any rewards that are triggered from user statistic increments will be considered. User statistics are defined through the brainCloud portal. Note also that the "xpCapped" property is returned (true/false depending on whether the xp cap is turned on and whether the user has hit it). Service Name - PlayerStatistics Service Operation - Update
      Parameters:
      jsonData - The JSON encoded data to be sent to the server as follows: { stat1: 10, stat2: -5.5, } would increment stat1 by 10 and decrement stat2 by 5.5. For the full statistics grammer see the api.braincloudservers.com site. There are many more complex operations supported such as: { stat1:INC_TO_LIMIT#9#30 } which increments stat1 by 9 up to a limit of 30.
      callback - The method to be invoked when the server response is received
    • incrementExperiencePoints

      public void incrementExperiencePoints​(int xpValue, IServerCallback callback)
      Increments the user's experience. If the user goes up a level, the new level details will be returned along with a list of rewards. Service Name - PlayerStatistics Service Operation - UpdateIncrement
      Parameters:
      xpValue - The amount to increase the user's experience by
      callback - The method to be invoked when the server response is received
    • getNextExperienceLevel

      public void getNextExperienceLevel​(IServerCallback callback)
      Returns JSON representing the next experience level for the user. Service Name - PlayerStatistics Service Operation - ReadNextXpLevel
      Parameters:
      callback - The method to be invoked when the server response is received
    • setExperiencePoints

      public void setExperiencePoints​(int xpValue, IServerCallback callback)
      Sets the user's experience to an absolute value. Note that this is simply a set and will not reward the user if their level changes as a result. Service Name - PlayerStatistics Service Operation - SetXpPoints
      Parameters:
      xpValue - The amount to set the the user's experience to
      callback - The method to be invoked when the server response is received
    • processStatistics

      public void processStatistics​(String jsonData, IServerCallback callback)
      Apply statistics grammar to a partial set of statistics. Service Name - PlayerStatistics Service Operation - PROCESS_STATISTICS
      Parameters:
      jsonData - The JSON format is as follows: { "DEAD_CATS": "RESET", "LIVES_LEFT": "SET#9", "MICE_KILLED": "INC#2", "DOG_SCARE_BONUS_POINTS": "INC#10", "TREES_CLIMBED": 1 }
      callback - Method to be invoked when the server response is received.