Zero crystal count items should not reward crystals when enchant fails.
This commit is contained in:
@@ -325,8 +325,7 @@ public class RequestEnchantItem implements IClientIncomingPacket
|
|||||||
{
|
{
|
||||||
item.setEnchantLevel(item.getEnchantLevel() - 1);
|
item.setEnchantLevel(item.getEnchantLevel() - 1);
|
||||||
}
|
}
|
||||||
else
|
else // blessed enchant - clear enchant value
|
||||||
// blessed enchant - clear enchant value
|
|
||||||
{
|
{
|
||||||
client.sendPacket(SystemMessageId.THE_BLESSED_ENCHANT_FAILED_THE_ENCHANT_VALUE_OF_THE_ITEM_BECAME_0);
|
client.sendPacket(SystemMessageId.THE_BLESSED_ENCHANT_FAILED_THE_ENCHANT_VALUE_OF_THE_ITEM_BECAME_0);
|
||||||
item.setEnchantLevel(0);
|
item.setEnchantLevel(0);
|
||||||
@@ -359,13 +358,6 @@ public class RequestEnchantItem implements IClientIncomingPacket
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// enchant failed, destroy item
|
// enchant failed, destroy item
|
||||||
final int crystalId = item.getItem().getCrystalItemId();
|
|
||||||
int count = item.getCrystalCount() - ((item.getItem().getCrystalCount() + 1) / 2);
|
|
||||||
if (count < 1)
|
|
||||||
{
|
|
||||||
count = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (player.getInventory().destroyItem("Enchant", item, player, null) == null)
|
if (player.getInventory().destroyItem("Enchant", item, player, null) == null)
|
||||||
{
|
{
|
||||||
// unable to destroy item, cheater ?
|
// unable to destroy item, cheater ?
|
||||||
@@ -398,8 +390,16 @@ public class RequestEnchantItem implements IClientIncomingPacket
|
|||||||
}
|
}
|
||||||
|
|
||||||
World.getInstance().removeObject(item);
|
World.getInstance().removeObject(item);
|
||||||
|
|
||||||
|
int count = 0;
|
||||||
|
if (item.getItem().isCrystallizable())
|
||||||
|
{
|
||||||
|
count = Math.max(0, item.getCrystalCount() - ((item.getItem().getCrystalCount() + 1) / 2));
|
||||||
|
}
|
||||||
|
|
||||||
ItemInstance crystals = null;
|
ItemInstance crystals = null;
|
||||||
if (crystalId != 0)
|
final int crystalId = item.getItem().getCrystalItemId();
|
||||||
|
if (count > 0)
|
||||||
{
|
{
|
||||||
crystals = player.getInventory().addItem("Enchant", crystalId, count, player, item);
|
crystals = player.getInventory().addItem("Enchant", crystalId, count, player, item);
|
||||||
|
|
||||||
@@ -414,7 +414,7 @@ public class RequestEnchantItem implements IClientIncomingPacket
|
|||||||
iu.addItem(crystals);
|
iu.addItem(crystals);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (crystalId == 0)
|
if ((crystalId == 0) || (count == 0))
|
||||||
{
|
{
|
||||||
client.sendPacket(new EnchantResult(EnchantResult.NO_CRYSTAL, 0, 0));
|
client.sendPacket(new EnchantResult(EnchantResult.NO_CRYSTAL, 0, 0));
|
||||||
}
|
}
|
||||||
|
@@ -325,8 +325,7 @@ public class RequestEnchantItem implements IClientIncomingPacket
|
|||||||
{
|
{
|
||||||
item.setEnchantLevel(item.getEnchantLevel() - 1);
|
item.setEnchantLevel(item.getEnchantLevel() - 1);
|
||||||
}
|
}
|
||||||
else
|
else // blessed enchant - clear enchant value
|
||||||
// blessed enchant - clear enchant value
|
|
||||||
{
|
{
|
||||||
client.sendPacket(SystemMessageId.THE_BLESSED_ENCHANT_FAILED_THE_ENCHANT_VALUE_OF_THE_ITEM_BECAME_0);
|
client.sendPacket(SystemMessageId.THE_BLESSED_ENCHANT_FAILED_THE_ENCHANT_VALUE_OF_THE_ITEM_BECAME_0);
|
||||||
item.setEnchantLevel(0);
|
item.setEnchantLevel(0);
|
||||||
@@ -359,13 +358,6 @@ public class RequestEnchantItem implements IClientIncomingPacket
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// enchant failed, destroy item
|
// enchant failed, destroy item
|
||||||
final int crystalId = item.getItem().getCrystalItemId();
|
|
||||||
int count = item.getCrystalCount() - ((item.getItem().getCrystalCount() + 1) / 2);
|
|
||||||
if (count < 1)
|
|
||||||
{
|
|
||||||
count = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (player.getInventory().destroyItem("Enchant", item, player, null) == null)
|
if (player.getInventory().destroyItem("Enchant", item, player, null) == null)
|
||||||
{
|
{
|
||||||
// unable to destroy item, cheater ?
|
// unable to destroy item, cheater ?
|
||||||
@@ -398,8 +390,16 @@ public class RequestEnchantItem implements IClientIncomingPacket
|
|||||||
}
|
}
|
||||||
|
|
||||||
World.getInstance().removeObject(item);
|
World.getInstance().removeObject(item);
|
||||||
|
|
||||||
|
int count = 0;
|
||||||
|
if (item.getItem().isCrystallizable())
|
||||||
|
{
|
||||||
|
count = Math.max(0, item.getCrystalCount() - ((item.getItem().getCrystalCount() + 1) / 2));
|
||||||
|
}
|
||||||
|
|
||||||
ItemInstance crystals = null;
|
ItemInstance crystals = null;
|
||||||
if (crystalId != 0)
|
final int crystalId = item.getItem().getCrystalItemId();
|
||||||
|
if (count > 0)
|
||||||
{
|
{
|
||||||
crystals = player.getInventory().addItem("Enchant", crystalId, count, player, item);
|
crystals = player.getInventory().addItem("Enchant", crystalId, count, player, item);
|
||||||
|
|
||||||
@@ -414,7 +414,7 @@ public class RequestEnchantItem implements IClientIncomingPacket
|
|||||||
iu.addItem(crystals);
|
iu.addItem(crystals);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (crystalId == 0)
|
if ((crystalId == 0) || (count == 0))
|
||||||
{
|
{
|
||||||
client.sendPacket(new EnchantResult(EnchantResult.NO_CRYSTAL, 0, 0));
|
client.sendPacket(new EnchantResult(EnchantResult.NO_CRYSTAL, 0, 0));
|
||||||
}
|
}
|
||||||
|
@@ -325,8 +325,7 @@ public class RequestEnchantItem implements IClientIncomingPacket
|
|||||||
{
|
{
|
||||||
item.setEnchantLevel(item.getEnchantLevel() - 1);
|
item.setEnchantLevel(item.getEnchantLevel() - 1);
|
||||||
}
|
}
|
||||||
else
|
else // blessed enchant - clear enchant value
|
||||||
// blessed enchant - clear enchant value
|
|
||||||
{
|
{
|
||||||
client.sendPacket(SystemMessageId.THE_BLESSED_ENCHANT_FAILED_THE_ENCHANT_VALUE_OF_THE_ITEM_BECAME_0);
|
client.sendPacket(SystemMessageId.THE_BLESSED_ENCHANT_FAILED_THE_ENCHANT_VALUE_OF_THE_ITEM_BECAME_0);
|
||||||
item.setEnchantLevel(0);
|
item.setEnchantLevel(0);
|
||||||
@@ -359,13 +358,6 @@ public class RequestEnchantItem implements IClientIncomingPacket
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// enchant failed, destroy item
|
// enchant failed, destroy item
|
||||||
final int crystalId = item.getItem().getCrystalItemId();
|
|
||||||
int count = item.getCrystalCount() - ((item.getItem().getCrystalCount() + 1) / 2);
|
|
||||||
if (count < 1)
|
|
||||||
{
|
|
||||||
count = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (player.getInventory().destroyItem("Enchant", item, player, null) == null)
|
if (player.getInventory().destroyItem("Enchant", item, player, null) == null)
|
||||||
{
|
{
|
||||||
// unable to destroy item, cheater ?
|
// unable to destroy item, cheater ?
|
||||||
@@ -398,8 +390,16 @@ public class RequestEnchantItem implements IClientIncomingPacket
|
|||||||
}
|
}
|
||||||
|
|
||||||
World.getInstance().removeObject(item);
|
World.getInstance().removeObject(item);
|
||||||
|
|
||||||
|
int count = 0;
|
||||||
|
if (item.getItem().isCrystallizable())
|
||||||
|
{
|
||||||
|
count = Math.max(0, item.getCrystalCount() - ((item.getItem().getCrystalCount() + 1) / 2));
|
||||||
|
}
|
||||||
|
|
||||||
ItemInstance crystals = null;
|
ItemInstance crystals = null;
|
||||||
if (crystalId != 0)
|
final int crystalId = item.getItem().getCrystalItemId();
|
||||||
|
if (count > 0)
|
||||||
{
|
{
|
||||||
crystals = player.getInventory().addItem("Enchant", crystalId, count, player, item);
|
crystals = player.getInventory().addItem("Enchant", crystalId, count, player, item);
|
||||||
|
|
||||||
@@ -414,7 +414,7 @@ public class RequestEnchantItem implements IClientIncomingPacket
|
|||||||
iu.addItem(crystals);
|
iu.addItem(crystals);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (crystalId == 0)
|
if ((crystalId == 0) || (count == 0))
|
||||||
{
|
{
|
||||||
client.sendPacket(new EnchantResult(EnchantResult.NO_CRYSTAL, 0, 0));
|
client.sendPacket(new EnchantResult(EnchantResult.NO_CRYSTAL, 0, 0));
|
||||||
}
|
}
|
||||||
|
@@ -325,8 +325,7 @@ public class RequestEnchantItem implements IClientIncomingPacket
|
|||||||
{
|
{
|
||||||
item.setEnchantLevel(item.getEnchantLevel() - 1);
|
item.setEnchantLevel(item.getEnchantLevel() - 1);
|
||||||
}
|
}
|
||||||
else
|
else // blessed enchant - clear enchant value
|
||||||
// blessed enchant - clear enchant value
|
|
||||||
{
|
{
|
||||||
client.sendPacket(SystemMessageId.THE_BLESSED_ENCHANT_FAILED_THE_ENCHANT_VALUE_OF_THE_ITEM_BECAME_0);
|
client.sendPacket(SystemMessageId.THE_BLESSED_ENCHANT_FAILED_THE_ENCHANT_VALUE_OF_THE_ITEM_BECAME_0);
|
||||||
item.setEnchantLevel(0);
|
item.setEnchantLevel(0);
|
||||||
@@ -359,13 +358,6 @@ public class RequestEnchantItem implements IClientIncomingPacket
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// enchant failed, destroy item
|
// enchant failed, destroy item
|
||||||
final int crystalId = item.getItem().getCrystalItemId();
|
|
||||||
int count = item.getCrystalCount() - ((item.getItem().getCrystalCount() + 1) / 2);
|
|
||||||
if (count < 1)
|
|
||||||
{
|
|
||||||
count = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (player.getInventory().destroyItem("Enchant", item, player, null) == null)
|
if (player.getInventory().destroyItem("Enchant", item, player, null) == null)
|
||||||
{
|
{
|
||||||
// unable to destroy item, cheater ?
|
// unable to destroy item, cheater ?
|
||||||
@@ -398,8 +390,16 @@ public class RequestEnchantItem implements IClientIncomingPacket
|
|||||||
}
|
}
|
||||||
|
|
||||||
World.getInstance().removeObject(item);
|
World.getInstance().removeObject(item);
|
||||||
|
|
||||||
|
int count = 0;
|
||||||
|
if (item.getItem().isCrystallizable())
|
||||||
|
{
|
||||||
|
count = Math.max(0, item.getCrystalCount() - ((item.getItem().getCrystalCount() + 1) / 2));
|
||||||
|
}
|
||||||
|
|
||||||
ItemInstance crystals = null;
|
ItemInstance crystals = null;
|
||||||
if (crystalId != 0)
|
final int crystalId = item.getItem().getCrystalItemId();
|
||||||
|
if (count > 0)
|
||||||
{
|
{
|
||||||
crystals = player.getInventory().addItem("Enchant", crystalId, count, player, item);
|
crystals = player.getInventory().addItem("Enchant", crystalId, count, player, item);
|
||||||
|
|
||||||
@@ -414,7 +414,7 @@ public class RequestEnchantItem implements IClientIncomingPacket
|
|||||||
iu.addItem(crystals);
|
iu.addItem(crystals);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (crystalId == 0)
|
if ((crystalId == 0) || (count == 0))
|
||||||
{
|
{
|
||||||
client.sendPacket(new EnchantResult(EnchantResult.NO_CRYSTAL, 0, 0));
|
client.sendPacket(new EnchantResult(EnchantResult.NO_CRYSTAL, 0, 0));
|
||||||
}
|
}
|
||||||
|
@@ -325,8 +325,7 @@ public class RequestEnchantItem implements IClientIncomingPacket
|
|||||||
{
|
{
|
||||||
item.setEnchantLevel(item.getEnchantLevel() - 1);
|
item.setEnchantLevel(item.getEnchantLevel() - 1);
|
||||||
}
|
}
|
||||||
else
|
else // blessed enchant - clear enchant value
|
||||||
// blessed enchant - clear enchant value
|
|
||||||
{
|
{
|
||||||
client.sendPacket(SystemMessageId.THE_BLESSED_ENCHANT_FAILED_THE_ENCHANT_VALUE_OF_THE_ITEM_BECAME_0);
|
client.sendPacket(SystemMessageId.THE_BLESSED_ENCHANT_FAILED_THE_ENCHANT_VALUE_OF_THE_ITEM_BECAME_0);
|
||||||
item.setEnchantLevel(0);
|
item.setEnchantLevel(0);
|
||||||
@@ -359,13 +358,6 @@ public class RequestEnchantItem implements IClientIncomingPacket
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// enchant failed, destroy item
|
// enchant failed, destroy item
|
||||||
final int crystalId = item.getItem().getCrystalItemId();
|
|
||||||
int count = item.getCrystalCount() - ((item.getItem().getCrystalCount() + 1) / 2);
|
|
||||||
if (count < 1)
|
|
||||||
{
|
|
||||||
count = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (player.getInventory().destroyItem("Enchant", item, player, null) == null)
|
if (player.getInventory().destroyItem("Enchant", item, player, null) == null)
|
||||||
{
|
{
|
||||||
// unable to destroy item, cheater ?
|
// unable to destroy item, cheater ?
|
||||||
@@ -398,8 +390,16 @@ public class RequestEnchantItem implements IClientIncomingPacket
|
|||||||
}
|
}
|
||||||
|
|
||||||
World.getInstance().removeObject(item);
|
World.getInstance().removeObject(item);
|
||||||
|
|
||||||
|
int count = 0;
|
||||||
|
if (item.getItem().isCrystallizable())
|
||||||
|
{
|
||||||
|
count = Math.max(0, item.getCrystalCount() - ((item.getItem().getCrystalCount() + 1) / 2));
|
||||||
|
}
|
||||||
|
|
||||||
ItemInstance crystals = null;
|
ItemInstance crystals = null;
|
||||||
if (crystalId != 0)
|
final int crystalId = item.getItem().getCrystalItemId();
|
||||||
|
if (count > 0)
|
||||||
{
|
{
|
||||||
crystals = player.getInventory().addItem("Enchant", crystalId, count, player, item);
|
crystals = player.getInventory().addItem("Enchant", crystalId, count, player, item);
|
||||||
|
|
||||||
@@ -414,7 +414,7 @@ public class RequestEnchantItem implements IClientIncomingPacket
|
|||||||
iu.addItem(crystals);
|
iu.addItem(crystals);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (crystalId == 0)
|
if ((crystalId == 0) || (count == 0))
|
||||||
{
|
{
|
||||||
client.sendPacket(new EnchantResult(EnchantResult.NO_CRYSTAL, 0, 0));
|
client.sendPacket(new EnchantResult(EnchantResult.NO_CRYSTAL, 0, 0));
|
||||||
}
|
}
|
||||||
|
@@ -325,8 +325,7 @@ public class RequestEnchantItem implements IClientIncomingPacket
|
|||||||
{
|
{
|
||||||
item.setEnchantLevel(item.getEnchantLevel() - 1);
|
item.setEnchantLevel(item.getEnchantLevel() - 1);
|
||||||
}
|
}
|
||||||
else
|
else // blessed enchant - clear enchant value
|
||||||
// blessed enchant - clear enchant value
|
|
||||||
{
|
{
|
||||||
client.sendPacket(SystemMessageId.THE_BLESSED_ENCHANT_FAILED_THE_ENCHANT_VALUE_OF_THE_ITEM_BECAME_0);
|
client.sendPacket(SystemMessageId.THE_BLESSED_ENCHANT_FAILED_THE_ENCHANT_VALUE_OF_THE_ITEM_BECAME_0);
|
||||||
item.setEnchantLevel(0);
|
item.setEnchantLevel(0);
|
||||||
@@ -359,13 +358,6 @@ public class RequestEnchantItem implements IClientIncomingPacket
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// enchant failed, destroy item
|
// enchant failed, destroy item
|
||||||
final int crystalId = item.getItem().getCrystalItemId();
|
|
||||||
int count = item.getCrystalCount() - ((item.getItem().getCrystalCount() + 1) / 2);
|
|
||||||
if (count < 1)
|
|
||||||
{
|
|
||||||
count = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (player.getInventory().destroyItem("Enchant", item, player, null) == null)
|
if (player.getInventory().destroyItem("Enchant", item, player, null) == null)
|
||||||
{
|
{
|
||||||
// unable to destroy item, cheater ?
|
// unable to destroy item, cheater ?
|
||||||
@@ -398,8 +390,16 @@ public class RequestEnchantItem implements IClientIncomingPacket
|
|||||||
}
|
}
|
||||||
|
|
||||||
World.getInstance().removeObject(item);
|
World.getInstance().removeObject(item);
|
||||||
|
|
||||||
|
int count = 0;
|
||||||
|
if (item.getItem().isCrystallizable())
|
||||||
|
{
|
||||||
|
count = Math.max(0, item.getCrystalCount() - ((item.getItem().getCrystalCount() + 1) / 2));
|
||||||
|
}
|
||||||
|
|
||||||
ItemInstance crystals = null;
|
ItemInstance crystals = null;
|
||||||
if (crystalId != 0)
|
final int crystalId = item.getItem().getCrystalItemId();
|
||||||
|
if (count > 0)
|
||||||
{
|
{
|
||||||
crystals = player.getInventory().addItem("Enchant", crystalId, count, player, item);
|
crystals = player.getInventory().addItem("Enchant", crystalId, count, player, item);
|
||||||
|
|
||||||
@@ -414,7 +414,7 @@ public class RequestEnchantItem implements IClientIncomingPacket
|
|||||||
iu.addItem(crystals);
|
iu.addItem(crystals);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (crystalId == 0)
|
if ((crystalId == 0) || (count == 0))
|
||||||
{
|
{
|
||||||
client.sendPacket(new EnchantResult(EnchantResult.NO_CRYSTAL, 0, 0));
|
client.sendPacket(new EnchantResult(EnchantResult.NO_CRYSTAL, 0, 0));
|
||||||
}
|
}
|
||||||
|
@@ -327,8 +327,7 @@ public class RequestEnchantItem implements IClientIncomingPacket
|
|||||||
{
|
{
|
||||||
item.setEnchantLevel(item.getEnchantLevel() - 1);
|
item.setEnchantLevel(item.getEnchantLevel() - 1);
|
||||||
}
|
}
|
||||||
else
|
else // blessed enchant - clear enchant value
|
||||||
// blessed enchant - clear enchant value
|
|
||||||
{
|
{
|
||||||
client.sendPacket(SystemMessageId.THE_BLESSED_ENCHANT_FAILED_THE_ENCHANT_VALUE_OF_THE_ITEM_BECAME_0);
|
client.sendPacket(SystemMessageId.THE_BLESSED_ENCHANT_FAILED_THE_ENCHANT_VALUE_OF_THE_ITEM_BECAME_0);
|
||||||
item.setEnchantLevel(0);
|
item.setEnchantLevel(0);
|
||||||
@@ -361,13 +360,6 @@ public class RequestEnchantItem implements IClientIncomingPacket
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// enchant failed, destroy item
|
// enchant failed, destroy item
|
||||||
final int crystalId = item.getItem().getCrystalItemId();
|
|
||||||
int count = item.getCrystalCount() - ((item.getItem().getCrystalCount() + 1) / 2);
|
|
||||||
if (count < 1)
|
|
||||||
{
|
|
||||||
count = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (player.getInventory().destroyItem("Enchant", item, player, null) == null)
|
if (player.getInventory().destroyItem("Enchant", item, player, null) == null)
|
||||||
{
|
{
|
||||||
// unable to destroy item, cheater ?
|
// unable to destroy item, cheater ?
|
||||||
@@ -400,8 +392,16 @@ public class RequestEnchantItem implements IClientIncomingPacket
|
|||||||
}
|
}
|
||||||
|
|
||||||
World.getInstance().removeObject(item);
|
World.getInstance().removeObject(item);
|
||||||
|
|
||||||
|
int count = 0;
|
||||||
|
if (item.getItem().isCrystallizable())
|
||||||
|
{
|
||||||
|
count = Math.max(0, item.getCrystalCount() - ((item.getItem().getCrystalCount() + 1) / 2));
|
||||||
|
}
|
||||||
|
|
||||||
ItemInstance crystals = null;
|
ItemInstance crystals = null;
|
||||||
if (crystalId != 0)
|
final int crystalId = item.getItem().getCrystalItemId();
|
||||||
|
if (count > 0)
|
||||||
{
|
{
|
||||||
crystals = player.getInventory().addItem("Enchant", crystalId, count, player, item);
|
crystals = player.getInventory().addItem("Enchant", crystalId, count, player, item);
|
||||||
|
|
||||||
@@ -416,7 +416,7 @@ public class RequestEnchantItem implements IClientIncomingPacket
|
|||||||
iu.addItem(crystals);
|
iu.addItem(crystals);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (crystalId == 0)
|
if ((crystalId == 0) || (count == 0))
|
||||||
{
|
{
|
||||||
client.sendPacket(new EnchantResult(EnchantResult.NO_CRYSTAL, 0, 0));
|
client.sendPacket(new EnchantResult(EnchantResult.NO_CRYSTAL, 0, 0));
|
||||||
}
|
}
|
||||||
|
@@ -327,8 +327,7 @@ public class RequestEnchantItem implements IClientIncomingPacket
|
|||||||
{
|
{
|
||||||
item.setEnchantLevel(item.getEnchantLevel() - 1);
|
item.setEnchantLevel(item.getEnchantLevel() - 1);
|
||||||
}
|
}
|
||||||
else
|
else // blessed enchant - clear enchant value
|
||||||
// blessed enchant - clear enchant value
|
|
||||||
{
|
{
|
||||||
client.sendPacket(SystemMessageId.THE_BLESSED_ENCHANT_FAILED_THE_ENCHANT_VALUE_OF_THE_ITEM_BECAME_0);
|
client.sendPacket(SystemMessageId.THE_BLESSED_ENCHANT_FAILED_THE_ENCHANT_VALUE_OF_THE_ITEM_BECAME_0);
|
||||||
item.setEnchantLevel(0);
|
item.setEnchantLevel(0);
|
||||||
@@ -361,13 +360,6 @@ public class RequestEnchantItem implements IClientIncomingPacket
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// enchant failed, destroy item
|
// enchant failed, destroy item
|
||||||
final int crystalId = item.getItem().getCrystalItemId();
|
|
||||||
int count = item.getCrystalCount() - ((item.getItem().getCrystalCount() + 1) / 2);
|
|
||||||
if (count < 1)
|
|
||||||
{
|
|
||||||
count = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (player.getInventory().destroyItem("Enchant", item, player, null) == null)
|
if (player.getInventory().destroyItem("Enchant", item, player, null) == null)
|
||||||
{
|
{
|
||||||
// unable to destroy item, cheater ?
|
// unable to destroy item, cheater ?
|
||||||
@@ -400,8 +392,16 @@ public class RequestEnchantItem implements IClientIncomingPacket
|
|||||||
}
|
}
|
||||||
|
|
||||||
World.getInstance().removeObject(item);
|
World.getInstance().removeObject(item);
|
||||||
|
|
||||||
|
int count = 0;
|
||||||
|
if (item.getItem().isCrystallizable())
|
||||||
|
{
|
||||||
|
count = Math.max(0, item.getCrystalCount() - ((item.getItem().getCrystalCount() + 1) / 2));
|
||||||
|
}
|
||||||
|
|
||||||
ItemInstance crystals = null;
|
ItemInstance crystals = null;
|
||||||
if (crystalId != 0)
|
final int crystalId = item.getItem().getCrystalItemId();
|
||||||
|
if (count > 0)
|
||||||
{
|
{
|
||||||
crystals = player.getInventory().addItem("Enchant", crystalId, count, player, item);
|
crystals = player.getInventory().addItem("Enchant", crystalId, count, player, item);
|
||||||
|
|
||||||
@@ -416,7 +416,7 @@ public class RequestEnchantItem implements IClientIncomingPacket
|
|||||||
iu.addItem(crystals);
|
iu.addItem(crystals);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (crystalId == 0)
|
if ((crystalId == 0) || (count == 0))
|
||||||
{
|
{
|
||||||
client.sendPacket(new EnchantResult(EnchantResult.NO_CRYSTAL, 0, 0));
|
client.sendPacket(new EnchantResult(EnchantResult.NO_CRYSTAL, 0, 0));
|
||||||
}
|
}
|
||||||
|
@@ -327,8 +327,7 @@ public class RequestEnchantItem implements IClientIncomingPacket
|
|||||||
{
|
{
|
||||||
item.setEnchantLevel(item.getEnchantLevel() - 1);
|
item.setEnchantLevel(item.getEnchantLevel() - 1);
|
||||||
}
|
}
|
||||||
else
|
else // blessed enchant - clear enchant value
|
||||||
// blessed enchant - clear enchant value
|
|
||||||
{
|
{
|
||||||
client.sendPacket(SystemMessageId.THE_BLESSED_ENCHANT_FAILED_THE_ENCHANT_VALUE_OF_THE_ITEM_BECAME_0);
|
client.sendPacket(SystemMessageId.THE_BLESSED_ENCHANT_FAILED_THE_ENCHANT_VALUE_OF_THE_ITEM_BECAME_0);
|
||||||
item.setEnchantLevel(0);
|
item.setEnchantLevel(0);
|
||||||
@@ -361,13 +360,6 @@ public class RequestEnchantItem implements IClientIncomingPacket
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// enchant failed, destroy item
|
// enchant failed, destroy item
|
||||||
final int crystalId = item.getItem().getCrystalItemId();
|
|
||||||
int count = item.getCrystalCount() - ((item.getItem().getCrystalCount() + 1) / 2);
|
|
||||||
if (count < 1)
|
|
||||||
{
|
|
||||||
count = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (player.getInventory().destroyItem("Enchant", item, player, null) == null)
|
if (player.getInventory().destroyItem("Enchant", item, player, null) == null)
|
||||||
{
|
{
|
||||||
// unable to destroy item, cheater ?
|
// unable to destroy item, cheater ?
|
||||||
@@ -400,8 +392,16 @@ public class RequestEnchantItem implements IClientIncomingPacket
|
|||||||
}
|
}
|
||||||
|
|
||||||
World.getInstance().removeObject(item);
|
World.getInstance().removeObject(item);
|
||||||
|
|
||||||
|
int count = 0;
|
||||||
|
if (item.getItem().isCrystallizable())
|
||||||
|
{
|
||||||
|
count = Math.max(0, item.getCrystalCount() - ((item.getItem().getCrystalCount() + 1) / 2));
|
||||||
|
}
|
||||||
|
|
||||||
ItemInstance crystals = null;
|
ItemInstance crystals = null;
|
||||||
if (crystalId != 0)
|
final int crystalId = item.getItem().getCrystalItemId();
|
||||||
|
if (count > 0)
|
||||||
{
|
{
|
||||||
crystals = player.getInventory().addItem("Enchant", crystalId, count, player, item);
|
crystals = player.getInventory().addItem("Enchant", crystalId, count, player, item);
|
||||||
|
|
||||||
@@ -416,7 +416,7 @@ public class RequestEnchantItem implements IClientIncomingPacket
|
|||||||
iu.addItem(crystals);
|
iu.addItem(crystals);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (crystalId == 0)
|
if ((crystalId == 0) || (count == 0))
|
||||||
{
|
{
|
||||||
client.sendPacket(new EnchantResult(EnchantResult.NO_CRYSTAL, 0, 0));
|
client.sendPacket(new EnchantResult(EnchantResult.NO_CRYSTAL, 0, 0));
|
||||||
}
|
}
|
||||||
|
@@ -325,8 +325,7 @@ public class RequestEnchantItem implements IClientIncomingPacket
|
|||||||
{
|
{
|
||||||
item.setEnchantLevel(item.getEnchantLevel() - 1);
|
item.setEnchantLevel(item.getEnchantLevel() - 1);
|
||||||
}
|
}
|
||||||
else
|
else // blessed enchant - clear enchant value
|
||||||
// blessed enchant - clear enchant value
|
|
||||||
{
|
{
|
||||||
client.sendPacket(SystemMessageId.THE_BLESSED_ENCHANT_FAILED_THE_ENCHANT_VALUE_OF_THE_ITEM_BECAME_0);
|
client.sendPacket(SystemMessageId.THE_BLESSED_ENCHANT_FAILED_THE_ENCHANT_VALUE_OF_THE_ITEM_BECAME_0);
|
||||||
item.setEnchantLevel(0);
|
item.setEnchantLevel(0);
|
||||||
@@ -359,13 +358,6 @@ public class RequestEnchantItem implements IClientIncomingPacket
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// enchant failed, destroy item
|
// enchant failed, destroy item
|
||||||
final int crystalId = item.getItem().getCrystalItemId();
|
|
||||||
int count = item.getCrystalCount() - ((item.getItem().getCrystalCount() + 1) / 2);
|
|
||||||
if (count < 1)
|
|
||||||
{
|
|
||||||
count = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (player.getInventory().destroyItem("Enchant", item, player, null) == null)
|
if (player.getInventory().destroyItem("Enchant", item, player, null) == null)
|
||||||
{
|
{
|
||||||
// unable to destroy item, cheater ?
|
// unable to destroy item, cheater ?
|
||||||
@@ -398,8 +390,16 @@ public class RequestEnchantItem implements IClientIncomingPacket
|
|||||||
}
|
}
|
||||||
|
|
||||||
World.getInstance().removeObject(item);
|
World.getInstance().removeObject(item);
|
||||||
|
|
||||||
|
int count = 0;
|
||||||
|
if (item.getItem().isCrystallizable())
|
||||||
|
{
|
||||||
|
count = Math.max(0, item.getCrystalCount() - ((item.getItem().getCrystalCount() + 1) / 2));
|
||||||
|
}
|
||||||
|
|
||||||
ItemInstance crystals = null;
|
ItemInstance crystals = null;
|
||||||
if (crystalId != 0)
|
final int crystalId = item.getItem().getCrystalItemId();
|
||||||
|
if (count > 0)
|
||||||
{
|
{
|
||||||
crystals = player.getInventory().addItem("Enchant", crystalId, count, player, item);
|
crystals = player.getInventory().addItem("Enchant", crystalId, count, player, item);
|
||||||
|
|
||||||
@@ -414,7 +414,7 @@ public class RequestEnchantItem implements IClientIncomingPacket
|
|||||||
iu.addItem(crystals);
|
iu.addItem(crystals);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (crystalId == 0)
|
if ((crystalId == 0) || (count == 0))
|
||||||
{
|
{
|
||||||
client.sendPacket(new EnchantResult(EnchantResult.NO_CRYSTAL, 0, 0));
|
client.sendPacket(new EnchantResult(EnchantResult.NO_CRYSTAL, 0, 0));
|
||||||
}
|
}
|
||||||
|
@@ -325,8 +325,7 @@ public class RequestEnchantItem implements IClientIncomingPacket
|
|||||||
{
|
{
|
||||||
item.setEnchantLevel(item.getEnchantLevel() - 1);
|
item.setEnchantLevel(item.getEnchantLevel() - 1);
|
||||||
}
|
}
|
||||||
else
|
else // blessed enchant - clear enchant value
|
||||||
// blessed enchant - clear enchant value
|
|
||||||
{
|
{
|
||||||
client.sendPacket(SystemMessageId.THE_BLESSED_ENCHANT_FAILED_THE_ENCHANT_VALUE_OF_THE_ITEM_BECAME_0);
|
client.sendPacket(SystemMessageId.THE_BLESSED_ENCHANT_FAILED_THE_ENCHANT_VALUE_OF_THE_ITEM_BECAME_0);
|
||||||
item.setEnchantLevel(0);
|
item.setEnchantLevel(0);
|
||||||
@@ -359,13 +358,6 @@ public class RequestEnchantItem implements IClientIncomingPacket
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// enchant failed, destroy item
|
// enchant failed, destroy item
|
||||||
final int crystalId = item.getItem().getCrystalItemId();
|
|
||||||
int count = item.getCrystalCount() - ((item.getItem().getCrystalCount() + 1) / 2);
|
|
||||||
if (count < 1)
|
|
||||||
{
|
|
||||||
count = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (player.getInventory().destroyItem("Enchant", item, player, null) == null)
|
if (player.getInventory().destroyItem("Enchant", item, player, null) == null)
|
||||||
{
|
{
|
||||||
// unable to destroy item, cheater ?
|
// unable to destroy item, cheater ?
|
||||||
@@ -398,8 +390,16 @@ public class RequestEnchantItem implements IClientIncomingPacket
|
|||||||
}
|
}
|
||||||
|
|
||||||
World.getInstance().removeObject(item);
|
World.getInstance().removeObject(item);
|
||||||
|
|
||||||
|
int count = 0;
|
||||||
|
if (item.getItem().isCrystallizable())
|
||||||
|
{
|
||||||
|
count = Math.max(0, item.getCrystalCount() - ((item.getItem().getCrystalCount() + 1) / 2));
|
||||||
|
}
|
||||||
|
|
||||||
ItemInstance crystals = null;
|
ItemInstance crystals = null;
|
||||||
if (crystalId != 0)
|
final int crystalId = item.getItem().getCrystalItemId();
|
||||||
|
if (count > 0)
|
||||||
{
|
{
|
||||||
crystals = player.getInventory().addItem("Enchant", crystalId, count, player, item);
|
crystals = player.getInventory().addItem("Enchant", crystalId, count, player, item);
|
||||||
|
|
||||||
@@ -414,7 +414,7 @@ public class RequestEnchantItem implements IClientIncomingPacket
|
|||||||
iu.addItem(crystals);
|
iu.addItem(crystals);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (crystalId == 0)
|
if ((crystalId == 0) || (count == 0))
|
||||||
{
|
{
|
||||||
client.sendPacket(new EnchantResult(EnchantResult.NO_CRYSTAL, 0, 0));
|
client.sendPacket(new EnchantResult(EnchantResult.NO_CRYSTAL, 0, 0));
|
||||||
}
|
}
|
||||||
|
@@ -325,8 +325,7 @@ public class RequestEnchantItem implements IClientIncomingPacket
|
|||||||
{
|
{
|
||||||
item.setEnchantLevel(item.getEnchantLevel() - 1);
|
item.setEnchantLevel(item.getEnchantLevel() - 1);
|
||||||
}
|
}
|
||||||
else
|
else // blessed enchant - clear enchant value
|
||||||
// blessed enchant - clear enchant value
|
|
||||||
{
|
{
|
||||||
client.sendPacket(SystemMessageId.THE_BLESSED_ENCHANT_FAILED_THE_ENCHANT_VALUE_OF_THE_ITEM_BECAME_0);
|
client.sendPacket(SystemMessageId.THE_BLESSED_ENCHANT_FAILED_THE_ENCHANT_VALUE_OF_THE_ITEM_BECAME_0);
|
||||||
item.setEnchantLevel(0);
|
item.setEnchantLevel(0);
|
||||||
@@ -359,13 +358,6 @@ public class RequestEnchantItem implements IClientIncomingPacket
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// enchant failed, destroy item
|
// enchant failed, destroy item
|
||||||
final int crystalId = item.getItem().getCrystalItemId();
|
|
||||||
int count = item.getCrystalCount() - ((item.getItem().getCrystalCount() + 1) / 2);
|
|
||||||
if (count < 1)
|
|
||||||
{
|
|
||||||
count = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (player.getInventory().destroyItem("Enchant", item, player, null) == null)
|
if (player.getInventory().destroyItem("Enchant", item, player, null) == null)
|
||||||
{
|
{
|
||||||
// unable to destroy item, cheater ?
|
// unable to destroy item, cheater ?
|
||||||
@@ -398,8 +390,16 @@ public class RequestEnchantItem implements IClientIncomingPacket
|
|||||||
}
|
}
|
||||||
|
|
||||||
World.getInstance().removeObject(item);
|
World.getInstance().removeObject(item);
|
||||||
|
|
||||||
|
int count = 0;
|
||||||
|
if (item.getItem().isCrystallizable())
|
||||||
|
{
|
||||||
|
count = Math.max(0, item.getCrystalCount() - ((item.getItem().getCrystalCount() + 1) / 2));
|
||||||
|
}
|
||||||
|
|
||||||
ItemInstance crystals = null;
|
ItemInstance crystals = null;
|
||||||
if (crystalId != 0)
|
final int crystalId = item.getItem().getCrystalItemId();
|
||||||
|
if (count > 0)
|
||||||
{
|
{
|
||||||
crystals = player.getInventory().addItem("Enchant", crystalId, count, player, item);
|
crystals = player.getInventory().addItem("Enchant", crystalId, count, player, item);
|
||||||
|
|
||||||
@@ -414,7 +414,7 @@ public class RequestEnchantItem implements IClientIncomingPacket
|
|||||||
iu.addItem(crystals);
|
iu.addItem(crystals);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (crystalId == 0)
|
if ((crystalId == 0) || (count == 0))
|
||||||
{
|
{
|
||||||
client.sendPacket(new EnchantResult(EnchantResult.NO_CRYSTAL, 0, 0));
|
client.sendPacket(new EnchantResult(EnchantResult.NO_CRYSTAL, 0, 0));
|
||||||
}
|
}
|
||||||
|
@@ -325,8 +325,7 @@ public class RequestEnchantItem implements IClientIncomingPacket
|
|||||||
{
|
{
|
||||||
item.setEnchantLevel(item.getEnchantLevel() - 1);
|
item.setEnchantLevel(item.getEnchantLevel() - 1);
|
||||||
}
|
}
|
||||||
else
|
else // blessed enchant - clear enchant value
|
||||||
// blessed enchant - clear enchant value
|
|
||||||
{
|
{
|
||||||
client.sendPacket(SystemMessageId.THE_BLESSED_ENCHANT_FAILED_THE_ENCHANT_VALUE_OF_THE_ITEM_BECAME_0);
|
client.sendPacket(SystemMessageId.THE_BLESSED_ENCHANT_FAILED_THE_ENCHANT_VALUE_OF_THE_ITEM_BECAME_0);
|
||||||
item.setEnchantLevel(0);
|
item.setEnchantLevel(0);
|
||||||
@@ -359,13 +358,6 @@ public class RequestEnchantItem implements IClientIncomingPacket
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// enchant failed, destroy item
|
// enchant failed, destroy item
|
||||||
final int crystalId = item.getItem().getCrystalItemId();
|
|
||||||
int count = item.getCrystalCount() - ((item.getItem().getCrystalCount() + 1) / 2);
|
|
||||||
if (count < 1)
|
|
||||||
{
|
|
||||||
count = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (player.getInventory().destroyItem("Enchant", item, player, null) == null)
|
if (player.getInventory().destroyItem("Enchant", item, player, null) == null)
|
||||||
{
|
{
|
||||||
// unable to destroy item, cheater ?
|
// unable to destroy item, cheater ?
|
||||||
@@ -398,8 +390,16 @@ public class RequestEnchantItem implements IClientIncomingPacket
|
|||||||
}
|
}
|
||||||
|
|
||||||
World.getInstance().removeObject(item);
|
World.getInstance().removeObject(item);
|
||||||
|
|
||||||
|
int count = 0;
|
||||||
|
if (item.getItem().isCrystallizable())
|
||||||
|
{
|
||||||
|
count = Math.max(0, item.getCrystalCount() - ((item.getItem().getCrystalCount() + 1) / 2));
|
||||||
|
}
|
||||||
|
|
||||||
ItemInstance crystals = null;
|
ItemInstance crystals = null;
|
||||||
if (crystalId != 0)
|
final int crystalId = item.getItem().getCrystalItemId();
|
||||||
|
if (count > 0)
|
||||||
{
|
{
|
||||||
crystals = player.getInventory().addItem("Enchant", crystalId, count, player, item);
|
crystals = player.getInventory().addItem("Enchant", crystalId, count, player, item);
|
||||||
|
|
||||||
@@ -414,7 +414,7 @@ public class RequestEnchantItem implements IClientIncomingPacket
|
|||||||
iu.addItem(crystals);
|
iu.addItem(crystals);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (crystalId == 0)
|
if ((crystalId == 0) || (count == 0))
|
||||||
{
|
{
|
||||||
client.sendPacket(new EnchantResult(EnchantResult.NO_CRYSTAL, 0, 0));
|
client.sendPacket(new EnchantResult(EnchantResult.NO_CRYSTAL, 0, 0));
|
||||||
}
|
}
|
||||||
|
@@ -327,8 +327,7 @@ public class RequestEnchantItem implements IClientIncomingPacket
|
|||||||
{
|
{
|
||||||
item.setEnchantLevel(item.getEnchantLevel() - 1);
|
item.setEnchantLevel(item.getEnchantLevel() - 1);
|
||||||
}
|
}
|
||||||
else
|
else // blessed enchant - clear enchant value
|
||||||
// blessed enchant - clear enchant value
|
|
||||||
{
|
{
|
||||||
client.sendPacket(SystemMessageId.THE_BLESSED_ENCHANT_FAILED_THE_ENCHANT_VALUE_OF_THE_ITEM_BECAME_0);
|
client.sendPacket(SystemMessageId.THE_BLESSED_ENCHANT_FAILED_THE_ENCHANT_VALUE_OF_THE_ITEM_BECAME_0);
|
||||||
item.setEnchantLevel(0);
|
item.setEnchantLevel(0);
|
||||||
@@ -361,13 +360,6 @@ public class RequestEnchantItem implements IClientIncomingPacket
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// enchant failed, destroy item
|
// enchant failed, destroy item
|
||||||
final int crystalId = item.getItem().getCrystalItemId();
|
|
||||||
int count = item.getCrystalCount() - ((item.getItem().getCrystalCount() + 1) / 2);
|
|
||||||
if (count < 1)
|
|
||||||
{
|
|
||||||
count = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (player.getInventory().destroyItem("Enchant", item, player, null) == null)
|
if (player.getInventory().destroyItem("Enchant", item, player, null) == null)
|
||||||
{
|
{
|
||||||
// unable to destroy item, cheater ?
|
// unable to destroy item, cheater ?
|
||||||
@@ -400,8 +392,16 @@ public class RequestEnchantItem implements IClientIncomingPacket
|
|||||||
}
|
}
|
||||||
|
|
||||||
World.getInstance().removeObject(item);
|
World.getInstance().removeObject(item);
|
||||||
|
|
||||||
|
int count = 0;
|
||||||
|
if (item.getItem().isCrystallizable())
|
||||||
|
{
|
||||||
|
count = Math.max(0, item.getCrystalCount() - ((item.getItem().getCrystalCount() + 1) / 2));
|
||||||
|
}
|
||||||
|
|
||||||
ItemInstance crystals = null;
|
ItemInstance crystals = null;
|
||||||
if (crystalId != 0)
|
final int crystalId = item.getItem().getCrystalItemId();
|
||||||
|
if (count > 0)
|
||||||
{
|
{
|
||||||
crystals = player.getInventory().addItem("Enchant", crystalId, count, player, item);
|
crystals = player.getInventory().addItem("Enchant", crystalId, count, player, item);
|
||||||
|
|
||||||
@@ -416,7 +416,7 @@ public class RequestEnchantItem implements IClientIncomingPacket
|
|||||||
iu.addItem(crystals);
|
iu.addItem(crystals);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (crystalId == 0)
|
if ((crystalId == 0) || (count == 0))
|
||||||
{
|
{
|
||||||
client.sendPacket(new EnchantResult(EnchantResult.NO_CRYSTAL, 0, 0));
|
client.sendPacket(new EnchantResult(EnchantResult.NO_CRYSTAL, 0, 0));
|
||||||
}
|
}
|
||||||
|
@@ -327,8 +327,7 @@ public class RequestEnchantItem implements IClientIncomingPacket
|
|||||||
{
|
{
|
||||||
item.setEnchantLevel(item.getEnchantLevel() - 1);
|
item.setEnchantLevel(item.getEnchantLevel() - 1);
|
||||||
}
|
}
|
||||||
else
|
else // blessed enchant - clear enchant value
|
||||||
// blessed enchant - clear enchant value
|
|
||||||
{
|
{
|
||||||
client.sendPacket(SystemMessageId.THE_BLESSED_ENCHANT_FAILED_THE_ENCHANT_VALUE_OF_THE_ITEM_BECAME_0);
|
client.sendPacket(SystemMessageId.THE_BLESSED_ENCHANT_FAILED_THE_ENCHANT_VALUE_OF_THE_ITEM_BECAME_0);
|
||||||
item.setEnchantLevel(0);
|
item.setEnchantLevel(0);
|
||||||
@@ -361,13 +360,6 @@ public class RequestEnchantItem implements IClientIncomingPacket
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// enchant failed, destroy item
|
// enchant failed, destroy item
|
||||||
final int crystalId = item.getItem().getCrystalItemId();
|
|
||||||
int count = item.getCrystalCount() - ((item.getItem().getCrystalCount() + 1) / 2);
|
|
||||||
if (count < 1)
|
|
||||||
{
|
|
||||||
count = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (player.getInventory().destroyItem("Enchant", item, player, null) == null)
|
if (player.getInventory().destroyItem("Enchant", item, player, null) == null)
|
||||||
{
|
{
|
||||||
// unable to destroy item, cheater ?
|
// unable to destroy item, cheater ?
|
||||||
@@ -400,8 +392,16 @@ public class RequestEnchantItem implements IClientIncomingPacket
|
|||||||
}
|
}
|
||||||
|
|
||||||
World.getInstance().removeObject(item);
|
World.getInstance().removeObject(item);
|
||||||
|
|
||||||
|
int count = 0;
|
||||||
|
if (item.getItem().isCrystallizable())
|
||||||
|
{
|
||||||
|
count = Math.max(0, item.getCrystalCount() - ((item.getItem().getCrystalCount() + 1) / 2));
|
||||||
|
}
|
||||||
|
|
||||||
ItemInstance crystals = null;
|
ItemInstance crystals = null;
|
||||||
if (crystalId != 0)
|
final int crystalId = item.getItem().getCrystalItemId();
|
||||||
|
if (count > 0)
|
||||||
{
|
{
|
||||||
crystals = player.getInventory().addItem("Enchant", crystalId, count, player, item);
|
crystals = player.getInventory().addItem("Enchant", crystalId, count, player, item);
|
||||||
|
|
||||||
@@ -416,7 +416,7 @@ public class RequestEnchantItem implements IClientIncomingPacket
|
|||||||
iu.addItem(crystals);
|
iu.addItem(crystals);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (crystalId == 0)
|
if ((crystalId == 0) || (count == 0))
|
||||||
{
|
{
|
||||||
client.sendPacket(new EnchantResult(EnchantResult.NO_CRYSTAL, 0, 0));
|
client.sendPacket(new EnchantResult(EnchantResult.NO_CRYSTAL, 0, 0));
|
||||||
}
|
}
|
||||||
|
@@ -326,8 +326,7 @@ public class RequestEnchantItem implements IClientIncomingPacket
|
|||||||
{
|
{
|
||||||
item.setEnchantLevel(item.getEnchantLevel() - 1);
|
item.setEnchantLevel(item.getEnchantLevel() - 1);
|
||||||
}
|
}
|
||||||
else
|
else // blessed enchant - clear enchant value
|
||||||
// blessed enchant - clear enchant value
|
|
||||||
{
|
{
|
||||||
client.sendPacket(SystemMessageId.THE_BLESSED_ENCHANT_FAILED_THE_ENCHANT_VALUE_OF_THE_ITEM_BECAME_0);
|
client.sendPacket(SystemMessageId.THE_BLESSED_ENCHANT_FAILED_THE_ENCHANT_VALUE_OF_THE_ITEM_BECAME_0);
|
||||||
item.setEnchantLevel(0);
|
item.setEnchantLevel(0);
|
||||||
@@ -360,13 +359,6 @@ public class RequestEnchantItem implements IClientIncomingPacket
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// enchant failed, destroy item
|
// enchant failed, destroy item
|
||||||
final int crystalId = item.getItem().getCrystalItemId();
|
|
||||||
int count = item.getCrystalCount() - ((item.getItem().getCrystalCount() + 1) / 2);
|
|
||||||
if (count < 1)
|
|
||||||
{
|
|
||||||
count = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (player.getInventory().destroyItem("Enchant", item, player, null) == null)
|
if (player.getInventory().destroyItem("Enchant", item, player, null) == null)
|
||||||
{
|
{
|
||||||
// unable to destroy item, cheater ?
|
// unable to destroy item, cheater ?
|
||||||
@@ -399,8 +391,16 @@ public class RequestEnchantItem implements IClientIncomingPacket
|
|||||||
}
|
}
|
||||||
|
|
||||||
World.getInstance().removeObject(item);
|
World.getInstance().removeObject(item);
|
||||||
|
|
||||||
|
int count = 0;
|
||||||
|
if (item.getItem().isCrystallizable())
|
||||||
|
{
|
||||||
|
count = Math.max(0, item.getCrystalCount() - ((item.getItem().getCrystalCount() + 1) / 2));
|
||||||
|
}
|
||||||
|
|
||||||
ItemInstance crystals = null;
|
ItemInstance crystals = null;
|
||||||
if (crystalId != 0)
|
final int crystalId = item.getItem().getCrystalItemId();
|
||||||
|
if (count > 0)
|
||||||
{
|
{
|
||||||
crystals = player.getInventory().addItem("Enchant", crystalId, count, player, item);
|
crystals = player.getInventory().addItem("Enchant", crystalId, count, player, item);
|
||||||
|
|
||||||
@@ -415,7 +415,7 @@ public class RequestEnchantItem implements IClientIncomingPacket
|
|||||||
iu.addItem(crystals);
|
iu.addItem(crystals);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (crystalId == 0)
|
if ((crystalId == 0) || (count == 0))
|
||||||
{
|
{
|
||||||
client.sendPacket(new EnchantResult(EnchantResult.NO_CRYSTAL, 0, 0));
|
client.sendPacket(new EnchantResult(EnchantResult.NO_CRYSTAL, 0, 0));
|
||||||
}
|
}
|
||||||
|
@@ -327,8 +327,7 @@ public class RequestEnchantItem implements IClientIncomingPacket
|
|||||||
{
|
{
|
||||||
item.setEnchantLevel(item.getEnchantLevel() - 1);
|
item.setEnchantLevel(item.getEnchantLevel() - 1);
|
||||||
}
|
}
|
||||||
else
|
else // blessed enchant - clear enchant value
|
||||||
// blessed enchant - clear enchant value
|
|
||||||
{
|
{
|
||||||
client.sendPacket(SystemMessageId.THE_BLESSED_ENCHANT_FAILED_THE_ENCHANT_VALUE_OF_THE_ITEM_BECAME_0);
|
client.sendPacket(SystemMessageId.THE_BLESSED_ENCHANT_FAILED_THE_ENCHANT_VALUE_OF_THE_ITEM_BECAME_0);
|
||||||
item.setEnchantLevel(0);
|
item.setEnchantLevel(0);
|
||||||
@@ -361,13 +360,6 @@ public class RequestEnchantItem implements IClientIncomingPacket
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// enchant failed, destroy item
|
// enchant failed, destroy item
|
||||||
final int crystalId = item.getItem().getCrystalItemId();
|
|
||||||
int count = item.getCrystalCount() - ((item.getItem().getCrystalCount() + 1) / 2);
|
|
||||||
if (count < 1)
|
|
||||||
{
|
|
||||||
count = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (player.getInventory().destroyItem("Enchant", item, player, null) == null)
|
if (player.getInventory().destroyItem("Enchant", item, player, null) == null)
|
||||||
{
|
{
|
||||||
// unable to destroy item, cheater ?
|
// unable to destroy item, cheater ?
|
||||||
@@ -400,8 +392,16 @@ public class RequestEnchantItem implements IClientIncomingPacket
|
|||||||
}
|
}
|
||||||
|
|
||||||
World.getInstance().removeObject(item);
|
World.getInstance().removeObject(item);
|
||||||
|
|
||||||
|
int count = 0;
|
||||||
|
if (item.getItem().isCrystallizable())
|
||||||
|
{
|
||||||
|
count = Math.max(0, item.getCrystalCount() - ((item.getItem().getCrystalCount() + 1) / 2));
|
||||||
|
}
|
||||||
|
|
||||||
ItemInstance crystals = null;
|
ItemInstance crystals = null;
|
||||||
if (crystalId != 0)
|
final int crystalId = item.getItem().getCrystalItemId();
|
||||||
|
if (count > 0)
|
||||||
{
|
{
|
||||||
crystals = player.getInventory().addItem("Enchant", crystalId, count, player, item);
|
crystals = player.getInventory().addItem("Enchant", crystalId, count, player, item);
|
||||||
|
|
||||||
@@ -416,7 +416,7 @@ public class RequestEnchantItem implements IClientIncomingPacket
|
|||||||
iu.addItem(crystals);
|
iu.addItem(crystals);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (crystalId == 0)
|
if ((crystalId == 0) || (count == 0))
|
||||||
{
|
{
|
||||||
client.sendPacket(new EnchantResult(EnchantResult.NO_CRYSTAL, 0, 0));
|
client.sendPacket(new EnchantResult(EnchantResult.NO_CRYSTAL, 0, 0));
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user