config

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2020 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ID = int(core.Qt__UserRole) + 1<<iota
	Location
	Instances
	OverrideBHCfg
	Flags
	HDVersion
	MaphackVersion
)

Model Roles.

View Source
const (
	// ModVersionNone is used to determine that no mod version has been chosen for a game.
	ModVersionNone = "none"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Game

type Game struct {
	core.QObject

	ID             string   `json:"id"`
	Location       string   `json:"location"`
	Instances      int      `json:"instances"`
	OverrideBHCfg  bool     `json:"override_bh_cfg"`
	Flags          []string `json:"flags"`
	HDVersion      string   `json:"hd_version"`
	MaphackVersion string   `json:"maphack_version"`
}

Game represents a diablo installation in the configuration.

type GameModel

type GameModel struct {
	core.QAbstractListModel
	// contains filtered or unexported fields
}

GameModel represents a Diablo game.

type GameMods

type GameMods struct {
	HD      []string `json:"hd"`
	Maphack []string `json:"maphack"`
}

GameMods represents the mods available for a Diablo II game.

type Service

type Service interface {
	// Read will read the configuration and return it.
	Read() (*storage.Config, error)

	// AddGame adds a new game to the game model.
	AddGame()

	// UpsertGame updates or creates a new game to the persistent store.
	UpsertGame(request UpdateGameRequest) error

	// DeleteGame will delete a game from the game model and the persistent store.
	DeleteGame(id string) error

	// PersistGameModel will persist the current game model to the persistent store.
	PersistGameModel() error

	// UpdateLaunchDelay will update the launch delay for  games in the persistent store.
	UpdateLaunchDelay(delay int) error

	// GetAvailableMods will fetch the game mode available to each D2 install.
	GetAvailableMods() (*GameMods, error)
}

Service is responsible for all things related to configuration.

func NewService

func NewService(
	slashdiabloClient slashdiablo.Client,
	store storage.Store,
	gameModel *GameModel,
) Service

NewService returns a service with all the dependencies.

type UpdateGameRequest

type UpdateGameRequest struct {
	ID             string   `json:"id"`
	Location       string   `json:"location"`
	Instances      int      `json:"instances"`
	OverrideBHCfg  bool     `json:"override_bh_cfg"`
	Flags          []string `json:"flags"`
	HDVersion      string   `json:"hd_version"`
	MaphackVersion string   `json:"maphack_version"`
}

UpdateGameRequest is the data used to update a game in the game model.

Jump to

Keyboard shortcuts

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