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.

events.gno

2.08 Kb · 32 lines
 1package gnoslinger
 2
 3import "chain"
 4
 5// Events emitted by the realm (type, attribute keys):
 6//
 7//	GameCreated       id creator char seats maxTurns timeoutMinutes hex facing stake
 8//	PlayerJoined      id player seat char hex facing
 9//	PlanCommitted     id turn player seat
10//	AllCommitted      id turn   (every character in the fight committed: the reveals start)
11//	PlanRevealed      id turn seat by   (by: who sent the reveal, the player or the opener of its timelocked plan)
12//	PlanUnopened      id turn seat reason   (a RevealMany skips a seat whose salt and plan do not match its commit or whose plan is not valid)
13//	PlanPassed        id turn seat   (a player with no time points to play is passed automatically)
14//	PlanMissed        id turn seat missed   (a claimed timeout passes the turn of a player whose plan is not in, no commit or never revealed; Out at the MaxMissed-th in a row)
15//	PlayerSurrendered id turn player seat
16//	TurnResolved      id turn rev seed
17//	VictoryPoints id seat player reason points   (one per award at the end of a turn or of the showdown, rule 15; points < 0 for a loss)
18//	GameEnded     id reason winner
19//	PotPaid       id seat player amount   (ugnot; one per winner, a draw splitting the pot, stakes.gno)
20//	StakeRefunded id seat player amount   (a showdown cancelled, or ended with everyone out of time, gives the stakes back)
21//	HouseWithdrawn to amount
22//	AdminChanged  admin
23//	PlanDue       id turn turns to char vs left   (a turn started: one per player with a plan to send; char its character, vs the others', left the time the turn gives; notify.gno)
24//	RevealDue     id turn turns to char vs   (the reveals started: one per player whose committed plan is not revealed)
25//	ShowdownOver  id to char vs outcome   (the game ended: one per player, "you won", "you lost", "a draw"; a cancelled game, to the players who had joined)
26//
27// They land in transaction results; clients still poll Game.Rev to sync.
28// PlanDue, RevealDue and ShowdownOver name their recipient, for the
29// browser notifications (notify.gno).
30func emit(typ string, attrs ...string) {
31	chain.Emit(typ, attrs...)
32}