Sell price checks.

This commit is contained in:
MobiusDevelopment
2021-03-06 09:19:30 +00:00
parent a5266432c5
commit e867feb170
107 changed files with 458 additions and 147 deletions

View File

@ -496,6 +496,7 @@ public class Config
public static int MAX_NPC_ANIMATION;
public static int MIN_MONSTER_ANIMATION;
public static int MAX_MONSTER_ANIMATION;
public static boolean CORRECT_PRICES;
public static boolean ENABLE_FALLING_DAMAGE;
public static boolean GRIDS_ALWAYS_ON;
public static int GRID_NEIGHBOR_TURNON_TIME;
@ -1968,6 +1969,7 @@ public class Config
GRIDS_ALWAYS_ON = General.getBoolean("GridsAlwaysOn", false);
GRID_NEIGHBOR_TURNON_TIME = General.getInt("GridNeighborTurnOnTime", 1);
GRID_NEIGHBOR_TURNOFF_TIME = General.getInt("GridNeighborTurnOffTime", 90);
CORRECT_PRICES = General.getBoolean("CorrectPrices", true);
PEACE_ZONE_MODE = General.getInt("PeaceZoneMode", 0);
DEFAULT_GLOBAL_CHAT = General.getString("GlobalChat", "ON");
DEFAULT_TRADE_CHAT = General.getString("TradeChat", "ON");

View File

@ -135,7 +135,16 @@ public class BuyListData implements IXmlReader
break;
}
buyList.addProduct(new Product(buyListId, item, price, restockDelay, count, baseTax));
final int sellPrice = item.getReferencePrice() / 2;
if (Config.CORRECT_PRICES && (price > -1) && (sellPrice > price) && (buyList.getNpcsAllowed() != null))
{
LOGGER.warning("Buy price " + price + " is less than sell price " + sellPrice + " for ItemID:" + itemId + " of buylist " + buyList.getListId() + ".");
buyList.addProduct(new Product(buyListId, item, sellPrice, restockDelay, count, baseTax));
}
else
{
buyList.addProduct(new Product(buyListId, item, price, restockDelay, count, baseTax));
}
}
else
{

View File

@ -173,7 +173,7 @@ public class MultisellData implements IXmlReader
continue;
}
totalPrice += (item.getReferencePrice() * count);
totalPrice += ((item.getReferencePrice() / 2) * count);
}
products.add(product);
@ -194,7 +194,7 @@ public class MultisellData implements IXmlReader
// 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))
if (Config.CORRECT_PRICES && (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.

View File

@ -70,8 +70,8 @@ public class ProductList
return (_allowedNpcs != null) && _allowedNpcs.contains(npcId);
}
// public Set<Integer> getNpcsAllowed()
// {
// return _allowedNpcs;
// }
public Set<Integer> getNpcsAllowed()
{
return _allowedNpcs;
}
}