Returns all available event leaderboards for the user. These can be filtered by categories, if these filter is empty it will include all event leaderboards.
Set a custom reward function which will run after an event leaderboard’s reward is rolled.
1
2
3
4
5
6
systems.GetEventLeaderboardsSystem().SetOnEventLeaderboardsReward(OnEventLeaderboardsReward)funcOnEventLeaderboardsReward(ctxcontext.Context,loggerruntime.Logger,nkruntime.NakamaModule,userID,sourceIDstring,source*hiro.EventLeaderboardsConfigLeaderboard,rewardConfig*hiro.EconomyConfigReward,reward*hiro.Reward)(*hiro.Reward,error){// Modify reward or take additional actions.
returnreward,nil}
Set a custom function to override or modify the cohort/opponent selection process for event leaderboards.
The default Nakama behavior for cohort selection is preserved for any of the returned values (cohortID, cohortUserIDs, newCohort) that are set to "", nil, or are empty.
systems.GetEventLeaderboardsSystem().SetOnEventLeaderboardCohortSelection(OnEventLeaderboardCohortSelection)funcOnEventLeaderboardCohortSelection(ctxcontext.Context,loggerruntime.Logger,nkruntime.NakamaModule,storageIndexstring,eventIDstring,config*hiro.EventLeaderboardsConfigLeaderboard,userIDstring,tierint,matchmakerPropertiesmap[string]interface{})(cohortIDstring,cohortUserIDs[]string,newCohort*hiro.EventLeaderboardCohortConfig,errerror){// To preserve the default behavior for a value, return:
// - cohortID: ""
// - cohortUserIDs: nil
// - newCohort: nil
// Example: Override only the cohort ID.
cohortID="my_custom_cohort_id"// Returning nil for the others preserves the default Nakama behavior
// for opponent selection and new cohort creation.
returncohortID,nil,nil,nil}