Documentation ¶
Index ¶
- func ChooseTranslationTable(l *lua.LState, locale string) *lua.LFunction
- func ParsePlayerTxt(content string) []string
- func ToCaveLevelDataOverridesLua(overrides LevelDataOverrides) ([]byte, error)
- func ToClusterInI(config ClusterConfig) ([]byte, error)
- func ToMasterLevelDataOverridesLua(overrides LevelDataOverrides) ([]byte, error)
- func ToModOverrideLua(options []ModOverRideOption) ([]byte, error)
- func ToPlayerTxt(kleiIDs []string) ([]byte, error)
- func ToServerInI(config ServerConfig) ([]byte, error)
- type ChatLog
- type ClusterConfig
- type ClusterNetwork
- type ClusterShard
- type ClusterSteam
- type GamePlay
- type LevelDataOverrides
- type LevelOverrideItem
- type Misc
- type ModInfo
- type ModOption
- type ModOptionItem
- type ModOverRideOption
- type ModOverRideOptionItem
- type ServerAccount
- type ServerConfig
- type ServerNetwork
- type ServerShard
- type ServerSteam
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ChooseTranslationTable ¶
ChooseTranslationTable returns *lua.LFunction, this function used to choose the translation table in lua state.
func ParsePlayerTxt ¶
ParsePlayerTxt parse player.txt file, returns slice of klei ID
func ToCaveLevelDataOverridesLua ¶
func ToCaveLevelDataOverridesLua(overrides LevelDataOverrides) ([]byte, error)
ToCaveLevelDataOverridesLua converts LevelDataOverrides to lua script
func ToClusterInI ¶
func ToClusterInI(config ClusterConfig) ([]byte, error)
ToClusterInI converts ClusterConfig to cluster.ini
func ToMasterLevelDataOverridesLua ¶
func ToMasterLevelDataOverridesLua(overrides LevelDataOverrides) ([]byte, error)
ToMasterLevelDataOverridesLua converts LevelDataOverrides to lua script
func ToModOverrideLua ¶
func ToModOverrideLua(options []ModOverRideOption) ([]byte, error)
ToModOverrideLua return the lua representation of the modOverride options, the format is same as modoverride.lua
func ToPlayerTxt ¶
ToPlayerTxt converts kleiIDs to player.txt
func ToServerInI ¶
func ToServerInI(config ServerConfig) ([]byte, error)
ToServerInI converts ServerConfig to server.ini
Types ¶
type ChatLog ¶
type ChatLog struct { Time string `mapstructure:"time"` Type string `mapstructure:"type"` KleiId string `mapstructure:"klei_id"` Name string `mapstructure:"player_name"` Msg string `mapstructure:"msg"` }
ChatLog represents a chat record in server_chat_log.txt
func ParseServerChatLogs ¶
type ClusterConfig ¶
type ClusterConfig struct { GamePlay GamePlay `ini:"GAMEPLAY"` NetWork ClusterNetwork `ini:"NETWORK"` Misc Misc `ini:"MISC"` Shard ClusterShard `ini:"SHARD"` Steam ClusterSteam `ini:"STEAM"` }
ClusterConfig represents cluster.ini
func ParseClusterInI ¶
func ParseClusterInI(data []byte) (ClusterConfig, error)
ParseClusterInI parses the cluster.ini to ClusterConfig struct type
type ClusterNetwork ¶
type ClusterNetwork struct { // basic information WhiteListSlots int `ini:"whitelist_slots"` ClusterPassword string `ini:"cluster_password"` ClusterName string `ini:"cluster_name"` ClusterDescription string `ini:"cluster_description"` ClusterLanguage string `ini:"cluster_language"` ClusterCloudId string `ini:"cluster_cloud_id,omitempty"` // network Offline bool `ini:"offline_cluster"` TrickRate int `ini:"tick_rate,omitempty"` LanOnly bool `ini:"lan_only_cluster"` }
type ClusterShard ¶
type ClusterSteam ¶
type LevelDataOverrides ¶
type LevelDataOverrides struct { Id string `mapstructure:"id"` Name string `mapstructure:"name"` Version float64 `mapstructure:"version"` Desc string `mapstructure:"desc"` Location string `mapstructure:"location"` PlayStyle string `mapstructure:"playstyle"` HideMiniMap bool `mapstructure:"hideminimap"` MaxPlayerListPosition float64 `mapstructure:"max_playerlist_position"` MinPlayerListPosition float64 `mapstructure:"min_playerlist_position"` NumRandomSetPieces int `mapstructure:"numrandom_set_pieces"` OverrideLevelString bool `mapstructure:"override_level_string"` // setting SettingId string `mapstructure:"settings_id"` SettingName string `mapstructure:"settings_name"` SettingDesc string `mapstructure:"settings_desc"` // worldgen WorldGenId string `mapstructure:"worldgen_id"` WorldGenName string `mapstructure:"worldgen_name"` WorldGenDesc string `mapstructure:"worldgen_desc"` // meta info Overrides []LevelOverrideItem `mapstructure:"overrides"` RandomSetPieces []string `mapstructure:"random_set_pieces"` RequiredPrefabs []string `mapstructure:"required_prefabs"` RequiredSetPieces []string `mapstructure:"required_setpieces"` Substitutes []string `mapstructure:"substitutes"` BackGroundNodeRange []float64 `mapstructure:"background_node_range"` }
LevelDataOverrides represents level data overrides information
func ParseLevelDataOverrides ¶
func ParseLevelDataOverrides(luaScript []byte) (LevelDataOverrides, error)
ParseLevelDataOverrides parses the leveldataoverrides.lua, returns LevelDataOverrides information
type LevelOverrideItem ¶
type ModInfo ¶
type ModInfo struct { // basic information Id string `mapstructure:"id"` Name string `mapstructure:"name"` Description string `mapstructure:"description"` Author string `mapstructure:"author"` Version string `mapstructure:"version"` ForumThread string `mapstructure:"forum_thread"` // dont starve ApiVersion int `mapstructure:"api_version"` DontStarveCompatible bool `mapstructure:"dont_starve_compatible"` ReignOfGiantsCompatible bool `mapstructure:"reign_of_giants_compatible"` ShipWreckedCompatible bool `mapstructure:"shipwrecked_compatible"` HamletCompatible bool `mapstructure:"hamlet_compatible"` // dont starve together ApiVersionDst int `mapstructure:"api_version_dst"` DstCompatible bool `mapstructure:"dst_compatible"` AllClientRequired bool `mapstructure:"all_client_required"` ClientOnly bool `mapstructure:"client_only_mod"` ServerOnly bool `mapstructure:"server_only_mod"` ForgeCompatible bool `mapstructure:"forge_compatible"` // meta info FilterTags []string `mapstructure:"server_filter_tags"` Priority float64 `mapstructure:"priority"` Icon string `mapstructure:"icon"` IconAtlas string `mapstructure:"icon_atlas"` // configuration ConfigurationOptions []ModOption `mapstructure:"configuration_options"` }
func ParseModInfo ¶
ParseModInfo returns the parsed modinfo from lua script
type ModOption ¶
type ModOption struct { // option name, maybe empty Name string `mapstructure:"name"` // option label, maybe empty Label string `mapstructure:"label"` // hover tooltip, maybe empty Hover string `mapstructure:"hover"` // default value of this option Default any `mapstructure:"default"` Client bool `mapstructure:"client"` Tags []string `mapstructure:"tags"` // options available Options []ModOptionItem `mapstructure:"options"` }
ModOption represents a mod option in 'configuration_options'
type ModOptionItem ¶
type ModOverRideOption ¶
type ModOverRideOption struct { Id string `mapstructure:"id"` Enabled bool `mapstructure:"enabled"` Items []ModOverRideOptionItem `mapstructure:"options"` }
func ParseModOverrides ¶
func ParseModOverrides(luaScript []byte) ([]ModOverRideOption, error)
ParseModOverrides returns the mod override options from modoverrides.lua
type ModOverRideOptionItem ¶
type ServerAccount ¶
type ServerAccount struct {
EncodeUserPath bool `ini:"encode_user_path"`
}
type ServerConfig ¶
type ServerConfig struct { Network ServerNetwork `ini:"NETWORK"` Shard ServerShard `ini:"SHARD"` Steam ServerSteam `ini:"STEAM"` Account ServerAccount `ini:"ACCOUNT"` }
ServerConfig represents server.ini
func ParseServerInI ¶
func ParseServerInI(data []byte) (ServerConfig, error)
ParseServerInI parses the server.ini to ServerConfig struct type
type ServerNetwork ¶
type ServerNetwork struct {
ServerPort int `ini:"server_port"`
}