Maintain enchant level for chance multisells.
This commit is contained in:
@@ -319,6 +319,7 @@ public class MultiSellChoose implements IClientIncomingPacket
|
||||
|
||||
final InventoryUpdate iu = new InventoryUpdate();
|
||||
boolean itemEnchantmentProcessed = (itemEnchantment == null);
|
||||
int enchantLevel = -1;
|
||||
|
||||
// Take all ingredients
|
||||
for (ItemChanceHolder ingredient : entry.getIngredients())
|
||||
@@ -381,6 +382,10 @@ public class MultiSellChoose implements IClientIncomingPacket
|
||||
{
|
||||
itemEnchantmentProcessed = true;
|
||||
iu.addItem(destroyedItem);
|
||||
if (enchantLevel < 0) // Will only consider first ingredient enchant.
|
||||
{
|
||||
enchantLevel = destroyedItem.getEnchantLevel();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -398,6 +403,10 @@ public class MultiSellChoose implements IClientIncomingPacket
|
||||
{
|
||||
itemEnchantmentProcessed = true;
|
||||
iu.addItem(destroyedItem);
|
||||
if (enchantLevel < 0) // Will only consider first ingredient enchant.
|
||||
{
|
||||
enchantLevel = destroyedItem.getEnchantLevel();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -414,6 +423,10 @@ public class MultiSellChoose implements IClientIncomingPacket
|
||||
if (destroyedItem != null)
|
||||
{
|
||||
iu.addItem(destroyedItem);
|
||||
if (enchantLevel < 0) // Will only consider first ingredient enchant.
|
||||
{
|
||||
enchantLevel = destroyedItem.getEnchantLevel();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -535,11 +548,18 @@ public class MultiSellChoose implements IClientIncomingPacket
|
||||
// Mark that we have already upgraded the item.
|
||||
itemEnchantmentProcessed = false;
|
||||
}
|
||||
|
||||
if (product.getEnchantmentLevel() > 0)
|
||||
{
|
||||
addedItem.setEnchantLevel(product.getEnchantmentLevel());
|
||||
addedItem.updateDatabase(true);
|
||||
}
|
||||
else if (itemEnchantmentProcessed && list.isMaintainEnchantment() && (enchantLevel > 0) && !addedItem.getItem().isEtcItem())
|
||||
{
|
||||
addedItem.setEnchantLevel(enchantLevel);
|
||||
addedItem.updateDatabase(true);
|
||||
enchantLevel = -1; // Will only enchant first product.
|
||||
}
|
||||
|
||||
if (addedItem.getCount() > 1)
|
||||
{
|
||||
|
Reference in New Issue
Block a user