ifaces

package
v0.0.0-...-19ad383 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2021 License: BSD-3-Clause Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ServerOffline           = 0
	ServerOnline            = 1
	ServerStarting          = 2
	ServerStopping          = 3
	ServerRestarting        = 4
	ServerCrashedOffline    = 255
	ServerCrashedRecovered  = 256
	ServerCrashedStarting   = 257
	ServerCrashedStopping   = 258
	ServerCrashedRestarting = 259

	ServerOfflineColor           = 16711680
	ServerOnlineColor            = 6749952
	ServerStartingColor          = 3381759
	ServerStoppingColor          = 16776960
	ServerRestartingColor        = 3381759
	ServerCrashedOfflineColor    = 15158332
	ServerCrashedRecoveredColor  = 15158332
	ServerCrashedStartingColor   = 15158332
	ServerCrashedStoppingColor   = 15158332
	ServerCrashedRestartingColor = 15158332

	ServerOfflineString           = "Offline"
	ServerOnlineString            = "Online"
	ServerStartingString          = "Initializing"
	ServerStoppingString          = "Stopping"
	ServerRestartingString        = "Re-Initializing"
	ServerCrashedOfflineString    = "Crashed (Dead)"
	ServerCrashedRecoveredString  = "Crashed (Recovered)"
	ServerCrashedStartingString   = "Crashed (Recovering)"
	ServerCrashedStoppingString   = "Crashed (Attempting Graceful Exit)"
	ServerCrashedRestartingString = "Crashed (Restarting)"

	CommandSuccess = 0
	CommandFailure = 1
	CommandWarning = 2
)

enums describing the status of a server

Variables

This section is empty.

Functions

func Difficulty

func Difficulty(d int) string

Difficulty returns the difficulty string for a given int

func State

func State(s int) (string, int)

State returns the matching state string and color for a given server state

Types

type ChatData

type ChatData struct {
	Name string
	UID  string
	Msg  string
}

ChatData describes datapassed between Discord and the Server

type IAlliance

type IAlliance interface {
	ITrackedAlliance
	IHaveShips
}

IAlliance describes a an IServer player alliance

type IAuthConfigurator

type IAuthConfigurator interface {
	AddRoleAuth(string, int) error
	RemoveRoleAuth(string) error
	GetRoleAuth(string) int

	AddCmndAuth(string, int)
	GetCmndAuth(string) int
	RemoveCmndAuth(string) error
}

IAuthConfigurator describes an interface to an authorization object

type IBotChatter

type IBotChatter interface {
	SetChatPipe(chan ChatData)
	ChatPipe() chan ChatData
}

IBotChatter describes an interface to a bot that can chat

type IBotMentioner

type IBotMentioner interface {
	Mention() string
}

IBotMentioner describes an interface to a Bot that can provide a

Discord mention string (@Username#Descriminator)

type IBotStarter

type IBotStarter interface {
	Start(IGameServer)
}

IBotStarter describes a bot that can start

type IChatConfigurator

type IChatConfigurator interface {
	ChatPipe() chan ChatData
	SetChatChannel(string) chan ChatData
	ChatChannel() string
	ReactConfirm() bool
}

IChatConfigurator describes an interface to an object that can configure chats

type ICommandConfigurator

type ICommandConfigurator interface {
	DisableCommand(string) error
	CommandDisabled(string) bool

	SetAliasCommand(string, string) error
	GetAliasedCommand(string) (bool, string)
	CommandAliases(string) (bool, []string)

	SetPrefix(string)
	Prefix() string

	SetToken(string)
	Token() string
}

ICommandConfigurator describes an interface to an object that can configure

bot commands

type ICommandableServer

type ICommandableServer interface {
	RunCommand(string) (string, error)
}

ICommandableServer describes an interface to an IGameServer that can have run

game commands

type IConfigSaveLoader

type IConfigSaveLoader interface {
	LoadConfiguration() error
	SaveConfiguration() error
}

IConfigSaveLoader describes an interface to a an object that saves and loads configuration

type IDatabaseConfigurator

type IDatabaseConfigurator interface {
	DBName() string
}

IDatabaseConfigurator describes an interface to a db configurator

type IDiscordBot

type IDiscordBot interface {
	IBotMentioner
	IBotChatter
	IBotStarter
}

IDiscordBot describes an interface to a discord bot

type IDiscordConfigurator

type IDiscordConfigurator interface {
	Token() string

	BotsAllowed() bool
	DiscordLink() string
	SetDiscordLink(string)
	SetBotsAllowed(bool)
	StatusChannel() (string, bool)
	SetStatusChannel(string)
	StatusChannelClear() bool
}

IDiscordConfigurator describes an interface that describes Discord configurations

type IDiscordIntegratedPlayer

type IDiscordIntegratedPlayer interface {
	DiscordUID() string
	SetDiscordUID(string)
}

IDiscordIntegratedPlayer describes an interface to a player that has

Discord integration

type IDiscordIntegratedServer

type IDiscordIntegratedServer interface {
	AddIntegrationRequest(string, string)
	ValidateIntegrationPin(string, string) bool
	SendChat(ChatData)
	SendLog(ChatData)
}

IDiscordIntegratedServer describes an IGameServer that is capable of integrating

with Discord

type IEventConfigurator

type IEventConfigurator interface {
	GetEvents() []*LoggedServerEvent
	LogPipe() chan ChatData
	SetLogChannel(string) chan ChatData
	LogChannel() string
}

IEventConfigurator describes a configuration object that has LoggedServerEvents

type IGalaxyConfigurator

type IGalaxyConfigurator interface {
	SetGalaxy(string)
	Galaxy() string
}

IGalaxyConfigurator describes an interface to an object that can configure a

galaxy

type IGalaxyServer

type IGalaxyServer interface {
	Sector(int, int) *Sector
}

IGalaxyServer describes an interface to a server with a sectored galaxy

type IGameConfigurator

type IGameConfigurator interface {
	RCONBin() string
	RCONPort() int
	DataPath() string
	RCONAddr() string
	RCONPass() string
	InstallPath() string
	LoadGameConfig() error
	GameConfig() (*ServerGameConfig, bool)
	PostUpCommand() string
	PostDownCommand() string
	HangTimeDuration() time.Duration
	DBUpdateTimeDuration() time.Duration
}

IGameConfigurator describes an interface to a games configuration

type IGameServer

IGameServer describes an interface to a server with full capability

type IHaveShips

type IHaveShips interface {
	Name() string
	GetLastJumps(int) []ShipCoordData
	SetJumpHistory([]ShipCoordData)
}

IHaveShips describes an object that is capable of returning jumphistory of ships

type ILockableServer

type ILockableServer interface {
	Password() string
	SetPassword(string)
}

ILockableServer describes an interface to lock a server with a password

type IMOTDServer

type IMOTDServer interface {
	MOTD() string
	SetMOTD(string)
}

IMOTDServer describes an interface to a server that can set an MOTD

type IModConfigurator

type IModConfigurator interface {
	BuildModConfig() error
	AddServerMod(int64) error
	RemoveServerMod(int64) error
	AddClientMod(int64) error
	RemoveClientMod(int64) error
	ListServerMods() []int64
	ListClientMods() []int64
}

IModConfigurator describes an interface to a modconfig builder

type IModeratablePlayer

type IModeratablePlayer interface {
	Kick(string)
	Ban(string)
}

IModeratablePlayer describes an interface to a player that can be

be moderated

type INetPlayer

type INetPlayer interface {
	IP() net.IP
	SetIP(string)

	Online() bool
	SetOnline(bool)
}

INetPlayer describes a an interface to a player that can connect

over the internet

type IPlayableServer

type IPlayableServer interface {
	Players() []IPlayer
	RemovePlayer(string)
	NewPlayer(string, []string) IPlayer

	Player(string) IPlayer
	PlayerFromName(string) IPlayer
	PlayerFromDiscord(string) IPlayer

	Alliance(string) IAlliance
	AllianceFromName(string) IAlliance
	Alliances() []IAlliance
	NewAlliance(string, []string) IAlliance

	AddPlayerOnline()
	SubPlayerOnline()
}

IPlayableServer defines an object that can track the players that have joined

type IPlayer

IPlayer describes a an IGameServer player

type ISeededServer

type ISeededServer interface {
	Seed() string
	SetSeed(string)
}

ISeededServer is an interface to an object that has a seed

type IServer

type IServer interface {
	IsUp() bool
	Stop(bool) error
	Start(bool) error
	Restart() error
	Config() IConfigurator
	Status() ServerStatus
	CompareStatus(ServerStatus, ServerStatus) bool
	InitializeEvents()
	IsCrashed() bool
	Crashed()

	logger.ILogger
}

IServer defines an interface to a Gameserver that we can change the status

of and log

type ISteamPlayer

type ISteamPlayer interface {
	SteamUID() int64
}

ISteamPlayer describes an interface to a player that has a SteamID

type ITimeConfigurator

type ITimeConfigurator interface {
	TimeZone() string
	SetTimeZone(string) error
}

ITimeConfigurator describes an interface to the configured timezone

type ITrackedAlliance

type ITrackedAlliance interface {
	logger.ILogger
	Name() string
	Index() string
	Message(string)
	AddJump(ShipCoordData)

	Update() error
	UpdateFromData([13]string) error
}

ITrackedAlliance defines an interface to an an alliance that has tracking

type ITrackedPlayer

type ITrackedPlayer interface {
	logger.ILogger
	IHaveShips
	Index() string
	Message(string)
	AddJump(ShipCoordData)

	Update() error
	UpdateFromData([15]string) error
}

ITrackedPlayer defines an interface to an a player that has tracking

type IVersionedServer

type IVersionedServer interface {
	Version() string
	SetVersion(string)
}

IVersionedServer describes an interface to an IGameserver's version information

type JumpInfo

type JumpInfo struct {
	// Jump *ShipCoordData
	Time time.Time
	Name string
	Kind string
	FID  int
	X    int
	Y    int
}

JumpInfo describes a ship jump

type LoggedServerEvent

type LoggedServerEvent struct {
	Name    string
	FString string
	Regex   *regexp.Regexp
}

LoggedServerEvent describes an event that can be tracked and logged

type Sector

type Sector struct {
	Index int64
	X     int
	Y     int

	Jumphistory []*JumpInfo
}

Sector defines a sector in an Avorion galaxy

type ServerGameConfig

type ServerGameConfig struct {
	PVP                 bool
	Name                string
	Collision           string
	Seed                string
	Steam               bool
	Version             string
	Difficulty          int
	BlockLimit          int64
	VolumeLimit         int64
	MaxPlayerShips      int64
	MaxPlayerSlots      int64
	MaxPlayerStations   int64
	MaxAllianceSlots    int64
	MaxAllianceShips    int64
	MaxAllianceStations int64
}

ServerGameConfig describes an object that contains the current

game configuration

type ServerStatus

type ServerStatus struct {
	Name    string
	Output  string
	Players string

	Status        int
	TotalPlayers  int
	PlayersOnline int
	Alliances     int
	Sectors       int

	INI *ServerGameConfig
}

ServerStatus is a struct that describes the current status of an

AvorionServer

type ShipCoordData

type ShipCoordData struct {
	X    int
	Y    int
	Name string
	Time time.Time
}

ShipCoordData describes a set of coords for a ship

Jump to

Keyboard shortcuts

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