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

@@ -273,6 +273,10 @@ GridNeighborTurnOnTime = 1
# Default: 90
GridNeighborTurnOffTime = 90
# Correct buylist prices when lower than sell price.
# Default: True
CorrectPrices = True
# ---------------------------------------------------------------------------
# Falling Damage

View File

@@ -538,6 +538,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;
@@ -2212,6 +2213,7 @@ public class Config
BOTREPORT_ALLOW_REPORTS_FROM_SAME_CLAN_MEMBERS = General.getBoolean("AllowReportsFromSameClanMembers", false);
ENABLE_PRIME_SHOP = General.getBoolean("EnablePrimeShop", false);
PRIME_SHOP_ITEM_ID = General.getInt("PrimeShopItemId", -1);
CORRECT_PRICES = General.getBoolean("CorrectPrices", true);
ENABLE_FALLING_DAMAGE = General.getBoolean("EnableFallingDamage", true);
// Load FloodProtector config file

View File

@@ -142,11 +142,11 @@ public class BuyListData implements IXmlReader
final Item item = ItemTable.getInstance().getTemplate(itemId);
if (item != null)
{
if ((price > -1) && (item.getReferencePrice() > price) && (buyList.getNpcsAllowed() != null))
final int sellPrice = item.getReferencePrice() / 2;
if (Config.CORRECT_PRICES && (price > -1) && (sellPrice > price) && (buyList.getNpcsAllowed() != null))
{
LOGGER.warning("Item price is too low. BuyList:" + buyList.getListId() + " ItemID:" + itemId + " File:" + f.getName());
LOGGER.warning("Setting price to reference price " + item.getReferencePrice() + " instead of " + price + ".");
buyList.addProduct(new Product(buyList.getListId(), item, item.getReferencePrice(), restockDelay, count));
LOGGER.warning("Buy price " + price + " is less than sell price " + sellPrice + " for ItemID:" + itemId + " of buylist " + buyList.getListId() + ".");
buyList.addProduct(new Product(buyList.getListId(), item, sellPrice, restockDelay, count));
}
else
{