s10state

package module
v1.0.0-alpha.9 Latest Latest
Warning

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

Go to latest
Published: May 19, 2024 License: MIT Imports: 23 Imported by: 0

README

s10s-state

Release

export TAG=v1.0.x
git tag $TAG
git push && git push origin $TAG
GOPROXY=proxy.golang.org go list -m github.com/ruudiRatlos/s10s-state@$TAG

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type RouteItem

type RouteItem struct {
	From, To *api.Waypoint
	Dist     int
	Duration time.Duration
	FM       api.ShipNavFlightMode
	Refuel   bool
}

type State

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

func NewState

func NewState(l *slog.Logger, c *s10s.Client, dbPath string) *State

func (*State) Agent

func (s *State) Agent() *api.Agent

func (*State) AllConstructions

func (s *State) AllConstructions(ctx context.Context, sys s10s.SystemSymbol) ([]*api.Construction, error)

func (*State) AllConstructionsStatic

func (s *State) AllConstructionsStatic(systemSymbol string) ([]*api.Construction, error)

func (*State) AllJumpGates

func (s *State) AllJumpGates(ctx context.Context, sys s10s.SystemSymbol, incUnderConstruction bool) ([]*api.JumpGate, error)

AllJumpGates returns the /jump-gate info for all jumpGates in the system Uncharted JumpGates are NOT returned

func (*State) AllJumpGatesStatic

func (s *State) AllJumpGatesStatic(ctx context.Context, sys s10s.SystemSymbol, incUnderConstruction bool) ([]*api.JumpGate, error)

AllJumpGatesStatic returns the /jump-gate info for all jumpGates currently on disk Uncharted JumpGates are NOT returned

func (*State) AllMarkets

func (s *State) AllMarkets(ctx context.Context, systemSymbol s10s.SystemSymbol) ([]*api.Market, error)

func (*State) AllMarketsStatic

func (s *State) AllMarketsStatic(ctx context.Context, systemSymbol s10s.SystemSymbol) ([]*api.Market, error)

func (*State) AllShipyards

func (s *State) AllShipyards(ctx context.Context, sys s10s.SystemSymbol) ([]*api.Shipyard, error)

func (*State) AllShipyardsStatic

func (s *State) AllShipyardsStatic(ctx context.Context, sys s10s.SystemSymbol) ([]*api.Shipyard, error)

func (*State) AllSystemsStatic

func (state *State) AllSystemsStatic(ctx context.Context) (<-chan *api.System, error)

AllSystemsStatic returns a channel with all systems currently on disk

func (*State) AllWaypoints

func (s *State) AllWaypoints(ctx context.Context, systemSymbol s10s.SystemSymbol) ([]*api.Waypoint, error)

func (*State) AllWaypointsStatic

func (s *State) AllWaypointsStatic(ctx context.Context, sys s10s.SystemSymbol) ([]*api.Waypoint, error)

func (*State) CacheAgeSystem

func (s *State) CacheAgeSystem(ctx context.Context, symbol s10s.SystemSymbol) time.Time

func (*State) CalcInterstellarJumpRoute

func (s *State) CalcInterstellarJumpRoute(ctx context.Context, from, to s10s.WaypointSymbol) ([]string, error)

func (*State) CalcInterstellarRoute

func (s *State) CalcInterstellarRoute(ctx context.Context, fuelCapa int, from, to s10s.WaypointSymbol) ([]string, error)

func (*State) CalcNavRoute

func (s *State) CalcNavRoute(ctx context.Context, ship *api.Ship, from, to s10s.WaypointSymbol) ([]RouteItem, error)

func (*State) CalcTravelDistance

func (s *State) CalcTravelDistance(ctx context.Context, ship *api.Ship, fromSymbol, toSymbol s10s.WaypointSymbol) (int, error)

func (*State) CalcWarpRoute

func (s *State) CalcWarpRoute(ctx context.Context, fuelCapa int, from, to s10s.WaypointSymbol) ([]string, error)

func (*State) Dump

func (s *State) Dump(ctx context.Context, fName string) (err error)

func (*State) FindInterstellarGood

func (state *State) FindInterstellarGood(ctx context.Context, good api.TradeSymbol) (<-chan *api.Market, error)

func (*State) FindInterstellarShipyards

func (s *State) FindInterstellarShipyards(ctx context.Context) (<-chan *api.Shipyard, error)

func (*State) FindWaypointBySymbol

func (s *State) FindWaypointBySymbol(ctx context.Context, wp s10s.WaypointSymbol) *api.Waypoint

func (*State) GetJumpGate

func (s *State) GetJumpGate(ctx context.Context, wp *api.Waypoint) (*api.JumpGate, error)

func (*State) GetMarketStatic

func (s *State) GetMarketStatic(ctx context.Context, wpSymbol s10s.WaypointSymbol) (*api.Market, error)

func (*State) GetMyAgent

func (s *State) GetMyAgent(ctx context.Context) (*api.Agent, error)

func (*State) GetShipyardStatic

func (s *State) GetShipyardStatic(ctx context.Context, wpSymbol s10s.WaypointSymbol) (*api.Shipyard, error)

func (*State) GetSystem

func (s *State) GetSystem(ctx context.Context, sysSym s10s.SystemSymbol) (*api.System, error)

func (*State) HasSystemCached

func (s *State) HasSystemCached(ctx context.Context, sysSymbol s10s.SystemSymbol) bool

func (*State) HasWaypointsCached

func (s *State) HasWaypointsCached(ctx context.Context, sysSymbol s10s.SystemSymbol) bool

func (*State) PersistCache

func (s *State) PersistCache(ctx context.Context) error

func (*State) Ships

func (s *State) Ships() []*api.Ship

func (*State) SortByDist

func (s *State) SortByDist(ctx context.Context, ship *api.Ship, wps []*api.Waypoint) (func(a, b *api.Waypoint) int, error)

func (*State) StellarConstructionsStatic

func (s *State) StellarConstructionsStatic() ([]*api.Construction, error)

func (*State) StellarJumpGatesStatic

func (s *State) StellarJumpGatesStatic() ([]*api.JumpGate, error)

func (*State) SubscribedEvents

func (s *State) SubscribedEvents() map[string]interface{}

type Vert

type Vert struct {
	WP     *api.Waypoint
	Refuel bool
	FM     api.ShipNavFlightMode
	Start  bool
}

func NewVert

func NewVert(wp *api.Waypoint, fm api.ShipNavFlightMode) Vert

Jump to

Keyboard shortcuts

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