From 36120db400691be75199ff404e35f5c289b8818f Mon Sep 17 00:00:00 2001 From: daniel0916 Date: Fri, 31 Jan 2014 19:46:51 +0100 Subject: Some updates for enchanting (2) --- src/Item.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/Item.h') diff --git a/src/Item.h b/src/Item.h index 727965112..1a070eafd 100644 --- a/src/Item.h +++ b/src/Item.h @@ -169,6 +169,9 @@ public: /// Returns true if the specified item type is enchantable (as per 1.2.5 protocol requirements) static bool IsEnchantable(short a_ItemType); + /** Fills a_Enchantments with the list of enchantments applicable to the specified item type */ + static void cItem::GetApplicableEnchantmentsForType(short a_ItemType, cEnchantmentsArray & a_Enchantments); + // tolua_begin short m_ItemType; -- cgit v1.2.3 From e6e702e7fdbc8b7475d3dbecc0f81a08304997ae Mon Sep 17 00:00:00 2001 From: daniel0916 Date: Sat, 12 Apr 2014 14:58:46 +0200 Subject: Added complete Enchanting System http://minecraft.gamepedia.com/Enchantment_mechanics --- src/Item.h | 3 --- 1 file changed, 3 deletions(-) (limited to 'src/Item.h') diff --git a/src/Item.h b/src/Item.h index 620c77b29..910ecb382 100644 --- a/src/Item.h +++ b/src/Item.h @@ -175,9 +175,6 @@ public: /** Returns true if the specified item type is enchantable (as per 1.2.5 protocol requirements) */ static bool IsEnchantable(short a_ItemType); // tolua_export - /** Fills a_Enchantments with the list of enchantments applicable to the specified item type */ - static void cItem::GetApplicableEnchantmentsForType(short a_ItemType, cEnchantmentsArray & a_Enchantments); - // tolua_begin short m_ItemType; -- cgit v1.2.3 From f9343a8490b50cb28a62c7327c0013da48ca2745 Mon Sep 17 00:00:00 2001 From: daniel0916 Date: Thu, 17 Apr 2014 13:15:35 +0200 Subject: Modified many things --- src/Item.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/Item.h') diff --git a/src/Item.h b/src/Item.h index 910ecb382..987dea2a9 100644 --- a/src/Item.h +++ b/src/Item.h @@ -175,6 +175,13 @@ public: /** Returns true if the specified item type is enchantable (as per 1.2.5 protocol requirements) */ static bool IsEnchantable(short a_ItemType); // tolua_export + /** Returns the enchantability of the item. When the item hasn't a enchantability, it will returns 0 */ + int GetEnchantability(); // tolua_export + + /** Enchants the item using the specified number of XP levels. + Returns true if item enchanted, false if not. */ + bool EnchantByXPLevels(int a_NumXPLevels, cPlayer & a_Player, bool a_BlockConflictingEnchantments, bool a_DeleteLevelFromPlayer); // tolua_export + // tolua_begin short m_ItemType; -- cgit v1.2.3 From 0086fcfef18db58f3a4509853399c0a9b610e950 Mon Sep 17 00:00:00 2001 From: daniel0916 Date: Thu, 17 Apr 2014 19:31:43 +0200 Subject: Fixed some Errors (not all) --- src/Item.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/Item.h') diff --git a/src/Item.h b/src/Item.h index 987dea2a9..00316c188 100644 --- a/src/Item.h +++ b/src/Item.h @@ -180,7 +180,7 @@ public: /** Enchants the item using the specified number of XP levels. Returns true if item enchanted, false if not. */ - bool EnchantByXPLevels(int a_NumXPLevels, cPlayer & a_Player, bool a_BlockConflictingEnchantments, bool a_DeleteLevelFromPlayer); // tolua_export + bool EnchantByXPLevels(int a_NumXPLevels); // tolua_export // tolua_begin -- cgit v1.2.3 From f2b579077649d5f40e0e60b53e60fe3b4804dada Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Wed, 30 Apr 2014 17:36:51 +0200 Subject: Fixed a warning when an empty item is being created. --- src/Item.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/Item.h') diff --git a/src/Item.h b/src/Item.h index 00316c188..641c681db 100644 --- a/src/Item.h +++ b/src/Item.h @@ -64,7 +64,7 @@ public: { if (!IsValidItem(m_ItemType)) { - if (m_ItemType != E_BLOCK_AIR) + if ((m_ItemType != E_BLOCK_AIR) && (m_ItemType != E_ITEM_EMPTY)) { LOGWARNING("%s: creating an invalid item type (%d), resetting to empty.", __FUNCTION__, a_ItemType); } -- cgit v1.2.3 From b0056cdcf8a36efbed4b97414ebf5741b56a5895 Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Thu, 1 May 2014 22:02:25 +0200 Subject: Removed the explicit copy constructor for cItem. The compiler generates an implicit one with the same contents and warns about it. The function left in for ToLua to generate the binding for it. --- src/Item.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/Item.h') diff --git a/src/Item.h b/src/Item.h index 641c681db..8eb0a1f4e 100644 --- a/src/Item.h +++ b/src/Item.h @@ -73,6 +73,10 @@ public: } + // The constructor is disabled in code, because the compiler generates it anyway, + // but it needs to stay because ToLua needs to generate the binding for it + #if 0 + /** Creates an exact copy of the item */ cItem(const cItem & a_CopyFrom) : m_ItemType (a_CopyFrom.m_ItemType), @@ -85,6 +89,8 @@ public: { } + #endif + void Empty(void) { -- cgit v1.2.3