Documentation ¶
Index ¶
- Variables
- type DatReader
- func (d *DatReader) Advance(offset int64)
- func (d *DatReader) ReadBool() bool
- func (d *DatReader) ReadModWithCRC() ModIdent
- func (d *DatReader) ReadOptimizedVersion(withBuild bool) Version
- func (d *DatReader) ReadString() string
- func (d *DatReader) ReadUint16() uint16
- func (d *DatReader) ReadUint16Optimized() uint16
- func (d *DatReader) ReadUint32() uint32
- func (d *DatReader) ReadUint8() uint8
- func (d *DatReader) ReadUnoptimizedVersion() Version
- type Dependency
- type DependencyKind
- type Manager
- func (m *Manager) Add(mod ModIdent) (*Version, error)
- 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) 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) 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 PlayerData
- type PortalModInfo
- type PortalModRelease
- type Release
- 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) ReadModWithCRC ¶
func (*DatReader) ReadOptimizedVersion ¶
func (*DatReader) ReadString ¶
func (*DatReader) ReadUint16 ¶
func (*DatReader) ReadUint16Optimized ¶
func (*DatReader) ReadUint32 ¶
func (*DatReader) ReadUnoptimizedVersion ¶
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) 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) 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) 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.
func ParseSaveFile ¶
Returns a slice of mod names and versions extracted from the given save 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 PlayerData ¶
type PortalModInfo ¶
type PortalModInfo struct { Name string Releases []PortalModRelease Title string }
type PortalModRelease ¶
type Release ¶
type Release struct { Name string Dependencies []*Dependency Path string Version Version }
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 )