API
Functions and classes available in the Lua API
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
cItem Class Reference

#include <0016.h>

Public Member Functions

 cItem (void)
 Creates an empty item.
 cItem (short a_ItemType, char a_ItemCount=1, short a_ItemDamage=0, const AString &a_Enchantments="")
 Creates an item of the specified type, by default 1 piece with no damage and no enchantments.
void Clear (void)
cItem CopyOne (void) const
 Returns a copy of this item with m_ItemCount set to 1. Useful to preserve enchantments etc. on stacked items.
bool DamageItem (short a_Amount=1)
 Damages a weapon / tool. Returns true when damage reaches max value and the item should be destroyed.
void Empty (void)
short GetMaxDamage (void) const
 Returns the maximum damage value that this item can have; zero if damage is not applied.
bool IsDamageable (void) const
bool IsEmpty (void) const
bool IsEqual (const cItem &a_Item) const
bool IsSameType (const cItem &a_Item) const
bool IsStackableWith (const cItem &a_OtherStack) const
 Returns true if this itemstack can stack with the specified stack (types match, enchantments etc.) ItemCounts are ignored!

Static Public Member Functions

static bool IsEnchantable (short a_ItemType)

Public Attributes

cEnchantments m_Enchantments
char m_ItemCount
short m_ItemDamage
short m_ItemType

Constructor & Destructor Documentation

cItem::cItem ( void  )
inline

Creates an empty item.

cItem::cItem ( short  a_ItemType,
char  a_ItemCount = 1,
short  a_ItemDamage = 0,
const AString &  a_Enchantments = "" 
)
inline

Creates an item of the specified type, by default 1 piece with no damage and no enchantments.

Member Function Documentation

void cItem::Clear ( void  )
inline
cItem cItem::CopyOne ( void  ) const

Returns a copy of this item with m_ItemCount set to 1. Useful to preserve enchantments etc. on stacked items.

bool cItem::DamageItem ( short  a_Amount = 1)

Damages a weapon / tool. Returns true when damage reaches max value and the item should be destroyed.

void cItem::Empty ( void  )
inline
short cItem::GetMaxDamage ( void  ) const

Returns the maximum damage value that this item can have; zero if damage is not applied.

bool cItem::IsDamageable ( void  ) const
inline
bool cItem::IsEmpty ( void  ) const
inline
static bool cItem::IsEnchantable ( short  a_ItemType)
static
bool cItem::IsEqual ( const cItem a_Item) const
inline
bool cItem::IsSameType ( const cItem a_Item) const
inline
bool cItem::IsStackableWith ( const cItem a_OtherStack) const

Returns true if this itemstack can stack with the specified stack (types match, enchantments etc.) ItemCounts are ignored!

Member Data Documentation

cEnchantments cItem::m_Enchantments
char cItem::m_ItemCount
short cItem::m_ItemDamage
short cItem::m_ItemType