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