46 short a_ItemDamage = 0,
47 const AString & a_Enchantments =
"",
48 const AString & a_CustomName =
"",
54 #ifdef TOLUA_EXPOSITION
130 void GetJson(Json::Value & a_OutValue)
const;
133 void FromJson(
const Json::Value & a_Value);
138 static bool IsEnchantable(
short a_ItemType,
bool a_FromBook =
false);
152 int AddEnchantment(
int a_EnchantmentID,
unsigned int a_Level,
bool a_FromBook);
214 :
public std::vector<cItem>
232 void Set (
int a_Idx,
const cItem & a_Item);
233 void Add (
const cItem & a_Item) {push_back(a_Item); }
234 void Add (
short a_ItemType) { emplace_back(a_ItemType); }
235 void Add (
short a_ItemType,
char a_ItemCount) { emplace_back(a_ItemType, a_ItemCount); }
238 size_t Size (
void)
const {
return size(); }
239 void Set (
int a_Idx,
short a_ItemType,
char a_ItemCount,
short a_ItemDamage);
243 void Add (
short a_ItemType,
char a_ItemCount,
short a_ItemDamage)
245 emplace_back(a_ItemType, a_ItemCount, a_ItemDamage);
std::vector< AString > AStringVector
Class that stores item enchantments or stored-enchantments The enchantments may be serialized to a st...
Class to wrap any random engine to provide a more convenient interface.
void FromJson(const Json::Value &a_Value)
Loads the item data from JSON representation.
cItem & AddCount(char a_AmountToAdd)
Adds the specified count to this object and returns the reference to self (useful for chaining)
const cItemHandler & GetHandler(void) const
Returns the cItemHandler responsible for this item type.
bool IsBothNameAndLoreEmpty(void) const
bool CanHaveEnchantment(int a_EnchantmentID)
Returns whether or not this item is allowed to have the given enchantment.
static bool IsEnchantable(short a_ItemType, bool a_FromBook=false)
Returns true if the specified item type is enchantable.
cEnchantments m_Enchantments
bool IsCustomNameEmpty(void) const
bool EnchantByXPLevels(unsigned a_NumXPLevels, MTRand &a_Random)
Randomly enchants the item using the specified number of XP levels.
bool DamageItem(short a_Amount=1)
Damages a weapon / tool.
unsigned GetEnchantability()
Returns the enchantability of the item.
void GetJson(Json::Value &a_OutValue) const
Saves the item data into JSON representation.
char GetMaxStackSize(void) const
Returns the maximum amount of stacked items of this type.
bool IsEmpty(void) const
Returns true if the item represents an empty stack - either the type is invalid, or count is zero.
bool IsLoreEmpty(void) const
bool IsEqual(const cItem &a_Item) const
int AddEnchantment(int a_EnchantmentID, unsigned int a_Level, bool a_FromBook)
Adds this specific enchantment to this item, returning the cost.
AStringVector m_LoreTable
void Clear(void)
Empties the item and frees up any dynamic storage used by the internals.
int AddEnchantmentsFromItem(const cItem &a_Other)
Adds the enchantments on a_Other to this item, returning the XP cost of the transfer.
void Empty(void)
Empties the item and frees up any dynamic storage used by the internals.
bool IsDamageable(void) const
short GetMaxDamage(void) const
Returns the maximum damage value that this item can have; zero if damage is not applied.
bool IsFullStack(void) const
Returns true if the item is stacked up to its maximum stacking.
cFireworkItem m_FireworkItem
cItem CopyOne(void) const
Returns a copy of this item with m_ItemCount set to 1.
cItem(void)
Creates an empty item.
bool IsSameType(const cItem &a_Item) const
Compares two items for the same type or category.
bool operator()(const cItem &a_Lhs, const cItem &a_Rhs) const
This class bridges a vector of cItem for safe access via Lua.
cItems & operator=(const cItems &)=default
cItems(cItems &&)=default
bool Contains(const cItem &a_Item)
cItems(void)
Need a Lua-accessible constructor.
cItems(const cItems &)=default
void Add(short a_ItemType, char a_ItemCount)
void Add(short a_ItemType)
bool ContainsType(const cItem &a_Item)
void AddItemGrid(const cItemGrid &a_ItemGrid)
Adds a copy of all items in a_ItemGrid.
void Add(const cItem &a_Item)
void Add(short a_ItemType, char a_ItemCount, short a_ItemDamage)
void Set(int a_Idx, const cItem &a_Item)
Used to store loot probability tables.
bool IsEqualTo(const cFireworkItem &a_Item) const