items

package
v0.0.0-...-9b4e82f Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2019 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const TradeItemType = "trade_effect"

Variables

View Source
var ItemLock = lock.NewLock("item")
View Source
var Items = make(map[string]*Item)
View Source
var ItemsPortInventory = make(map[string]map[string]*Item)

Functions

func BuyItem

func BuyItem(portUuid, configId string) (string, error)

func DeleteItem

func DeleteItem(item *Item)

func DeleteRequest

func DeleteRequest(uuid string) error

func LoadItemConfig

func LoadItemConfig(data []byte)

func TransferItem

func TransferItem(currentOwner, newOwner, itemId string) error

*

  • Transfer an item

func Use

func Use(itemId, portfolioUuid string, itemParameters interface{}) (interface{}, error)

Types

type InnerItem

type InnerItem interface {
	SetPortfolioUuid(string)
	Activate(interface{}) (interface{}, error)
	Copy() InnerItem
	SetParentItemUuid(string)
}

func UnmarshalJsonItem

func UnmarshalJsonItem(itemType, jsonStr string) (InnerItem, error)

type Item

type Item struct {
	objects.Item
	UpdateChannel chan interface{} `json:"-"`
}

func GetItemsForPortfolio

func GetItemsForPortfolio(portfolioUuid string) []*Item

func MakeItem

func MakeItem(i objects.Item) (*Item, error)

func (*Item) MarshalJSON

func (i *Item) MarshalJSON() ([]byte, error)

type TradeEffectItem

type TradeEffectItem struct {
	ParentItemUuid    string         `json:"-"`
	TargetPortfolio   string         `json:"portfolio_uuid"`
	Duration          utils.Duration `json:"duration"`
	ProfitMultiplier  *float64       `json:"profit_multiplier"`
	BuyFeeMultiplier  *float64       `json:"buy_fee_multiplier"`
	SellFeeMultiplier *float64       `json:"sell_fee_multiplier"`
	BuyFeeAmount      *int64         `json:"buy_fee"`
	SellFeeAmount     *int64         `json:"sell_fee"`
	BlockTrading      *bool          `json:"block_trading"`
}

func (*TradeEffectItem) Activate

func (p *TradeEffectItem) Activate(interface{}) (interface{}, error)

func (*TradeEffectItem) Copy

func (p *TradeEffectItem) Copy() InnerItem

func (*TradeEffectItem) SetParentItemUuid

func (p *TradeEffectItem) SetParentItemUuid(parent string)

func (*TradeEffectItem) SetPortfolioUuid

func (p *TradeEffectItem) SetPortfolioUuid(portfolioUuid string)

Jump to

Keyboard shortcuts

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