Documentation
¶
Index ¶
- Constants
- Variables
- func AddOverlayOverrides(dotMap map[string]any) error
- func FindFullPath(inputKey string) (properKey string, typeName string)
- func Flatten(input map[string]any) map[string]any
- func GetOverrides() map[string]any
- func GetSecret(v ConfigSecret) string
- func ReloadConfig() error
- func SetVal(propertyPath string, newVal string) error
- type Config
- func (c Config) AllConfigData(excludeStrings ...string) map[string]any
- func (c *Config) DotPaths() map[string]any
- func (c Config) IsBannedName(name string) (string, bool)
- func (c *Config) OverlayOverrides(dotMap map[string]any) error
- func (c Config) SeedInt() int64
- func (c *Config) SetOverrides(newOverrides map[string]any) error
- func (c *Config) Validate()
- type ConfigBool
- type ConfigFloat
- type ConfigInt
- type ConfigSecret
- type ConfigSliceString
- type ConfigString
- type ConfigUInt64
- type ConfigValue
- type FilePaths
- type GamePlay
- type GameplayDeath
- type Integrations
- type IntegrationsDiscord
- type LootGoblin
- type Memory
- type Modules
- type Network
- type Roles
- type Scripting
- type Server
- type SpecialRooms
- type TextFormats
- type Timing
- func (e Timing) MinutesToRounds(minutes int) int
- func (e Timing) MinutesToTurns(minutes int) int
- func (e Timing) RoundsToSeconds(rounds int) int
- func (e Timing) SecondsToRounds(seconds int) int
- func (e Timing) SecondsToTurns(seconds int) int
- func (e Timing) TurnsPerAutoSave() int
- func (e Timing) TurnsPerRound() int
- func (e Timing) TurnsPerSecond() int
- func (e *Timing) Validate()
- type Translation
- type Validation
Constants ¶
View Source
const ( PVPEnabled = `enabled` PVPDisabled = `disabled` PVPOff = `off` PVPLimited = `limited` )
Variables ¶
View Source
var ( ErrInvalidConfigName = errors.New("invalid config name") ErrLockedConfig = errors.New("config name is locked") )
Functions ¶
func AddOverlayOverrides ¶
func FindFullPath ¶
func Flatten ¶
flatten recursively flattens a map[string]any. It supports both map[string]any and map[any]any values, which is useful when unmarshaling YAML.
func GetOverrides ¶
func GetSecret ¶
func GetSecret(v ConfigSecret) string
Usage: configs.GetSecret(c.DiscordWebhookUrl)
func ReloadConfig ¶
func ReloadConfig() error
Types ¶
type Config ¶
type Config struct {
// Start config subsections
Server Server `yaml:"Server"`
Memory Memory `yaml:"Memory"`
LootGoblin LootGoblin `yaml:"LootGoblin"`
Timing Timing `yaml:"Timing"`
FilePaths FilePaths `yaml:"FilePaths"`
GamePlay GamePlay `yaml:"GamePlay"`
Integrations Integrations `yaml:"Integrations"`
TextFormats TextFormats `yaml:"TextFormats"`
Translation Translation `yaml:"Translation"`
Network Network `yaml:"Network"`
Scripting Scripting `yaml:"Scripting"`
SpecialRooms SpecialRooms `yaml:"SpecialRooms"`
Validation Validation `yaml:"Validation"`
Roles Roles `yaml:"Roles"`
// Plugins is a special case
Modules Modules `yaml:"Modules"`
// contains filtered or unexported fields
}
func (Config) AllConfigData ¶
func (*Config) OverlayOverrides ¶
OverlayDotMap overlays values from a dot-syntax map onto the Config.
type ConfigBool ¶
type ConfigBool bool
func (*ConfigBool) Set ¶
func (c *ConfigBool) Set(value string) error
func (ConfigBool) String ¶
func (c ConfigBool) String() string
type ConfigFloat ¶
type ConfigFloat float64
func (*ConfigFloat) Set ¶
func (c *ConfigFloat) Set(value string) error
func (ConfigFloat) String ¶
func (c ConfigFloat) String() string
type ConfigSecret ¶
type ConfigSecret string // special case string
func (*ConfigSecret) Set ¶
func (c *ConfigSecret) Set(value string) error
func (ConfigSecret) String ¶
func (c ConfigSecret) String() string
type ConfigSliceString ¶
type ConfigSliceString []string
func (*ConfigSliceString) Set ¶
func (c *ConfigSliceString) Set(value string) error
func (ConfigSliceString) String ¶
func (c ConfigSliceString) String() string
type ConfigString ¶
type ConfigString string
func (*ConfigString) Set ¶
func (c *ConfigString) Set(value string) error
func (ConfigString) String ¶
func (c ConfigString) String() string
type ConfigUInt64 ¶
type ConfigUInt64 uint64
func (*ConfigUInt64) Set ¶
func (c *ConfigUInt64) Set(value string) error
func (ConfigUInt64) String ¶
func (c ConfigUInt64) String() string
type ConfigValue ¶
func StringToConfigValue ¶
func StringToConfigValue(strVal string, typeName string) ConfigValue
type FilePaths ¶
type FilePaths struct {
WebDomain ConfigString `yaml:"WebDomain"`
WebCDNLocation ConfigString `yaml:"WebCDNLocation"`
DataFiles ConfigString `yaml:"DataFiles"`
PublicHtml ConfigString `yaml:"PublicHtml"`
AdminHtml ConfigString `yaml:"AdminHtml"`
HttpsCertFile ConfigString `yaml:"HttpsCertFile"`
HttpsKeyFile ConfigString `yaml:"HttpsKeyFile"`
CarefulSaveFiles ConfigBool `yaml:"CarefulSaveFiles"`
}
func GetFilePathsConfig ¶
func GetFilePathsConfig() FilePaths
type GamePlay ¶
type GamePlay struct {
AllowItemBuffRemoval ConfigBool `yaml:"AllowItemBuffRemoval"`
// Death related settings
Death GameplayDeath `yaml:"Death"`
LivesStart ConfigInt `yaml:"LivesStart"` // Starting permadeath lives
LivesMax ConfigInt `yaml:"LivesMax"` // Maximum permadeath lives
LivesOnLevelUp ConfigInt `yaml:"LivesOnLevelUp"` // # lives gained on level up
PricePerLife ConfigInt `yaml:"PricePerLife"` // Price in gold to buy new lives
// Shops/Conatiners
ShopRestockRate ConfigString `yaml:"ShopRestockRate"` // Default time it takes to restock 1 quantity in shops
ContainerSizeMax ConfigInt `yaml:"ContainerSizeMax"` // How many objects containers can hold before overflowing
// Alt chars
MaxAltCharacters ConfigInt `yaml:"MaxAltCharacters"` // How many characters beyond the default character can they create?
// Combat
ConsistentAttackMessages ConfigBool `yaml:"ConsistentAttackMessages"` // Whether each weapon has consistent attack messages
// PVP Restrictions
PVP ConfigString `yaml:"PVP"`
PVPMinimumLevel ConfigInt `yaml:"PVPMinimumLevel"`
// XpScale (difficulty)
XPScale ConfigFloat `yaml:"XPScale"`
MobConverseChance ConfigInt `yaml:"MobConverseChance"` // Chance 1-100 of attempting to converse when idle
}
func GetGamePlayConfig ¶
func GetGamePlayConfig() GamePlay
type GameplayDeath ¶
type GameplayDeath struct {
EquipmentDropChance ConfigFloat `yaml:"EquipmentDropChance"` // Chance a player will drop a given piece of equipment on death
AlwaysDropBackpack ConfigBool `yaml:"AlwaysDropBackpack"` // If true, players will always drop their backpack items on death
XPPenalty ConfigString `yaml:"XPPenalty"` // Possible values are: none, level, 10%, 25%, 50%, 75%, 90%, 100%
ProtectionLevels ConfigInt `yaml:"ProtectionLevels"` // How many levels is the user protected from death penalties for?
PermaDeath ConfigBool `yaml:"PermaDeath"` // Is permadeath enabled?
CorpsesEnabled ConfigBool `yaml:"CorpsesEnabled"` // Whether corpses are left behind after mob/player deaths
CorpseDecayTime ConfigString `yaml:"CorpseDecayTime"` // How long until corpses decay to dust (go away)
}
type Integrations ¶
type Integrations struct {
Discord IntegrationsDiscord `yaml:"Discord"`
}
func GetIntegrationsConfig ¶
func GetIntegrationsConfig() Integrations
func (*Integrations) Validate ¶
func (i *Integrations) Validate()
type IntegrationsDiscord ¶
type IntegrationsDiscord struct {
WebhookUrl ConfigSecret `yaml:"WebhookUrl" env:"DISCORD_WEBHOOK_URL"` // Optional Discord URL to post updates to
}
type LootGoblin ¶
type LootGoblin struct {
// Item/floor cleanup
RoomId ConfigInt `yaml:"RoomId"` // The room the loot goblin spawns in
RoundCount ConfigInt `yaml:"RoundCount"` // How often to spawn a loot goblin
MinimumItems ConfigInt `yaml:"MinimumItems"` // How many items on the ground to attract the loot goblin
MinimumGold ConfigInt `yaml:"MinimumGold"` // How much gold on the ground to attract the loot goblin
IncludeRecentRooms ConfigBool `yaml:"IncludeRecentRooms"` // should the goblin include rooms that have been visited recently?
}
func GetLootGoblinConfig ¶
func GetLootGoblinConfig() LootGoblin
func (*LootGoblin) Validate ¶
func (l *LootGoblin) Validate()
type Memory ¶
type Memory struct {
// Mob/Room memory unload thresholds
MaxMobBoredom ConfigInt `yaml:"MaxMobBoredom"`
MobUnloadThreshold ConfigInt `yaml:"MobUnloadThreshold"`
RoomUnloadRounds ConfigInt `yaml:"RoomUnloadRounds"`
RoomUnloadThreshold ConfigInt `yaml:"RoomUnloadThreshold"`
}
func GetMemoryConfig ¶
func GetMemoryConfig() Memory
type Modules ¶
func GetModulesConfig ¶
func GetModulesConfig() Modules
type Network ¶
type Network struct {
MaxTelnetConnections ConfigInt `yaml:"MaxTelnetConnections"` // Maximum number of telnet connections to accept
TelnetPort ConfigSliceString `yaml:"TelnetPort"` // One or more Ports used to accept telnet connections
LocalPort ConfigInt `yaml:"LocalPort"` // Port used for admin connections, localhost only
HttpPort ConfigInt `yaml:"HttpPort"` // Port used for web requests
HttpsPort ConfigInt `yaml:"HttpsPort"` // Port used for web https requests
HttpsRedirect ConfigBool `yaml:"HttpsRedirect"` // If true, http traffic will be redirected to https
AfkSeconds ConfigInt `yaml:"AfkSeconds"` // How long until a player is marked as afk?
MaxIdleSeconds ConfigInt `yaml:"MaxIdleSeconds"` // How many seconds a player can go without a command in game before being kicked.
TimeoutMods ConfigBool `yaml:"TimeoutMods"` // Whether to kick admin/mods when idle too long.
ZombieSeconds ConfigInt `yaml:"ZombieSeconds"` // How many seconds a player will be a zombie allowing them to reconnect.
LogoutRounds ConfigInt `yaml:"LogoutRounds"` // How many rounds of uninterrupted meditation must be completed to log out.
}
func GetNetworkConfig ¶
func GetNetworkConfig() Network
type Roles ¶
type Roles map[string]ConfigSliceString
func GetRolesConfig ¶
func GetRolesConfig() Roles
type Scripting ¶
type Scripting struct {
LoadTimeoutMs ConfigInt `yaml:"LoadTimeoutMs"` // How long to spend the first time a script is loaded into memory
RoomTimeoutMs ConfigInt `yaml:"RoomTimeoutMs"` // How many milliseconds to allow a script to run before it is interrupted
}
func GetScriptingConfig ¶
func GetScriptingConfig() Scripting
type Server ¶
type Server struct {
MudName ConfigString `yaml:"MudName"` // Name of the MUD
CurrentVersion ConfigString `yaml:"CurrentVersion"` // Current version this mud has been updated to
Seed ConfigSecret `yaml:"Seed"` // Seed that may be used for generating content
MaxCPUCores ConfigInt `yaml:"MaxCPUCores"` // How many cores to allow for multi-core operations
OnLoginCommands ConfigSliceString `yaml:"OnLoginCommands"` // Commands to run when a user logs in
Motd ConfigString `yaml:"Motd"` // Message of the day to display when a user logs in
NextRoomId ConfigInt `yaml:"NextRoomId"` // The next room id to use when creating a new room
Locked ConfigSliceString `yaml:"Locked"` // List of locked config properties that cannot be changed without editing the file directly.
}
func GetServerConfig ¶
func GetServerConfig() Server
type SpecialRooms ¶
type SpecialRooms struct {
StartRoom ConfigInt `yaml:"StartRoom"` // Default starting room.
DeathRecoveryRoom ConfigInt `yaml:"DeathRecoveryRoom"` // Recovery room after dying.
TutorialRooms ConfigSliceString `yaml:"TutorialRooms"` // List of all rooms that can be used to begin the tutorial process
}
func GetSpecialRoomsConfig ¶
func GetSpecialRoomsConfig() SpecialRooms
func (*SpecialRooms) Validate ¶
func (s *SpecialRooms) Validate()
type TextFormats ¶
type TextFormats struct {
Prompt ConfigString `yaml:"Prompt"` // The in-game status prompt style
EnterRoomMessageWrapper ConfigString `yaml:"EnterRoomMessageWrapper"` // Special enter messages
ExitRoomMessageWrapper ConfigString `yaml:"ExitRoomMessageWrapper"` // Special exit messages
Time ConfigString `yaml:"Time"` // How to format time when displaying real time
TimeShort ConfigString `yaml:"TimeShort"` // How to format time when displaying real time (shortform)
}
func GetTextFormatsConfig ¶
func GetTextFormatsConfig() TextFormats
func (*TextFormats) Validate ¶
func (m *TextFormats) Validate()
type Timing ¶
type Timing struct {
TurnMs ConfigInt `yaml:"TurnMs"`
RoundSeconds ConfigInt `yaml:"RoundSeconds"`
RoundsPerAutoSave ConfigInt `yaml:"RoundsPerAutoSave"`
RoundsPerDay ConfigInt `yaml:"RoundsPerDay"` // How many rounds are in a day
NightHours ConfigInt `yaml:"NightHours"` // How many hours of night
// contains filtered or unexported fields
}
func GetTimingConfig ¶
func GetTimingConfig() Timing
func (Timing) MinutesToRounds ¶
func (Timing) MinutesToTurns ¶
func (Timing) RoundsToSeconds ¶
func (Timing) SecondsToRounds ¶
func (Timing) SecondsToTurns ¶
func (Timing) TurnsPerAutoSave ¶
func (Timing) TurnsPerRound ¶
func (Timing) TurnsPerSecond ¶
type Translation ¶
type Translation struct {
DefaultLanguage ConfigString `yaml:"DefaultLanguage"` // Specify the default game language (fallback)
Language ConfigString `yaml:"Language"` // Specify the game language
LanguagePaths ConfigSliceString `yaml:"LanguagePaths"` // Specify the game language file paths
}
func GetTranslationConfig ¶
func GetTranslationConfig() Translation
func (*Translation) Validate ¶
func (t *Translation) Validate()
type Validation ¶
type Validation struct {
NameSizeMin ConfigInt `yaml:"NameSizeMin"`
NameSizeMax ConfigInt `yaml:"NameSizeMax"`
PasswordSizeMin ConfigInt `yaml:"PasswordSizeMin"`
PasswordSizeMax ConfigInt `yaml:"PasswordSizeMax"`
NameRejectRegex ConfigString `yaml:"NameRejectRegex"`
NameRejectReason ConfigString `yaml:"NameRejectReason"`
EmailOnJoin ConfigString `yaml:"EmailOnJoin"`
BannedNames ConfigSliceString `yaml:"BannedNames"` // List of names that are not allowed to be used
}
func GetValidationConfig ¶
func GetValidationConfig() Validation
func (*Validation) Validate ¶
func (v *Validation) Validate()
Source Files
¶
- config.filepaths.go
- config.gameplay.go
- config.integrations.go
- config.lootgoblin.go
- config.memory.go
- config.modules.go
- config.network.go
- config.roles.go
- config.scripting.go
- config.server.go
- config.specialrooms.go
- config.textformats.go
- config.timing.go
- config.translation.go
- config.validation.go
- config_types.go
- configs.go
- overrides.go
Click to show internal directories.
Click to hide internal directories.