Documentation
¶
Index ¶
- Constants
- Variables
- func FindJournals() (dir string, err error)
- func LoadJSON(file string, into interface{}) error
- func Must(err error)
- func SaveJSON(file string, data interface{}) error
- type App
- type AppChannel
- type Change
- type ChgF32
- type ChgInt
- type ChgString
- type Commander
- func (cmdr *Commander) FindShip(id int) *Ship
- func (cmdr *Commander) GetShip(id int) *Ship
- func (cmdr *Commander) Jump(addr uint64, t time.Time)
- func (cmdr *Commander) Load(file string) error
- func (cmdr *Commander) Save(file string) error
- func (cmdr *Commander) SetShip(id int) (res *Ship, chg bool)
- func (cmdr *Commander) StoreCurrentShip(shipId int)
- type EDState
- func (ed *EDState) Load(file string) error
- func (es *EDState) MustCommander() *Commander
- func (es *EDState) Read(do func() error) error
- func (ed *EDState) Save(file string, cmdrFile string) error
- func (es *EDState) SetEDVersion(v string)
- func (es *EDState) SetLanguage(lang string)
- func (es *EDState) Write(do func() error) error
- func (es *EDState) WriteCmdr(do func(*Commander) error) error
- type EventHandlingError
- type Extension
- func (ext *Extension) AddApp(name string, app App)
- func (ext *Extension) DiffEvtsHdls() (es []string, hs []string)
- func (ext *Extension) EventHandler(evtType events.Type, raw []byte) (err error)
- func (ext *Extension) MustRun(latestJournal bool)
- func (ext *Extension) Run(latestJournal bool) (err error)
- func (ext *Extension) Stop()
- func (ext *Extension) SwitchCommander(fid, name string) *Commander
- type Galaxy
- type InMemGalaxy
- type JSONLocation
- type Jump
- type Location
- type Material
- type Materials
- type Port
- type Rank
- type RankType
- type Ranks
- type RawMatStats
- type Ship
- type ShutdownMode
- type SysCoos
- type System
Examples ¶
Constants ¶
View Source
const ( Major = 0 Minor = 1 Patch = 2 Quality = `a` BuildNo = 3 )
View Source
const EchoGalaxy = echoGxy(0)
View Source
const JumpHitsMax = 100
Variables ¶
Functions ¶
func FindJournals ¶
Types ¶
type AppChannel ¶
type AppChannel struct {
// contains filtered or unexported fields
}
func NewAppChannel ¶
func NewAppChannel(app App, capacity int) *AppChannel
func (*AppChannel) Close ¶
func (ac *AppChannel) Close()
func (*AppChannel) FinishEDEvent ¶ added in v0.2.0
func (ac *AppChannel) FinishEDEvent(token interface{}, e events.Event, chg Change)
func (*AppChannel) PrepareEDEvent ¶ added in v0.2.0
func (ac *AppChannel) PrepareEDEvent(e events.Event) (token interface{})
type Commander ¶
type Commander struct {
FID string
Name string
Ranks Ranks
ShipID int
At JSONLocation
Ships map[int]*Ship
Mats Materials
JumpHist []Jump
LastJump int
RawMatStats map[string]*RawMatStats
// contains filtered or unexported fields
}
func NewCommander ¶
func (*Commander) StoreCurrentShip ¶
shipId == 0 => caller has no idea of id
type EDState ¶
type EDState struct {
Lock sync.RWMutex `json:"-"`
GoEDXversion struct{ Major, Minor, Patch int }
// Is modified w/o using Lock!
EDVersion string
Beta bool
Language string
L10n struct {
Lang string
Region string
}
Cmdr *Commander `json:"-"`
LastJournalEvent time.Time
}
func NewEDState ¶
func NewEDState() *EDState
func (*EDState) MustCommander ¶
func (*EDState) SetEDVersion ¶
func (*EDState) SetLanguage ¶
type EventHandlingError ¶
func (*EventHandlingError) Error ¶
func (ehe *EventHandlingError) Error() string
type Extension ¶
type Extension struct {
JournalDir string
JournalAfter time.Time
EDState *EDState
Galaxy Galaxy
CmdrFile func(*Commander) string
ShutdownLogsOut bool
// contains filtered or unexported fields
}
func (*Extension) DiffEvtsHdls ¶
func (*Extension) EventHandler ¶
func (*Extension) SwitchCommander ¶
type InMemGalaxy ¶
func (InMemGalaxy) EdgxSystem ¶
func (g InMemGalaxy) EdgxSystem(addr uint64, name string, coos []float32) (*System, interface{})
type JSONLocation ¶
type JSONLocation struct {
Location
}
func (JSONLocation) MarshalJSON ¶
func (jloc JSONLocation) MarshalJSON() ([]byte, error)
func (JSONLocation) Port ¶
func (jl JSONLocation) Port() *Port
func (JSONLocation) System ¶
func (jl JSONLocation) System() *System
func (*JSONLocation) UnmarshalJSON ¶
func (jloc *JSONLocation) UnmarshalJSON(data []byte) (err error)
type Port ¶
Example ¶
p := Port{
Sys: &System{
Addr: 4711,
Name: "Köln",
Coos: ToSysCoos(3, 2, 1),
},
Name: "Hafen",
Docked: true,
}
var sb bytes.Buffer
enc := json.NewEncoder(&sb)
enc.Encode(&p)
os.Stdout.Write(sb.Bytes())
sb.Reset()
enc.Encode(JSONLocation{&p})
os.Stdout.Write(sb.Bytes())
var jloc JSONLocation
fmt.Println(json.Unmarshal(sb.Bytes(), &jloc))
sb.Reset()
enc.Encode(&p)
os.Stdout.Write(sb.Bytes())
Output: {"Sys":{"Addr":4711,"Name":"Köln","Coos":[3,2,1],"FirstAccess":"0001-01-01T00:00:00Z","LastAccess":"0001-01-01T00:00:00Z"},"Name":"Hafen","Docked":true} {"@type":"port","Docked":true,"Name":"Hafen","Sys":{"Addr":4711,"Coos":[3,2,1],"Name":"Köln"}} <nil> {"Sys":{"Addr":4711,"Name":"Köln","Coos":[3,2,1],"FirstAccess":"0001-01-01T00:00:00Z","LastAccess":"0001-01-01T00:00:00Z"},"Name":"Hafen","Docked":true}
type RawMatStats ¶ added in v0.2.0
type ShutdownMode ¶ added in v0.2.0
type ShutdownMode int
type System ¶
type System struct {
Addr uint64
Name string
Coos SysCoos
FirstAccess time.Time
LastAccess time.Time
}
Example ¶
s := System{
Addr: 4711,
Name: "Köln",
Coos: ToSysCoos(3, 2, 1),
}
var sb bytes.Buffer
enc := json.NewEncoder(&sb)
enc.Encode(&s)
os.Stdout.Write(sb.Bytes())
sb.Reset()
enc.Encode(JSONLocation{&s})
os.Stdout.Write(sb.Bytes())
var jloc JSONLocation
fmt.Println(json.Unmarshal(sb.Bytes(), &jloc))
sb.Reset()
enc.Encode(&s)
os.Stdout.Write(sb.Bytes())
Output: {"Addr":4711,"Name":"Köln","Coos":[3,2,1],"FirstAccess":"0001-01-01T00:00:00Z","LastAccess":"0001-01-01T00:00:00Z"} {"@type":"system","Addr":4711,"Coos":[3,2,1],"Name":"Köln"} <nil> {"Addr":4711,"Name":"Köln","Coos":[3,2,1],"FirstAccess":"0001-01-01T00:00:00Z","LastAccess":"0001-01-01T00:00:00Z"}
Source Files
¶
- apps.go
- changeable.go
- edstate.go
- edx.go
- ehCommander.go
- ehDocked.go
- ehFSDJump.go
- ehFileheader.go
- ehLoadout.go
- ehLocation.go
- ehMaterials.go
- ehScan.go
- ehSellShipOnRebuy.go
- ehSetUserShipName.go
- ehShipTargeted.go
- ehShipyardBuy.go
- ehShipyardNew.go
- ehShipyardSell.go
- ehShipyardSwap.go
- ehShutdown.go
- ehUndocked.go
- galaxy.go
- locations.go
- log.go
- os.go
- ranktype_string.go
- version.go
Directories
¶
| Path | Synopsis |
|---|---|
|
apps
|
|
|
bboltgalaxy/bbgxydump
command
|
|
|
examples
|
|
|
feedfiles
command
|
|
|
tools
|
|
|
newjournalevent
command
|
Click to show internal directories.
Click to hide internal directories.