games

package
v0.22.1 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2023 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddGame

func AddGame(g Game)

AddGame adds a game to the list this triggers the list to be written to disk as well

func GameCount

func GameCount() int

GameCount returns the number of games available

func InformChangeListeners added in v0.5.0

func InformChangeListeners()

InformChangeListeners triggers the given function for each registered listener

func MaxModCount

func MaxModCount() int

MaxModCount returns the biggest number of mods for a single game this is useful for table creation, to know how many colums one needs

func Persist

func Persist() error

Persist writes all games into the according JSON file

func RegisterChangeListener

func RegisterChangeListener(f func())

RegisterChangeListener takes functions, that should get executed once configuration change

func RemoveGameAt

func RemoveGameAt(i int)

RemoveGameAt removes the game at the given index

func SortAlph added in v0.7.0

func SortAlph()

SortAlph sorts games alphabetically

Types

type Game

type Game struct {
	Name             string         `json:"name"`
	Port             string         `json:"source_port"`
	Iwad             string         `json:"iwad"`
	Environment      []string       `json:"environment"`
	Mods             []string       `json:"mods"`
	CustomParameters []string       `json:"custom_parameters"`
	ConsoleStats     map[string]int `json:"stats"`
	Playtime         int64          `json:"playtime"`
	LastPlayed       string         `json:"last_played"`
	SaveGameCount    int            `json:"save_game_count"`
	Rating           int            `json:"rating"`
	AddEdit          time.Time      `json:"added"`
	Link             string         `json:"link"`
	PersonalPortCfg  bool           `json:"own_source_port_cfg"`
	SharedConfig     string         `json:"shared_config"`
	Stats            []st.MapStats
	StatsTotal       st.MapStats
	Savegames        []*st.Savegame
}

Game represents one game configuration

func NewGame

func NewGame(name, sourceport, sharedConfig, iwad string) Game

NewGame creates new instance of a game

func (*Game) AddMod

func (g *Game) AddMod(modFile string)

AddMod adds mod

func (*Game) CommandList added in v0.7.0

func (g *Game) CommandList() (command []string)

CommandList returns the full slice of strings in order to launch the game

func (*Game) DemoCount added in v0.8.0

func (g *Game) DemoCount() int

DemoCount returns the number of demos existing for this game

func (*Game) DemoExists added in v0.8.0

func (g *Game) DemoExists(name string) bool

DemoExists checks if a file with the same name already exists in the default demo dir Doesn't use standard library to ignore file ending; design decision

func (*Game) Demos added in v0.8.0

func (g *Game) Demos() ([]os.DirEntry, error)

Demos returns the demo files existing for the game

func (*Game) EnvironmentString added in v0.5.0

func (g *Game) EnvironmentString() string

EnvironmentString returns a join of all prefix parameters

func (*Game) GetSaveMeta added in v0.15.0

func (g *Game) GetSaveMeta(savePath string) st.SaveMeta

GetSaveMeta reads meta information for the given savegame

func (*Game) GetStats added in v0.15.0

func (g *Game) GetStats(savePath string) []st.MapStats

GetStats reads stats from the given savegame path for zdoom ports If the port is boom or chocolate, their respective dump-files are used

func (*Game) GoToMap added in v0.19.0

func (g *Game) GoToMap(mapName string, skill int) (err error)

GoToMap lets you select a specific map from a mod based on it's name Just a wrapper for game.run

func (*Game) GoToMapRecord added in v0.19.0

func (g *Game) GoToMapRecord(mapName string, skill int, demoName string) (err error)

GoToMapRecord lets you select a specific map from a mod based on it's name Just a wrapper for game.run

func (*Game) LoadSavegames added in v0.15.0

func (g *Game) LoadSavegames() []*st.Savegame

LoadSavegames returns a slice of Savegames for the game

func (Game) ModMaps added in v0.18.0

func (g Game) ModMaps() map[string]string

func (*Game) ParamsString added in v0.5.0

func (g *Game) ParamsString() string

ParamsString returns a join of all custom parameters

func (*Game) PlayDemo added in v0.8.0

func (g *Game) PlayDemo(name string)

PlayDemo replays the given demo file Wrapper for game.run

func (*Game) Quickload added in v0.7.0

func (g *Game) Quickload() (err error)

Quickload starts the game from it's last savegame Just a wrapper for game.run

func (*Game) Rate added in v0.7.0

func (g *Game) Rate(increment int)

Rate increases or decreases the games rating

func (*Game) RatingString added in v0.7.0

func (g *Game) RatingString() string

RatingString returns the string resulting from the games rating

func (*Game) ReadLatestStats added in v0.15.0

func (g *Game) ReadLatestStats()

ReadLatestStats tries to read stats from the newest existing savegame

func (*Game) RemoveDemo added in v0.8.0

func (g *Game) RemoveDemo(name string) ([]os.DirEntry, error)

RemoveDemo removes the demo file with the given name and returns the new set of demos

func (*Game) RemoveMod added in v0.7.0

func (g *Game) RemoveMod(i int)

RemoveMod removes mod at the given index

func (*Game) Run

func (g *Game) Run() (err error)

Run executes given configuration and launches the mod Just a wrapper for game.run

func (*Game) SaveCount added in v0.2.1

func (g *Game) SaveCount() int

SaveCount returns the number of savegames existing for this game

func (*Game) SwitchMods added in v0.7.0

func (g *Game) SwitchMods(a, b int)

SwitchMods switches both entries within the mod slice

func (*Game) Warp added in v0.7.0

func (g *Game) Warp(episode, level, skill int) (err error)

Warp lets you select episode and level to start in Just a wrapper for game.run

func (*Game) WarpRecord added in v0.8.0

func (g *Game) WarpRecord(episode, level, skill int, demoName string) (err error)

WarpRecord lets you select episode and level to start in Just a wrapper for game.run

type GameList

type GameList []Game

GameList holds all the games configured

func Games added in v0.18.0

func Games() GameList

Games sets up and returns the singleton instance of games

Jump to

Keyboard shortcuts

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