Event Leaderboards #

Read more about the Event Leaderboards system in Hiro here.

Get an event leaderboard #

Get a specified event leaderboard defined for the game.

1
2
3
4
5
const request = new EventLeaderboardGet();
request.id = "leaderboard_1";

const eventLeaderboard = await hiroClient.eventLeaderboardGet(session, request);
console.log(eventLeaderboard);

Update event leaderboard record #

Update an event leaderboard record for a user.

1
2
3
4
5
6
7
const request = new EventLeaderboardUpdate();
request.id = "leaderboard_1";
request.score = 100;
request.subscore = 10;

const eventLeaderboard = await hiroClient.eventLeaderboardUpdate(session, request);
console.log(eventLeaderboard);

Claim event leaderboard reward #

Claim an event leaderboard reward for a user.

1
2
3
4
5
const request = new EventLeaderboardClaim();
request.id = "leaderboard_1";

const eventLeaderboard = await hiroClient.eventLeaderboardClaim(session, request);
console.log(eventLeaderboard);

Roll a new cohort #

Roll a new cohort for the specified event leaderboard.

1
2
3
4
5
const request = new EventLeaderboardRoll();
request.id = "leaderboard_1";

const eventLeaderboard = await hiroClient.eventLeaderboardRoll(session, request);
console.log(eventLeaderboard);

Debugging an event leaderboard #

You can fill an event leaderboard with dummy users and assign random scores to them for testing purposes.

This is intended for debugging use only.
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
const fill_Request = new EventLeaderboardDebugFillRequest();
fill_Request.id = "leaderboard_1";
fill_Request.target_count = 50; // Optional target cohort size to fill to, otherwise fill to the max cohort size.

const scores_Request = new EventLeaderboardDebugRandomScoresRequest();
scores_Request.id = "leaderboard_1";
scores_Request.min = "1";
scores_Request.max = "100";
scores_Request.subscore_min = "1";
scores_Request.subscore_max = "100";

// Fills cohort with debug players
const fill_Leaderboard = await hiroClient.eventLeaderboardDebugFill(session, fill_Request);
console.log(fill_Leaderboard);

// Sets randomly generated scores between a range for other players (does not change the user's score)
const scores_Leaderboard = await hiroClient.eventLeaderboardDebugRandomScores(session, scores_Request);
console.log(scores_Leaderboard);