inventory

package
v0.220216.0 Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2022 License: CC0-1.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrStockLow = errors.New("Stock is too low")
)

Functions

This section is empty.

Types

type Inventory

type Inventory struct {
	persist.Persist
	// contains filtered or unexported fields
}

func (*Inventory) DisableAll

func (self *Inventory) DisableAll()

func (*Inventory) EnableAll

func (self *Inventory) EnableAll()

func (*Inventory) Get

func (self *Inventory) Get(name string) (*Stock, error)

func (*Inventory) Init

func (self *Inventory) Init(ctx context.Context, c *engine_config.Inventory, engine *engine.Engine) error

func (*Inventory) Iter

func (self *Inventory) Iter(fun func(s *Stock))

func (*Inventory) MarshalBinary

func (self *Inventory) MarshalBinary() ([]byte, error)

func (*Inventory) MustGet

func (self *Inventory) MustGet(f interface{ Fatal(...interface{}) }, name string) *Stock

func (*Inventory) SetTele

func (self *Inventory) SetTele(src *tele_api.Inventory) (*tele_api.Inventory, error)

func (*Inventory) Tele

func (self *Inventory) Tele() *tele_api.Inventory

func (*Inventory) UnmarshalBinary

func (self *Inventory) UnmarshalBinary(b []byte) error

func (*Inventory) WithTuning

func (self *Inventory) WithTuning(ctx context.Context, stockName string, adj float32) (context.Context, error)

type State

type State struct {
	Stocks               []*State_Stock `protobuf:"bytes,1,rep,name=stocks,proto3" json:"stocks,omitempty"`
	XXX_NoUnkeyedLiteral struct{}       `json:"-"`
	XXX_unrecognized     []byte         `json:"-"`
	XXX_sizecache        int32          `json:"-"`
}

func (*State) Descriptor

func (*State) Descriptor() ([]byte, []int)

func (*State) GetStocks

func (m *State) GetStocks() []*State_Stock

func (*State) ProtoMessage

func (*State) ProtoMessage()

func (*State) Reset

func (m *State) Reset()

func (*State) String

func (m *State) String() string

func (*State) XXX_DiscardUnknown

func (m *State) XXX_DiscardUnknown()

func (*State) XXX_Marshal

func (m *State) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*State) XXX_Merge

func (dst *State) XXX_Merge(src proto.Message)

func (*State) XXX_Size

func (m *State) XXX_Size() int

func (*State) XXX_Unmarshal

func (m *State) XXX_Unmarshal(b []byte) error

type State_Stock

type State_Stock struct {
	Name                 string   `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
	Enabled              bool     `protobuf:"varint,2,opt,name=enabled,proto3" json:"enabled,omitempty"`
	Value                float32  `protobuf:"fixed32,3,opt,name=value,proto3" json:"value,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*State_Stock) Descriptor

func (*State_Stock) Descriptor() ([]byte, []int)

func (*State_Stock) GetEnabled

func (m *State_Stock) GetEnabled() bool

func (*State_Stock) GetName

func (m *State_Stock) GetName() string

func (*State_Stock) GetValue

func (m *State_Stock) GetValue() float32

func (*State_Stock) ProtoMessage

func (*State_Stock) ProtoMessage()

func (*State_Stock) Reset

func (m *State_Stock) Reset()

func (*State_Stock) String

func (m *State_Stock) String() string

func (*State_Stock) XXX_DiscardUnknown

func (m *State_Stock) XXX_DiscardUnknown()

func (*State_Stock) XXX_Marshal

func (m *State_Stock) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*State_Stock) XXX_Merge

func (dst *State_Stock) XXX_Merge(src proto.Message)

func (*State_Stock) XXX_Size

func (m *State_Stock) XXX_Size() int

func (*State_Stock) XXX_Unmarshal

func (m *State_Stock) XXX_Unmarshal(b []byte) error

type Stock

type Stock struct {
	Code uint32
	Name string
	// contains filtered or unexported fields
}

func NewStock

func NewStock(c engine_config.Stock, e *engine.Engine) (*Stock, error)

func (*Stock) Disable

func (s *Stock) Disable()

func (*Stock) Enable

func (s *Stock) Enable()

func (*Stock) Enabled

func (s *Stock) Enabled() bool

func (*Stock) Has

func (s *Stock) Has(v float32) bool

func (*Stock) Set

func (s *Stock) Set(new float32)

func (*Stock) String

func (s *Stock) String() string

func (*Stock) TranslateHw

func (s *Stock) TranslateHw(arg engine.Arg) float32

func (*Stock) TranslateSpend

func (s *Stock) TranslateSpend(arg engine.Arg) float32

func (*Stock) Value

func (s *Stock) Value() float32

func (*Stock) Wrap

func (s *Stock) Wrap(d engine.Doer) engine.Doer

Jump to

Keyboard shortcuts

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