edreader

package
v1.2.3-beta Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2025 License: GPL-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const FileCargo = "Cargo.json"
View Source
const FileModulesInfo = "ModulesInfo.json"

Variables

View Source
var (
	Mfd     mfd.Display
	MfdLock = sync.RWMutex{}
	PrevMfd mfd.Display
)

Mfd is the MFD display structure to be used by this module.

View Source
var PageRegistry = []PageDef{
	{
		Key:         PageDestination,
		DisplayName: "Destination",
		Render:      RenderDestinationPage,
	},
	{
		Key:         PageLocation,
		DisplayName: "Location",
		Render:      RenderLocationPage,
	},
	{
		Key:         PageCargo,
		DisplayName: "Cargo",
		Render:      RenderCargoPage,
	},
}

Registry of all possible pages

Functions

func ApplyBodyPage

func ApplyBodyPage(page *mfd.Page, header string, systemAddress int64, bodyID int64, bodyName string)

func ApplySystemPage

func ApplySystemPage(page *mfd.Page, header, systemname string, systemaddress int64, state *Journalstate)

Page assembly functions for MFD

func ExtractFleetCarrierNameID

func ExtractFleetCarrierNameID(full string) (string, string)

ExtractFleetCarrierNameID splits a string like "Stormcrow VZY-8XQ" into ("Stormcrow", "VZY-8XQ"). Returns ("", "") if not a FC.

func GetEDSMBodies

func GetEDSMBodies(systemaddress int64) (*edsm.System, error)

Gets system body information from EDSM

func GetEDSMSystemValue

func GetEDSMSystemValue(systemaddress int64) (*edsm.System, error)

Gets system monetary values from EDSM

func GetLastFleetCarrierName

func GetLastFleetCarrierName(id string) string

GetLastFleetCarrierName returns the last seen FC name for a given ID, or "".

func ModulesInfoCargoCapacity

func ModulesInfoCargoCapacity() int

func ParseJournalLine

func ParseJournalLine(line []byte, state *Journalstate)

ParseJournalLine parses a single line of the journal and returns the new state after parsing.

func PrefetchStations

func PrefetchStations(systemAddress int64)

Prefetches station info for a system and caches it

func RenderCargoPage

func RenderCargoPage(page *mfd.Page, _ Journalstate)

func RenderDestinationPage

func RenderDestinationPage(page *mfd.Page, state Journalstate)

func RenderFleetCarrierPage

func RenderFleetCarrierPage(page *mfd.Page, header, fcID, fcName string, systemAddress int64)

Helper to render a Fleet Carrier page

func RenderLocationPage

func RenderLocationPage(page *mfd.Page, state Journalstate)

Page rendering functions for MFD

func RenderStationPage

func RenderStationPage(page *mfd.Page, header string, st edsm.Station)

Helper to render a station page

func SaveFleetCarrierReceiveText

func SaveFleetCarrierReceiveText(from string)

SaveFleetCarrierReceiveText remembers the last FC name for a given ID.

func SetFirstEnabledPageKey

func SetFirstEnabledPageKey(cfg map[string]bool)

Call this at startup after loading config, e.g. in main or Start()

func Start

func Start(cfg conf.Conf)

Start starts the Elite Dangerous journal reader routine using fsnotify

func Stop

func Stop()

Stop closes the watcher again

Types

type Cargo

type Cargo struct {
	Count     int
	Inventory []CargoLine
}

type CargoLine

type CargoLine struct {
	Name          string
	Count         int
	Stolen        int
	NameLocalized string `json:"Name_Localised"`
}

type Destination

type Destination struct {
	SystemAddress int64
	BodyID        int64
	Name          string
}

Destination holds the current destination info from Status.json

type EDSMTarget

type EDSMTarget struct {
	Name                  string
	SystemAddress         int64
	RemainingJumpsInRoute int // NEW: for FSD Target jumps
}

EDSMTarget indicates a system targeted by the FSD drive for a jump

type Journalstate

type Journalstate struct {
	Location
	EDSMTarget
	Destination
	ArrivedAtFSDTarget     bool
	ArrivedAtFSDTargetTime time.Time
	LastFSDTargetSystem    string
	LastFSDTargetAddress   int64
	ShowSplashScreen       bool      // NEW: splash flag
	SplashScreenStartTime  time.Time // NEW: splash start time
}

Journalstate encapsulates the player state baed on the journal

type Location

type Location struct {
	Type LocationType

	SystemAddress int64
	StarSystem    string

	Body     string
	BodyID   int64
	BodyType string

	Latitude  float64
	Longitude float64
}

Location indicates the players current location in the game

type LocationType

type LocationType int

LocationType indicates where in a system the player is

const (
	// LocationSystem means the player is somewhere in the system, not close to a body
	LocationSystem LocationType = iota
	// LocationPlanet means the player is close to a planetary body
	LocationPlanet
	// LocationLanded indicates the player has touched down
	LocationLanded
	// LocationDocked indicates the player has docked at a station (or outpost)
	LocationDocked
)

type ModulesInfo

type ModulesInfo struct {
	Modules []ModulesLine
}

ModulesInfo struct to load the ModulesInfo file saved by ED

type ModulesLine

type ModulesLine struct {
	Slot string
	Item string
}

ModulesLine struct to load individual module in the ModuleInfo

type PageDef

type PageDef struct {
	Key         PageKey
	DisplayName string
	Render      func(*mfd.Page, Journalstate)
}

PageDef describes a page and how to render it

type PageKey

type PageKey string

PageKey is a string identifier for each page

const (
	PageDestination PageKey = "destination"
	PageLocation    PageKey = "location"
	PageCargo       PageKey = "cargo"
)

type StarTypeData

type StarTypeData struct {
	Class string
	Desc  string
}

func ParseStarTypeString

func ParseStarTypeString(starType string) StarTypeData

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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