diff options
author | daniel0916 <theschokolps@gmail.com> | 2014-04-17 19:31:43 +0200 |
---|---|---|
committer | daniel0916 <theschokolps@gmail.com> | 2014-04-17 19:31:43 +0200 |
commit | 0086fcfef18db58f3a4509853399c0a9b610e950 (patch) | |
tree | fa84dc65a061981a56c3040ef3ff87adb4182885 /src/ClientHandle.cpp | |
parent | Modified many things (diff) | |
download | cuberite-0086fcfef18db58f3a4509853399c0a9b610e950.tar cuberite-0086fcfef18db58f3a4509853399c0a9b610e950.tar.gz cuberite-0086fcfef18db58f3a4509853399c0a9b610e950.tar.bz2 cuberite-0086fcfef18db58f3a4509853399c0a9b610e950.tar.lz cuberite-0086fcfef18db58f3a4509853399c0a9b610e950.tar.xz cuberite-0086fcfef18db58f3a4509853399c0a9b610e950.tar.zst cuberite-0086fcfef18db58f3a4509853399c0a9b610e950.zip |
Diffstat (limited to 'src/ClientHandle.cpp')
-rw-r--r-- | src/ClientHandle.cpp | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/src/ClientHandle.cpp b/src/ClientHandle.cpp index a3d0501c3..eab306a0c 100644 --- a/src/ClientHandle.cpp +++ b/src/ClientHandle.cpp @@ -2735,15 +2735,18 @@ void cClientHandle::HandleEnchantItem(Byte & WindowID, Byte & Enchantment) cItem Item = *Window->m_SlotArea->GetSlot(0, *m_Player); int BaseEnchantmentLevel = Window->GetPropertyValue(Enchantment); - if (Item.EnchantByXPLevels(BaseEnchantmentLevel, *m_Player, true, true)) + if (Item.EnchantByXPLevels(BaseEnchantmentLevel)) { - Window->m_SlotArea->SetSlot(0, *m_Player, Item); - Window->SendSlot(*m_Player, Window->m_SlotArea, 0); - Window->BroadcastWholeWindow(); + if (m_Player->IsGameModeCreative() | m_Player->DeltaExperience(-m_Player->XpForLevel(BaseEnchantmentLevel)) >= 0) + { + Window->m_SlotArea->SetSlot(0, *m_Player, Item); + Window->SendSlot(*m_Player, Window->m_SlotArea, 0); + Window->BroadcastWholeWindow(); - Window->SetProperty(0, 0, *m_Player); - Window->SetProperty(1, 0, *m_Player); - Window->SetProperty(2, 0, *m_Player); + Window->SetProperty(0, 0, *m_Player); + Window->SetProperty(1, 0, *m_Player); + Window->SetProperty(2, 0, *m_Player); + } } } |