const MaxPage
MaxPage bounds PlayersJSON and json/players/{offset}/{count}.
Community realm. Read the code first. Community realm, deployed by its author. Read the code before you interact or send coins.
Package profiles keeps the Gnoslinger players' records (games played, victory points) and their ranking apart from th...
Package profiles keeps the Gnoslinger players' records (games played, victory points) and their ranking apart from the game realm, so a new version of the game (new rules) keeps the scores. Only the game realms on the allowlist may write; the admin, the deployer, manages that list.
AddGamePlayed counts a game that started for addr.
AddVictoryPoints adds an award's points (< 0 for a loss) to addr's total.
Allow lets the game realm pkgPath write the profiles (a new version of the game).
Count is the number of profiles.
Disallow stops pkgPath from writing (a game version no longer scored); its calls panic from then on.
Ensure creates addr's profile if it has none yet.
Games lists the allowed game realms.
IsGame tells whether the realm pkgPath may write the profiles.
Name is addr's name in gno.land/r/sys/users (where namereg registers them), or "".
PlayersJSON is one page of the ranking, best first, count at most MaxPage:
1{"total","offset","players":[profile...]}
ProfileJSON is the profile of an address, or null when it has none yet:
1{"addr","name","rank","gamesPlayed","victoryPoints","createdAt"}
name is the address's name in gno.land/r/sys/users, "" if none.
Rank is addr's 1-based position in the ranking, 0 without a profile.
Render serves the ranking page ("") and the raw JSON views the web client reads ("json/profile/{addr}", "json/players/{offset}/{count}").
SetAdmin hands the allowlist over to addr.
Get is a copy of addr's profile, false when it has none.
1type Profile struct {
2 Addr address
3 // GamesPlayed counts the games the player sat in once they started (a
4 // second player joined); a cancelled showdown does not count.
5 GamesPlayed int
6 // VictoryPoints adds up the points of the player's finished games (rule
7 // 15); it may be negative.
8 VictoryPoints int
9 CreatedAt time.Time
10}Profile is a player's record, created the first time the address creates or joins a game.