entities

package
v0.0.0-...-d23a236 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MAJOR_CARGO      = "Major"
	MINOR_CARGO      = "Minor"
	INCIDENTAL_CARGO = "Incidental"
	MAIL             = "Mail"
)
View Source
const (
	HIGH   = "High"
	MIDDLE = "Middle"
	BASIC  = "Basic"
	LOW    = "Low"
)

Variables

View Source
var CodeOffset = map[string]int{}

Functions

func GetPurchaseResult

func GetPurchaseResult(tradeGood TradeGood, codes []string) int

func GetSaleResult

func GetSaleResult(tradeGood TradeGood, codes []string) int

func IsValidTradeCode

func IsValidTradeCode(code string) bool

Types

type FreightLot

type FreightLot struct {
	CargoType string
	LotCount  int
	Lots      []FreightTrade
}

func NewFreightLot

func NewFreightLot(cargoType string) *FreightLot

func (*FreightLot) Description

func (f *FreightLot) Description() string

type FreightTrade

type FreightTrade struct {
	Cargo string
	Tons  int
}

func NewFreightTrade

func NewFreightTrade(cargoType, cargo string) *FreightTrade

func (*FreightTrade) Description

func (f *FreightTrade) Description() string

type Name

type Name struct {
	Text string `json:"Text"`
	Lang string `json:"Lang"`
}

type NoDmError

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

func NewNoDmError

func NewNoDmError(code string) NoDmError

func (NoDmError) Error

func (n NoDmError) Error() string

type PassengerTrade

type PassengerTrade struct {
	Passage string
	Count   int
}

func (*PassengerTrade) Description

func (p *PassengerTrade) Description() string

type Planet

type Planet struct {
	Name   string `json:"name"`
	Hex    string `json:"hex"`
	Sector string `json:"sector"`

	Highport       bool   `json:"highport"`
	HighportString string `json:"-"`

	NavalBase string `json:"naval-base"`
	ScoutBase string `json:"scout-base"`

	Uwp       Uwp    `json:"uwp"`
	UwpString string `json:"-"`
}

type PriceModifier

type PriceModifier struct {
	Result           int     `json:"result"`
	PurchaseModifier float32 `json:"purchase_mod"`
	SaleModifier     float32 `json:"sale_mod"`
}

func GetPriceModifier

func GetPriceModifier(num int) (PriceModifier, error)

type PriceModifiers

type PriceModifiers []PriceModifier

type Sector

type Sector struct {
	X            int    `json:"X"`
	Y            int    `json:"Y"`
	Milieu       string `json:"Milieu"`
	Abbreviation string `json:"Abbreviation"`
	Tags         string `json:"Tags"`
	Names        []Name `json:"Names"`
}

type SectorList

type SectorList []Sector

func NewSectorList

func NewSectorList(data []byte) (SectorList, error)

type SpeculativeTrade

type SpeculativeTrade struct {
	Cargo string
	Tons  int
}

func (*SpeculativeTrade) Description

func (s *SpeculativeTrade) Description() string

type TonsType

type TonsType struct {
	NumDice  int `json:"num_dice"`
	Modifier int `json:"modifier"`
}

func NewTons

func NewTons(number, modifier string) TonsType

func (*TonsType) String

func (t *TonsType) String() string

type Trade

type Trade interface {
	Description() string
}

type TradeGood

type TradeGood struct {
	Id            string         `json:"id"`
	Type          string         `json:"type"`
	Availability  []string       `json:"availability"`
	Tons          TonsType       `json:"tons"`
	BasePrice     int            `json:"base_price"`
	PurchaseDm    map[string]int `json:"purchase_dms"`
	SaleDm        map[string]int `json:"sale_dms"`
	PurchasePrice int            `json:"-"`
	SalePrice     int            `json:"-"`
	AvailableTons int            `json:"-"`
	ReasonAdded   []string       `json:"-"`
	// contains filtered or unexported fields
}

func GetAvailableForCodes

func GetAvailableForCodes(includeIllegal bool, includeAdditional int, availabilityMod int, codes ...string) []TradeGood

func GetTradeGoodById

func GetTradeGoodById(id string) (TradeGood, error)

func NewTradeGood

func NewTradeGood(id, typeName, numDice, modifier, basePrice string) *TradeGood

func (*TradeGood) CalculateAvailability

func (t *TradeGood) CalculateAvailability(mod int)

func (*TradeGood) GetPurchaseDm

func (t *TradeGood) GetPurchaseDm(code string) (int, error)

func (*TradeGood) GetSaleDm

func (t *TradeGood) GetSaleDm(code string) (int, error)

func (*TradeGood) IsAvailable

func (t *TradeGood) IsAvailable(code string) bool

func (*TradeGood) IsCommon

func (t *TradeGood) IsCommon() bool

func (*TradeGood) IsIllegal

func (t *TradeGood) IsIllegal() bool

func (*TradeGood) PurchaseDmsString

func (t *TradeGood) PurchaseDmsString() string

func (*TradeGood) SaleDmsString

func (t *TradeGood) SaleDmsString() string

func (*TradeGood) SetPurchasePrice

func (t *TradeGood) SetPurchasePrice(popSize int, tradeCodes []string, brokerSkill int)

func (*TradeGood) SetSalePrice

func (t *TradeGood) SetSalePrice(popSize int, tradeCodes []string, brokerSkill int)

func (*TradeGood) String

func (t *TradeGood) String() string

type TradeGoods

type TradeGoods []TradeGood

func GetAllTradeGoods

func GetAllTradeGoods() TradeGoods

func GetTradeGoodsByIds

func GetTradeGoodsByIds(ids []string) TradeGoods

type Uwp

type Uwp struct {
	Starport     string `json:"starport"`
	Size         int    `json:"size"`
	Atmosphere   int    `json:"atmosphere"`
	Hydrographic int    `json:"hydrographic"`
	Population   int    `json:"population"`
	Government   int    `json:"government"`
	LawLevel     int    `json:"law_level"`
	TechLevel    int    `json:"tech_level"`
}

func (*Uwp) String

func (u *Uwp) String() string

Jump to

Keyboard shortcuts

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