summaryrefslogtreecommitdiffstats
path: root/src/ClientHandle.cpp
diff options
context:
space:
mode:
authordaniel0916 <theschokolps@gmail.com>2014-01-31 19:46:51 +0100
committerdaniel0916 <theschokolps@gmail.com>2014-01-31 19:46:51 +0100
commit36120db400691be75199ff404e35f5c289b8818f (patch)
tree0547d366be14b96a961331de0f93ae86ff0fa4ae /src/ClientHandle.cpp
parentremoved hook from enchanting commit (diff)
downloadcuberite-36120db400691be75199ff404e35f5c289b8818f.tar
cuberite-36120db400691be75199ff404e35f5c289b8818f.tar.gz
cuberite-36120db400691be75199ff404e35f5c289b8818f.tar.bz2
cuberite-36120db400691be75199ff404e35f5c289b8818f.tar.lz
cuberite-36120db400691be75199ff404e35f5c289b8818f.tar.xz
cuberite-36120db400691be75199ff404e35f5c289b8818f.tar.zst
cuberite-36120db400691be75199ff404e35f5c289b8818f.zip
Diffstat (limited to '')
-rw-r--r--src/ClientHandle.cpp36
1 files changed, 36 insertions, 0 deletions
diff --git a/src/ClientHandle.cpp b/src/ClientHandle.cpp
index 74d192129..979298c59 100644
--- a/src/ClientHandle.cpp
+++ b/src/ClientHandle.cpp
@@ -2453,4 +2453,40 @@ void cClientHandle::SocketClosed(void)
+void cClientHandle::HandleEnchantItem(Byte & WindowID, Byte & Enchantment)
+{
+ //Get Item
+ cItem EnchantItem = m_Player->GetDraggingItem();
+
+ cEnchantmentsArray enchantments;
+ cItem::GetApplicableEnchantmentsForType(EnchantItem.m_ItemType, enchantments);
+
+ m_Player->SendMessage(Printf("ItemType: %d", EnchantItem.m_ItemType));
+
+
+ m_Player->SendMessage(enchantments[1].ToString());
+
+ //shuffle enchantments (i don't know if this is good)
+ std::random_shuffle(enchantments.begin(), enchantments.end());
+
+ m_Player->SendMessage(enchantments[1].ToString());
+
+
+
+
+
+
+ //Enchant Item
+ EnchantItem.m_Enchantments.AddFromString(enchantments[1].ToString());
+
+ //Set Enchanted Item to Window Slot
+ m_Player->GetWindow()->SetSlot(*m_Player, 0, EnchantItem);
+
+ LOGWARN("Item enchanted!");
+}
+
+
+
+
+