C# Class SunsetHigh.Inventory

Represents an assortment of items; each Character has an Inventory to hold his/her own collection
Inheritance: IEnumerable
Mostrar archivo Open project: ErraticUnicorn/MOSH

Public Properties

Property Type Description
NUM_TYPE_ITEMS int

Public Methods

Method Description
GetEnumerator ( ) : IEnumerator
Inventory ( ) : System

Default constructor

addItem ( System.Item type ) : void

Adds one item of a given type to this Inventory

addItem ( System.Item type, int quantity ) : void

Adds a given number of the given Item type to this Inventory

getSaveStructure ( ) : InventorySave

Used for saving purposes only

hasItem ( ) : bool

Checks if this Inventory has at least one item

hasItem ( System.Item item ) : bool

Checks if this Inventory has the given Item type

loadSaveStructure ( InventorySave saveStruct ) : void

Used for loading in the hero's inventory when restoring a saved game

numItem ( System.Item item ) : int

Gets the amount of a specific Item type in this Inventory

numTotalItems ( ) : int

Sum total of all the items in this Inventory

removeAll ( ) : void

Clears this Inventory of all items

removeItem ( System.Item type ) : void

Removes one item of a given type from this Inventory

removeItem ( System.Item type, int quantity ) : void

Removes a given number of the given item type from this Inventory

removeRandomItem ( ) : System.Item

Removes and returns a random item from this Inventory; each Item type is weighted equally (i.e. quantity does not matter); use this for pickpocketing

Private Methods

Method Description
pushEvent ( InventoryEventArgs e ) : void

Method Details

GetEnumerator() public method

public GetEnumerator ( ) : IEnumerator
return IEnumerator

Inventory() public method

Default constructor
public Inventory ( ) : System
return System

addItem() public method

Adds one item of a given type to this Inventory
public addItem ( System.Item type ) : void
type System.Item The Item type to add
return void

addItem() public method

Adds a given number of the given Item type to this Inventory
public addItem ( System.Item type, int quantity ) : void
type System.Item The Item type to add
quantity int The number of items to add
return void

getSaveStructure() public method

Used for saving purposes only
public getSaveStructure ( ) : InventorySave
return InventorySave

hasItem() public method

Checks if this Inventory has at least one item
public hasItem ( ) : bool
return bool

hasItem() public method

Checks if this Inventory has the given Item type
public hasItem ( System.Item item ) : bool
item System.Item The Item type to check for
return bool

loadSaveStructure() public method

Used for loading in the hero's inventory when restoring a saved game
public loadSaveStructure ( InventorySave saveStruct ) : void
saveStruct InventorySave An int[] representation of inventory to load
return void

numItem() public method

Gets the amount of a specific Item type in this Inventory
public numItem ( System.Item item ) : int
item System.Item The Item type to check for
return int

numTotalItems() public method

Sum total of all the items in this Inventory
public numTotalItems ( ) : int
return int

removeAll() public method

Clears this Inventory of all items
public removeAll ( ) : void
return void

removeItem() public method

Removes one item of a given type from this Inventory
public removeItem ( System.Item type ) : void
type System.Item The Item type to remove
return void

removeItem() public method

Removes a given number of the given item type from this Inventory
public removeItem ( System.Item type, int quantity ) : void
type System.Item The Item type to remove
quantity int The number of items to remove
return void

removeRandomItem() public method

Removes and returns a random item from this Inventory; each Item type is weighted equally (i.e. quantity does not matter); use this for pickpocketing
public removeRandomItem ( ) : System.Item
return System.Item

Property Details

NUM_TYPE_ITEMS public_oe static_oe property

public static int NUM_TYPE_ITEMS
return int