C# Class Gruppe22.Backend.Item

Class to represent items ingame e.g. weapons, armor
Show file Open project: propra13-orga/gruppe22

Public Methods

Method Description
ChangeEffect ( ItemEffect effect, bool enable ) : void

Method the activate the effects of an item for an owner

Drop ( FloorTile tile ) : void

Method to drop an item from an actor to the ground. Deletes the item from the inventory and creats an itemtile to place the item on the ground

EquipItem ( ) : void

Method to (un)equip an item disables and enables the effects of the item

EstimateValue ( ) : void

Method to evaluate the (gold)value of an item based of the type of the item and the number of effects.

GenerateIcon ( ) : void

Method to determine the icon for an item based on what kind of item it is

GenerateName ( ) : void

Method to generate a matching name for an item

GenerateProperties ( Random r = null ) : void

Method to create (random) effects for an item

Item ( ) : System

Konstruktor.

Item ( Actor owner, ItemType itemtype, string name = "", ImageData icon = null, int value, int level = 1 ) : System

Ein weiterer Konstruktor.

Item ( ItemTile parent, ItemType itemtype, string name = "", ImageData icon = null, int value, int level = 1 ) : System

Noch ein Konstruktor mit anderen Initial-Parametern.

Item ( ItemType itemtype, string name = "", Random r = null, ImageData icon = null, int value, int level = 1 ) : System

Another constructor for items

Item ( Random r = null, int value, int level = 1, bool gold = true ) : System

Constructor for an item.

Load ( XmlReader reader ) : void

Saving method. Parses the path to the item icon and all effects to xml

Pickup ( Actor actor ) : void

Method called when an actor picks up an item from the ground. Replaces the old owner and deletes the itemtile from the map

PropertyToString ( ItemProperty property ) : string

Method to convert the name of a property to a string

Save ( XmlWriter xmlw ) : void

Saving method

Update ( ) : void

The Update method for the itemeffect-duration

UseItem ( ) : void

Method called when a item is used.

Method Details

ChangeEffect() public method

Method the activate the effects of an item for an owner
public ChangeEffect ( ItemEffect effect, bool enable ) : void
effect ItemEffect The effect which should be (de)activated
enable bool Whether the effect gets (de)activated
return void

Drop() public method

Method to drop an item from an actor to the ground. Deletes the item from the inventory and creats an itemtile to place the item on the ground
public Drop ( FloorTile tile ) : void
tile FloorTile The tile on which the itemtile with the item will be added.
return void

EquipItem() public method

Method to (un)equip an item disables and enables the effects of the item
public EquipItem ( ) : void
return void

EstimateValue() public method

Method to evaluate the (gold)value of an item based of the type of the item and the number of effects.
public EstimateValue ( ) : void
return void

GenerateIcon() public method

Method to determine the icon for an item based on what kind of item it is
public GenerateIcon ( ) : void
return void

GenerateName() public method

Method to generate a matching name for an item
public GenerateName ( ) : void
return void

GenerateProperties() public method

Method to create (random) effects for an item
public GenerateProperties ( Random r = null ) : void
r System.Random A dice used to create the effetcs
return void

Item() public method

Konstruktor.
public Item ( ) : System
return System

Item() public method

Ein weiterer Konstruktor.
public Item ( Actor owner, ItemType itemtype, string name = "", ImageData icon = null, int value, int level = 1 ) : System
owner Actor Der Besitzer-Actor des Items.
itemtype ItemType Typ
name string Name
icon ImageData Symbol
value int Wert
level int Level
return System

Item() public method

Noch ein Konstruktor mit anderen Initial-Parametern.
public Item ( ItemTile parent, ItemType itemtype, string name = "", ImageData icon = null, int value, int level = 1 ) : System
parent ItemTile
itemtype ItemType
name string
icon ImageData
value int
level int
return System

Item() public method

Another constructor for items
public Item ( ItemType itemtype, string name = "", Random r = null, ImageData icon = null, int value, int level = 1 ) : System
itemtype ItemType
name string
r System.Random
icon ImageData
value int
level int
return System

Item() public method

Constructor for an item.
public Item ( Random r = null, int value, int level = 1, bool gold = true ) : System
r System.Random by default null, gets generated in the constructor
value int by default 0
level int by default 1
gold bool True if the constructed item can be gold
return System

Load() public method

Saving method. Parses the path to the item icon and all effects to xml
public Load ( XmlReader reader ) : void
reader System.Xml.XmlReader XmlReader.
return void

Pickup() public method

Method called when an actor picks up an item from the ground. Replaces the old owner and deletes the itemtile from the map
public Pickup ( Actor actor ) : void
actor Actor The actor which gains the item
return void

PropertyToString() public static method

Method to convert the name of a property to a string
public static PropertyToString ( ItemProperty property ) : string
property ItemProperty The effect which should be parsed to a string
return string

Save() public method

Saving method
public Save ( XmlWriter xmlw ) : void
xmlw System.Xml.XmlWriter XmlWriter.
return void

Update() public method

The Update method for the itemeffect-duration
public Update ( ) : void
return void

UseItem() public method

Method called when a item is used.
public UseItem ( ) : void
return void