summaryrefslogtreecommitdiffstats
path: root/src/ClientHandle.cpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/ClientHandle.cpp17
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);
+ }
}
}