Skip to content Search Apps Documentation Source Content File Folder Download Copy Actions State String Boolean Number Struct Map Slice Pointer Function Closure Reference Nil Package Type Interface Unknown

Community realm. Read the code first. Community realm, deployed by its author. Read the code before you interact or send coins.

v0 state

Back to all declarations

ProfileJSON

func(addr string) string

ProfileJSON is the profile of an address, or null when it has none yet: {"addr","name","rank","gamesPlayed","victoryPoints","createdAt"} name is the address's name in gno.land/r/sys/users, "" if none.

Open
OID
03175f…88e2:3
ProfileJSON details

Inspect func

PlayersJSON

func(offset int, count int) string

PlayersJSON is one page of the ranking, best first, count at most MaxPage: {"total","offset","players":[profile...]}

Open
OID
03175f…88e2:5
PlayersJSON details

Inspect func

writeProfile

func(b *strings.Builder, p *v0.Profile, rank int)
Open
OID
03175f…88e2:6
writeProfile details

Inspect func

quote

func(s string) string

quote encodes s as a JSON string.

Open
OID
03175f…88e2:7
quote details

Inspect func

MaxPage

untyped bigint

MaxPage bounds PlayersJSON and json/players/{offset}/{count}.

Value

(50 <untyped> bigint)

Profile

type

Profile is a player's record, created the first time the address creates or joins a game.

Value

v0.Profile

admin

.uverse.address

Value

<gnolang.StringValue>

Ensure

func(addr .uverse.address)

Ensure creates addr's profile if it has none yet.

Open
OID
03175f…88e2:20
Ensure details

Inspect func

AddGamePlayed

func(addr .uverse.address)

AddGamePlayed counts a game that started for addr.

Open
OID
03175f…88e2:21
AddGamePlayed details

Inspect func

AddVictoryPoints

func(addr .uverse.address, points int)

AddVictoryPoints adds an award's points (\< 0 for a loss) to addr's total.

Open
OID
03175f…88e2:22
AddVictoryPoints details

Inspect func

Allow

func(pkgPath string)

Allow lets the game realm pkgPath write the profiles (a new version of the game).

Open
OID
03175f…88e2:24
Allow details

Inspect func

Disallow

func(pkgPath string)

Disallow stops pkgPath from writing (a game version no longer scored); its calls panic from then on.

Open
OID
03175f…88e2:25
Disallow details

Inspect func

SetAdmin

func(addr .uverse.address)

SetAdmin hands the allowlist over to addr.

Open
OID
03175f…88e2:26
SetAdmin details

Inspect func

IsGame

func(pkgPath string) bool

IsGame tells whether the realm pkgPath may write the profiles.

Open
OID
03175f…88e2:29
IsGame details

Inspect func

Games

func() []string

Games lists the allowed game realms.

Open
OID
03175f…88e2:30
Games details

Inspect func

Get

func(addr .uverse.address) (v0.Profile, bool)

Get is a copy of addr's profile, false when it has none.

Open
OID
03175f…88e2:31
Get details

Inspect func

Rank

func(addr .uverse.address) int

Rank is addr's 1-based position in the ranking, 0 without a profile.

Open
OID
03175f…88e2:32
Rank details

Inspect func

Count

func() int

Count is the number of profiles.

Open
OID
03175f…88e2:33
Count details

Inspect func

Name

func(addr .uverse.address) string

Name is addr's name in gno.land/r/sys/users (where namereg registers them), or "".

Open
OID
03175f…88e2:34
Name details

Inspect func

rankKey

func(p *v0.Profile) string

rankKey sorts by victory points, then games played, both descending, then by address.

Open
OID
03175f…88e2:35
rankKey details

Inspect func

desc

func(n int) string

desc is a fixed-width key that sorts larger numbers first; victory points may be negative, so it is centred on 0 (|n| below 5e8).

Open
OID
03175f…88e2:36
desc details

Inspect func

ensure

func(addr .uverse.address) *v0.Profile

ensure returns addr's profile, creating it on first use.

Open
OID
03175f…88e2:37
ensure details

Inspect func

update

func(addr .uverse.address, change func(...))

update applies change to addr's profile and keeps its rank.

Open
OID
03175f…88e2:38
update details

Inspect func

rankOf

func(p *v0.Profile) int

rankOf is the 1-based position of p in the ranking.

Open
OID
03175f…88e2:39
rankOf details

Inspect func

rankingLimit

untyped bigint

rankingLimit is how many players the gnoweb page lists.

Value

(50 <untyped> bigint)

Render

func(path string) string

Render serves the ranking page ("") and the raw JSON views the web client reads ("json/profile/{addr}", "json/players/{offset}/{count}").

Open
OID
03175f…88e2:46
Render details

Inspect func

renderHome

func(res *v0.ResponseWriter, *v0.Request)
Open
OID
03175f…88e2:47
renderHome details

Inspect func

label

func(a .uverse.address) string

label shows an address by its registered name when it has one.

Open
OID
03175f…88e2:48
label details

Inspect func
ProfileJSON : func(addr string) string Inspect
PlayersJSON : func(offset int, count int) string Inspect
writeProfile : func(b *strings.Builder, p *v0.Profile, rank int) Inspect
quote : func(s string) string Inspect
MaxPage : untyped bigint =(50 <untyped> bigint)
Profile : type =v0.Profile
admin : .uverse.address =<gnolang.StringValue>
profiles : *v0.Tree Inspect
ranking : *v0.Tree Inspect
games : *v0.Tree Inspect
init.10 : func() Inspect
Ensure : func(addr .uverse.address) Inspect
AddGamePlayed : func(addr .uverse.address) Inspect
AddVictoryPoints : func(addr .uverse.address, points int) Inspect
assertGame : func() Inspect
Allow : func(pkgPath string) Inspect
Disallow : func(pkgPath string) Inspect
SetAdmin : func(addr .uverse.address) Inspect
assertAdmin : func() Inspect
Admin : func() .uverse.address Inspect
IsGame : func(pkgPath string) bool Inspect
Games : func() []string Inspect
Get : func(addr .uverse.address) (v0.Profile, bool) Inspect
Rank : func(addr .uverse.address) int Inspect
Count : func() int Inspect
Name : func(addr .uverse.address) string Inspect
rankKey : func(p *v0.Profile) string Inspect
desc : func(n int) string Inspect
ensure : func(addr .uverse.address) *v0.Profile Inspect
update : func(addr .uverse.address, change func(...)) Inspect
rankOf : func(p *v0.Profile) int Inspect
rankingLimit : untyped bigint =(50 <untyped> bigint)
router : *v0.Router Inspect
init.33 : func() Inspect
Render : func(path string) string Inspect
renderHome : func(res *v0.ResponseWriter, *v0.Request) Inspect
label : func(a .uverse.address) string Inspect