inventory

package
v0.0.0-...-59334ad Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2019 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ClassID

type ClassID uint64

ClassID and InstanceID represent the unique identifier for an item type

func (ClassID) String

func (classID ClassID) String() string

String will turn a ClassID into a string

type Description

type Description struct {
	AppID      mangosteam.AppID `json:",string"`
	ClassID    ClassID          `json:",string"`
	InstanceID InstanceID       `json:",string"`

	IconURL     string `json:"icon_url"`
	IconDragURL string `json:"icon_drag_url"`

	Name           string
	MarketHashName string `json:"market_hash_name"`
	MarketName     string `json:"market_name"`

	// Colors in hex, for example `B2B2B2`
	NameColor       string `json:"name_color"`
	BackgroundColor string `json:"background_color"`

	Type string

	Tradable   int
	Marketable int
	Commodity  int

	Tags Tags
}

Description contains the market hash name

type Descriptions

type Descriptions map[string]*Description

Descriptions for the inventory

func (*Descriptions) UnmarshalJSON

func (d *Descriptions) UnmarshalJSON(data []byte) error

UnmarshalJSON for the inventory currencies

type InstanceID

type InstanceID uint64

InstanceID and ClassID represent the unique identifier for an item type

func (InstanceID) String

func (instanceID InstanceID) String() string

String will turn a ClassID into a string

type InvChecker

type InvChecker interface {
	AreItemsWithinUserInventory(items []*Item) bool
	AreItemsDataSimilarUserInventory(items []*Item) bool
}

InvChecker is the user interface

type Inventory

type Inventory struct {
	Items        Items        `json:"rgInventory"`
	Descriptions Descriptions `json:"rgDescriptions"`
}

Inventory represents the inventory of a user

func GetUserWebInventory

func GetUserWebInventory(appID mangosteam.AppID, steamID mangosteam.SteamID) (*Inventory, error)

GetUserWebInventory returns the inventory of the user, if available

func (*Inventory) AreItemsDataSimilarUserInventory

func (userInventory *Inventory) AreItemsDataSimilarUserInventory(items []*Item) bool

AreItemsDataSimilarUserInventory returns true or false according to the data of the items

func (*Inventory) AreItemsWithinUserInventory

func (userInventory *Inventory) AreItemsWithinUserInventory(items []*Item) bool

AreItemsWithinUserInventory returns true or false accordign to the presence of items

type Item

type Item struct {
	ID         ItemID     `json:",string"`
	ClassID    ClassID    `json:",string"`
	InstanceID InstanceID `json:",string"`
	Amount     uint64     `json:",string"`
	Pos        uint64
}

Item represents an item in the inventory

type ItemID

type ItemID uint64

ItemID represents the unique identifier for an item

func (ItemID) String

func (itemID ItemID) String() string

String will turn a ItemID into a string

type Items

type Items map[string]*Item

Items is a map of items in the inventory

func (*Items) UnmarshalJSON

func (i *Items) UnmarshalJSON(data []byte) error

UnmarshalJSON for the inventory items

type Tag

type Tag struct {
	InternalName string `json:"internal_name"`
	Name         string `json:"name"`
	Category     string `json:"category"`
	CategoryName string `json:"category_name"`
	Color        string `json:"color"`
}

Tag is an unstructured data

type Tags

type Tags []*Tag

Tags is a list of tags in the description

func (*Tags) GetTagNameFromCategory

func (t *Tags) GetTagNameFromCategory(category string) string

GetTagNameFromCategory returns the tag name for a specific category

Jump to

Keyboard shortcuts

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