Realm detail
nisse2
gno.land/r/g1wt79w2q0sfmpfrxc4990mlsg5ll09yva6fyc4p/nisse2
Indexed deployment identity with independently loaded latest RPC source, functions, and Render.
Indexed deployment
Identity
- Package path
- gno.land/r/g1wt79w2q0sfmpfrxc4990mlsg5ll09yva6fyc4p/nisse2
- Block
- 272320
- Deployed (UTC)
- Transaction
- bttPhIDSuXKTPpVzVGaAsrdvDM3OtvGetl4C8VRIvuA=
Latest RPC state
Source
package nisse2
import (
"strconv"
"gno.land/p/g1wt79w2q0sfmpfrxc4990mlsg5ll09yva6fyc4p/nisse2/book"
"gno.land/p/g1wt79w2q0sfmpfrxc4990mlsg5ll09yva6fyc4p/nisse2/rules"
"gno.land/p/g1wt79w2q0sfmpfrxc4990mlsg5ll09yva6fyc4p/nisse2/types"
)
func SetHouseSign(cur realm, playerName string, buildingID uint64, text string) string {
key, player := ownedPlayer(cur, playerName)
b := buildings[buildingID]
if b == nil {
panic("house not found")
}
if normalizeKey(b.OwnerPlayer) != key {
panic("only the house owner may set the sign")
}
if !types.SameTile(player.Pos, b.Pos) {
panic("you must be at the house to set its sign")
}
text = cleanName(text)
if len(text) > 120 {
panic("sign text must be 120 characters or fewer")
}
b.Sign = text
label := text
if label == "" {
label = "(cleared)"
}
createDiary(key, "sign", "house_sign", "House #"+strconv.Itoa(int(buildingID))+"\nSign:"+label)
if text == "" {
return "sign cleared on house #" + strconv.Itoa(int(buildingID))
}
return "sign set on house #" + strconv.Itoa(int(buildingID))
}
func DescribeTileBuildings(x uint64, y uint64) string {
if !book.InBounds(x, y) {
panic("tile out of bounds")
}
pos := types.Position{X: x, Y: y}
ids := tileHouses[tileKey(pos)]
out := "Tile (" + strconv.Itoa(int(x)) + "," + strconv.Itoa(int(y)) + ")\n"
out += "Houses: " + strconv.Itoa(int(len(ids))) + "\n"
out += "NextBuildCost: " + strconv.Itoa(int(rules.HouseBuildCost(uint64(len(ids))))) + " pearls\n"
if len(ids) == 0 {
out += "No houses here."
return out
}
for _, id := range ids {
b := buildings[id]
if b == nil {
continue
}
out += "- #" + strconv.Itoa(int(b.ID)) + " owner:" + b.OwnerPlayer
if b.Sign != "" {
out += " sign:\"" + b.Sign + "\""
} else {
out += " sign:(none)"
}
out += "\n"
}
return out
}
func ListPlayerHouses(playerName string) string {
key := normalizeKey(playerName)
player, ok := players[key]
if !ok {
panic("player not found")
}
out := "Houses owned by " + player.Name + "\n"
count := 0
for id := uint64(1); id < nextBuildingID; id++ {
b := buildings[id]
if b == nil || normalizeKey(b.OwnerPlayer) != key {
continue
}
count++
out += "- #" + strconv.Itoa(int(b.ID)) +
" @ (" + strconv.Itoa(int(b.Pos.X)) + "," + strconv.Itoa(int(b.Pos.Y)) + ")"
if b.Sign != "" {
out += " \"" + b.Sign + "\""
}
out += "\n"
}
if count == 0 {
out += "None."
}
return out
}
func DescribeTileSceneAt(x uint64, y uint64) string {
if !book.InBounds(x, y) {
panic("tile out of bounds")
}
pos := types.Position{X: x, Y: y}
code := book.Tile(x, y)
tk := tileKey(pos)
named := namedPlaces[tk] != ""
out := "TileSceneID: tile-" + strconv.Itoa(int(x)) + "-" + strconv.Itoa(int(y)) + "\n"
out += "TileScenePlaceName: " + placeName(pos) + "\n"
out += "TileSceneTerrain: " + book.TerrainName(code) + "\n"
out += "TileSceneResources: " + book.TerrainResources(code) + "\n"
if book.PlaceCanBeNamed(code, named) {
out += "TileSceneCanName: yes\n"
} else {
out += "TileSceneCanName: no\n"
}
ids := tileHouses[tk]
out += "TileSceneHouses: " + strconv.Itoa(int(len(ids))) + "\n"
out += "TileSceneNextBuildCost: " + strconv.Itoa(int(rules.HouseBuildCost(uint64(len(ids))))) + "\n"
for _, id := range ids {
b := buildings[id]
if b == nil {
continue
}
out += "House #" + strconv.Itoa(int(b.ID)) + " owner:" + b.OwnerPlayer
if b.Sign != "" {
out += " sign:\"" + b.Sign + "\""
}
out += "\n"
}
return out
}
Latest RPC state
Exported functions
- SetHouseSign(cur interface {.seal func(); Address func() .uverse.address; IsCode func() bool; IsCurrent func() bool; IsEphemeral func() bool; IsUser func() bool; IsUserCall func() bool; IsUserRun func() bool; PkgPath func() string; Previous func() .uverse.realm; String func() string; Sub func(string) .uverse.realm; Subpath func() string}, playerName string, buildingID uint64, text string) string
- DescribeTileBuildings(x uint64, y uint64) string
- ListPlayerHouses(playerName string) string
- DescribeTileSceneAt(x uint64, y uint64) string
- WriteToFriend(cur interface {.seal func(); Address func() .uverse.address; IsCode func() bool; IsCurrent func() bool; IsEphemeral func() bool; IsUser func() bool; IsUserCall func() bool; IsUserRun func() bool; PkgPath func() string; Previous func() .uverse.realm; String func() string; Sub func(string) .uverse.realm; Subpath func() string}, fromPlayerName string, toPlayerName string, body string) string
- GetMessages(playerName string) string
- DescribeLatestIncomingMessage(playerName string) string
- ListPlayerPositions() string
- GetPlayerCoreData(name string) string
- GetPlayerTravelData(name string) string
- GetPlayerWealthData(name string) string
- GetPlayerMapData(name string) string
- DescribeCompanion(playerName string) string
- DescribeLatestDiaryEntry(playerName string) string
- DescribeCreature(kind string) string
- Render(path string) string
- MintPlayer(cur interface {.seal func(); Address func() .uverse.address; IsCode func() bool; IsCurrent func() bool; IsEphemeral func() bool; IsUser func() bool; IsUserCall func() bool; IsUserRun func() bool; PkgPath func() string; Previous func() .uverse.realm; String func() string; Sub func(string) .uverse.realm; Subpath func() string}, name string) string
- TravelPlayer(cur interface {.seal func(); Address func() .uverse.address; IsCode func() bool; IsCurrent func() bool; IsEphemeral func() bool; IsUser func() bool; IsUserCall func() bool; IsUserRun func() bool; PkgPath func() string; Previous func() .uverse.realm; String func() string; Sub func(string) .uverse.realm; Subpath func() string}, playerName string, x uint64, y uint64, attitude string) string
Latest RPC state · Realm Render
Nisse v2
Frozen book: creatures + terrain live in /p/.../nisse2/book.
Rules live in /p/.../nisse2/rules. This realm only stores players and applies outcomes.
Atlas 18x10
sea sea sea sea sea sea sea sea sea sea sea sea sea sea sea sea sea sea
sea sea sea sea sea cst cst cst cst cst sea cst cst cst cst sea sea sea
sea sea sea cst nct for for moo moo moo fsh for for for cst cst sea sea
sea cst cst cst for for for mvl for mtn for for mon for moo cst cst sea
sea cst fsh for for frm frm mtn for mtn mdw for for for mtn hil cst sea
sea hbr frm for mdw mvl mtn mon mtn mtn for for for frm frm cst cst sea
sea cst for for for hil mtn for mtn hil fsh moo moo frm sct cst sea sea
sea cst cst for fsh moo moo moo moo moo cst cst cst cst cst sea sea sea
sea sea cst cst sea cst cst cst cst cst cst sea sea sea sea sea sea sea
sea sea sea sea sea sea sea sea sea sea sea sea sea sea sea sea sea sea
Players
Player positions
- troll2 @ (16, 9)
- Huldra @ (14, 5)