SysResetExperiencePointsAndLevelForUser
System call (cloud code only from client) to reset the experience points for the specified user to a given value. The user's experienceLevel will remain unchanged unless recalculateXPLevel is true, in which case the user's experienceLevel will also be reset to the applicable level (to be used with caution). If the XP points value to be reset is HIGHER than the user's current experiencePoints, an error is returned unless skipResetIfUserXPPointsAlreadyLower is true.
| Service | Operation |
|---|---|
| playerStatistics | SYS_RESET_EXPERIENCE_POINTS_AND_LEVEL_FOR_USER |
Method Parameters
| Parameter | Description |
|---|---|
| profileId | The profile id of the user whose experiencePoints are being reset. |
| xp_points | The absolute value to reset the user's experiencePoints. |
| recalculateXPLevel | Whether to reset the user's experienceLevel to the applicable level for the XP points being set. Use With Caution: If the user’s XP Level is lowered, stats and events awarded by previous level ups are not automatically withdrawn. You may wish to withdraw these awards (manually). Additionally, when this user levels up again, they will be awarded each of the level up awards once again. |
| skipResetIfUserXPPointsAlreadyLower | If the given xp_points is HIGHER than the user's current experiencePoints, an error is returned if this is false; otherwise, if true, success is returned without any changes being made. |
Usage
http://localhost:3000
- C#
- C++
- Objective-C
- Java
- JavaScript
- Dart
- Cloud Code
- Raw
// Cloud Code only. To view example, switch to the Cloud Code tab
// Cloud Code only. To view example, switch to the Cloud Code tab
// Cloud Code only. To view example, switch to the Cloud Code tab
// Cloud Code only. To view example, switch to the Cloud Code tab
// Cloud Code only. To view example, switch to the Cloud Code tab
// Cloud Code only. To view example, switch to the Cloud Code tab
var profileId = "user-profile-id";
var xp_points = 1;
var recalculateXPLevel = False;
var skipResetIfUserXPPointsAlreadyLower = True;
var playerStatisticsProxy = bridge.getPlayerstatisticsServiceProxy();
var postResult = playerStatisticsProxy.sysResetExperiencePointsAndLevelForUser(profileId, xp_points, recalculateXPLevel, skipResetIfUserXPPointsAlreadyLower);
{
"service":"playerStatistics",
"operation":"SYS_RESET_EXPERIENCE_POINTS_AND_LEVEL_FOR_USER",
"data":{
"profileId":"user-profile-id",
"xp_points":1,
"recalculateXPLevel":false,
"skipResetIfUserXPPointsAlreadyLower":true
}
}
JSON Response
{
"data": {
"xpCapped": false,
"experienceLevel": 1,
"experiencePoints": 100
},
"status": 200
}