config

package
v0.17.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 4, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package config loads configuration from defaults, the working-directory file, explicitly selected files, and command-line flags, and saves preferences to the selected file. It should not depend on game runtime state.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NextScreenshotPath

func NextScreenshotPath(now time.Time) (string, error)

func UserDataDir

func UserDataDir() (string, error)

Types

type AudioConfig

type AudioConfig struct {
	Disabled  bool
	BGM       bool
	BGMVolume float64
	SFXVolume float64
}

type ChatShortcuts added in v0.13.0

type ChatShortcuts [10]string

ChatShortcuts are client-side Alt+1 through Alt+0 commands, independent of the server's item and skill hotkey slots.

type Config

type Config struct {
	// ConfigPath is the absolute file path selected by LoadConfig for saving settings.
	ConfigPath string
	Headless   bool
	DataDir    string
	// AIStateDir holds writable AI overrides when a platform uses read-only assets.
	// Empty keeps the desktop behavior of writing inside DataDir.
	AIStateDir    string
	Window        WindowConfig
	Packet        PacketConfig
	Login         LoginConfig
	Audio         AudioConfig
	Render        RenderConfig
	Network       NetworkConfig
	Fog           FogConfig
	Gameplay      GameplayConfig
	Script        ScriptConfig
	Log           glog.LogConfig
	ChatShortcuts ChatShortcuts
}

func LoadConfig

func LoadConfig(args []string) (Config, error)

func (Config) LoadChatShortcuts added in v0.14.0

func (cfg Config) LoadChatShortcuts() (ChatShortcuts, error)

LoadChatShortcuts refreshes saved bindings when entering the game again; the startup Config may predate edits made before character selection.

func (Config) SaveChatShortcuts added in v0.14.0

func (cfg Config) SaveChatShortcuts(commands ChatShortcuts) (string, error)

func (Config) SaveLoginID added in v0.14.0

func (cfg Config) SaveLoginID(username string, keep bool) (string, error)

SaveLoginID remembers only the ID, independently of explicit login credentials.

func (Config) SaveScriptPath added in v0.16.0

func (cfg Config) SaveScriptPath(path string) (string, error)

SaveScriptPath saves an explicit script choice independently of other settings.

func (Config) SaveUserSettings added in v0.14.0

func (cfg Config) SaveUserSettings(settings UserSettings) (string, error)

type FogConfig

type FogConfig struct {
	Enabled bool
}

type GameplayConfig

type GameplayConfig struct {
	NoShift     bool
	NoCtrl      bool
	LessEffects bool
	SnapTargets bool
	SnapItems   bool
	ForceUserAI bool
}

type LoginConfig

type LoginConfig struct {
	Username       string
	Password       string
	AutoLogin      bool
	ServerSlot     int
	CharServerSlot int
	CharSlot       int
	KeepID         bool
	SavedUsername  string
}

type NetworkConfig

type NetworkConfig struct {
	Trace bool
}

type PacketConfig

type PacketConfig struct {
	ClientDate int
	Profile    int
}

type RenderConfig

type RenderConfig struct {
	GraphicsAPI        string
	VSync              bool
	FPS                bool
	NoUI               bool
	AsyncUI            bool
	UIProfile          bool
	BenchSeconds       int
	BenchWarmupSeconds int
	CPUProfile         string
	Stats              bool
	WorldDebugStats    bool
}

type ScriptConfig

type ScriptConfig struct {
	Path string
}

type UserSettings

type UserSettings struct {
	Fullscreen  bool
	VSync       bool
	FPS         bool
	BGMVolume   float64
	SFXVolume   float64
	NoShift     bool
	NoCtrl      bool
	LessEffects bool
	SnapTargets bool
	SnapItems   bool
}

type WindowConfig

type WindowConfig struct {
	Title      string
	Width      int
	Height     int
	Fullscreen bool
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL