modmgr

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2026 License: GPL-3.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const InstallationInfoFileName = ".mod_installation"

Variables

This section is empty.

Functions

func DownloadMods added in v1.1.0

func DownloadMods(cacheDir string, modVersions []ModVersion, binaryType aumgr.BinaryType, progress progress.Progress, force bool) error

func PrepareProfileDirectory added in v1.1.0

func PrepareProfileDirectory(profileDir string, cacheDir string, modVersions []ModVersion, binaryType aumgr.BinaryType, gameVersion string, force bool) error

PrepareProfileDirectory installs mods from cache to the profile directory and generates doorstop_config.ini.

func ResolveDependencies added in v1.1.0

func ResolveDependencies(initialMods []ModVersion, provider VersionProvider) (map[string]ModVersion, error)

ResolveDependencies recursively finds all required dependencies for a given set of mod versions. It returns a map of ModID to ModVersion containing all original mods and their required dependencies.

func RestoreGame added in v1.1.0

func RestoreGame(gameDir string, restoreInfo *RestoreInfo) error

func SaveInstallationInfo

func SaveInstallationInfo(gameRoot *os.Root, installation *ModInstallation) error

func UninstallMod

func UninstallMod(modInstallLocation *os.Root, progress progress.Progress, remainMods []ModVersion) error

Types

type FileType

type FileType string
const (
	FileTypeZip    FileType = "zip"
	FileTypeNormal FileType = "normal"
	FileTypePlugin FileType = "plugin"
)

type InstallStatus

type InstallStatus string
const (
	InstallStatusCompatible   InstallStatus = "compatible"
	InstallStatusIncompatible InstallStatus = "incompatible"
	InstallStatusBroken       InstallStatus = "broken"
	InstallStatusUnknown      InstallStatus = "unknown"
)

type InstalledVersionInfo added in v1.1.0

type InstalledVersionInfo struct {
	ModVersion `json:",inline"`
	Paths      []string `json:"paths"`
}

func UninstallRemainingMods

func UninstallRemainingMods(modInstallLocation *os.Root, progress progress.Progress, remainMods []ModVersion) ([]InstalledVersionInfo, error)

type Mod

type Mod struct {
	ID        string    `json:"id"`                  // Mod unique ID
	Type      ModType   `json:"type,omitempty"`      // Mod type
	Name      string    `json:"name"`                // Mod name
	Author    string    `json:"author"`              // Author name
	Thumbnail string    `json:"thumbnail,omitempty"` // URL to thumbnail image (optional)
	Website   string    `json:"website,omitempty"`   // Mod website URL (optional)
	CreatedAt time.Time `json:"created_at"`          // Creation timestamp
	UpdatedAt time.Time `json:"updated_at"`          // Last update timestamp

	LatestVersion string `json:"latest_version,omitempty"` // Latest version ID (optional)
	Description   string `json:"description,omitempty"`    // Mod description
}

type ModDependency

type ModDependency struct {
	ID      string            `json:"id"`
	Version string            `json:"version,omitempty"`
	Type    ModDependencyType `json:"type"`
}

type ModDependencyType

type ModDependencyType string
const (
	ModDependencyTypeRequired ModDependencyType = "required"
	ModDependencyTypeOptional ModDependencyType = "optional"
	ModDependencyTypeConflict ModDependencyType = "conflict"
	ModDependencyTypeEmbedded ModDependencyType = "embedded"
)

type ModFile

type ModFile struct {
	Compatible []aumgr.BinaryType `json:"compatible"`
	FileType   FileType           `json:"file_type"`
	// When FileType is Normal or Plugin, Path is used.
	Path string `json:"path,omitempty"`
	URL  string `json:"url"`
}

type ModInstallation deprecated

type ModInstallation struct {
	FileVersion          int                    `json:"file_version"`
	InstalledMods        []InstalledVersionInfo `json:"installed_mods"`
	InstalledGameVersion string                 `json:"installed_game_version"`
	Status               InstallStatus          `json:"status"`
	// contains filtered or unexported fields
}

Deprecated: Should use profile.Profile to track installed mods instead.

func InstallMod

func InstallMod(modInstallLocation *os.Root, gameVersion string, launcherType aumgr.LauncherType, binaryType aumgr.BinaryType, modVersions []ModVersion, progress progress.Progress) (*ModInstallation, error)

func LoadInstallationInfo

func LoadInstallationInfo(modInstallLocation *os.Root) (*ModInstallation, error)

func (*ModInstallation) MarshalJSON

func (mi *ModInstallation) MarshalJSON() ([]byte, error)

func (*ModInstallation) OldVanillaFiles

func (mi *ModInstallation) OldVanillaFiles() []string

For file versions 0 and 1, return the list of vanilla files stored in the installation data.

func (*ModInstallation) UnmarshalJSON

func (mi *ModInstallation) UnmarshalJSON(data []byte) error

type ModPack deprecated

type ModPack struct {
	ID      string `json:"id"`
	Version string `json:"version,omitempty"`
}

Deprecated: use profile.Profile to represent mod packs now

type ModType

type ModType string
const (
	ModTypeMod     ModType = "mod"
	ModTypeLibrary ModType = "library"
	// Deprecated: should not be used anymore
	// ModPack will be represented as profile.Profile now
	ModTypeModPack ModType = "modpack"
)

func (ModType) IsVisible

func (mt ModType) IsVisible() bool

type ModVersion

type ModVersion struct {
	ID           string          `json:"id"`
	ModID        string          `json:"mod_id"`
	CreatedAt    time.Time       `json:"created_at"`
	Dependencies []ModDependency `json:"dependencies,omitempty"`
	Files        []ModFile       `json:"files,omitempty"`
	GameVersions []string        `json:"game_versions,omitempty"`

	// Deprecated: use profile.Profile to represent mod packs now
	Mods []ModPack `json:"mods,omitempty"`
}

func (ModVersion) CompatibleFilesCount

func (m ModVersion) CompatibleFilesCount(binaryType aumgr.BinaryType) int

func (ModVersion) Downloads

func (m ModVersion) Downloads(binaryType aumgr.BinaryType) iter.Seq[ModFile]

func (ModVersion) IsCompatible

func (m ModVersion) IsCompatible(launcherType aumgr.LauncherType, binaryType aumgr.BinaryType, gameVersion string) bool

type ProfileMetadata added in v1.1.0

type ProfileMetadata struct {
	ModVersions []ModVersion     `json:"mod_versions"`
	GameVersion string           `json:"game_version"`
	BinaryType  aumgr.BinaryType `json:"binary_type"`
}

func GetProfileMetadata added in v1.1.0

func GetProfileMetadata(profileDir string) (*ProfileMetadata, error)

type ProgressWrapper

type ProgressWrapper struct {
	// contains filtered or unexported fields
}

func (*ProgressWrapper) Write

func (pw *ProgressWrapper) Write(data []byte) (n int, err error)

type ProgressWriter

type ProgressWriter struct {
	// contains filtered or unexported fields
}

func (*ProgressWriter) Write

func (pw *ProgressWriter) Write(data []byte) (n int, err error)

type RestoreInfo added in v1.1.0

type RestoreInfo struct {
	BackupDir string            `json:"backup_dir"`
	Added     []string          `json:"added"`
	Moved     map[string]string `json:"moved"` // Original Path -> Backup Path
}

func ApplyMods added in v1.1.0

func ApplyMods(gameDir string, cacheDir string, modVersions []ModVersion, binaryType aumgr.BinaryType) (*RestoreInfo, error)

type VersionProvider added in v1.1.0

type VersionProvider interface {
	GetModVersion(modID string, versionID string) (*ModVersion, error)
	GetLatestModVersion(modID string) (*ModVersion, error)
}

VersionProvider is an interface to fetch mod version details.

Jump to

Keyboard shortcuts

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