Check multisell product price when possible.

This commit is contained in:
MobiusDevelopment 2021-03-03 22:04:53 +00:00
parent c6e875ac85
commit 13a5bd1836
18 changed files with 482 additions and 0 deletions

View File

@ -24,6 +24,7 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.logging.Level;
import java.util.logging.Logger;
@ -93,11 +94,17 @@ public class MultisellData implements IXmlReader
final StatSet set = new StatSet(parseAttributes(listNode));
final int listId = Integer.parseInt(f.getName().substring(0, f.getName().length() - 4));
final List<MultisellEntryHolder> entries = new ArrayList<>(listNode.getChildNodes().getLength());
final AtomicInteger entryCounter = new AtomicInteger();
forEach(listNode, itemNode ->
{
if ("item".equalsIgnoreCase(itemNode.getNodeName()))
{
int totalPrice = 0;
int lastIngredientId = 0;
long lastIngredientCount = 0;
entryCounter.incrementAndGet();
final List<ItemChanceHolder> ingredients = new ArrayList<>(1);
final List<ItemChanceHolder> products = new ArrayList<>(1);
final MultisellEntryHolder entry = new MultisellEntryHolder(ingredients, products);
@ -113,6 +120,9 @@ public class MultisellData implements IXmlReader
if (itemExists(ingredient))
{
ingredients.add(ingredient);
lastIngredientId = id;
lastIngredientCount = count;
}
else
{
@ -153,6 +163,12 @@ public class MultisellData implements IXmlReader
}
products.add(product);
final Item item = ItemTable.getInstance().getTemplate(id);
if (item != null)
{
totalPrice += item.getReferencePrice();
}
}
else
{
@ -168,6 +184,17 @@ public class MultisellData implements IXmlReader
LOGGER.warning("Products' total chance of " + totalChance + "% exceeds 100% for list: " + listId + " at entry " + entries.size() + 1 + ".");
}
// Check if buy price is lower than sell price.
// Only applies when there is only one ingredient and it is adena.
if ((ingredients.size() == 1) && (lastIngredientId == 57) && (lastIngredientCount < totalPrice))
{
LOGGER.warning("Buy price " + lastIngredientCount + " is less than sell price " + totalPrice + " at entry " + entryCounter.intValue() + " of multisell " + listId + ".");
// Adjust price.
final ItemChanceHolder ingredient = new ItemChanceHolder(57, 0, totalPrice, (byte) 0, ingredients.get(0).isMaintainIngredient());
ingredients.clear();
ingredients.add(ingredient);
}
entries.add(entry);
}
else if ("npcs".equalsIgnoreCase(itemNode.getNodeName()))

View File

@ -24,6 +24,7 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.logging.Level;
import java.util.logging.Logger;
@ -93,11 +94,17 @@ public class MultisellData implements IXmlReader
final StatSet set = new StatSet(parseAttributes(listNode));
final int listId = Integer.parseInt(f.getName().substring(0, f.getName().length() - 4));
final List<MultisellEntryHolder> entries = new ArrayList<>(listNode.getChildNodes().getLength());
final AtomicInteger entryCounter = new AtomicInteger();
forEach(listNode, itemNode ->
{
if ("item".equalsIgnoreCase(itemNode.getNodeName()))
{
int totalPrice = 0;
int lastIngredientId = 0;
long lastIngredientCount = 0;
entryCounter.incrementAndGet();
final List<ItemChanceHolder> ingredients = new ArrayList<>(1);
final List<ItemChanceHolder> products = new ArrayList<>(1);
final MultisellEntryHolder entry = new MultisellEntryHolder(ingredients, products);
@ -113,6 +120,9 @@ public class MultisellData implements IXmlReader
if (itemExists(ingredient))
{
ingredients.add(ingredient);
lastIngredientId = id;
lastIngredientCount = count;
}
else
{
@ -153,6 +163,12 @@ public class MultisellData implements IXmlReader
}
products.add(product);
final Item item = ItemTable.getInstance().getTemplate(id);
if (item != null)
{
totalPrice += item.getReferencePrice();
}
}
else
{
@ -168,6 +184,17 @@ public class MultisellData implements IXmlReader
LOGGER.warning("Products' total chance of " + totalChance + "% exceeds 100% for list: " + listId + " at entry " + entries.size() + 1 + ".");
}
// Check if buy price is lower than sell price.
// Only applies when there is only one ingredient and it is adena.
if ((ingredients.size() == 1) && (lastIngredientId == 57) && (lastIngredientCount < totalPrice))
{
LOGGER.warning("Buy price " + lastIngredientCount + " is less than sell price " + totalPrice + " at entry " + entryCounter.intValue() + " of multisell " + listId + ".");
// Adjust price.
final ItemChanceHolder ingredient = new ItemChanceHolder(57, 0, totalPrice, (byte) 0, ingredients.get(0).isMaintainIngredient());
ingredients.clear();
ingredients.add(ingredient);
}
entries.add(entry);
}
else if ("npcs".equalsIgnoreCase(itemNode.getNodeName()))

View File

@ -24,6 +24,7 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.logging.Level;
import java.util.logging.Logger;
@ -93,11 +94,17 @@ public class MultisellData implements IXmlReader
final StatSet set = new StatSet(parseAttributes(listNode));
final int listId = Integer.parseInt(f.getName().substring(0, f.getName().length() - 4));
final List<MultisellEntryHolder> entries = new ArrayList<>(listNode.getChildNodes().getLength());
final AtomicInteger entryCounter = new AtomicInteger();
forEach(listNode, itemNode ->
{
if ("item".equalsIgnoreCase(itemNode.getNodeName()))
{
int totalPrice = 0;
int lastIngredientId = 0;
long lastIngredientCount = 0;
entryCounter.incrementAndGet();
final List<ItemChanceHolder> ingredients = new ArrayList<>(1);
final List<ItemChanceHolder> products = new ArrayList<>(1);
final MultisellEntryHolder entry = new MultisellEntryHolder(ingredients, products);
@ -113,6 +120,9 @@ public class MultisellData implements IXmlReader
if (itemExists(ingredient))
{
ingredients.add(ingredient);
lastIngredientId = id;
lastIngredientCount = count;
}
else
{
@ -153,6 +163,12 @@ public class MultisellData implements IXmlReader
}
products.add(product);
final Item item = ItemTable.getInstance().getTemplate(id);
if (item != null)
{
totalPrice += item.getReferencePrice();
}
}
else
{
@ -168,6 +184,17 @@ public class MultisellData implements IXmlReader
LOGGER.warning("Products' total chance of " + totalChance + "% exceeds 100% for list: " + listId + " at entry " + entries.size() + 1 + ".");
}
// Check if buy price is lower than sell price.
// Only applies when there is only one ingredient and it is adena.
if ((ingredients.size() == 1) && (lastIngredientId == 57) && (lastIngredientCount < totalPrice))
{
LOGGER.warning("Buy price " + lastIngredientCount + " is less than sell price " + totalPrice + " at entry " + entryCounter.intValue() + " of multisell " + listId + ".");
// Adjust price.
final ItemChanceHolder ingredient = new ItemChanceHolder(57, 0, totalPrice, (byte) 0, ingredients.get(0).isMaintainIngredient());
ingredients.clear();
ingredients.add(ingredient);
}
entries.add(entry);
}
else if ("npcs".equalsIgnoreCase(itemNode.getNodeName()))

View File

@ -24,6 +24,7 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.logging.Level;
import java.util.logging.Logger;
@ -93,11 +94,17 @@ public class MultisellData implements IXmlReader
final StatSet set = new StatSet(parseAttributes(listNode));
final int listId = Integer.parseInt(f.getName().substring(0, f.getName().length() - 4));
final List<MultisellEntryHolder> entries = new ArrayList<>(listNode.getChildNodes().getLength());
final AtomicInteger entryCounter = new AtomicInteger();
forEach(listNode, itemNode ->
{
if ("item".equalsIgnoreCase(itemNode.getNodeName()))
{
int totalPrice = 0;
int lastIngredientId = 0;
long lastIngredientCount = 0;
entryCounter.incrementAndGet();
final List<ItemChanceHolder> ingredients = new ArrayList<>(1);
final List<ItemChanceHolder> products = new ArrayList<>(1);
final MultisellEntryHolder entry = new MultisellEntryHolder(ingredients, products);
@ -113,6 +120,9 @@ public class MultisellData implements IXmlReader
if (itemExists(ingredient))
{
ingredients.add(ingredient);
lastIngredientId = id;
lastIngredientCount = count;
}
else
{
@ -153,6 +163,12 @@ public class MultisellData implements IXmlReader
}
products.add(product);
final Item item = ItemTable.getInstance().getTemplate(id);
if (item != null)
{
totalPrice += item.getReferencePrice();
}
}
else
{
@ -168,6 +184,17 @@ public class MultisellData implements IXmlReader
LOGGER.warning("Products' total chance of " + totalChance + "% exceeds 100% for list: " + listId + " at entry " + entries.size() + 1 + ".");
}
// Check if buy price is lower than sell price.
// Only applies when there is only one ingredient and it is adena.
if ((ingredients.size() == 1) && (lastIngredientId == 57) && (lastIngredientCount < totalPrice))
{
LOGGER.warning("Buy price " + lastIngredientCount + " is less than sell price " + totalPrice + " at entry " + entryCounter.intValue() + " of multisell " + listId + ".");
// Adjust price.
final ItemChanceHolder ingredient = new ItemChanceHolder(57, 0, totalPrice, (byte) 0, ingredients.get(0).isMaintainIngredient());
ingredients.clear();
ingredients.add(ingredient);
}
entries.add(entry);
}
else if ("npcs".equalsIgnoreCase(itemNode.getNodeName()))

View File

@ -24,6 +24,7 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.logging.Level;
import java.util.logging.Logger;
@ -93,11 +94,17 @@ public class MultisellData implements IXmlReader
final StatSet set = new StatSet(parseAttributes(listNode));
final int listId = Integer.parseInt(f.getName().substring(0, f.getName().length() - 4));
final List<MultisellEntryHolder> entries = new ArrayList<>(listNode.getChildNodes().getLength());
final AtomicInteger entryCounter = new AtomicInteger();
forEach(listNode, itemNode ->
{
if ("item".equalsIgnoreCase(itemNode.getNodeName()))
{
int totalPrice = 0;
int lastIngredientId = 0;
long lastIngredientCount = 0;
entryCounter.incrementAndGet();
final List<ItemChanceHolder> ingredients = new ArrayList<>(1);
final List<ItemChanceHolder> products = new ArrayList<>(1);
final MultisellEntryHolder entry = new MultisellEntryHolder(ingredients, products);
@ -113,6 +120,9 @@ public class MultisellData implements IXmlReader
if (itemExists(ingredient))
{
ingredients.add(ingredient);
lastIngredientId = id;
lastIngredientCount = count;
}
else
{
@ -153,6 +163,12 @@ public class MultisellData implements IXmlReader
}
products.add(product);
final Item item = ItemTable.getInstance().getTemplate(id);
if (item != null)
{
totalPrice += item.getReferencePrice();
}
}
else
{
@ -168,6 +184,17 @@ public class MultisellData implements IXmlReader
LOGGER.warning("Products' total chance of " + totalChance + "% exceeds 100% for list: " + listId + " at entry " + entries.size() + 1 + ".");
}
// Check if buy price is lower than sell price.
// Only applies when there is only one ingredient and it is adena.
if ((ingredients.size() == 1) && (lastIngredientId == 57) && (lastIngredientCount < totalPrice))
{
LOGGER.warning("Buy price " + lastIngredientCount + " is less than sell price " + totalPrice + " at entry " + entryCounter.intValue() + " of multisell " + listId + ".");
// Adjust price.
final ItemChanceHolder ingredient = new ItemChanceHolder(57, 0, totalPrice, (byte) 0, ingredients.get(0).isMaintainIngredient());
ingredients.clear();
ingredients.add(ingredient);
}
entries.add(entry);
}
else if ("npcs".equalsIgnoreCase(itemNode.getNodeName()))

View File

@ -24,6 +24,7 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.logging.Level;
import java.util.logging.Logger;
@ -93,11 +94,17 @@ public class MultisellData implements IXmlReader
final StatSet set = new StatSet(parseAttributes(listNode));
final int listId = Integer.parseInt(f.getName().substring(0, f.getName().length() - 4));
final List<MultisellEntryHolder> entries = new ArrayList<>(listNode.getChildNodes().getLength());
final AtomicInteger entryCounter = new AtomicInteger();
forEach(listNode, itemNode ->
{
if ("item".equalsIgnoreCase(itemNode.getNodeName()))
{
int totalPrice = 0;
int lastIngredientId = 0;
long lastIngredientCount = 0;
entryCounter.incrementAndGet();
final List<ItemChanceHolder> ingredients = new ArrayList<>(1);
final List<ItemChanceHolder> products = new ArrayList<>(1);
final MultisellEntryHolder entry = new MultisellEntryHolder(ingredients, products);
@ -113,6 +120,9 @@ public class MultisellData implements IXmlReader
if (itemExists(ingredient))
{
ingredients.add(ingredient);
lastIngredientId = id;
lastIngredientCount = count;
}
else
{
@ -153,6 +163,12 @@ public class MultisellData implements IXmlReader
}
products.add(product);
final Item item = ItemTable.getInstance().getTemplate(id);
if (item != null)
{
totalPrice += item.getReferencePrice();
}
}
else
{
@ -168,6 +184,17 @@ public class MultisellData implements IXmlReader
LOGGER.warning("Products' total chance of " + totalChance + "% exceeds 100% for list: " + listId + " at entry " + entries.size() + 1 + ".");
}
// Check if buy price is lower than sell price.
// Only applies when there is only one ingredient and it is adena.
if ((ingredients.size() == 1) && (lastIngredientId == 57) && (lastIngredientCount < totalPrice))
{
LOGGER.warning("Buy price " + lastIngredientCount + " is less than sell price " + totalPrice + " at entry " + entryCounter.intValue() + " of multisell " + listId + ".");
// Adjust price.
final ItemChanceHolder ingredient = new ItemChanceHolder(57, 0, totalPrice, (byte) 0, ingredients.get(0).isMaintainIngredient());
ingredients.clear();
ingredients.add(ingredient);
}
entries.add(entry);
}
else if ("npcs".equalsIgnoreCase(itemNode.getNodeName()))

View File

@ -24,6 +24,7 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.logging.Level;
import java.util.logging.Logger;
@ -93,11 +94,17 @@ public class MultisellData implements IXmlReader
final StatSet set = new StatSet(parseAttributes(listNode));
final int listId = Integer.parseInt(f.getName().substring(0, f.getName().length() - 4));
final List<MultisellEntryHolder> entries = new ArrayList<>(listNode.getChildNodes().getLength());
final AtomicInteger entryCounter = new AtomicInteger();
forEach(listNode, itemNode ->
{
if ("item".equalsIgnoreCase(itemNode.getNodeName()))
{
int totalPrice = 0;
int lastIngredientId = 0;
long lastIngredientCount = 0;
entryCounter.incrementAndGet();
final List<ItemChanceHolder> ingredients = new ArrayList<>(1);
final List<ItemChanceHolder> products = new ArrayList<>(1);
final MultisellEntryHolder entry = new MultisellEntryHolder(ingredients, products);
@ -113,6 +120,9 @@ public class MultisellData implements IXmlReader
if (itemExists(ingredient))
{
ingredients.add(ingredient);
lastIngredientId = id;
lastIngredientCount = count;
}
else
{
@ -153,6 +163,12 @@ public class MultisellData implements IXmlReader
}
products.add(product);
final Item item = ItemTable.getInstance().getTemplate(id);
if (item != null)
{
totalPrice += item.getReferencePrice();
}
}
else
{
@ -168,6 +184,17 @@ public class MultisellData implements IXmlReader
LOGGER.warning("Products' total chance of " + totalChance + "% exceeds 100% for list: " + listId + " at entry " + entries.size() + 1 + ".");
}
// Check if buy price is lower than sell price.
// Only applies when there is only one ingredient and it is adena.
if ((ingredients.size() == 1) && (lastIngredientId == 57) && (lastIngredientCount < totalPrice))
{
LOGGER.warning("Buy price " + lastIngredientCount + " is less than sell price " + totalPrice + " at entry " + entryCounter.intValue() + " of multisell " + listId + ".");
// Adjust price.
final ItemChanceHolder ingredient = new ItemChanceHolder(57, 0, totalPrice, (byte) 0, ingredients.get(0).isMaintainIngredient());
ingredients.clear();
ingredients.add(ingredient);
}
entries.add(entry);
}
else if ("npcs".equalsIgnoreCase(itemNode.getNodeName()))

View File

@ -24,6 +24,7 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.logging.Level;
import java.util.logging.Logger;
@ -93,11 +94,17 @@ public class MultisellData implements IXmlReader
final StatSet set = new StatSet(parseAttributes(listNode));
final int listId = Integer.parseInt(f.getName().substring(0, f.getName().length() - 4));
final List<MultisellEntryHolder> entries = new ArrayList<>(listNode.getChildNodes().getLength());
final AtomicInteger entryCounter = new AtomicInteger();
forEach(listNode, itemNode ->
{
if ("item".equalsIgnoreCase(itemNode.getNodeName()))
{
int totalPrice = 0;
int lastIngredientId = 0;
long lastIngredientCount = 0;
entryCounter.incrementAndGet();
final List<ItemChanceHolder> ingredients = new ArrayList<>(1);
final List<ItemChanceHolder> products = new ArrayList<>(1);
final MultisellEntryHolder entry = new MultisellEntryHolder(ingredients, products);
@ -113,6 +120,9 @@ public class MultisellData implements IXmlReader
if (itemExists(ingredient))
{
ingredients.add(ingredient);
lastIngredientId = id;
lastIngredientCount = count;
}
else
{
@ -153,6 +163,12 @@ public class MultisellData implements IXmlReader
}
products.add(product);
final Item item = ItemTable.getInstance().getTemplate(id);
if (item != null)
{
totalPrice += item.getReferencePrice();
}
}
else
{
@ -168,6 +184,17 @@ public class MultisellData implements IXmlReader
LOGGER.warning("Products' total chance of " + totalChance + "% exceeds 100% for list: " + listId + " at entry " + entries.size() + 1 + ".");
}
// Check if buy price is lower than sell price.
// Only applies when there is only one ingredient and it is adena.
if ((ingredients.size() == 1) && (lastIngredientId == 57) && (lastIngredientCount < totalPrice))
{
LOGGER.warning("Buy price " + lastIngredientCount + " is less than sell price " + totalPrice + " at entry " + entryCounter.intValue() + " of multisell " + listId + ".");
// Adjust price.
final ItemChanceHolder ingredient = new ItemChanceHolder(57, 0, totalPrice, (byte) 0, ingredients.get(0).isMaintainIngredient());
ingredients.clear();
ingredients.add(ingredient);
}
entries.add(entry);
}
else if ("npcs".equalsIgnoreCase(itemNode.getNodeName()))

View File

@ -24,6 +24,7 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.logging.Level;
import java.util.logging.Logger;
@ -93,11 +94,17 @@ public class MultisellData implements IXmlReader
final StatSet set = new StatSet(parseAttributes(listNode));
final int listId = Integer.parseInt(f.getName().substring(0, f.getName().length() - 4));
final List<MultisellEntryHolder> entries = new ArrayList<>(listNode.getChildNodes().getLength());
final AtomicInteger entryCounter = new AtomicInteger();
forEach(listNode, itemNode ->
{
if ("item".equalsIgnoreCase(itemNode.getNodeName()))
{
int totalPrice = 0;
int lastIngredientId = 0;
long lastIngredientCount = 0;
entryCounter.incrementAndGet();
final List<ItemChanceHolder> ingredients = new ArrayList<>(1);
final List<ItemChanceHolder> products = new ArrayList<>(1);
final MultisellEntryHolder entry = new MultisellEntryHolder(ingredients, products);
@ -113,6 +120,9 @@ public class MultisellData implements IXmlReader
if (itemExists(ingredient))
{
ingredients.add(ingredient);
lastIngredientId = id;
lastIngredientCount = count;
}
else
{
@ -153,6 +163,12 @@ public class MultisellData implements IXmlReader
}
products.add(product);
final Item item = ItemTable.getInstance().getTemplate(id);
if (item != null)
{
totalPrice += item.getReferencePrice();
}
}
else
{
@ -168,6 +184,17 @@ public class MultisellData implements IXmlReader
LOGGER.warning("Products' total chance of " + totalChance + "% exceeds 100% for list: " + listId + " at entry " + entries.size() + 1 + ".");
}
// Check if buy price is lower than sell price.
// Only applies when there is only one ingredient and it is adena.
if ((ingredients.size() == 1) && (lastIngredientId == 57) && (lastIngredientCount < totalPrice))
{
LOGGER.warning("Buy price " + lastIngredientCount + " is less than sell price " + totalPrice + " at entry " + entryCounter.intValue() + " of multisell " + listId + ".");
// Adjust price.
final ItemChanceHolder ingredient = new ItemChanceHolder(57, 0, totalPrice, (byte) 0, ingredients.get(0).isMaintainIngredient());
ingredients.clear();
ingredients.add(ingredient);
}
entries.add(entry);
}
else if ("npcs".equalsIgnoreCase(itemNode.getNodeName()))

View File

@ -24,6 +24,7 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.logging.Level;
import java.util.logging.Logger;
@ -93,11 +94,17 @@ public class MultisellData implements IXmlReader
final StatSet set = new StatSet(parseAttributes(listNode));
final int listId = Integer.parseInt(f.getName().substring(0, f.getName().length() - 4));
final List<MultisellEntryHolder> entries = new ArrayList<>(listNode.getChildNodes().getLength());
final AtomicInteger entryCounter = new AtomicInteger();
forEach(listNode, itemNode ->
{
if ("item".equalsIgnoreCase(itemNode.getNodeName()))
{
int totalPrice = 0;
int lastIngredientId = 0;
long lastIngredientCount = 0;
entryCounter.incrementAndGet();
final List<ItemChanceHolder> ingredients = new ArrayList<>(1);
final List<ItemChanceHolder> products = new ArrayList<>(1);
final MultisellEntryHolder entry = new MultisellEntryHolder(ingredients, products);
@ -113,6 +120,9 @@ public class MultisellData implements IXmlReader
if (itemExists(ingredient))
{
ingredients.add(ingredient);
lastIngredientId = id;
lastIngredientCount = count;
}
else
{
@ -153,6 +163,12 @@ public class MultisellData implements IXmlReader
}
products.add(product);
final Item item = ItemTable.getInstance().getTemplate(id);
if (item != null)
{
totalPrice += item.getReferencePrice();
}
}
else
{
@ -168,6 +184,17 @@ public class MultisellData implements IXmlReader
LOGGER.warning("Products' total chance of " + totalChance + "% exceeds 100% for list: " + listId + " at entry " + entries.size() + 1 + ".");
}
// Check if buy price is lower than sell price.
// Only applies when there is only one ingredient and it is adena.
if ((ingredients.size() == 1) && (lastIngredientId == 57) && (lastIngredientCount < totalPrice))
{
LOGGER.warning("Buy price " + lastIngredientCount + " is less than sell price " + totalPrice + " at entry " + entryCounter.intValue() + " of multisell " + listId + ".");
// Adjust price.
final ItemChanceHolder ingredient = new ItemChanceHolder(57, 0, totalPrice, (byte) 0, ingredients.get(0).isMaintainIngredient());
ingredients.clear();
ingredients.add(ingredient);
}
entries.add(entry);
}
else if ("npcs".equalsIgnoreCase(itemNode.getNodeName()))

View File

@ -24,6 +24,7 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.logging.Level;
import java.util.logging.Logger;
@ -93,11 +94,17 @@ public class MultisellData implements IXmlReader
final StatSet set = new StatSet(parseAttributes(listNode));
final int listId = Integer.parseInt(f.getName().substring(0, f.getName().length() - 4));
final List<MultisellEntryHolder> entries = new ArrayList<>(listNode.getChildNodes().getLength());
final AtomicInteger entryCounter = new AtomicInteger();
forEach(listNode, itemNode ->
{
if ("item".equalsIgnoreCase(itemNode.getNodeName()))
{
int totalPrice = 0;
int lastIngredientId = 0;
long lastIngredientCount = 0;
entryCounter.incrementAndGet();
final List<ItemChanceHolder> ingredients = new ArrayList<>(1);
final List<ItemChanceHolder> products = new ArrayList<>(1);
final MultisellEntryHolder entry = new MultisellEntryHolder(ingredients, products);
@ -113,6 +120,9 @@ public class MultisellData implements IXmlReader
if (itemExists(ingredient))
{
ingredients.add(ingredient);
lastIngredientId = id;
lastIngredientCount = count;
}
else
{
@ -153,6 +163,12 @@ public class MultisellData implements IXmlReader
}
products.add(product);
final Item item = ItemTable.getInstance().getTemplate(id);
if (item != null)
{
totalPrice += item.getReferencePrice();
}
}
else
{
@ -168,6 +184,17 @@ public class MultisellData implements IXmlReader
LOGGER.warning("Products' total chance of " + totalChance + "% exceeds 100% for list: " + listId + " at entry " + entries.size() + 1 + ".");
}
// Check if buy price is lower than sell price.
// Only applies when there is only one ingredient and it is adena.
if ((ingredients.size() == 1) && (lastIngredientId == 57) && (lastIngredientCount < totalPrice))
{
LOGGER.warning("Buy price " + lastIngredientCount + " is less than sell price " + totalPrice + " at entry " + entryCounter.intValue() + " of multisell " + listId + ".");
// Adjust price.
final ItemChanceHolder ingredient = new ItemChanceHolder(57, 0, totalPrice, (byte) 0, ingredients.get(0).isMaintainIngredient());
ingredients.clear();
ingredients.add(ingredient);
}
entries.add(entry);
}
else if ("npcs".equalsIgnoreCase(itemNode.getNodeName()))

View File

@ -24,6 +24,7 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.logging.Level;
import java.util.logging.Logger;
@ -93,11 +94,17 @@ public class MultisellData implements IXmlReader
final StatSet set = new StatSet(parseAttributes(listNode));
final int listId = Integer.parseInt(f.getName().substring(0, f.getName().length() - 4));
final List<MultisellEntryHolder> entries = new ArrayList<>(listNode.getChildNodes().getLength());
final AtomicInteger entryCounter = new AtomicInteger();
forEach(listNode, itemNode ->
{
if ("item".equalsIgnoreCase(itemNode.getNodeName()))
{
int totalPrice = 0;
int lastIngredientId = 0;
long lastIngredientCount = 0;
entryCounter.incrementAndGet();
final List<ItemChanceHolder> ingredients = new ArrayList<>(1);
final List<ItemChanceHolder> products = new ArrayList<>(1);
final MultisellEntryHolder entry = new MultisellEntryHolder(ingredients, products);
@ -113,6 +120,9 @@ public class MultisellData implements IXmlReader
if (itemExists(ingredient))
{
ingredients.add(ingredient);
lastIngredientId = id;
lastIngredientCount = count;
}
else
{
@ -153,6 +163,12 @@ public class MultisellData implements IXmlReader
}
products.add(product);
final Item item = ItemTable.getInstance().getTemplate(id);
if (item != null)
{
totalPrice += item.getReferencePrice();
}
}
else
{
@ -168,6 +184,17 @@ public class MultisellData implements IXmlReader
LOGGER.warning("Products' total chance of " + totalChance + "% exceeds 100% for list: " + listId + " at entry " + entries.size() + 1 + ".");
}
// Check if buy price is lower than sell price.
// Only applies when there is only one ingredient and it is adena.
if ((ingredients.size() == 1) && (lastIngredientId == 57) && (lastIngredientCount < totalPrice))
{
LOGGER.warning("Buy price " + lastIngredientCount + " is less than sell price " + totalPrice + " at entry " + entryCounter.intValue() + " of multisell " + listId + ".");
// Adjust price.
final ItemChanceHolder ingredient = new ItemChanceHolder(57, 0, totalPrice, (byte) 0, ingredients.get(0).isMaintainIngredient());
ingredients.clear();
ingredients.add(ingredient);
}
entries.add(entry);
}
else if ("npcs".equalsIgnoreCase(itemNode.getNodeName()))

View File

@ -24,6 +24,7 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.logging.Level;
import java.util.logging.Logger;
@ -93,11 +94,17 @@ public class MultisellData implements IXmlReader
final StatSet set = new StatSet(parseAttributes(listNode));
final int listId = Integer.parseInt(f.getName().substring(0, f.getName().length() - 4));
final List<MultisellEntryHolder> entries = new ArrayList<>(listNode.getChildNodes().getLength());
final AtomicInteger entryCounter = new AtomicInteger();
forEach(listNode, itemNode ->
{
if ("item".equalsIgnoreCase(itemNode.getNodeName()))
{
int totalPrice = 0;
int lastIngredientId = 0;
long lastIngredientCount = 0;
entryCounter.incrementAndGet();
final List<ItemChanceHolder> ingredients = new ArrayList<>(1);
final List<ItemChanceHolder> products = new ArrayList<>(1);
final MultisellEntryHolder entry = new MultisellEntryHolder(ingredients, products);
@ -113,6 +120,9 @@ public class MultisellData implements IXmlReader
if (itemExists(ingredient))
{
ingredients.add(ingredient);
lastIngredientId = id;
lastIngredientCount = count;
}
else
{
@ -153,6 +163,12 @@ public class MultisellData implements IXmlReader
}
products.add(product);
final Item item = ItemTable.getInstance().getTemplate(id);
if (item != null)
{
totalPrice += item.getReferencePrice();
}
}
else
{
@ -168,6 +184,17 @@ public class MultisellData implements IXmlReader
LOGGER.warning("Products' total chance of " + totalChance + "% exceeds 100% for list: " + listId + " at entry " + entries.size() + 1 + ".");
}
// Check if buy price is lower than sell price.
// Only applies when there is only one ingredient and it is adena.
if ((ingredients.size() == 1) && (lastIngredientId == 57) && (lastIngredientCount < totalPrice))
{
LOGGER.warning("Buy price " + lastIngredientCount + " is less than sell price " + totalPrice + " at entry " + entryCounter.intValue() + " of multisell " + listId + ".");
// Adjust price.
final ItemChanceHolder ingredient = new ItemChanceHolder(57, 0, totalPrice, (byte) 0, ingredients.get(0).isMaintainIngredient());
ingredients.clear();
ingredients.add(ingredient);
}
entries.add(entry);
}
else if ("npcs".equalsIgnoreCase(itemNode.getNodeName()))

View File

@ -24,6 +24,7 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.logging.Level;
import java.util.logging.Logger;
@ -93,11 +94,17 @@ public class MultisellData implements IXmlReader
final StatSet set = new StatSet(parseAttributes(listNode));
final int listId = Integer.parseInt(f.getName().substring(0, f.getName().length() - 4));
final List<MultisellEntryHolder> entries = new ArrayList<>(listNode.getChildNodes().getLength());
final AtomicInteger entryCounter = new AtomicInteger();
forEach(listNode, itemNode ->
{
if ("item".equalsIgnoreCase(itemNode.getNodeName()))
{
int totalPrice = 0;
int lastIngredientId = 0;
long lastIngredientCount = 0;
entryCounter.incrementAndGet();
final List<ItemChanceHolder> ingredients = new ArrayList<>(1);
final List<ItemChanceHolder> products = new ArrayList<>(1);
final MultisellEntryHolder entry = new MultisellEntryHolder(ingredients, products);
@ -113,6 +120,9 @@ public class MultisellData implements IXmlReader
if (itemExists(ingredient))
{
ingredients.add(ingredient);
lastIngredientId = id;
lastIngredientCount = count;
}
else
{
@ -153,6 +163,12 @@ public class MultisellData implements IXmlReader
}
products.add(product);
final Item item = ItemTable.getInstance().getTemplate(id);
if (item != null)
{
totalPrice += item.getReferencePrice();
}
}
else
{
@ -168,6 +184,17 @@ public class MultisellData implements IXmlReader
LOGGER.warning("Products' total chance of " + totalChance + "% exceeds 100% for list: " + listId + " at entry " + entries.size() + 1 + ".");
}
// Check if buy price is lower than sell price.
// Only applies when there is only one ingredient and it is adena.
if ((ingredients.size() == 1) && (lastIngredientId == 57) && (lastIngredientCount < totalPrice))
{
LOGGER.warning("Buy price " + lastIngredientCount + " is less than sell price " + totalPrice + " at entry " + entryCounter.intValue() + " of multisell " + listId + ".");
// Adjust price.
final ItemChanceHolder ingredient = new ItemChanceHolder(57, 0, totalPrice, (byte) 0, ingredients.get(0).isMaintainIngredient());
ingredients.clear();
ingredients.add(ingredient);
}
entries.add(entry);
}
else if ("npcs".equalsIgnoreCase(itemNode.getNodeName()))

View File

@ -24,6 +24,7 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.logging.Level;
import java.util.logging.Logger;
@ -93,11 +94,17 @@ public class MultisellData implements IXmlReader
final StatSet set = new StatSet(parseAttributes(listNode));
final int listId = Integer.parseInt(f.getName().substring(0, f.getName().length() - 4));
final List<MultisellEntryHolder> entries = new ArrayList<>(listNode.getChildNodes().getLength());
final AtomicInteger entryCounter = new AtomicInteger();
forEach(listNode, itemNode ->
{
if ("item".equalsIgnoreCase(itemNode.getNodeName()))
{
int totalPrice = 0;
int lastIngredientId = 0;
long lastIngredientCount = 0;
entryCounter.incrementAndGet();
final List<ItemChanceHolder> ingredients = new ArrayList<>(1);
final List<ItemChanceHolder> products = new ArrayList<>(1);
final MultisellEntryHolder entry = new MultisellEntryHolder(ingredients, products);
@ -113,6 +120,9 @@ public class MultisellData implements IXmlReader
if (itemExists(ingredient))
{
ingredients.add(ingredient);
lastIngredientId = id;
lastIngredientCount = count;
}
else
{
@ -153,6 +163,12 @@ public class MultisellData implements IXmlReader
}
products.add(product);
final Item item = ItemTable.getInstance().getTemplate(id);
if (item != null)
{
totalPrice += item.getReferencePrice();
}
}
else
{
@ -168,6 +184,17 @@ public class MultisellData implements IXmlReader
LOGGER.warning("Products' total chance of " + totalChance + "% exceeds 100% for list: " + listId + " at entry " + entries.size() + 1 + ".");
}
// Check if buy price is lower than sell price.
// Only applies when there is only one ingredient and it is adena.
if ((ingredients.size() == 1) && (lastIngredientId == 57) && (lastIngredientCount < totalPrice))
{
LOGGER.warning("Buy price " + lastIngredientCount + " is less than sell price " + totalPrice + " at entry " + entryCounter.intValue() + " of multisell " + listId + ".");
// Adjust price.
final ItemChanceHolder ingredient = new ItemChanceHolder(57, 0, totalPrice, (byte) 0, ingredients.get(0).isMaintainIngredient());
ingredients.clear();
ingredients.add(ingredient);
}
entries.add(entry);
}
else if ("npcs".equalsIgnoreCase(itemNode.getNodeName()))

View File

@ -24,6 +24,7 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.logging.Level;
import java.util.logging.Logger;
@ -94,11 +95,17 @@ public class MultisellData implements IXmlReader
final StatSet set = new StatSet(parseAttributes(listNode));
final int listId = Integer.parseInt(f.getName().substring(0, f.getName().length() - 4));
final List<MultisellEntryHolder> entries = new ArrayList<>(listNode.getChildNodes().getLength());
final AtomicInteger entryCounter = new AtomicInteger();
forEach(listNode, itemNode ->
{
if ("item".equalsIgnoreCase(itemNode.getNodeName()))
{
int totalPrice = 0;
int lastIngredientId = 0;
long lastIngredientCount = 0;
entryCounter.incrementAndGet();
final List<ItemChanceHolder> ingredients = new ArrayList<>(1);
final List<ItemChanceHolder> products = new ArrayList<>(1);
final MultisellEntryHolder entry = new MultisellEntryHolder(ingredients, products);
@ -114,6 +121,9 @@ public class MultisellData implements IXmlReader
if (itemExists(ingredient))
{
ingredients.add(ingredient);
lastIngredientId = id;
lastIngredientCount = count;
}
else
{
@ -162,6 +172,8 @@ public class MultisellData implements IXmlReader
{
continue;
}
totalPrice += item.getReferencePrice();
}
products.add(product);
@ -180,6 +192,17 @@ public class MultisellData implements IXmlReader
LOGGER.warning("Products' total chance of " + totalChance + "% exceeds 100% for list: " + listId + " at entry " + entries.size() + 1 + ".");
}
// Check if buy price is lower than sell price.
// Only applies when there is only one ingredient and it is adena.
if ((ingredients.size() == 1) && (lastIngredientId == 57) && (lastIngredientCount < totalPrice))
{
LOGGER.warning("Buy price " + lastIngredientCount + " is less than sell price " + totalPrice + " at entry " + entryCounter.intValue() + " of multisell " + listId + ".");
// Adjust price.
final ItemChanceHolder ingredient = new ItemChanceHolder(57, 0, totalPrice, (byte) 0, ingredients.get(0).isMaintainIngredient());
ingredients.clear();
ingredients.add(ingredient);
}
entries.add(entry);
}
else if ("npcs".equalsIgnoreCase(itemNode.getNodeName()))

View File

@ -24,6 +24,7 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.logging.Level;
import java.util.logging.Logger;
@ -93,11 +94,17 @@ public class MultisellData implements IXmlReader
final StatSet set = new StatSet(parseAttributes(listNode));
final int listId = Integer.parseInt(f.getName().substring(0, f.getName().length() - 4));
final List<MultisellEntryHolder> entries = new ArrayList<>(listNode.getChildNodes().getLength());
final AtomicInteger entryCounter = new AtomicInteger();
forEach(listNode, itemNode ->
{
if ("item".equalsIgnoreCase(itemNode.getNodeName()))
{
int totalPrice = 0;
int lastIngredientId = 0;
long lastIngredientCount = 0;
entryCounter.incrementAndGet();
final List<ItemChanceHolder> ingredients = new ArrayList<>(1);
final List<ItemChanceHolder> products = new ArrayList<>(1);
final MultisellEntryHolder entry = new MultisellEntryHolder(ingredients, products);
@ -113,6 +120,9 @@ public class MultisellData implements IXmlReader
if (itemExists(ingredient))
{
ingredients.add(ingredient);
lastIngredientId = id;
lastIngredientCount = count;
}
else
{
@ -153,6 +163,12 @@ public class MultisellData implements IXmlReader
}
products.add(product);
final Item item = ItemTable.getInstance().getTemplate(id);
if (item != null)
{
totalPrice += item.getReferencePrice();
}
}
else
{
@ -168,6 +184,17 @@ public class MultisellData implements IXmlReader
LOGGER.warning("Products' total chance of " + totalChance + "% exceeds 100% for list: " + listId + " at entry " + entries.size() + 1 + ".");
}
// Check if buy price is lower than sell price.
// Only applies when there is only one ingredient and it is adena.
if ((ingredients.size() == 1) && (lastIngredientId == 57) && (lastIngredientCount < totalPrice))
{
LOGGER.warning("Buy price " + lastIngredientCount + " is less than sell price " + totalPrice + " at entry " + entryCounter.intValue() + " of multisell " + listId + ".");
// Adjust price.
final ItemChanceHolder ingredient = new ItemChanceHolder(57, 0, totalPrice, (byte) 0, ingredients.get(0).isMaintainIngredient());
ingredients.clear();
ingredients.add(ingredient);
}
entries.add(entry);
}
else if ("npcs".equalsIgnoreCase(itemNode.getNodeName()))

View File

@ -24,6 +24,7 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.logging.Level;
import java.util.logging.Logger;
@ -93,11 +94,17 @@ public class MultisellData implements IXmlReader
final StatSet set = new StatSet(parseAttributes(listNode));
final int listId = Integer.parseInt(f.getName().substring(0, f.getName().length() - 4));
final List<MultisellEntryHolder> entries = new ArrayList<>(listNode.getChildNodes().getLength());
final AtomicInteger entryCounter = new AtomicInteger();
forEach(listNode, itemNode ->
{
if ("item".equalsIgnoreCase(itemNode.getNodeName()))
{
int totalPrice = 0;
int lastIngredientId = 0;
long lastIngredientCount = 0;
entryCounter.incrementAndGet();
final List<ItemChanceHolder> ingredients = new ArrayList<>(1);
final List<ItemChanceHolder> products = new ArrayList<>(1);
final MultisellEntryHolder entry = new MultisellEntryHolder(ingredients, products);
@ -113,6 +120,9 @@ public class MultisellData implements IXmlReader
if (itemExists(ingredient))
{
ingredients.add(ingredient);
lastIngredientId = id;
lastIngredientCount = count;
}
else
{
@ -153,6 +163,12 @@ public class MultisellData implements IXmlReader
}
products.add(product);
final Item item = ItemTable.getInstance().getTemplate(id);
if (item != null)
{
totalPrice += item.getReferencePrice();
}
}
else
{
@ -168,6 +184,17 @@ public class MultisellData implements IXmlReader
LOGGER.warning("Products' total chance of " + totalChance + "% exceeds 100% for list: " + listId + " at entry " + entries.size() + 1 + ".");
}
// Check if buy price is lower than sell price.
// Only applies when there is only one ingredient and it is adena.
if ((ingredients.size() == 1) && (lastIngredientId == 57) && (lastIngredientCount < totalPrice))
{
LOGGER.warning("Buy price " + lastIngredientCount + " is less than sell price " + totalPrice + " at entry " + entryCounter.intValue() + " of multisell " + listId + ".");
// Adjust price.
final ItemChanceHolder ingredient = new ItemChanceHolder(57, 0, totalPrice, (byte) 0, ingredients.get(0).isMaintainIngredient());
ingredients.clear();
ingredients.add(ingredient);
}
entries.add(entry);
}
else if ("npcs".equalsIgnoreCase(itemNode.getNodeName()))