moves source realm
Package moves is the book of move recipes for the Code Arena brawler.
Package moves is the book of move recipes for the Code Arena brawler.
A recipe is a special move written as data, like "Blink Thief/84/D82S11": a name, a cooldown and up to three effects (see recipe.gno in the brawl package for the format and the budget). Anyone can publish one; the browser lets you equip any published move for practice, and the chain's rules run it exactly like the browser does.
Built to be cheap: a recipe is stored as one short string, "author recipe", and bucketSize recipes share one tree node, so most publishes only pay for their own few dozen bytes. Each author also has one string listing their ids.
1
9
func Author
ActionAuthor returns who published a move.
func ByAuthor
ActionByAuthor returns an author's moves as a JSON array, oldest first.
func Check
ActionCheck reports whether a recipe is valid and what cooldown it needs, without storing anything: "ok <cost>" or the reason it is refused.
func Count
ActionCount is how many moves have been published.
func List
ActionList returns up to n moves as a JSON array, newest first, skipping the newest skip.
func MoveJSON
ActionMoveJSON describes one move as JSON.
func Publish
crossing ActionPublish checks a recipe and stores it under the caller's address. It returns the move's id. An author can publish MaxPerAuthor moves.
func Recipe
ActionRecipe returns a move's recipe string.
func Render
Render shows the newest moves, one move at "move/<id>", or an author's moves at "by/<address>".