Documentation ¶
Index ¶
- Variables
- type DatReader
- func (r *DatReader) Read(buf []byte) (int, error)
- func (r *DatReader) ReadBool() bool
- func (r *DatReader) ReadDouble() float64
- func (r *DatReader) ReadInt64() int64
- func (r *DatReader) ReadModSettings() ModSettings
- func (r *DatReader) ReadModWithCRC() ModIdent
- func (r *DatReader) ReadPropertyTree() PropertyTree
- func (r *DatReader) ReadString() string
- func (r *DatReader) ReadStringOptional() string
- func (r *DatReader) ReadUint16() uint16
- func (r *DatReader) ReadUint16Optimized() uint16
- func (r *DatReader) ReadUint32() uint32
- func (r *DatReader) ReadUint32Optimized() uint32
- func (r *DatReader) ReadUint64() uint64
- func (r *DatReader) ReadUint8() uint8
- func (r *DatReader) ReadVersionOptimized(withBuild bool) Version
- func (r *DatReader) ReadVersionUnoptimized() Version
- type DatWriter
- func (w *DatWriter) Write(buf []byte) (int, error)
- func (w *DatWriter) WriteBool(value bool)
- func (w *DatWriter) WriteDouble(value float64)
- func (w *DatWriter) WriteInt64(value int64)
- func (w *DatWriter) WriteModSettings(input *ModSettings)
- func (w *DatWriter) WritePropertyTree(pt PropertyTree)
- func (w *DatWriter) WriteString(value string)
- func (w *DatWriter) WriteStringOptional(value string)
- func (w *DatWriter) WriteUint16(value uint16)
- func (w *DatWriter) WriteUint16Optimized(value uint16)
- func (w *DatWriter) WriteUint32(value uint32)
- func (w *DatWriter) WriteUint32Optimized(value uint32)
- func (w *DatWriter) WriteUint64(value uint64)
- func (w *DatWriter) WriteUint8(value uint8)
- func (w *DatWriter) WriteVersionUnoptimized(version Version)
- type Dependency
- type DependencyKind
- type Manager
- func (m *Manager) Add(mod ModIdent) (*Version, error)
- func (m *Manager) CheckDownloadUpdates(mods []ModIdent)
- func (m *Manager) Disable(modName string) error
- func (m *Manager) DisableAll()
- func (m *Manager) Enable(ident ModIdent) (*Version, error)
- func (m *Manager) ExpandDependencies(mods []ModIdent, fetchFromPortal bool) []ModIdent
- func (m *Manager) GetApiKey() string
- func (m *Manager) GetLatestMods() []ModIdent
- func (m *Manager) GetMod(name string) (*Mod, error)
- func (m *Manager) GetMods() []ModIdent
- func (m *Manager) GetPlayerData() PlayerData
- func (m *Manager) HasApiKey() bool
- func (m *Manager) HasPlayerData() bool
- func (m *Manager) MergeStartupModSettings(input PropertyTree) error
- func (m *Manager) Save() error
- func (m *Manager) SetApiKey(key string)
- func (m *Manager) SetPlayerData(playerData PlayerData)
- type Mod
- type ModIdent
- type ModInitUploadRes
- type ModListJson
- type ModListJsonMod
- type ModPortal
- func (p *ModPortal) DownloadLatestRelease(name string) (string, error)
- func (p *ModPortal) DownloadMatchingRelease(dep *Dependency) (string, error)
- func (p *ModPortal) DownloadRelease(name string, version *Version) (string, error)
- func (p *ModPortal) GetMatchingRelease(dep *Dependency) (*PortalModRelease, error)
- func (p *ModPortal) GetModInfo(name string) (*PortalModInfo, error)
- func (p *ModPortal) UploadMod(filepath string) error
- type ModSettings
- type PlayerData
- type PortalModInfo
- type PortalModRelease
- type PropertyTree
- type PropertyTreeBool
- type PropertyTreeDict
- type PropertyTreeList
- type PropertyTreeNone
- type PropertyTreeNumber
- type PropertyTreeSignedInteger
- type PropertyTreeString
- type PropertyTreeUnsignedInteger
- type Release
- type SaveFileInfo
- type Version
- type VersionCmpRes
Constants ¶
This section is empty.
Variables ¶
var ( ErrInvalidGameDirectory = errors.New("invalid game directory") ErrModAlreadyDisabled = errors.New("mod is already disabled") ErrModAlreadyEnabled = errors.New("mod is already enabled") ErrModNotFoundLocal = errors.New("mod was not found in the local mods directory") ErrNoCompatibleRelease = errors.New("no compatible release was found") )
Functions ¶
This section is empty.
Types ¶
type DatReader ¶
type DatReader struct {
// contains filtered or unexported fields
}
func (*DatReader) ReadDouble ¶ added in v0.8.0
func (*DatReader) ReadModSettings ¶ added in v0.8.0
func (r *DatReader) ReadModSettings() ModSettings
func (*DatReader) ReadModWithCRC ¶
func (*DatReader) ReadPropertyTree ¶ added in v0.8.0
func (r *DatReader) ReadPropertyTree() PropertyTree
func (*DatReader) ReadString ¶
func (*DatReader) ReadStringOptional ¶ added in v0.8.0
func (*DatReader) ReadUint16 ¶
func (*DatReader) ReadUint16Optimized ¶
func (*DatReader) ReadUint32 ¶
func (*DatReader) ReadUint32Optimized ¶ added in v0.8.0
func (*DatReader) ReadUint64 ¶ added in v0.8.0
func (*DatReader) ReadVersionOptimized ¶ added in v0.8.0
func (*DatReader) ReadVersionUnoptimized ¶ added in v0.8.0
type DatWriter ¶ added in v0.8.0
type DatWriter struct {
// contains filtered or unexported fields
}
func (*DatWriter) WriteDouble ¶ added in v0.8.0
func (*DatWriter) WriteInt64 ¶ added in v0.8.0
func (*DatWriter) WriteModSettings ¶ added in v0.8.0
func (w *DatWriter) WriteModSettings(input *ModSettings)
func (*DatWriter) WritePropertyTree ¶ added in v0.8.0
func (w *DatWriter) WritePropertyTree(pt PropertyTree)
func (*DatWriter) WriteString ¶ added in v0.8.0
func (*DatWriter) WriteStringOptional ¶ added in v0.8.0
func (*DatWriter) WriteUint16 ¶ added in v0.8.0
func (*DatWriter) WriteUint16Optimized ¶ added in v0.8.0
func (*DatWriter) WriteUint32 ¶ added in v0.8.0
func (*DatWriter) WriteUint32Optimized ¶ added in v0.8.0
func (*DatWriter) WriteUint64 ¶ added in v0.8.0
func (*DatWriter) WriteUint8 ¶ added in v0.8.0
func (*DatWriter) WriteVersionUnoptimized ¶ added in v0.8.0
type Dependency ¶
type Dependency struct { Name string Version *Version Kind DependencyKind Req VersionCmpRes }
func NewDependency ¶
func NewDependency(input string) (*Dependency, error)
func (*Dependency) Test ¶
func (d *Dependency) Test(ver *Version) bool
func (*Dependency) ToString ¶
func (d *Dependency) ToString() string
func (*Dependency) UnmarshalJSON ¶
func (d *Dependency) UnmarshalJSON(data []byte) error
type DependencyKind ¶
type DependencyKind uint8
const ( DependencyRequired DependencyKind = iota DependencyOptional DependencyHiddenOptional DependencyIncompatible DependencyNoLoadOrder )
type Manager ¶
Manager manages mdos for a given game directory. A game directory is considered valid if it has either a config-path.cfg file or a config/config.ini file.
func NewManager ¶
Creates a new Manager for the given game directory. A game directory is considered valid if it has either a config-path.cfg file or a config/config.ini file. The player's username and token will be automatically retrieved from `player-data.json` if it exists.
func (*Manager) CheckDownloadUpdates ¶ added in v0.8.0
func (*Manager) DisableAll ¶
func (m *Manager) DisableAll()
Requests all non-internal mods to be disabled.
func (*Manager) Enable ¶
Enable the given mod, if it exists. If version is nil, it will default to the newest local release. Returns the version that was enabled, if any.
func (*Manager) ExpandDependencies ¶
func (*Manager) GetLatestMods ¶ added in v0.8.0
GetLatestMods gets a list of the newest mods managed by this Manager.
func (*Manager) GetPlayerData ¶
func (m *Manager) GetPlayerData() PlayerData
Returns the current player data.
func (*Manager) HasPlayerData ¶
Returns true if the Manager has valid player data.
func (*Manager) MergeStartupModSettings ¶ added in v0.8.0
func (m *Manager) MergeStartupModSettings(input PropertyTree) error
func (*Manager) SetPlayerData ¶
func (m *Manager) SetPlayerData(playerData PlayerData)
Sets the player data used for downloading mods. The player data will be automatically retrieved from the game directory if it is available.
type Mod ¶
func (*Mod) GetLatestRelease ¶
func (*Mod) GetMatchingRelease ¶
func (m *Mod) GetMatchingRelease(dep *Dependency) *Release
func (*Mod) GetRelease ¶
type ModIdent ¶
A small representation of a mod, with an optional version.
func NewModIdent ¶
Returns a ModIdent parsed from an input string with the format of 'name', 'name_version', or 'name_version.zip'.
func ParseLogFile ¶
Returns a slice of mod names extracted from a list of mod checksums in the given log file.
type ModInitUploadRes ¶
type ModListJson ¶
type ModListJson struct {
Mods []ModListJsonMod `json:"mods"`
}
func ParseModListJson ¶
func ParseModListJson(path string) (*ModListJson, error)
type ModListJsonMod ¶
type ModPortal ¶
type ModPortal struct {
// contains filtered or unexported fields
}
func (*ModPortal) DownloadLatestRelease ¶
DownloadLatestRelease downloads the latest release compatible with the current base version.
func (*ModPortal) DownloadMatchingRelease ¶
func (p *ModPortal) DownloadMatchingRelease(dep *Dependency) (string, error)
DownloadMatchingRelease downloads the latest mod release matching the given dependency. Returns the filepath of the newly downloaded mod.
func (*ModPortal) DownloadRelease ¶
func (*ModPortal) GetMatchingRelease ¶
func (p *ModPortal) GetMatchingRelease(dep *Dependency) (*PortalModRelease, error)
GetMatchingRelease fetches information for the newest release matching the given dependency.
func (*ModPortal) GetModInfo ¶
func (p *ModPortal) GetModInfo(name string) (*PortalModInfo, error)
GetModInfo fetches information for the given mod from the mod portal.
type ModSettings ¶ added in v0.8.0
type ModSettings struct { MapVersion Version Settings PropertyTree }
type PlayerData ¶
type PortalModInfo ¶
type PortalModInfo struct { Name string Releases []PortalModRelease Title string }
type PortalModRelease ¶
type PropertyTree ¶ added in v0.8.0
type PropertyTree interface {
// contains filtered or unexported methods
}
type PropertyTreeBool ¶ added in v0.8.0
type PropertyTreeBool bool
type PropertyTreeDict ¶ added in v0.8.0
type PropertyTreeDict map[string]PropertyTree
type PropertyTreeList ¶ added in v0.8.0
type PropertyTreeList []PropertyTree
type PropertyTreeNone ¶ added in v0.8.0
type PropertyTreeNone struct{}
type PropertyTreeNumber ¶ added in v0.8.0
type PropertyTreeNumber float64
type PropertyTreeSignedInteger ¶ added in v0.8.0
type PropertyTreeSignedInteger int64
type PropertyTreeString ¶ added in v0.8.0
type PropertyTreeString string
type PropertyTreeUnsignedInteger ¶ added in v0.8.0
type PropertyTreeUnsignedInteger uint64
type Release ¶
type Release struct { Name string Dependencies []*Dependency Path string Version Version }
type SaveFileInfo ¶ added in v0.8.0
type SaveFileInfo struct { Mods []ModIdent ModSettings PropertyTree }
func ParseSaveFile ¶
func ParseSaveFile(filepath string) (SaveFileInfo, error)
Returns a slice of mod names and versions extracted from the given save file.
type Version ¶
type Version [4]uint16
func NewVersion ¶
func (*Version) Cmp ¶
func (v *Version) Cmp(other *Version) VersionCmpRes
func (*Version) MarshalJSON ¶
func (*Version) UnmarshalJSON ¶
type VersionCmpRes ¶
type VersionCmpRes uint8
const ( VersionAny VersionCmpRes = iota VersionEq VersionGt VersionGtEq VersionLt VersionLtEq )