Added enchantmentLevel for multisell enchanted item and ingredients.

This commit is contained in:
MobiusDevelopment
2021-11-07 11:37:12 +00:00
parent c0b6d218f0
commit b19fd303fd
30 changed files with 382 additions and 376 deletions

View File

@@ -376,6 +376,13 @@ public class MultisellData
{
Node attribute;
// Enable enchant level on multisell ingredient using attribue "enchantmentLevel".
int enchantmentLevel = 0;
if (n.getAttributes().getNamedItem("enchantmentLevel") != null)
{
enchantmentLevel = Integer.parseInt(n.getAttributes().getNamedItem("enchantmentLevel").getNodeValue());
}
final int id = Integer.parseInt(n.getAttributes().getNamedItem("id").getNodeValue());
final int count = Integer.parseInt(n.getAttributes().getNamedItem("count").getNodeValue());
boolean isTaxIngredient = false;
@@ -392,11 +399,18 @@ public class MultisellData
mantainIngredient = Boolean.parseBoolean(attribute.getNodeValue());
}
final MultiSellIngredient e = new MultiSellIngredient(id, count, isTaxIngredient, mantainIngredient);
final MultiSellIngredient e = new MultiSellIngredient(id, count, enchantmentLevel, isTaxIngredient, mantainIngredient);
entry.addIngredient(e);
}
else if ("production".equalsIgnoreCase(n.getNodeName()))
{
// Enable enchant level on multisell production using attribue "enchantmentLevel".
int enchantmentLevel = 0;
if (n.getAttributes().getNamedItem("enchantmentLevel") != null)
{
enchantmentLevel = Integer.parseInt(n.getAttributes().getNamedItem("enchantmentLevel").getNodeValue());
}
final int id = Integer.parseInt(n.getAttributes().getNamedItem("id").getNodeValue());
final int count = Integer.parseInt(n.getAttributes().getNamedItem("count").getNodeValue());
if (ItemTable.getInstance().getTemplate(id) == null)
@@ -404,13 +418,7 @@ public class MultisellData
LOGGER.warning("Multisell: Item " + id + " does not exist.");
}
int enchant = 0;
// By Azagthtot support enchantment in multisell
if (n.getAttributes().getNamedItem("enchant") != null)
{
enchant = Integer.parseInt(n.getAttributes().getNamedItem("enchant").getNodeValue());
}
final MultiSellIngredient e = new MultiSellIngredient(id, count, enchant, false, false);
MultiSellIngredient e = new MultiSellIngredient(id, count, enchantmentLevel, false, false);
entry.addProduct(e);
}
}

View File

@@ -27,11 +27,6 @@ public class MultiSellIngredient
private boolean _isTaxIngredient;
private boolean _mantainIngredient;
public MultiSellIngredient(int itemId, int itemCount, boolean isTaxIngredient, boolean mantainIngredient)
{
this(itemId, itemCount, 0, isTaxIngredient, mantainIngredient);
}
public MultiSellIngredient(int itemId, int itemCount, int enchantmentLevel, boolean isTaxIngredient, boolean mantainIngredient)
{
setItemId(itemId);

View File

@@ -501,7 +501,7 @@ public class MultiSellChoose implements IClientIncomingPacket
// Next add the adena amount, if any
if (totalAdenaCount > 0)
{
newEntry.addIngredient(new MultiSellIngredient(57, totalAdenaCount, false, false));
newEntry.addIngredient(new MultiSellIngredient(57, totalAdenaCount, 0, false, false));
}
// Now modify the enchantment level of products, if necessary