avorion

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: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(c ifaces.IConfigurator, wg *sync.WaitGroup, exit chan struct{},
	args ...string) ifaces.IGameServer

New returns a new object of type Server

Types

type Alliance

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

Alliance defines a player alliance in Avorion

func (*Alliance) AddJump

func (a *Alliance) AddJump(sc ifaces.ShipCoordData)

AddJump registers a jump that a player took into a system

func (*Alliance) GetLastJumps

func (a *Alliance) GetLastJumps(limit int) []ifaces.ShipCoordData

GetLastJumps returns up to (max) jumps that this player has performed recently TODO: This should return both the jumps and how many were found

func (*Alliance) Index

func (a *Alliance) Index() string

Index returns the faction index of an alliance

func (*Alliance) Loglevel

func (a *Alliance) Loglevel() int

Loglevel returns the loglevel of an alliance

func (*Alliance) Message

func (a *Alliance) Message(string)

Message sends an in-game message to all members of an alliance

func (*Alliance) Name

func (a *Alliance) Name() string

Name returns the name of the Alliance

func (*Alliance) SetJumpHistory

func (a *Alliance) SetJumpHistory([]ifaces.ShipCoordData)

SetJumpHistory sets the jump history for an alliance

func (*Alliance) SetLoglevel

func (a *Alliance) SetLoglevel(l int)

SetLoglevel sets the loglevel of an alliance

func (*Alliance) UUID

func (a *Alliance) UUID() string

UUID returns the UUID of an alliance

func (*Alliance) Update

func (a *Alliance) Update() error

Update updates the Alliance internal data

func (*Alliance) UpdateFromData

func (a *Alliance) UpdateFromData(d [13]string) error

UpdateFromData updates the alliances information using the data from

a successful reAllianceData match

type Player

type Player struct {
	ifaces.IPlayer
	// contains filtered or unexported fields
}

Player is a player that has connected to the server at some point, and has data present in the game db

func (*Player) AddJump

func (p *Player) AddJump(sc ifaces.ShipCoordData)

AddJump registers a jump that a player took into a system

func (*Player) Ban

func (p *Player) Ban(r string)

Ban bans the player

func (*Player) DiscordUID

func (p *Player) DiscordUID() string

DiscordUID returns a players Discord ID

func (*Player) GetLastJumps

func (p *Player) GetLastJumps(limit int) []ifaces.ShipCoordData

GetLastJumps returns up to (max) jumps that this player has performed recently

TODO: This should return both the jumps and how many were found so that we can avoid an extra len call later

func (*Player) IP

func (p *Player) IP() net.IP

IP returns the IP address that the player used to connect this session

func (*Player) Index

func (p *Player) Index() string

Index returns the players in-game index

func (*Player) Kick

func (p *Player) Kick(r string)

Kick kicks the player

func (*Player) Loglevel

func (p *Player) Loglevel() int

Loglevel returns the loglevel of a player

func (*Player) Message

func (p *Player) Message(string)

Message messages a player

func (*Player) Name

func (p *Player) Name() string

Name returns the name of the player

func (*Player) Online

func (p *Player) Online() bool

Online returns the current online status of the player

func (*Player) SetDiscordUID

func (p *Player) SetDiscordUID(uid string)

SetDiscordUID sets a players Discord ID

func (*Player) SetIP

func (p *Player) SetIP(ips string)

SetIP sets or updates a players IP address

func (*Player) SetJumpHistory

func (p *Player) SetJumpHistory([]ifaces.ShipCoordData)

SetJumpHistory sets the jump history for a player

func (*Player) SetLoglevel

func (p *Player) SetLoglevel(l int)

SetLoglevel sets the loglevel of a player

func (*Player) SetOnline

func (p *Player) SetOnline(o bool)

SetOnline updates the player status to the boolean passed

func (*Player) Steam64

func (p *Player) Steam64() int64

Steam64 returns the players steam64 ID

func (*Player) SteamUID

func (p *Player) SteamUID() int64

SteamUID returns the steamUID or 0 of the player TODO: Modify this function, as well as the GameDB to store this data in the sqlite database

func (*Player) UUID

func (p *Player) UUID() string

UUID returns the UUID of a player

func (*Player) Update

func (p *Player) Update() error

Update gathers playerdata from the server and updates our cache

func (*Player) UpdateFromData

func (p *Player) UpdateFromData(d [15]string) error

UpdateFromData updates the players information using the data from

a successful rePlayerData match

type RunState

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

RunState describes the current state of commands being run

type Server

type Server struct {
	ifaces.IGameServer

	// Execution variables
	Cmd *exec.Cmd
	// contains filtered or unexported fields
}

Server - Avorion server definition

func (*Server) AddIntegrationRequest

func (s *Server) AddIntegrationRequest(index, pin string)

AddIntegrationRequest registers a request by a player for Discord integration TODO: Move this to our sqlite DB

func (*Server) AddPlayerOnline

func (s *Server) AddPlayerOnline()

AddPlayerOnline increments the count of online players

func (*Server) Alliance

func (s *Server) Alliance(index string) ifaces.IAlliance

Alliance returns a reference to the given alliance

func (*Server) AllianceFromName

func (s *Server) AllianceFromName(name string) ifaces.IAlliance

AllianceFromName returns an alliance object that matches the name given

func (*Server) Alliances

func (s *Server) Alliances() []ifaces.IAlliance

Alliances returns a slice of all of the alliances that are currently known

func (*Server) CompareStatus

func (s *Server) CompareStatus(a, b ifaces.ServerStatus) bool

CompareStatus takes two ifaces.ServerStatus arguments and compares

them. If they are equivalent, then return true. Else, false.

func (*Server) Config

func (s *Server) Config() ifaces.IConfigurator

Config returns the server configuration struct

func (*Server) Crashed

func (s *Server) Crashed()

Crashed sets the server status to crashed

func (*Server) InitializeEvents

func (s *Server) InitializeEvents()

InitializeEvents runs the event initializer

func (*Server) IsCrashed

func (s *Server) IsCrashed() bool

IsCrashed returns the current crash status of the server

func (*Server) IsUp

func (s *Server) IsUp() bool

IsUp checks whether or not the game process is running

func (*Server) Loglevel

func (s *Server) Loglevel() int

Loglevel returns the loglevel of an avorion.Server

func (*Server) MOTD

func (s *Server) MOTD() string

MOTD - Return the current MOTD

func (*Server) NewAlliance

func (s *Server) NewAlliance(index string, d []string) ifaces.IAlliance

NewAlliance adds a new alliance to the list of alliances if it isn't already

present

func (*Server) NewPlayer

func (s *Server) NewPlayer(index string, d []string) ifaces.IPlayer

NewPlayer adds a new player to the list of players if it isn't already present

func (*Server) NotifyServer

func (s *Server) NotifyServer(in string) error

NotifyServer sends an ingame notification

func (*Server) Password

func (s *Server) Password() string

Password - Return the current password

func (*Server) Player

func (s *Server) Player(plrstr string) ifaces.IPlayer

Player return a player object that matches the index given

func (*Server) PlayerFromDiscord

func (s *Server) PlayerFromDiscord(name string) ifaces.IPlayer

PlayerFromDiscord return a player object that has been assigned the given

Discord user

TODO: Complete this stub

func (*Server) PlayerFromName

func (s *Server) PlayerFromName(name string) ifaces.IPlayer

PlayerFromName return a player object that matches the name given

func (*Server) Players

func (s *Server) Players() []ifaces.IPlayer

Players returns a slice of all of the players that are known

func (*Server) Recovered

func (s *Server) Recovered()

Recovered sets the server status to be normal (from crashed)

func (*Server) RemovePlayer

func (s *Server) RemovePlayer(n string)

RemovePlayer removes a player from the list of online players TODO: This function is currently a stub and needs to be made functional once more.

func (*Server) Restart

func (s *Server) Restart() error

Restart restarts the Avorion server

func (*Server) RunCommand

func (s *Server) RunCommand(c string) (string, error)

RunCommand runs a command via rcon and returns the output

TODO 1: Modify this to use the games rcon websocket interface or an rcon lib
TODO 2: Modify this function to make use of permitted command levels

func (*Server) Sector

func (s *Server) Sector(x, y int) *ifaces.Sector

Sector returns a pointer to a sector object (new or prexisting)

func (*Server) Seed

func (s *Server) Seed() string

Seed - Return the current game seed

func (*Server) SendChat

func (s *Server) SendChat(input ifaces.ChatData)

SendChat sends an ifaces.ChatData object to the discord bot if chatting is

currently enabled in the configuration

func (*Server) SendLog

func (s *Server) SendLog(input ifaces.ChatData)

SendLog sends an ifaces.ChatData object to the discord bot if logging is

currently enabled in the configuration

func (*Server) SetLoglevel

func (s *Server) SetLoglevel(l int)

SetLoglevel sets the loglevel of an avorion.Server

func (*Server) SetMOTD

func (s *Server) SetMOTD(m string)

SetMOTD - Set the server MOTD

func (*Server) SetPassword

func (s *Server) SetPassword(p string)

SetPassword - Set the server password

func (*Server) SetSeed

func (s *Server) SetSeed(seed string)

SetSeed - Sets the seed stored in the *Server, *does not* change the games seed

func (*Server) SetVersion

func (s *Server) SetVersion(v string)

SetVersion - Sets the current version of the Avorion server

func (*Server) Start

func (s *Server) Start(sendchat bool) error

Start starts the Avorion server process

func (*Server) Status

func (s *Server) Status() ifaces.ServerStatus

Status returns a struct containing the current status of the server

func (*Server) Stop

func (s *Server) Stop(sendchat bool) error

Stop gracefully stops the Avorion process

func (*Server) SubPlayerOnline

func (s *Server) SubPlayerOnline()

SubPlayerOnline decrements the count of online players

func (*Server) UUID

func (s *Server) UUID() string

UUID returns the UUID of an avorion.Server

func (*Server) UpdatePlayerDatabase

func (s *Server) UpdatePlayerDatabase(notify bool) error

UpdatePlayerDatabase updates the Avorion player database with all of the players that are known to the game

FIXME: Fix this absolute mess of a method

func (*Server) ValidateIntegrationPin

func (s *Server) ValidateIntegrationPin(in, discordID string) bool

ValidateIntegrationPin confirms that a given pin was indeed a valid request

and registers the integration

func (*Server) Version

func (s *Server) Version() string

Version - Return the version of the Avorion server

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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