Skip to content

Use Character Class Progressions

This how-to retrieves a Character Class's Progressions in your game, and adds, subtracts, resets, or deletes its points on a Progression.

Prerequisites

A Character Class is started on a Progression the moment you add points to it — you don't need to create the association separately. Your game may define many Progressions, and a Character Class only progresses through the ones it's started, since some may need to be unlocked or may be mutually exclusive.

Retrieve Character Class Progressions

Get a Single Character Class Progression

int characterId = 1;
string progressionKey = "mage";
LootLockerSDKManager.GetCharacterProgression(characterId, progressionKey, response =>
{
if (!response.success) {
Debug.Log("Failed: " + response.Error);
}
// Output the character level and show how much points are needed to progress to the next tier
Debug.Log($"The character is currently level {response.step}");
if (response.next_threshold != null)
{
Debug.Log($"Points needed to reach next level: {response.next_threshold - response.points}");
}
});

See the Reference Documentation for the full response.

Get All Character Class Progressions

int characterId = 1;
LootLockerSDKManager.GetCharacterProgressions(characterId, response =>
{
if (!response.success) {
Debug.Log("Failed: " + response.Error);
}
// Output the character level and show how much points are needed to progress to the next tier for all character progressions
foreach (var characterProgression in response.items)
{
Debug.Log($"Current level in {characterProgression.progression_name} is {characterProgression.step}");
if (characterProgression.next_threshold != null)
{
Debug.Log($"Points needed to reach next level in {characterProgression.progression_name}: {characterProgression.next_threshold - characterProgression.points}");
}
}
});

See the Reference Documentation for the full response.

Get All Character Class Progressions Using Count

Count limits the number of entries returned.

int characterId = 1;
int count = 20;
LootLockerSDKManager.GetCharacterProgressions(characterId, count, response =>
{
if (!response.success) {
Debug.Log("Failed: " + response.Error);
}
// Output the character level and show how much points are needed to progress to the next tier for all character progressions
foreach (var characterProgression in response.items)
{
Debug.Log($"Current level in {characterProgression.progression_name} is {characterProgression.step}");
if (characterProgression.next_threshold != null)
{
Debug.Log($"Points needed to reach next level in {characterProgression.progression_name}: {characterProgression.next_threshold - characterProgression.points}");
}
}
});

See the Reference Documentation for the full response.

Paginate Character Class Progressions

Use the After parameter to paginate if the Character Class is on many Progressions.

int characterId = 1;
int numberOfItemsPerPage = 10;
LootLockerPaginatedCharacterProgressionsResponse characterProgressions;
void Start()
{
LootLockerSDKManager.StartGuestSession(_ =>
{
// Fetch the initial character progressions list
LootLockerSDKManager.GetCharacterProgressions(characterId, numberOfItemsPerPage, response =>
{
if (!response.success)
{
Debug.Log("Failed: " + response.Error);
}
if (response.pagination.total == 0)
{
Debug.Log("This character does not have any progressions, start them by giving some exp to the character");
}
characterProgressions = response;
});
});
}
void Update()
{
if (characterProgressions == null) return;
// Fetch the next page if more character progressions exist
if (Input.GetKeyDown(KeyCode.RightArrow) && characterProgressions.pagination.next_cursor != null)
{
LootLockerSDKManager.GetCharacterProgressions(characterId, numberOfItemsPerPage, characterProgressions.pagination.next_cursor, response =>
{
if (!response.success)
{
Debug.Log("Failed: " + response.Error);
}
characterProgressions = response;
Debug.Log($"Paginating right, got {characterProgressions.items.Count} character progressions");
});
}
// Fetch the previous page if we are not on the first page
if (Input.GetKeyDown(KeyCode.LeftArrow) && characterProgressions.pagination.previous_cursor != null)
{
LootLockerSDKManager.GetCharacterProgressions(characterId, numberOfItemsPerPage, characterProgressions.pagination.previous_cursor, response =>
{
if (!response.success)
{
Debug.Log("Failed: " + response.Error);
}
characterProgressions = response;
Debug.Log($"Paginating left, got {characterProgressions.items.Count} character progressions");
});
}
}

See the Reference Documentation for the full response.

Update Character Class Progressions

Add Points to a Character Class Progression

If the Character Class levels up, the awarded_tiers field contains the Rewards acquired.

int characterId = 1;
string progressionKey = "mage";
ulong amountOfPoints = 100;
LootLockerSDKManager.AddPointsToCharacterProgression(characterId, progressionKey, amountOfPoints, response =>
{
if (!response.success) {
Debug.Log("Failed: " + response.Error);
}
// If the awarded_tiers array contains any items that means the character leveled up
// There can also be multiple level-ups at once
if (response.awarded_tiers.Any())
{
foreach (var awardedTier in response.awarded_tiers)
{
Debug.Log($"Reached level {awardedTier.step}!");
foreach (var assetReward in awardedTier.rewards.asset_rewards)
{
Debug.Log($"Rewarded with an asset, id: {assetReward.asset_id}!");
}
foreach (var progressionPointsReward in awardedTier.rewards.progression_points_rewards)
{
Debug.Log($"Rewarded with {progressionPointsReward.amount} bonus points in {progressionPointsReward.progression_name} progression!");
}
foreach (var progressionResetReward in awardedTier.rewards.progression_reset_rewards)
{
Debug.Log($"Progression {progressionResetReward.progression_name} has been reset as a reward!");
}
}
}
});

See the Reference Documentation for the full response.

Subtract Points from a Character Class Progression

int characterId = 1;
string progressionKey = "mage";
ulong amountOfPoints = 10;
LootLockerSDKManager.SubtractPointsFromCharacterProgression(characterId, progressionKey, amountOfPoints, response =>
{
if (!response.success) {
Debug.Log("Failed: " + response.Error);
}
// Output the amount of points the character has after subtracting points
Debug.Log($"Character now has {response.points} points in {response.progression_name} progression");
});

See the Reference Documentation for the full response.

Reset a Character Class Progression

Resets the Character Class's points on the Progression to 0, returning it to level 1. To remove the Progression from the Character Class entirely, see Delete a Character Class Progression below.

int characterId = 1;
string progressionKey = "mage";
LootLockerSDKManager.ResetCharacterProgression(characterId, progressionKey, response =>
{
if (!response.success) {
Debug.Log("Failed: " + response.Error);
}
// Character level is now 1
Debug.Log($"Character is level {response.step} since the {response.progression_name} was reset");
});

See the Reference Documentation for the full response.

Delete a Character Class Progression

Completely removes a Character Class Progression — it's no longer listed when retrieving the Character Class's Progressions.

int characterId = 1;
string progressionKey = "mage";
LootLockerSDKManager.DeleteCharacterProgression(characterId, progressionKey, response =>
{
if (!response.success) {
Debug.Log("Failed: " + response.Error);
}
// Trying to fetch the deleted character progression will result in a "Not Found" error
LootLockerSDKManager.GetCharacterProgression(progressionKey, response =>
{
if (!response.success) {
Debug.Log("Failed: " + response.Error);
}
});
});

See the Reference Documentation for the full response.

Conclusion

You've retrieved a Character Class's Progressions and updated its points from your game. Next, explore Player Progressions or Asset Instance Progressions if your game also tracks progress on those holders.