summaryrefslogtreecommitdiffstats
path: root/source/Item.cpp
diff options
context:
space:
mode:
authormadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2013-04-11 12:05:53 +0200
committermadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2013-04-11 12:05:53 +0200
commit58fb05980d0abaa955f7fcad672d9af76e679f76 (patch)
tree89665d735eb857ac84c5e7276224052a5dd75393 /source/Item.cpp
parentDispensers rewritten to use ItemGrid (diff)
downloadcuberite-58fb05980d0abaa955f7fcad672d9af76e679f76.tar
cuberite-58fb05980d0abaa955f7fcad672d9af76e679f76.tar.gz
cuberite-58fb05980d0abaa955f7fcad672d9af76e679f76.tar.bz2
cuberite-58fb05980d0abaa955f7fcad672d9af76e679f76.tar.lz
cuberite-58fb05980d0abaa955f7fcad672d9af76e679f76.tar.xz
cuberite-58fb05980d0abaa955f7fcad672d9af76e679f76.tar.zst
cuberite-58fb05980d0abaa955f7fcad672d9af76e679f76.zip
Diffstat (limited to 'source/Item.cpp')
-rw-r--r--source/Item.cpp56
1 files changed, 56 insertions, 0 deletions
diff --git a/source/Item.cpp b/source/Item.cpp
index 15f011c13..fde4f7ba9 100644
--- a/source/Item.cpp
+++ b/source/Item.cpp
@@ -19,6 +19,62 @@ cItem cItem::CopyOne(void) const
+short cItem::GetMaxDamage(void) const
+{
+ switch (m_ItemType)
+ {
+ case E_ITEM_DIAMOND_AXE: return 1563;
+ case E_ITEM_DIAMOND_HOE: return 1563;
+ case E_ITEM_DIAMOND_PICKAXE: return 1563;
+ case E_ITEM_DIAMOND_SHOVEL: return 1563;
+ case E_ITEM_DIAMOND_SWORD: return 1563;
+ case E_ITEM_FLINT_AND_STEEL: return 65;
+ case E_ITEM_GOLD_AXE: return 32;
+ case E_ITEM_GOLD_HOE: return 32;
+ case E_ITEM_GOLD_PICKAXE: return 32;
+ case E_ITEM_GOLD_SHOVEL: return 32;
+ case E_ITEM_GOLD_SWORD: return 32;
+ case E_ITEM_IRON_AXE: return 251;
+ case E_ITEM_IRON_HOE: return 251;
+ case E_ITEM_IRON_PICKAXE: return 251;
+ case E_ITEM_IRON_SHOVEL: return 251;
+ case E_ITEM_IRON_SWORD: return 251;
+ case E_ITEM_SHEARS: return 251;
+ case E_ITEM_STONE_AXE: return 132;
+ case E_ITEM_STONE_HOE: return 132;
+ case E_ITEM_STONE_PICKAXE: return 132;
+ case E_ITEM_STONE_SHOVEL: return 132;
+ case E_ITEM_STONE_SWORD: return 132;
+ case E_ITEM_WOODEN_AXE: return 60;
+ case E_ITEM_WOODEN_HOE: return 60;
+ case E_ITEM_WOODEN_PICKAXE: return 60;
+ case E_ITEM_WOODEN_SHOVEL: return 60;
+ case E_ITEM_WOODEN_SWORD: return 60;
+ }
+ return 0;
+}
+
+
+
+
+
+bool cItem::DamageItem(void)
+{
+ short MaxDamage = GetMaxDamage();
+ if (MaxDamage == 0)
+ {
+ // Item doesn't have damage
+ return false;
+ }
+
+ m_ItemDamage++;
+ return (m_ItemDamage >= MaxDamage);
+}
+
+
+
+
+
bool cItem::IsStackableWith(const cItem & a_OtherStack)
{
if (a_OtherStack.m_ItemType != m_ItemType)