Documentation
¶
Index ¶
- Constants
- Variables
- func BuildAllCoordinateIndexes()
- func BuildCoordinateIndex(zoneName string)
- func ClearRoomCache(roomId int) error
- func ConnectRoom(fromRoomId int, toRoomId int, exitName string, mapDirection ...string) error
- func CreateBiome(b *BiomeInfo) error
- func CreateEmptyEphemeralRooms(qty int) ([]int, error)
- func CreateEphemeralRoomIds(roomIds ...int) (map[int]int, error)
- func CreateEphemeralZone(zoneName string) (map[int]int, error)
- func CreateRoomForAdmin(zone string) (int, error)
- func CreateZone(zoneName string) (roomId int, err error)
- func DeleteBiome(biomeId string) error
- func DeleteRoomForAdmin(roomId int) error
- func DeleteRoomInstance(roomId int) error
- func DeleteZoneForAdmin(zoneName string) error
- func EphemeralRoomMaintenance() []int
- func FindEphemeralRoomIds(roomId int) []int
- func FindZoneName(zone string) string
- func GetAllRoomIds() []int
- func GetAllZoneNames() []string
- func GetAllZoneRoomsIds(zoneName string) []int
- func GetChunkCount() int
- func GetMemoryUsage() map[string]util.MemoryResult
- func GetNextRoomId() int
- func GetOriginalRoom(roomId int) int
- func GetRoomAtCoordinate(zoneName string, x, y, z int) (int, bool)
- func GetRoomCount(zoneName string) int
- func GetRoomInstanceRaw(roomId int) ([]byte, error)
- func GetRoomTemplatePath(roomId int) string
- func GetRoomWithMostItems(skipRecentlyVisited bool, minimumItemCt int, minimumGoldCt int) (roomId int, itemCt int)
- func GetRoomsWithMobs() []int
- func GetRoomsWithPlayers() []int
- func GetZoneBiome(zone string) string
- func GetZoneForRoom(roomId int) string
- func GetZoneRoot(zone string) (int, error)
- func GetZonesWithMutators() ([]string, []int)
- func IsCoordinateAvailable(zoneName string, x, y, z int, excludeRoomId ...int) bool
- func IsEphemeralRoomId(roomId int) bool
- func IsRoomLoaded(roomId int) bool
- func LoadBiomeDataFiles()
- func LoadDataFiles()
- func MoveToRoom(userId int, toRoomId int, isSpawn ...bool) error
- func MoveToZone(roomId int, newZoneName string) error
- func RegisterCoordinate(zoneName string, roomId, x, y, z int)
- func RenameZoneForAdmin(oldName, newName string) error
- func RoomMaintenance() []int
- func SaveAllRooms() error
- func SaveBiome(b *BiomeInfo) error
- func SaveRoomForAdmin(room Room) error
- func SaveRoomInstance(r Room) error
- func SaveRoomInstanceRaw(roomId int, content []byte) error
- func SaveRoomScript(roomId int, content string) error
- func SaveRoomTemplate(roomTpl Room) error
- func SaveZoneConfig(zoneConfig *ZoneConfig) error
- func SaveZoneConfigForAdmin(name string, cfg *ZoneConfig) error
- func SetNextRoomId(nextRoomId int)
- func TryEphemeralCleanup(ephemeralRoomId int) []int
- func UnregisterCoordinate(zoneName string, roomId int)
- func ValidateZoneName(zone string) error
- func ZoneNameSanitize(zone string) string
- func ZoneStats(zone string) (rootRoomId int, totalRooms int, err error)
- func ZoneToFolder(zone string) string
- type BiomeInfo
- type Container
- func (c *Container) AddItem(i items.Item)
- func (c *Container) Count(itemId int) int
- func (c *Container) FindItem(itemName string) (items.Item, bool)
- func (c *Container) FindItemById(itemId int) (items.Item, bool)
- func (c Container) HasLock() bool
- func (c *Container) RecipeReady() int
- func (c *Container) RemoveItem(i items.Item)
- type Corpse
- type FindFlag
- type MapperExitData
- type MapperRoomData
- type PaginatedRooms
- type Room
- func BuildRoom(fromRoomId int, exitName string, mapDirection ...string) (room *Room, err error)
- func GetRoomForAdmin(roomId int) *Room
- func LoadRoom(roomId int) *Room
- func LoadRoomInstance(roomId int) *Room
- func LoadRoomTemplate(roomId int) *Room
- func NewEmptyRoom() *Room
- func NewRoom(zone string) *Room
- func (r *Room) ActiveMutators(yield func(mutators.Mutator) bool)
- func (r *Room) AddCorpse(c Corpse)
- func (r *Room) AddItem(item items.Item, stash bool)
- func (r *Room) AddMob(mobInstanceId int)
- func (r *Room) AddPlayer(userId int) int
- func (r *Room) AddSign(displayText string, visibleUserId int, daysBeforeDecay int) bool
- func (r *Room) AddTemporaryExit(exitName string, t exit.TemporaryRoomExit) bool
- func (r *Room) ApplyBuffIdToMobs(buffIds []int, source string)
- func (r *Room) ApplyBuffIdToNativeMobs(buffIds []int, source string)
- func (r *Room) ApplyBuffIdToPlayers(buffIds []int, source string)
- func (r *Room) AreMobsAttacking(userId int) bool
- func (r *Room) ArePlayersAttacking(userId int) bool
- func (r *Room) CanPvp(attUser *users.UserRecord, defUser *users.UserRecord) error
- func (r *Room) CleanupMobSpawns(noCooldown bool)
- func (r *Room) ClearCoordinates()
- func (r *Room) Filename() string
- func (r *Room) Filepath() string
- func (r *Room) FindByName(searchName string, findTypes ...FindFlag) (playerId int, mobInstanceId int)
- func (r *Room) FindByPetName(searchName string) (playerId int)
- func (r *Room) FindContainerByName(containerNameSearch string) string
- func (r *Room) FindCorpse(searchName string) (Corpse, bool)
- func (r *Room) FindCorpseByRef(searchName string) (*Corpse, bool)
- func (r *Room) FindExitByName(exitNameSearch string) (exitName string, exitRoomId int)
- func (r *Room) FindExitTo(roomId int) string
- func (r *Room) FindNoun(noun string) (foundNoun string, nounDescription string)
- func (r *Room) FindOnFloor(itemName string, stash bool) (items.Item, bool)
- func (r *Room) FindTemporaryExitByUserId(userId int) (exit.TemporaryRoomExit, bool)
- func (r *Room) GetAllFloorItems(stash bool) []items.Item
- func (r *Room) GetBiome() *BiomeInfo
- func (r *Room) GetDescription() string
- func (r *Room) GetDescriptionFormatted(lineSplit int, highlightNouns bool) string
- func (r *Room) GetExitInfo(exitName string) (exitInfo exit.RoomExit, ok bool)
- func (r *Room) GetLongTermData(key string) any
- func (r *Room) GetMapSymbol() string
- func (r *Room) GetMobs(findTypes ...FindFlag) []int
- func (r *Room) GetPlayers(findTypes ...FindFlag) []int
- func (r *Room) GetPrivateSigns() []Sign
- func (r *Room) GetPublicSigns() []Sign
- func (r *Room) GetRandomExit() (exitName string, roomId int)
- func (r *Room) GetScript() string
- func (r *Room) GetScriptPath() string
- func (r *Room) GetTags() []string
- func (r *Room) GetTempData(key string) any
- func (r *Room) GetVisibility() int
- func (r *Room) HasRecentVisitors() bool
- func (r *Room) HasScript() bool
- func (r *Room) HasTag(tag string) bool
- func (r *Room) HasVisited(id int, vType VisitorType) bool
- func (r *Room) Id() int
- func (r *Room) IsCalm() bool
- func (r *Room) IsEphemeral() bool
- func (r *Room) IsPvp() bool
- func (r *Room) MarkVisited(id int, vType VisitorType, subtrackTurns ...int)
- func (r *Room) MobCt() int
- func (r *Room) PlaySound(soundId string, category string, excludeUserIds ...int)
- func (r *Room) PlayerCt() int
- func (r *Room) Prepare(checkAdjacentRooms bool)
- func (r *Room) PruneSigns() []Sign
- func (r *Room) PruneTemporaryExits() []exit.TemporaryRoomExit
- func (r *Room) PruneVisitors() int
- func (r *Room) RemoveCorpse(c Corpse) bool
- func (r *Room) RemoveItem(i items.Item, stash bool)
- func (r *Room) RemoveMob(mobInstanceId int)
- func (r *Room) RemovePlayer(userId int) (int, bool)
- func (r *Room) RemoveTemporaryExit(t exit.TemporaryRoomExit) bool
- func (r *Room) RepeatSpawnItem(itemId int, roundFrequency int, containerName ...string) bool
- func (r *Room) RoundTick()
- func (r *Room) SendText(txt string, excludeUserIds ...int)
- func (r *Room) SendTextCommunication(txt string, excludeUserIds ...int)
- func (r *Room) SendTextToExits(txt string, isQuiet bool, excludeUserIds ...int)
- func (r *Room) SetCoordinates(x, y, z int)
- func (r *Room) SetExitLock(exitName string, locked bool)
- func (r *Room) SetLongTermData(key string, value any)
- func (r *Room) SetTempData(key string, value any)
- func (r *Room) SpawnTempContainer(name string, duration string, lockDifficulty int, trapBuffIds ...int) string
- func (r *Room) UpdateCorpses(roundNow uint64)
- func (r *Room) Validate() error
- func (r *Room) Visitors(vType VisitorType) map[int]float64
- type RoomManager
- type RoomSummary
- type RoomSummaryInfo
- type RoomTemplateDetails
- type Sign
- type SpawnInfo
- type SymbolColor
- type TrainingRange
- type VisitorType
- type ZoneConfig
- type ZoneInfo
- type ZoneSummary
Constants ¶
const ( AffectsNone = "" AffectsPlayer = "player" // Does it affect only the player who triggered it? AffectsRoom = "room" // Does it affect everyone in the room? // Useful for finding mobs/players FindCharmed FindFlag = 0b00000000001 // charmed FindNeutral FindFlag = 0b00000000010 // Not aggro, not charmed, not Hostile FindFightingPlayer FindFlag = 0b00000000100 // aggro vs. a player FindFightingMob FindFlag = 0b00000001000 // aggro vs. a mob FindHostile FindFlag = 0b00000010000 // will auto-attack players FindMerchant FindFlag = 0b00000100000 // is a merchant FindDowned FindFlag = 0b00001000000 // hp < 1 FindBuffed FindFlag = 0b00010000000 // has a buff FindHasLight FindFlag = 0b00100000000 // has a light source FindHasPet FindFlag = 0b01000000000 // has a pet FindNative FindFlag = 0b10000000000 // spawns in this room // Combinatorial flags FindFighting = FindFightingPlayer | FindFightingMob // Currently in combat (aggro) FindIdle = FindCharmed | FindNeutral // Not aggro or hostile FindAll FindFlag = 0b111111111 // Visitor types VisitorUser = "user" VisitorMob = "mob" )
const (
StartRoomIdAlias = 0
)
Variables ¶
var (
MapSymbolOverrides = map[string]string{
"*": defaultMapSymbol,
}
)
var OnRoomLook util.Hook[RoomTemplateDetails]
OnRoomLook is fired at the end of GetDetails with the fully-populated RoomTemplateDetails. Modules may register handlers to modify the details before they are returned to the caller.
Example registration from a module:
rooms.OnRoomLook.Register(func(d rooms.RoomTemplateDetails) rooms.RoomTemplateDetails {
d.Alert("You can fish here!")
return d
})
Functions ¶
func BuildAllCoordinateIndexes ¶ added in v0.9.8
func BuildAllCoordinateIndexes()
func BuildCoordinateIndex ¶ added in v0.9.8
func BuildCoordinateIndex(zoneName string)
func ClearRoomCache ¶
Deletes any knowledge of a room in memory. Loading this room after the fact will trigger full re-loading and caching of room data.
func ConnectRoom ¶
#build exit north 1337 Build an exit in the current room that links to room by id You still need to visit that room and connect it the opposite way
func CreateBiome ¶ added in v0.9.8
CreateBiome registers a new biome. Returns an error if the id already exists.
func CreateEmptyEphemeralRooms ¶ added in v0.9.8
Accepts a quantity and returns roomId's for a chunk of empty rooms This is a special use function for dynamically building ephemeral rooms in code
func CreateEphemeralRoomIds ¶
accepts RoomId's as arguments, and creates ephemeral copies of them, returning the new ID's of the copies.
func CreateEphemeralZone ¶
accepts RoomId's as arguments, and creates ephemeral copies of them, returning the new ID's of the copies.
func CreateRoomForAdmin ¶ added in v0.9.8
func CreateZone ¶
#build zone The Arctic Build a zone, popualtes with an empty boring room
func DeleteBiome ¶ added in v0.9.8
DeleteBiome removes a biome from disk and the in-memory registry. The "default" biome cannot be deleted.
func DeleteRoomForAdmin ¶ added in v0.9.8
func DeleteRoomInstance ¶ added in v0.9.8
DeleteRoomInstance removes the instance file for roomId. Returns nil when the file does not exist.
func DeleteZoneForAdmin ¶ added in v0.9.8
func EphemeralRoomMaintenance ¶
func EphemeralRoomMaintenance() []int
All this does is unload chunks with no players in them.
func FindEphemeralRoomIds ¶
Looks for any ephemeralRoomId's that exits for the given roomId. Returns a slice containing all found ephemeralIds
func FindZoneName ¶
func GetAllRoomIds ¶
func GetAllRoomIds() []int
func GetAllZoneNames ¶
func GetAllZoneNames() []string
func GetAllZoneRoomsIds ¶
func GetChunkCount ¶
func GetChunkCount() int
func GetMemoryUsage ¶
func GetMemoryUsage() map[string]util.MemoryResult
func GetNextRoomId ¶
func GetNextRoomId() int
func GetOriginalRoom ¶
func GetRoomAtCoordinate ¶ added in v0.9.8
func GetRoomCount ¶
func GetRoomInstanceRaw ¶ added in v0.9.8
GetRoomInstanceRaw returns the raw YAML bytes of the instance file for roomId. Returns nil, nil when the file does not exist.
func GetRoomTemplatePath ¶ added in v0.9.8
GetRoomTemplatePath returns the absolute path to the YAML template file for the given room ID, or an empty string if the room is not known.
func GetRoomWithMostItems ¶
func GetRoomWithMostItems(skipRecentlyVisited bool, minimumItemCt int, minimumGoldCt int) (roomId int, itemCt int)
skipRecentlyVisited means ignore rooms with recent visitors minimumItemCt is the minimum items in the room to care about it
func GetRoomsWithMobs ¶
func GetRoomsWithMobs() []int
func GetRoomsWithPlayers ¶
func GetRoomsWithPlayers() []int
func GetZoneBiome ¶
func GetZoneForRoom ¶ added in v0.9.8
GetZoneForRoom returns the zone name for a given room ID using the lightweight summary cache. Returns an empty string if the room is not known.
func GetZoneRoot ¶
func GetZonesWithMutators ¶
func IsCoordinateAvailable ¶ added in v0.9.8
func IsEphemeralRoomId ¶
func IsRoomLoaded ¶
func LoadBiomeDataFiles ¶ added in v0.9.4
func LoadBiomeDataFiles()
func LoadDataFiles ¶
func LoadDataFiles()
func MoveToZone ¶
func RegisterCoordinate ¶ added in v0.9.8
func RenameZoneForAdmin ¶ added in v0.9.8
RenameZoneForAdmin renames a zone: it updates all on-disk files (rooms, mobs, conversations, zone-config) and all in-memory state (room manager, live mob instances, online user records). No players may be present in the zone when this is called.
func RoomMaintenance ¶
func RoomMaintenance() []int
func SaveAllRooms ¶
func SaveAllRooms() error
func SaveBiome ¶ added in v0.9.8
SaveBiome validates, writes a biome YAML to disk, and updates the in-memory registry.
func SaveRoomForAdmin ¶ added in v0.9.8
func SaveRoomInstanceRaw ¶ added in v0.9.8
SaveRoomInstanceRaw writes raw YAML bytes to the instance file for roomId. The room template must exist. Passing empty or nil content deletes the file.
func SaveRoomScript ¶ added in v0.9.8
SaveRoomScript writes (or overwrites) the JavaScript file for a room. If content is empty the script file is deleted instead.
func SaveRoomTemplate ¶
See C. UPDATING EXISTING ROOM TEMPLATES
func SaveZoneConfig ¶ added in v0.0.4
func SaveZoneConfig(zoneConfig *ZoneConfig) error
Overwrite file and memory for zoneconfig
func SaveZoneConfigForAdmin ¶ added in v0.9.8
func SaveZoneConfigForAdmin(name string, cfg *ZoneConfig) error
func SetNextRoomId ¶
func SetNextRoomId(nextRoomId int)
func TryEphemeralCleanup ¶
func UnregisterCoordinate ¶ added in v0.9.8
func ValidateZoneName ¶
func ZoneNameSanitize ¶
func ZoneToFolder ¶
Types ¶
type BiomeInfo ¶
type BiomeInfo struct {
BiomeId string `yaml:"biomeid"`
Name string `yaml:"name"`
Symbol string `yaml:"symbol"`
Color SymbolColor `yaml:"color"`
Description string `yaml:"description"`
DarkArea bool `yaml:"darkarea"`
LitArea bool `yaml:"litarea"`
RequiredItemId int `yaml:"requireditemid"`
UsesItem bool `yaml:"usesitem"`
Burns bool `yaml:"burns"`
// Overrides for symbols in this biome
SymbolOverrides map[string]SymbolColor `yaml:"symboloverrides"`
// contains filtered or unexported fields
}
func GetAllBiomes ¶
func GetAllBiomes() []BiomeInfo
func GetAllBiomesSorted ¶ added in v0.9.8
func GetAllBiomesSorted() []BiomeInfo
GetAllBiomesSorted returns a copy of every loaded biome, sorted by BiomeId.
func (*BiomeInfo) SymbolString ¶
type Container ¶
type Container struct {
Lock gamelock.Lock `yaml:"lock,omitempty"` // 0 - no lock. greater than zero = difficulty to unlock.
Items []items.Item `yaml:"items,omitempty"` // Save contents now, since players can put new items in there
Gold int `yaml:"gold,omitempty"` // Save contents now, since players can put new items in there
DespawnRound uint64 `yaml:"despawnround,omitempty"` // If this is set, it's a chest that will disappear with time.
Recipes map[int][]int `yaml:"recipes,omitempty,flow"` // Item Id's (key) that are created when the recipe is present in the container (values) and it is "used"
}
func (*Container) RecipeReady ¶
Returns an itemId if it can produce one based on contents + recipe
func (*Container) RemoveItem ¶
type Corpse ¶
type Corpse struct {
UserId int
MobId int
Character characters.Character
RoundCreated uint64
Prunable bool // Whether it can be removed
Items []items.Item // Held items when CorpseItems config is enabled
Gold int // Held gold when CorpseItems config is enabled
}
func (*Corpse) RemoveItem ¶ added in v0.9.8
type MapperExitData ¶ added in v0.9.8
type MapperRoomData ¶ added in v0.9.8
type MapperRoomData struct {
RoomId int `json:"RoomId"`
Zone string `json:"Zone"`
Title string `json:"Title"`
MapX int `json:"MapX"`
MapY int `json:"MapY"`
MapZ int `json:"MapZ"`
HasCoordinates bool `json:"HasCoordinates"`
MapSymbol string `json:"MapSymbol"`
MapLegend string `json:"MapLegend"`
Biome string `json:"Biome,omitempty"`
Tags []string `json:"Tags,omitempty"`
HasScript bool `json:"HasScript,omitempty"`
HasMobSpawn bool `json:"HasMobSpawn,omitempty"`
Exits map[string]MapperExitData `json:"Exits"`
}
func GetAllMapperRooms ¶ added in v0.9.8
func GetAllMapperRooms() []MapperRoomData
func GetMapperRooms ¶ added in v0.9.8
func GetMapperRooms(zoneName string) ([]MapperRoomData, error)
type PaginatedRooms ¶ added in v0.9.8
type PaginatedRooms struct {
Rooms []RoomSummary `json:"rooms"`
Total int `json:"total"`
Page int `json:"page"`
PerPage int `json:"perPage"`
}
func GetPaginatedRoomSummaries ¶ added in v0.9.8
func GetPaginatedRoomSummaries(zone string, search string, page int, perPage int) PaginatedRooms
type Room ¶
type Room struct {
//mutex
RoomId int `yaml:"roomid"` // a unique numeric index of the room. Also the filename.
Zone string `yaml:"zone"` // zone is a way to partition rooms into groups. Also into folders.
MusicFile string `yaml:"musicfile,omitempty"` // background music to play when in this room
IsBank bool `yaml:"isbank,omitempty"` // Is this a bank room? If so, players can deposit/withdraw gold here.
Title string `yaml:"title"` // Title shown to the user
Description string `yaml:"description"` // Description shown to the user
MapSymbol string `yaml:"mapsymbol,omitempty"` // The symbol to use when generating a map of the zone
MapLegend string `yaml:"maplegend,omitempty"` // The text to display in the legend for this room. Should be one word.
Biome string `yaml:"biome,omitempty" instance:"skip"` // The biome of the room. Used for weather generation.
Containers map[string]Container `yaml:"containers,omitempty"` // If this room has a chest, what is in it?
Exits map[string]exit.RoomExit `yaml:"exits"` // Exits to other rooms
ExitsTemp map[string]exit.TemporaryRoomExit `yaml:"-"` // Temporary exits that will be removed after a certain time. Don't bother saving on sever shutting down.
Nouns map[string]string `yaml:"nouns,omitempty"` // Interesting nouns to highlight in the room or reveal on succesful searches.
Items []items.Item `yaml:"items,omitempty"` // Items on the floor
Stash []items.Item `yaml:"stash,omitempty"` // list of items in the room that are not visible to players
Corpses []Corpse `yaml:"-"` // Any corpses laying around from recent deaths
Gold int `yaml:"gold,omitempty"` // How much gold is on the ground?
SpawnInfo []SpawnInfo `yaml:"spawninfo,omitempty" instance:"skip"` // key is creature ID, value is spawn chance
SkillTraining map[string]TrainingRange `yaml:"skilltraining,omitempty"` // list of skills that can be trained in this room
Signs []Sign `yaml:"sign,omitempty"` // list of scribbles in the room
IdleMessages []string `yaml:"idlemessages,omitempty" ` // list of messages that can be displayed to players in the room
LastIdleMessage uint8 `yaml:"-"` // index of the last idle message displayed
LongTermDataStore map[string]any `yaml:"longtermdatastore,omitempty"` // Long term data store for the room
Mutators mutators.MutatorList `yaml:"mutators,omitempty"` // mutators this room spawns with.
Pvp bool `yaml:"pvp,omitempty"` // if config pvp is set to `limited`, uses this value
Tags []string `yaml:"tags,omitempty"` // short tags that can be added to rooms for any purpose (modules, scripting, etc)
MapX int `yaml:"mapx"`
MapY int `yaml:"mapy"`
MapZ int `yaml:"mapz"`
HasCoordinates bool `yaml:"hascoordinates,omitempty"`
// contains filtered or unexported fields
}
func BuildRoom ¶
#build room north Build a room to a specific direction, and connect it by exit name You still need to visit that room and connect it the opposite way
func GetRoomForAdmin ¶ added in v0.9.8
func LoadRoomTemplate ¶
Only loads the template data, ignores instance data.
func NewEmptyRoom ¶ added in v0.9.8
func NewEmptyRoom() *Room
func (*Room) AddTemporaryExit ¶
func (r *Room) AddTemporaryExit(exitName string, t exit.TemporaryRoomExit) bool
Can't add twoof the same exitName Will return false if it already exists
func (*Room) ApplyBuffIdToMobs ¶
applies buffs to any mobs in the room that don't already have it
func (*Room) ApplyBuffIdToNativeMobs ¶
applies buffs to any mobs in the room that don't already have it
func (*Room) ApplyBuffIdToPlayers ¶
applies buffs to any players in the room that don't already have it
func (*Room) AreMobsAttacking ¶
func (*Room) ArePlayersAttacking ¶
func (*Room) CanPvp ¶
func (r *Room) CanPvp(attUser *users.UserRecord, defUser *users.UserRecord) error
Returns an error with a reason why they cannot PVP, or nil
func (*Room) CleanupMobSpawns ¶
func (*Room) ClearCoordinates ¶ added in v0.9.8
func (r *Room) ClearCoordinates()
func (*Room) FindByName ¶
func (*Room) FindByPetName ¶
func (*Room) FindContainerByName ¶
func (*Room) FindCorpseByRef ¶ added in v0.9.8
func (*Room) FindExitByName ¶
func (*Room) FindOnFloor ¶
func (*Room) FindTemporaryExitByUserId ¶
func (r *Room) FindTemporaryExitByUserId(userId int) (exit.TemporaryRoomExit, bool)
func (*Room) GetDescription ¶
func (*Room) GetDescriptionFormatted ¶
func (*Room) GetExitInfo ¶
func (*Room) GetLongTermData ¶
func (*Room) GetMapSymbol ¶
func (*Room) GetPlayers ¶
func (*Room) GetPrivateSigns ¶
func (*Room) GetPublicSigns ¶
func (*Room) GetRandomExit ¶
func (*Room) GetScriptPath ¶
func (*Room) GetTempData ¶
func (*Room) GetVisibility ¶
0 = none (darkness). 1 = can see this room. 2 = can see this room and all exits
func (*Room) HasRecentVisitors ¶
func (*Room) HasVisited ¶
func (r *Room) HasVisited(id int, vType VisitorType) bool
func (*Room) IsEphemeral ¶
func (*Room) MarkVisited ¶
func (r *Room) MarkVisited(id int, vType VisitorType, subtrackTurns ...int)
func (*Room) Prepare ¶
The purpose of Prepare() is to ensure a room is properly setup before anyone looks into it or enters it That way if there should be anything in the room prior, it will already be there. For example, mobs shouldn't ENTER the room right as the player arrives, they should already be there.
func (*Room) PruneSigns ¶
func (*Room) PruneTemporaryExits ¶
func (r *Room) PruneTemporaryExits() []exit.TemporaryRoomExit
func (*Room) PruneVisitors ¶
func (*Room) RemoveCorpse ¶
func (*Room) RemoveTemporaryExit ¶
func (r *Room) RemoveTemporaryExit(t exit.TemporaryRoomExit) bool
func (*Room) RepeatSpawnItem ¶
Spawns an item in the room unless: 1. Item is already in the room 2. (optional) Item is currently held by someone in the room 3. item repeat-spawned too recently If containerName is provided, ony that container name will be considered
func (*Room) SendTextCommunication ¶
func (*Room) SendTextToExits ¶
func (*Room) SetCoordinates ¶ added in v0.9.8
func (*Room) SetExitLock ¶
func (*Room) SetLongTermData ¶
func (*Room) SetTempData ¶
func (*Room) SpawnTempContainer ¶
func (*Room) UpdateCorpses ¶
type RoomManager ¶
type RoomManager struct {
// contains filtered or unexported fields
}
func (*RoomManager) GetFilePath ¶
func (r *RoomManager) GetFilePath(roomId int) string
type RoomSummary ¶ added in v0.9.8
type RoomSummary struct {
RoomId int `json:"RoomId"`
Zone string `json:"Zone"`
Title string `json:"Title"`
Biome string `json:"Biome"`
ExitCount int `json:"ExitCount"`
SpawnCount int `json:"SpawnCount"`
IsBank bool `json:"IsBank,omitempty"`
Pvp bool `json:"Pvp,omitempty"`
HasScript bool `json:"HasScript,omitempty"`
TrainingCount int `json:"TrainingCount,omitempty"`
}
type RoomSummaryInfo ¶ added in v0.9.8
type RoomTemplateDetails ¶
type RoomTemplateDetails struct {
VisiblePlayers []string
VisibleMobs []string
VisibleCorpses []string
VisibleExits map[string]exit.RoomExit
TemporaryExits map[string]exit.TemporaryRoomExit
UserId int
Character *characters.Character
RoomSymbol string
RoomLegend string
Nouns []string
Zone string
Title string
Description string
IsDark bool
IsNight bool
TrackingString string
RoomAlerts [][]string // Messages to show below room description as a special alert
ShowPvp bool // Whether to display that the room is PVP
Tags []string // Tags applied to the room
}
func GetDetails ¶
func GetDetails(r *Room, user *users.UserRecord, tinymap ...[]string) RoomTemplateDetails
func (*RoomTemplateDetails) Alert ¶ added in v0.9.8
func (d *RoomTemplateDetails) Alert(lines ...string)
Alert appends one alert group to RoomAlerts. Each argument becomes one line within the same header/footer bracket when rendered. A single string containing "\n" is automatically split into multiple lines of the same group.
type SpawnInfo ¶
type SpawnInfo struct {
MobId int `yaml:"mobid,omitempty"` // Mob template Id to spawn
InstanceId int `yaml:"-"` // Mob instance Id that was spawned (tracks whether exists currently)
Container string `yaml:"container,omitempty"` // If set, any item or gold spawned will go into the container.
ItemId int `yaml:"itemid,omitempty"` // Item template Id to spawn on the floor
Gold int `yaml:"gold,omitempty"` // How much gold to spawn on the floor
Message string `yaml:"message,omitempty"` // (optional) message to display to the room when this creature spawns, instead of a default
Name string `yaml:"name,omitempty"` // (optional) if set, will override the mob's name
ForceHostile bool `yaml:"forcehostile,omitempty"` // (optional) if true, forces the mob to be hostile.
MaxWander int `yaml:"maxwander,omitempty"` // (optional) if set, will override the mob's max wander distance
IdleCommands []string `yaml:"idlecommands,omitempty"` // (optional) list of commands to override the default of the mob. Useful when you need a mob to be more unique.
ScriptTag string `yaml:"scripttag,omitempty"` // (optional) if set, will override the mob's script tag
QuestFlags []string `yaml:"questflags,omitempty,flow"` // (optional) list of quest flags to set on the mob
BuffIds []int `yaml:"buffids,omitempty,flow"` // (optional) list of buffs the mob always has active
Level int `yaml:"level,omitempty"` // (optional) force this mob to a specific level
LevelMod int `yaml:"levelmod,omitempty"` // (optional) modify this mobs level by this amount
// spawn tracking and rate
DespawnedRound uint64 `yaml:"-"` // When this mob was last despawned (killed)
RespawnRate string `yaml:"respawnrate,omitempty"` // How long until it respawns when not present?
}
type SymbolColor ¶ added in v0.9.8
type TrainingRange ¶
type VisitorType ¶
type VisitorType string
type ZoneConfig ¶
type ZoneConfig struct {
Name string `yaml:"name,omitempty"`
RoomId int `yaml:"roomid,omitempty"`
MobAutoScale struct {
Minimum int `yaml:"minimum,omitempty"` // level scaling minimum
Maximum int `yaml:"maximum,omitempty"` // level scaling maximum
} `yaml:"autoscale,omitempty"` // level scaling range if any
Mutators mutators.MutatorList `yaml:"mutators,omitempty"` // mutators defined here apply to entire zone
IdleMessages []string `yaml:"idlemessages,omitempty"` // list of messages that can be displayed to players in the zone, assuming a room has none defined
MusicFile string `yaml:"musicfile,omitempty"` // background music to play when in this zone
DefaultBiome string `yaml:"defaultbiome,omitempty"` // city, swamp etc. see biomes.go
RoomIds map[int]struct{} `yaml:"-"` // Does not get written. Built dyanmically when rooms are loaded.
}
func GetZoneConfig ¶
func GetZoneConfig(zone string) *ZoneConfig
func NewZoneConfig ¶ added in v0.0.4
func NewZoneConfig(zName string) *ZoneConfig
func (*ZoneConfig) Filename ¶ added in v0.0.4
func (z *ZoneConfig) Filename() string
func (*ZoneConfig) Filepath ¶ added in v0.0.4
func (z *ZoneConfig) Filepath() string
func (*ZoneConfig) GenerateRandomLevel ¶
func (z *ZoneConfig) GenerateRandomLevel() int
Generates a random number between min and max
func (*ZoneConfig) Id ¶ added in v0.0.4
func (z *ZoneConfig) Id() string
func (*ZoneConfig) Validate ¶
func (z *ZoneConfig) Validate() error
type ZoneSummary ¶ added in v0.9.8
type ZoneSummary struct {
Name string `json:"Name"`
RoomId int `json:"RoomId"`
RoomCount int `json:"RoomCount"`
DefaultBiome string `json:"DefaultBiome"`
MusicFile string `json:"MusicFile,omitempty"`
AutoScaleMin int `json:"AutoScaleMin"`
AutoScaleMax int `json:"AutoScaleMax"`
IdleMessages []string `json:"IdleMessages,omitempty"`
}
func GetAllZoneSummaries ¶ added in v0.9.8
func GetAllZoneSummaries() []ZoneSummary