From e867feb170c24cae796343aebed9bd7be1094cc3 Mon Sep 17 00:00:00 2001 From: MobiusDevelopment <8391001+MobiusDevelopment@users.noreply.github.com> Date: Sat, 6 Mar 2021 09:19:30 +0000 Subject: [PATCH] Sell price checks. --- L2J_Mobius_1.0_Ertheia/dist/game/config/General.ini | 4 ++++ L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/Config.java | 2 ++ .../l2jmobius/gameserver/data/xml/BuyListData.java | 11 ++++++++++- .../l2jmobius/gameserver/data/xml/MultisellData.java | 4 ++-- .../gameserver/model/buylist/ProductList.java | 8 ++++---- .../dist/game/config/General.ini | 4 ++++ .../java/org/l2jmobius/Config.java | 2 ++ .../l2jmobius/gameserver/data/xml/BuyListData.java | 11 ++++++++++- .../l2jmobius/gameserver/data/xml/MultisellData.java | 4 ++-- .../gameserver/model/buylist/ProductList.java | 8 ++++---- L2J_Mobius_3.0_Helios/dist/game/config/General.ini | 4 ++++ L2J_Mobius_3.0_Helios/java/org/l2jmobius/Config.java | 2 ++ .../l2jmobius/gameserver/data/xml/BuyListData.java | 11 ++++++++++- .../l2jmobius/gameserver/data/xml/MultisellData.java | 4 ++-- .../gameserver/model/buylist/ProductList.java | 8 ++++---- .../dist/game/config/General.ini | 4 ++++ .../java/org/l2jmobius/Config.java | 2 ++ .../l2jmobius/gameserver/data/xml/BuyListData.java | 11 ++++++++++- .../l2jmobius/gameserver/data/xml/MultisellData.java | 4 ++-- .../gameserver/model/buylist/ProductList.java | 8 ++++---- L2J_Mobius_5.0_Salvation/dist/game/config/General.ini | 4 ++++ .../java/org/l2jmobius/Config.java | 2 ++ .../l2jmobius/gameserver/data/xml/BuyListData.java | 11 ++++++++++- .../l2jmobius/gameserver/data/xml/MultisellData.java | 4 ++-- .../gameserver/model/buylist/ProductList.java | 8 ++++---- .../dist/game/config/General.ini | 4 ++++ .../java/org/l2jmobius/Config.java | 2 ++ .../l2jmobius/gameserver/data/xml/BuyListData.java | 11 ++++++++++- .../l2jmobius/gameserver/data/xml/MultisellData.java | 4 ++-- .../gameserver/model/buylist/ProductList.java | 8 ++++---- L2J_Mobius_6.0_Fafurion/dist/game/config/General.ini | 4 ++++ .../java/org/l2jmobius/Config.java | 2 ++ .../l2jmobius/gameserver/data/xml/BuyListData.java | 11 ++++++++++- .../l2jmobius/gameserver/data/xml/MultisellData.java | 4 ++-- .../gameserver/model/buylist/ProductList.java | 8 ++++---- .../dist/game/config/General.ini | 4 ++++ .../java/org/l2jmobius/Config.java | 2 ++ .../l2jmobius/gameserver/data/xml/BuyListData.java | 11 ++++++++++- .../l2jmobius/gameserver/data/xml/MultisellData.java | 4 ++-- .../gameserver/model/buylist/ProductList.java | 8 ++++---- .../dist/game/config/General.ini | 4 ++++ .../java/org/l2jmobius/Config.java | 2 ++ .../l2jmobius/gameserver/data/xml/BuyListData.java | 11 ++++++++++- .../l2jmobius/gameserver/data/xml/MultisellData.java | 4 ++-- .../gameserver/model/buylist/ProductList.java | 8 ++++---- .../dist/game/config/General.ini | 4 ++++ .../java/org/l2jmobius/Config.java | 2 ++ .../l2jmobius/gameserver/data/xml/BuyListData.java | 11 ++++++++++- .../l2jmobius/gameserver/data/xml/MultisellData.java | 4 ++-- .../gameserver/model/buylist/ProductList.java | 8 ++++---- .../dist/game/config/main/General.ini | 4 ++++ .../java/org/l2jmobius/Config.java | 2 ++ .../org/l2jmobius/gameserver/TradeController.java | 7 ++++--- .../dist/game/config/main/General.ini | 4 ++++ .../java/org/l2jmobius/Config.java | 2 ++ .../org/l2jmobius/gameserver/TradeController.java | 7 ++++--- .../dist/game/config/General.ini | 4 ++++ .../java/org/l2jmobius/Config.java | 2 ++ .../l2jmobius/gameserver/data/xml/BuyListData.java | 8 ++++---- .../dist/game/config/General.ini | 4 ++++ .../java/org/l2jmobius/Config.java | 2 ++ .../l2jmobius/gameserver/data/xml/BuyListData.java | 8 ++++---- .../dist/game/config/General.ini | 4 ++++ .../java/org/l2jmobius/Config.java | 2 ++ .../l2jmobius/gameserver/data/xml/BuyListData.java | 11 ++++++++++- .../l2jmobius/gameserver/data/xml/MultisellData.java | 4 ++-- .../gameserver/model/buylist/ProductList.java | 8 ++++---- .../dist/game/config/General.ini | 4 ++++ .../java/org/l2jmobius/Config.java | 2 ++ .../l2jmobius/gameserver/data/xml/BuyListData.java | 11 ++++++++++- .../l2jmobius/gameserver/data/xml/MultisellData.java | 4 ++-- .../gameserver/model/buylist/ProductList.java | 8 ++++---- .../dist/game/config/General.ini | 4 ++++ .../java/org/l2jmobius/Config.java | 2 ++ .../l2jmobius/gameserver/data/xml/BuyListData.java | 11 ++++++++++- .../l2jmobius/gameserver/data/xml/MultisellData.java | 4 ++-- .../gameserver/model/buylist/ProductList.java | 8 ++++---- .../dist/game/config/General.ini | 4 ++++ .../java/org/l2jmobius/Config.java | 2 ++ .../l2jmobius/gameserver/data/xml/BuyListData.java | 11 ++++++++++- .../l2jmobius/gameserver/data/xml/MultisellData.java | 4 ++-- .../gameserver/model/buylist/ProductList.java | 8 ++++---- .../dist/game/config/General.ini | 4 ++++ .../java/org/l2jmobius/Config.java | 2 ++ .../l2jmobius/gameserver/data/xml/BuyListData.java | 11 ++++++++++- .../l2jmobius/gameserver/data/xml/MultisellData.java | 4 ++-- .../gameserver/model/buylist/ProductList.java | 8 ++++---- .../dist/game/config/General.ini | 4 ++++ .../java/org/l2jmobius/Config.java | 2 ++ .../l2jmobius/gameserver/data/xml/BuyListData.java | 11 ++++++++++- .../l2jmobius/gameserver/data/xml/MultisellData.java | 4 ++-- .../gameserver/model/buylist/ProductList.java | 8 ++++---- .../dist/game/config/General.ini | 4 ++++ .../java/org/l2jmobius/Config.java | 2 ++ .../l2jmobius/gameserver/data/xml/BuyListData.java | 11 ++++++++++- .../l2jmobius/gameserver/data/xml/MultisellData.java | 4 ++-- .../gameserver/model/buylist/ProductList.java | 8 ++++---- .../dist/game/config/General.ini | 4 ++++ .../java/org/l2jmobius/Config.java | 2 ++ .../l2jmobius/gameserver/data/xml/BuyListData.java | 11 ++++++++++- .../l2jmobius/gameserver/data/xml/MultisellData.java | 4 ++-- .../gameserver/model/buylist/ProductList.java | 8 ++++---- .../dist/game/config/General.ini | 4 ++++ .../java/org/l2jmobius/Config.java | 2 ++ .../l2jmobius/gameserver/data/xml/BuyListData.java | 11 ++++++++++- .../l2jmobius/gameserver/data/xml/MultisellData.java | 4 ++-- .../gameserver/model/buylist/ProductList.java | 8 ++++---- 107 files changed, 458 insertions(+), 147 deletions(-) diff --git a/L2J_Mobius_1.0_Ertheia/dist/game/config/General.ini b/L2J_Mobius_1.0_Ertheia/dist/game/config/General.ini index 864cd737db..2b1f563a3d 100644 --- a/L2J_Mobius_1.0_Ertheia/dist/game/config/General.ini +++ b/L2J_Mobius_1.0_Ertheia/dist/game/config/General.ini @@ -280,6 +280,10 @@ GridNeighborTurnOnTime = 1 # Default: 90 GridNeighborTurnOffTime = 90 +# Correct buylist and multisell prices when lower than sell price. +# Default: True +CorrectPrices = True + # --------------------------------------------------------------------------- # Falling Damage diff --git a/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/Config.java b/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/Config.java index 7b07bfc413..bc2579288a 100644 --- a/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/Config.java +++ b/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/Config.java @@ -473,6 +473,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; @@ -1992,6 +1993,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"); diff --git a/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/data/xml/BuyListData.java b/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/data/xml/BuyListData.java index 3f2854fd9b..7258e07114 100644 --- a/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/data/xml/BuyListData.java +++ b/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/data/xml/BuyListData.java @@ -126,7 +126,16 @@ public class BuyListData implements IXmlReader final long restockDelay = parseLong(attrs, "restock_delay", -1L); final long count = parseLong(attrs, "count", -1L); final int baseTax = parseInteger(attrs, "baseTax", defaultBaseTax); - 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 { diff --git a/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/data/xml/MultisellData.java b/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/data/xml/MultisellData.java index 1f31601a53..105dad8ed4 100644 --- a/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/data/xml/MultisellData.java +++ b/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/data/xml/MultisellData.java @@ -167,7 +167,7 @@ public class MultisellData implements IXmlReader final Item item = ItemTable.getInstance().getTemplate(id); if (item != null) { - totalPrice += (item.getReferencePrice() * count); + totalPrice += ((item.getReferencePrice() / 2) * count); } } else @@ -186,7 +186,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. diff --git a/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/model/buylist/ProductList.java b/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/model/buylist/ProductList.java index 7ff80ead24..c21638731f 100644 --- a/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/model/buylist/ProductList.java +++ b/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/model/buylist/ProductList.java @@ -70,8 +70,8 @@ public class ProductList return (_allowedNpcs != null) && _allowedNpcs.contains(npcId); } - // public Set getNpcsAllowed() - // { - // return _allowedNpcs; - // } + public Set getNpcsAllowed() + { + return _allowedNpcs; + } } diff --git a/L2J_Mobius_2.5_Underground/dist/game/config/General.ini b/L2J_Mobius_2.5_Underground/dist/game/config/General.ini index 84f2d6ecf5..e73a7de479 100644 --- a/L2J_Mobius_2.5_Underground/dist/game/config/General.ini +++ b/L2J_Mobius_2.5_Underground/dist/game/config/General.ini @@ -288,6 +288,10 @@ GridNeighborTurnOnTime = 1 # Default: 90 GridNeighborTurnOffTime = 90 +# Correct buylist and multisell prices when lower than sell price. +# Default: True +CorrectPrices = True + # --------------------------------------------------------------------------- # Falling Damage diff --git a/L2J_Mobius_2.5_Underground/java/org/l2jmobius/Config.java b/L2J_Mobius_2.5_Underground/java/org/l2jmobius/Config.java index f6400bf61b..5b8a52a0d8 100644 --- a/L2J_Mobius_2.5_Underground/java/org/l2jmobius/Config.java +++ b/L2J_Mobius_2.5_Underground/java/org/l2jmobius/Config.java @@ -483,6 +483,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; @@ -2015,6 +2016,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"); diff --git a/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/data/xml/BuyListData.java b/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/data/xml/BuyListData.java index 3f2854fd9b..7258e07114 100644 --- a/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/data/xml/BuyListData.java +++ b/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/data/xml/BuyListData.java @@ -126,7 +126,16 @@ public class BuyListData implements IXmlReader final long restockDelay = parseLong(attrs, "restock_delay", -1L); final long count = parseLong(attrs, "count", -1L); final int baseTax = parseInteger(attrs, "baseTax", defaultBaseTax); - 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 { diff --git a/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/data/xml/MultisellData.java b/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/data/xml/MultisellData.java index 1f31601a53..105dad8ed4 100644 --- a/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/data/xml/MultisellData.java +++ b/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/data/xml/MultisellData.java @@ -167,7 +167,7 @@ public class MultisellData implements IXmlReader final Item item = ItemTable.getInstance().getTemplate(id); if (item != null) { - totalPrice += (item.getReferencePrice() * count); + totalPrice += ((item.getReferencePrice() / 2) * count); } } else @@ -186,7 +186,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. diff --git a/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/model/buylist/ProductList.java b/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/model/buylist/ProductList.java index 7ff80ead24..c21638731f 100644 --- a/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/model/buylist/ProductList.java +++ b/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/model/buylist/ProductList.java @@ -70,8 +70,8 @@ public class ProductList return (_allowedNpcs != null) && _allowedNpcs.contains(npcId); } - // public Set getNpcsAllowed() - // { - // return _allowedNpcs; - // } + public Set getNpcsAllowed() + { + return _allowedNpcs; + } } diff --git a/L2J_Mobius_3.0_Helios/dist/game/config/General.ini b/L2J_Mobius_3.0_Helios/dist/game/config/General.ini index 84f2d6ecf5..e73a7de479 100644 --- a/L2J_Mobius_3.0_Helios/dist/game/config/General.ini +++ b/L2J_Mobius_3.0_Helios/dist/game/config/General.ini @@ -288,6 +288,10 @@ GridNeighborTurnOnTime = 1 # Default: 90 GridNeighborTurnOffTime = 90 +# Correct buylist and multisell prices when lower than sell price. +# Default: True +CorrectPrices = True + # --------------------------------------------------------------------------- # Falling Damage diff --git a/L2J_Mobius_3.0_Helios/java/org/l2jmobius/Config.java b/L2J_Mobius_3.0_Helios/java/org/l2jmobius/Config.java index 252f8ba0bd..c544ed61c5 100644 --- a/L2J_Mobius_3.0_Helios/java/org/l2jmobius/Config.java +++ b/L2J_Mobius_3.0_Helios/java/org/l2jmobius/Config.java @@ -483,6 +483,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; @@ -2028,6 +2029,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"); diff --git a/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/data/xml/BuyListData.java b/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/data/xml/BuyListData.java index 3f2854fd9b..7258e07114 100644 --- a/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/data/xml/BuyListData.java +++ b/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/data/xml/BuyListData.java @@ -126,7 +126,16 @@ public class BuyListData implements IXmlReader final long restockDelay = parseLong(attrs, "restock_delay", -1L); final long count = parseLong(attrs, "count", -1L); final int baseTax = parseInteger(attrs, "baseTax", defaultBaseTax); - 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 { diff --git a/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/data/xml/MultisellData.java b/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/data/xml/MultisellData.java index 1f31601a53..105dad8ed4 100644 --- a/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/data/xml/MultisellData.java +++ b/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/data/xml/MultisellData.java @@ -167,7 +167,7 @@ public class MultisellData implements IXmlReader final Item item = ItemTable.getInstance().getTemplate(id); if (item != null) { - totalPrice += (item.getReferencePrice() * count); + totalPrice += ((item.getReferencePrice() / 2) * count); } } else @@ -186,7 +186,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. diff --git a/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/model/buylist/ProductList.java b/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/model/buylist/ProductList.java index 7ff80ead24..c21638731f 100644 --- a/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/model/buylist/ProductList.java +++ b/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/model/buylist/ProductList.java @@ -70,8 +70,8 @@ public class ProductList return (_allowedNpcs != null) && _allowedNpcs.contains(npcId); } - // public Set getNpcsAllowed() - // { - // return _allowedNpcs; - // } + public Set getNpcsAllowed() + { + return _allowedNpcs; + } } diff --git a/L2J_Mobius_4.0_GrandCrusade/dist/game/config/General.ini b/L2J_Mobius_4.0_GrandCrusade/dist/game/config/General.ini index 84f2d6ecf5..e73a7de479 100644 --- a/L2J_Mobius_4.0_GrandCrusade/dist/game/config/General.ini +++ b/L2J_Mobius_4.0_GrandCrusade/dist/game/config/General.ini @@ -288,6 +288,10 @@ GridNeighborTurnOnTime = 1 # Default: 90 GridNeighborTurnOffTime = 90 +# Correct buylist and multisell prices when lower than sell price. +# Default: True +CorrectPrices = True + # --------------------------------------------------------------------------- # Falling Damage diff --git a/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/Config.java b/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/Config.java index 5b0dfb4ff4..a980269fe9 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/Config.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/Config.java @@ -477,6 +477,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; @@ -2008,6 +2009,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"); diff --git a/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/data/xml/BuyListData.java b/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/data/xml/BuyListData.java index 3f2854fd9b..191c5fa403 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/data/xml/BuyListData.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/data/xml/BuyListData.java @@ -126,7 +126,16 @@ public class BuyListData implements IXmlReader final long restockDelay = parseLong(attrs, "restock_delay", -1L); final long count = parseLong(attrs, "count", -1L); final int baseTax = parseInteger(attrs, "baseTax", defaultBaseTax); - buyList.addProduct(new Product(buyListId, item, price, restockDelay, count, baseTax)); + final long 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 { diff --git a/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/data/xml/MultisellData.java b/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/data/xml/MultisellData.java index 1f31601a53..105dad8ed4 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/data/xml/MultisellData.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/data/xml/MultisellData.java @@ -167,7 +167,7 @@ public class MultisellData implements IXmlReader final Item item = ItemTable.getInstance().getTemplate(id); if (item != null) { - totalPrice += (item.getReferencePrice() * count); + totalPrice += ((item.getReferencePrice() / 2) * count); } } else @@ -186,7 +186,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. diff --git a/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/model/buylist/ProductList.java b/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/model/buylist/ProductList.java index 7ff80ead24..c21638731f 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/model/buylist/ProductList.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/model/buylist/ProductList.java @@ -70,8 +70,8 @@ public class ProductList return (_allowedNpcs != null) && _allowedNpcs.contains(npcId); } - // public Set getNpcsAllowed() - // { - // return _allowedNpcs; - // } + public Set getNpcsAllowed() + { + return _allowedNpcs; + } } diff --git a/L2J_Mobius_5.0_Salvation/dist/game/config/General.ini b/L2J_Mobius_5.0_Salvation/dist/game/config/General.ini index 84f2d6ecf5..e73a7de479 100644 --- a/L2J_Mobius_5.0_Salvation/dist/game/config/General.ini +++ b/L2J_Mobius_5.0_Salvation/dist/game/config/General.ini @@ -288,6 +288,10 @@ GridNeighborTurnOnTime = 1 # Default: 90 GridNeighborTurnOffTime = 90 +# Correct buylist and multisell prices when lower than sell price. +# Default: True +CorrectPrices = True + # --------------------------------------------------------------------------- # Falling Damage diff --git a/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/Config.java b/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/Config.java index 867c3d8dba..87dacfcd8c 100644 --- a/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/Config.java +++ b/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/Config.java @@ -472,6 +472,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; @@ -2009,6 +2010,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"); diff --git a/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/data/xml/BuyListData.java b/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/data/xml/BuyListData.java index 3f2854fd9b..191c5fa403 100644 --- a/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/data/xml/BuyListData.java +++ b/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/data/xml/BuyListData.java @@ -126,7 +126,16 @@ public class BuyListData implements IXmlReader final long restockDelay = parseLong(attrs, "restock_delay", -1L); final long count = parseLong(attrs, "count", -1L); final int baseTax = parseInteger(attrs, "baseTax", defaultBaseTax); - buyList.addProduct(new Product(buyListId, item, price, restockDelay, count, baseTax)); + final long 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 { diff --git a/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/data/xml/MultisellData.java b/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/data/xml/MultisellData.java index 1f31601a53..105dad8ed4 100644 --- a/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/data/xml/MultisellData.java +++ b/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/data/xml/MultisellData.java @@ -167,7 +167,7 @@ public class MultisellData implements IXmlReader final Item item = ItemTable.getInstance().getTemplate(id); if (item != null) { - totalPrice += (item.getReferencePrice() * count); + totalPrice += ((item.getReferencePrice() / 2) * count); } } else @@ -186,7 +186,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. diff --git a/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/model/buylist/ProductList.java b/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/model/buylist/ProductList.java index 7ff80ead24..c21638731f 100644 --- a/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/model/buylist/ProductList.java +++ b/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/model/buylist/ProductList.java @@ -70,8 +70,8 @@ public class ProductList return (_allowedNpcs != null) && _allowedNpcs.contains(npcId); } - // public Set getNpcsAllowed() - // { - // return _allowedNpcs; - // } + public Set getNpcsAllowed() + { + return _allowedNpcs; + } } diff --git a/L2J_Mobius_5.5_EtinasFate/dist/game/config/General.ini b/L2J_Mobius_5.5_EtinasFate/dist/game/config/General.ini index 84f2d6ecf5..e73a7de479 100644 --- a/L2J_Mobius_5.5_EtinasFate/dist/game/config/General.ini +++ b/L2J_Mobius_5.5_EtinasFate/dist/game/config/General.ini @@ -288,6 +288,10 @@ GridNeighborTurnOnTime = 1 # Default: 90 GridNeighborTurnOffTime = 90 +# Correct buylist and multisell prices when lower than sell price. +# Default: True +CorrectPrices = True + # --------------------------------------------------------------------------- # Falling Damage diff --git a/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/Config.java b/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/Config.java index fbf09e7329..cc81e2f355 100644 --- a/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/Config.java +++ b/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/Config.java @@ -472,6 +472,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; @@ -2016,6 +2017,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"); diff --git a/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/data/xml/BuyListData.java b/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/data/xml/BuyListData.java index 3f2854fd9b..191c5fa403 100644 --- a/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/data/xml/BuyListData.java +++ b/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/data/xml/BuyListData.java @@ -126,7 +126,16 @@ public class BuyListData implements IXmlReader final long restockDelay = parseLong(attrs, "restock_delay", -1L); final long count = parseLong(attrs, "count", -1L); final int baseTax = parseInteger(attrs, "baseTax", defaultBaseTax); - buyList.addProduct(new Product(buyListId, item, price, restockDelay, count, baseTax)); + final long 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 { diff --git a/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/data/xml/MultisellData.java b/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/data/xml/MultisellData.java index 1f31601a53..105dad8ed4 100644 --- a/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/data/xml/MultisellData.java +++ b/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/data/xml/MultisellData.java @@ -167,7 +167,7 @@ public class MultisellData implements IXmlReader final Item item = ItemTable.getInstance().getTemplate(id); if (item != null) { - totalPrice += (item.getReferencePrice() * count); + totalPrice += ((item.getReferencePrice() / 2) * count); } } else @@ -186,7 +186,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. diff --git a/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/model/buylist/ProductList.java b/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/model/buylist/ProductList.java index 7ff80ead24..c21638731f 100644 --- a/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/model/buylist/ProductList.java +++ b/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/model/buylist/ProductList.java @@ -70,8 +70,8 @@ public class ProductList return (_allowedNpcs != null) && _allowedNpcs.contains(npcId); } - // public Set getNpcsAllowed() - // { - // return _allowedNpcs; - // } + public Set getNpcsAllowed() + { + return _allowedNpcs; + } } diff --git a/L2J_Mobius_6.0_Fafurion/dist/game/config/General.ini b/L2J_Mobius_6.0_Fafurion/dist/game/config/General.ini index 84f2d6ecf5..e73a7de479 100644 --- a/L2J_Mobius_6.0_Fafurion/dist/game/config/General.ini +++ b/L2J_Mobius_6.0_Fafurion/dist/game/config/General.ini @@ -288,6 +288,10 @@ GridNeighborTurnOnTime = 1 # Default: 90 GridNeighborTurnOffTime = 90 +# Correct buylist and multisell prices when lower than sell price. +# Default: True +CorrectPrices = True + # --------------------------------------------------------------------------- # Falling Damage diff --git a/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/Config.java b/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/Config.java index 2960dd258b..6537b57355 100644 --- a/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/Config.java +++ b/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/Config.java @@ -473,6 +473,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; @@ -2055,6 +2056,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"); diff --git a/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/data/xml/BuyListData.java b/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/data/xml/BuyListData.java index 3f2854fd9b..191c5fa403 100644 --- a/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/data/xml/BuyListData.java +++ b/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/data/xml/BuyListData.java @@ -126,7 +126,16 @@ public class BuyListData implements IXmlReader final long restockDelay = parseLong(attrs, "restock_delay", -1L); final long count = parseLong(attrs, "count", -1L); final int baseTax = parseInteger(attrs, "baseTax", defaultBaseTax); - buyList.addProduct(new Product(buyListId, item, price, restockDelay, count, baseTax)); + final long 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 { diff --git a/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/data/xml/MultisellData.java b/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/data/xml/MultisellData.java index 1f31601a53..105dad8ed4 100644 --- a/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/data/xml/MultisellData.java +++ b/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/data/xml/MultisellData.java @@ -167,7 +167,7 @@ public class MultisellData implements IXmlReader final Item item = ItemTable.getInstance().getTemplate(id); if (item != null) { - totalPrice += (item.getReferencePrice() * count); + totalPrice += ((item.getReferencePrice() / 2) * count); } } else @@ -186,7 +186,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. diff --git a/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/model/buylist/ProductList.java b/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/model/buylist/ProductList.java index 7ff80ead24..c21638731f 100644 --- a/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/model/buylist/ProductList.java +++ b/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/model/buylist/ProductList.java @@ -70,8 +70,8 @@ public class ProductList return (_allowedNpcs != null) && _allowedNpcs.contains(npcId); } - // public Set getNpcsAllowed() - // { - // return _allowedNpcs; - // } + public Set getNpcsAllowed() + { + return _allowedNpcs; + } } diff --git a/L2J_Mobius_7.0_PreludeOfWar/dist/game/config/General.ini b/L2J_Mobius_7.0_PreludeOfWar/dist/game/config/General.ini index 4d5a6e68cd..fc8cce65b3 100644 --- a/L2J_Mobius_7.0_PreludeOfWar/dist/game/config/General.ini +++ b/L2J_Mobius_7.0_PreludeOfWar/dist/game/config/General.ini @@ -289,6 +289,10 @@ GridNeighborTurnOnTime = 1 # Default: 90 GridNeighborTurnOffTime = 90 +# Correct buylist and multisell prices when lower than sell price. +# Default: True +CorrectPrices = True + # --------------------------------------------------------------------------- # Falling Damage diff --git a/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/Config.java b/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/Config.java index fb2422eade..1811311ae0 100644 --- a/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/Config.java +++ b/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/Config.java @@ -474,6 +474,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; @@ -2075,6 +2076,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); ENABLE_FALLING_DAMAGE = General.getBoolean("EnableFallingDamage", true); PEACE_ZONE_MODE = General.getInt("PeaceZoneMode", 0); DEFAULT_GLOBAL_CHAT = General.getString("GlobalChat", "ON"); diff --git a/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/data/xml/BuyListData.java b/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/data/xml/BuyListData.java index 3f2854fd9b..191c5fa403 100644 --- a/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/data/xml/BuyListData.java +++ b/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/data/xml/BuyListData.java @@ -126,7 +126,16 @@ public class BuyListData implements IXmlReader final long restockDelay = parseLong(attrs, "restock_delay", -1L); final long count = parseLong(attrs, "count", -1L); final int baseTax = parseInteger(attrs, "baseTax", defaultBaseTax); - buyList.addProduct(new Product(buyListId, item, price, restockDelay, count, baseTax)); + final long 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 { diff --git a/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/data/xml/MultisellData.java b/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/data/xml/MultisellData.java index 1f31601a53..105dad8ed4 100644 --- a/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/data/xml/MultisellData.java +++ b/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/data/xml/MultisellData.java @@ -167,7 +167,7 @@ public class MultisellData implements IXmlReader final Item item = ItemTable.getInstance().getTemplate(id); if (item != null) { - totalPrice += (item.getReferencePrice() * count); + totalPrice += ((item.getReferencePrice() / 2) * count); } } else @@ -186,7 +186,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. diff --git a/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/model/buylist/ProductList.java b/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/model/buylist/ProductList.java index 7ff80ead24..c21638731f 100644 --- a/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/model/buylist/ProductList.java +++ b/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/model/buylist/ProductList.java @@ -70,8 +70,8 @@ public class ProductList return (_allowedNpcs != null) && _allowedNpcs.contains(npcId); } - // public Set getNpcsAllowed() - // { - // return _allowedNpcs; - // } + public Set getNpcsAllowed() + { + return _allowedNpcs; + } } diff --git a/L2J_Mobius_8.0_Homunculus/dist/game/config/General.ini b/L2J_Mobius_8.0_Homunculus/dist/game/config/General.ini index 850df0bb43..a5f0e2a21c 100644 --- a/L2J_Mobius_8.0_Homunculus/dist/game/config/General.ini +++ b/L2J_Mobius_8.0_Homunculus/dist/game/config/General.ini @@ -284,6 +284,10 @@ GridNeighborTurnOnTime = 1 # Default: 90 GridNeighborTurnOffTime = 90 +# Correct buylist and multisell prices when lower than sell price. +# Default: True +CorrectPrices = True + # --------------------------------------------------------------------------- # Falling Damage diff --git a/L2J_Mobius_8.0_Homunculus/java/org/l2jmobius/Config.java b/L2J_Mobius_8.0_Homunculus/java/org/l2jmobius/Config.java index 2f7f69a20f..45fb87b795 100644 --- a/L2J_Mobius_8.0_Homunculus/java/org/l2jmobius/Config.java +++ b/L2J_Mobius_8.0_Homunculus/java/org/l2jmobius/Config.java @@ -471,6 +471,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; @@ -2075,6 +2076,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); ENABLE_FALLING_DAMAGE = General.getBoolean("EnableFallingDamage", true); PEACE_ZONE_MODE = General.getInt("PeaceZoneMode", 0); DEFAULT_GLOBAL_CHAT = General.getString("GlobalChat", "ON"); diff --git a/L2J_Mobius_8.0_Homunculus/java/org/l2jmobius/gameserver/data/xml/BuyListData.java b/L2J_Mobius_8.0_Homunculus/java/org/l2jmobius/gameserver/data/xml/BuyListData.java index 3f2854fd9b..191c5fa403 100644 --- a/L2J_Mobius_8.0_Homunculus/java/org/l2jmobius/gameserver/data/xml/BuyListData.java +++ b/L2J_Mobius_8.0_Homunculus/java/org/l2jmobius/gameserver/data/xml/BuyListData.java @@ -126,7 +126,16 @@ public class BuyListData implements IXmlReader final long restockDelay = parseLong(attrs, "restock_delay", -1L); final long count = parseLong(attrs, "count", -1L); final int baseTax = parseInteger(attrs, "baseTax", defaultBaseTax); - buyList.addProduct(new Product(buyListId, item, price, restockDelay, count, baseTax)); + final long 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 { diff --git a/L2J_Mobius_8.0_Homunculus/java/org/l2jmobius/gameserver/data/xml/MultisellData.java b/L2J_Mobius_8.0_Homunculus/java/org/l2jmobius/gameserver/data/xml/MultisellData.java index 1f31601a53..105dad8ed4 100644 --- a/L2J_Mobius_8.0_Homunculus/java/org/l2jmobius/gameserver/data/xml/MultisellData.java +++ b/L2J_Mobius_8.0_Homunculus/java/org/l2jmobius/gameserver/data/xml/MultisellData.java @@ -167,7 +167,7 @@ public class MultisellData implements IXmlReader final Item item = ItemTable.getInstance().getTemplate(id); if (item != null) { - totalPrice += (item.getReferencePrice() * count); + totalPrice += ((item.getReferencePrice() / 2) * count); } } else @@ -186,7 +186,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. diff --git a/L2J_Mobius_8.0_Homunculus/java/org/l2jmobius/gameserver/model/buylist/ProductList.java b/L2J_Mobius_8.0_Homunculus/java/org/l2jmobius/gameserver/model/buylist/ProductList.java index 7ff80ead24..c21638731f 100644 --- a/L2J_Mobius_8.0_Homunculus/java/org/l2jmobius/gameserver/model/buylist/ProductList.java +++ b/L2J_Mobius_8.0_Homunculus/java/org/l2jmobius/gameserver/model/buylist/ProductList.java @@ -70,8 +70,8 @@ public class ProductList return (_allowedNpcs != null) && _allowedNpcs.contains(npcId); } - // public Set getNpcsAllowed() - // { - // return _allowedNpcs; - // } + public Set getNpcsAllowed() + { + return _allowedNpcs; + } } diff --git a/L2J_Mobius_9.0_ReturnOfTheQueenAnt/dist/game/config/General.ini b/L2J_Mobius_9.0_ReturnOfTheQueenAnt/dist/game/config/General.ini index 850df0bb43..a5f0e2a21c 100644 --- a/L2J_Mobius_9.0_ReturnOfTheQueenAnt/dist/game/config/General.ini +++ b/L2J_Mobius_9.0_ReturnOfTheQueenAnt/dist/game/config/General.ini @@ -284,6 +284,10 @@ GridNeighborTurnOnTime = 1 # Default: 90 GridNeighborTurnOffTime = 90 +# Correct buylist and multisell prices when lower than sell price. +# Default: True +CorrectPrices = True + # --------------------------------------------------------------------------- # Falling Damage diff --git a/L2J_Mobius_9.0_ReturnOfTheQueenAnt/java/org/l2jmobius/Config.java b/L2J_Mobius_9.0_ReturnOfTheQueenAnt/java/org/l2jmobius/Config.java index 2f7f69a20f..45fb87b795 100644 --- a/L2J_Mobius_9.0_ReturnOfTheQueenAnt/java/org/l2jmobius/Config.java +++ b/L2J_Mobius_9.0_ReturnOfTheQueenAnt/java/org/l2jmobius/Config.java @@ -471,6 +471,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; @@ -2075,6 +2076,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); ENABLE_FALLING_DAMAGE = General.getBoolean("EnableFallingDamage", true); PEACE_ZONE_MODE = General.getInt("PeaceZoneMode", 0); DEFAULT_GLOBAL_CHAT = General.getString("GlobalChat", "ON"); diff --git a/L2J_Mobius_9.0_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/data/xml/BuyListData.java b/L2J_Mobius_9.0_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/data/xml/BuyListData.java index 3f2854fd9b..191c5fa403 100644 --- a/L2J_Mobius_9.0_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/data/xml/BuyListData.java +++ b/L2J_Mobius_9.0_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/data/xml/BuyListData.java @@ -126,7 +126,16 @@ public class BuyListData implements IXmlReader final long restockDelay = parseLong(attrs, "restock_delay", -1L); final long count = parseLong(attrs, "count", -1L); final int baseTax = parseInteger(attrs, "baseTax", defaultBaseTax); - buyList.addProduct(new Product(buyListId, item, price, restockDelay, count, baseTax)); + final long 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 { diff --git a/L2J_Mobius_9.0_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/data/xml/MultisellData.java b/L2J_Mobius_9.0_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/data/xml/MultisellData.java index 1f31601a53..105dad8ed4 100644 --- a/L2J_Mobius_9.0_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/data/xml/MultisellData.java +++ b/L2J_Mobius_9.0_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/data/xml/MultisellData.java @@ -167,7 +167,7 @@ public class MultisellData implements IXmlReader final Item item = ItemTable.getInstance().getTemplate(id); if (item != null) { - totalPrice += (item.getReferencePrice() * count); + totalPrice += ((item.getReferencePrice() / 2) * count); } } else @@ -186,7 +186,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. diff --git a/L2J_Mobius_9.0_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/model/buylist/ProductList.java b/L2J_Mobius_9.0_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/model/buylist/ProductList.java index 7ff80ead24..c21638731f 100644 --- a/L2J_Mobius_9.0_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/model/buylist/ProductList.java +++ b/L2J_Mobius_9.0_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/model/buylist/ProductList.java @@ -70,8 +70,8 @@ public class ProductList return (_allowedNpcs != null) && _allowedNpcs.contains(npcId); } - // public Set getNpcsAllowed() - // { - // return _allowedNpcs; - // } + public Set getNpcsAllowed() + { + return _allowedNpcs; + } } diff --git a/L2J_Mobius_C4_ScionsOfDestiny/dist/game/config/main/General.ini b/L2J_Mobius_C4_ScionsOfDestiny/dist/game/config/main/General.ini index 8c78d2de99..4720b488b4 100644 --- a/L2J_Mobius_C4_ScionsOfDestiny/dist/game/config/main/General.ini +++ b/L2J_Mobius_C4_ScionsOfDestiny/dist/game/config/main/General.ini @@ -278,6 +278,10 @@ RaidMinionRespawnTime = 300000 # Default: 50 ClickTaskDelay = 50 +# Correct buylist prices when lower than sell price. +# Default: True +CorrectPrices = True + # --------------------------------------------------------------------------- # Pets diff --git a/L2J_Mobius_C4_ScionsOfDestiny/java/org/l2jmobius/Config.java b/L2J_Mobius_C4_ScionsOfDestiny/java/org/l2jmobius/Config.java index bcb2b4ff66..6b68a08eee 100644 --- a/L2J_Mobius_C4_ScionsOfDestiny/java/org/l2jmobius/Config.java +++ b/L2J_Mobius_C4_ScionsOfDestiny/java/org/l2jmobius/Config.java @@ -216,6 +216,7 @@ public class Config public static int WYVERN_SPEED; public static int STRIDER_SPEED; public static boolean ALLOW_WYVERN_UPGRADER; + public static boolean CORRECT_PRICES; public static String NONDROPPABLE_ITEMS; public static List LIST_NONDROPPABLE_ITEMS = new ArrayList<>(); public static String PET_RENT_NPC; @@ -1404,6 +1405,7 @@ public class Config WYVERN_SPEED = generalConfig.getInt("WyvernSpeed", 100); STRIDER_SPEED = generalConfig.getInt("StriderSpeed", 80); ALLOW_WYVERN_UPGRADER = generalConfig.getBoolean("AllowWyvernUpgrader", false); + CORRECT_PRICES = generalConfig.getBoolean("CorrectPrices", true); ENABLE_AIO_SYSTEM = generalConfig.getBoolean("EnableAioSystem", true); ALLOW_AIO_NCOLOR = generalConfig.getBoolean("AllowAioNameColor", true); AIO_NCOLOR = Integer.decode("0x" + generalConfig.getString("AioNameColor", "88AA88")); diff --git a/L2J_Mobius_C4_ScionsOfDestiny/java/org/l2jmobius/gameserver/TradeController.java b/L2J_Mobius_C4_ScionsOfDestiny/java/org/l2jmobius/gameserver/TradeController.java index 6d6d41ef13..37576a6972 100644 --- a/L2J_Mobius_C4_ScionsOfDestiny/java/org/l2jmobius/gameserver/TradeController.java +++ b/L2J_Mobius_C4_ScionsOfDestiny/java/org/l2jmobius/gameserver/TradeController.java @@ -84,10 +84,11 @@ public class TradeController limitedItem = true; } - if (!rset1.getString("npc_id").equals("gm") && (price < (item.getReferencePrice() / 2))) + final int sellPrice = item.getReferencePrice() / 2; + if (Config.CORRECT_PRICES && (price < sellPrice) && !rset1.getString("npc_id").equals("gm")) { - LOGGER.warning("TradeList " + buy1.getListId() + " itemId " + itemId + " has an ADENA sell price lower then reference price.. Automatically Updating it.."); - price = item.getReferencePrice(); + LOGGER.warning("Buy price " + price + " is less than sell price " + sellPrice + " for ItemID:" + itemId + " of buylist " + buy1.getListId() + "."); + price = sellPrice; } item.setPriceToSell(price); diff --git a/L2J_Mobius_C6_Interlude/dist/game/config/main/General.ini b/L2J_Mobius_C6_Interlude/dist/game/config/main/General.ini index d09565b4ad..11f072cdd8 100644 --- a/L2J_Mobius_C6_Interlude/dist/game/config/main/General.ini +++ b/L2J_Mobius_C6_Interlude/dist/game/config/main/General.ini @@ -302,6 +302,10 @@ RaidMinionRespawnTime = 300000 # Default: 50 ClickTaskDelay = 50 +# Correct buylist prices when lower than sell price. +# Default: True +CorrectPrices = True + # --------------------------------------------------------------------------- # Pets diff --git a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/Config.java b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/Config.java index 54eca364a5..f56d668cd9 100644 --- a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/Config.java +++ b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/Config.java @@ -222,6 +222,7 @@ public class Config public static int WYVERN_SPEED; public static int STRIDER_SPEED; public static boolean ALLOW_WYVERN_UPGRADER; + public static boolean CORRECT_PRICES; public static String NONDROPPABLE_ITEMS; public static List LIST_NONDROPPABLE_ITEMS = new ArrayList<>(); public static String PET_RENT_NPC; @@ -1452,6 +1453,7 @@ public class Config WYVERN_SPEED = generalConfig.getInt("WyvernSpeed", 100); STRIDER_SPEED = generalConfig.getInt("StriderSpeed", 80); ALLOW_WYVERN_UPGRADER = generalConfig.getBoolean("AllowWyvernUpgrader", false); + CORRECT_PRICES = generalConfig.getBoolean("CorrectPrices", true); ENABLE_AIO_SYSTEM = generalConfig.getBoolean("EnableAioSystem", true); ALLOW_AIO_NCOLOR = generalConfig.getBoolean("AllowAioNameColor", true); AIO_NCOLOR = Integer.decode("0x" + generalConfig.getString("AioNameColor", "88AA88")); diff --git a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/TradeController.java b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/TradeController.java index 6d6d41ef13..37576a6972 100644 --- a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/TradeController.java +++ b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/TradeController.java @@ -84,10 +84,11 @@ public class TradeController limitedItem = true; } - if (!rset1.getString("npc_id").equals("gm") && (price < (item.getReferencePrice() / 2))) + final int sellPrice = item.getReferencePrice() / 2; + if (Config.CORRECT_PRICES && (price < sellPrice) && !rset1.getString("npc_id").equals("gm")) { - LOGGER.warning("TradeList " + buy1.getListId() + " itemId " + itemId + " has an ADENA sell price lower then reference price.. Automatically Updating it.."); - price = item.getReferencePrice(); + LOGGER.warning("Buy price " + price + " is less than sell price " + sellPrice + " for ItemID:" + itemId + " of buylist " + buy1.getListId() + "."); + price = sellPrice; } item.setPriceToSell(price); diff --git a/L2J_Mobius_CT_2.4_Epilogue/dist/game/config/General.ini b/L2J_Mobius_CT_2.4_Epilogue/dist/game/config/General.ini index 1ccc0bf069..dd5881d5ef 100644 --- a/L2J_Mobius_CT_2.4_Epilogue/dist/game/config/General.ini +++ b/L2J_Mobius_CT_2.4_Epilogue/dist/game/config/General.ini @@ -273,6 +273,10 @@ GridNeighborTurnOnTime = 1 # Default: 90 GridNeighborTurnOffTime = 90 +# Correct buylist prices when lower than sell price. +# Default: True +CorrectPrices = True + # --------------------------------------------------------------------------- # Falling Damage diff --git a/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/Config.java b/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/Config.java index 80260c21d1..936bb8c87b 100644 --- a/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/Config.java +++ b/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/Config.java @@ -533,6 +533,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; @@ -2207,6 +2208,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 diff --git a/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/data/xml/BuyListData.java b/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/data/xml/BuyListData.java index 7d075c3e58..8e4d13ae84 100644 --- a/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/data/xml/BuyListData.java +++ b/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/data/xml/BuyListData.java @@ -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 { diff --git a/L2J_Mobius_CT_2.6_HighFive/dist/game/config/General.ini b/L2J_Mobius_CT_2.6_HighFive/dist/game/config/General.ini index 1ccc0bf069..dd5881d5ef 100644 --- a/L2J_Mobius_CT_2.6_HighFive/dist/game/config/General.ini +++ b/L2J_Mobius_CT_2.6_HighFive/dist/game/config/General.ini @@ -273,6 +273,10 @@ GridNeighborTurnOnTime = 1 # Default: 90 GridNeighborTurnOffTime = 90 +# Correct buylist prices when lower than sell price. +# Default: True +CorrectPrices = True + # --------------------------------------------------------------------------- # Falling Damage diff --git a/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/Config.java b/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/Config.java index da038c82ec..f95c21ddc7 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/Config.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/Config.java @@ -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 diff --git a/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/data/xml/BuyListData.java b/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/data/xml/BuyListData.java index 7d075c3e58..8e4d13ae84 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/data/xml/BuyListData.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/data/xml/BuyListData.java @@ -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 { diff --git a/L2J_Mobius_Classic_2.0_Saviors/dist/game/config/General.ini b/L2J_Mobius_Classic_2.0_Saviors/dist/game/config/General.ini index 1fb2f45932..ed97b6fd69 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/dist/game/config/General.ini +++ b/L2J_Mobius_Classic_2.0_Saviors/dist/game/config/General.ini @@ -284,6 +284,10 @@ GridNeighborTurnOnTime = 1 # Default: 90 GridNeighborTurnOffTime = 90 +# Correct buylist and multisell prices when lower than sell price. +# Default: True +CorrectPrices = True + # --------------------------------------------------------------------------- # Falling Damage diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/Config.java b/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/Config.java index 20cd961600..ec523f674e 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/Config.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/Config.java @@ -494,6 +494,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; @@ -1949,6 +1950,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"); diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/data/xml/BuyListData.java b/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/data/xml/BuyListData.java index 3f2854fd9b..7258e07114 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/data/xml/BuyListData.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/data/xml/BuyListData.java @@ -126,7 +126,16 @@ public class BuyListData implements IXmlReader final long restockDelay = parseLong(attrs, "restock_delay", -1L); final long count = parseLong(attrs, "count", -1L); final int baseTax = parseInteger(attrs, "baseTax", defaultBaseTax); - 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 { diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/data/xml/MultisellData.java b/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/data/xml/MultisellData.java index 1f31601a53..105dad8ed4 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/data/xml/MultisellData.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/data/xml/MultisellData.java @@ -167,7 +167,7 @@ public class MultisellData implements IXmlReader final Item item = ItemTable.getInstance().getTemplate(id); if (item != null) { - totalPrice += (item.getReferencePrice() * count); + totalPrice += ((item.getReferencePrice() / 2) * count); } } else @@ -186,7 +186,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. diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/buylist/ProductList.java b/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/buylist/ProductList.java index 7ff80ead24..c21638731f 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/buylist/ProductList.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/buylist/ProductList.java @@ -70,8 +70,8 @@ public class ProductList return (_allowedNpcs != null) && _allowedNpcs.contains(npcId); } - // public Set getNpcsAllowed() - // { - // return _allowedNpcs; - // } + public Set getNpcsAllowed() + { + return _allowedNpcs; + } } diff --git a/L2J_Mobius_Classic_2.1_Zaken/dist/game/config/General.ini b/L2J_Mobius_Classic_2.1_Zaken/dist/game/config/General.ini index 1fb2f45932..ed97b6fd69 100644 --- a/L2J_Mobius_Classic_2.1_Zaken/dist/game/config/General.ini +++ b/L2J_Mobius_Classic_2.1_Zaken/dist/game/config/General.ini @@ -284,6 +284,10 @@ GridNeighborTurnOnTime = 1 # Default: 90 GridNeighborTurnOffTime = 90 +# Correct buylist and multisell prices when lower than sell price. +# Default: True +CorrectPrices = True + # --------------------------------------------------------------------------- # Falling Damage diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/Config.java b/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/Config.java index 77f5b95dd8..5d0300239a 100644 --- a/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/Config.java +++ b/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/Config.java @@ -494,6 +494,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; @@ -1953,6 +1954,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"); diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/data/xml/BuyListData.java b/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/data/xml/BuyListData.java index 3f2854fd9b..7258e07114 100644 --- a/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/data/xml/BuyListData.java +++ b/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/data/xml/BuyListData.java @@ -126,7 +126,16 @@ public class BuyListData implements IXmlReader final long restockDelay = parseLong(attrs, "restock_delay", -1L); final long count = parseLong(attrs, "count", -1L); final int baseTax = parseInteger(attrs, "baseTax", defaultBaseTax); - 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 { diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/data/xml/MultisellData.java b/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/data/xml/MultisellData.java index 1f31601a53..105dad8ed4 100644 --- a/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/data/xml/MultisellData.java +++ b/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/data/xml/MultisellData.java @@ -167,7 +167,7 @@ public class MultisellData implements IXmlReader final Item item = ItemTable.getInstance().getTemplate(id); if (item != null) { - totalPrice += (item.getReferencePrice() * count); + totalPrice += ((item.getReferencePrice() / 2) * count); } } else @@ -186,7 +186,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. diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/model/buylist/ProductList.java b/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/model/buylist/ProductList.java index 7ff80ead24..c21638731f 100644 --- a/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/model/buylist/ProductList.java +++ b/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/model/buylist/ProductList.java @@ -70,8 +70,8 @@ public class ProductList return (_allowedNpcs != null) && _allowedNpcs.contains(npcId); } - // public Set getNpcsAllowed() - // { - // return _allowedNpcs; - // } + public Set getNpcsAllowed() + { + return _allowedNpcs; + } } diff --git a/L2J_Mobius_Classic_2.2_Antharas/dist/game/config/General.ini b/L2J_Mobius_Classic_2.2_Antharas/dist/game/config/General.ini index 1fb2f45932..ed97b6fd69 100644 --- a/L2J_Mobius_Classic_2.2_Antharas/dist/game/config/General.ini +++ b/L2J_Mobius_Classic_2.2_Antharas/dist/game/config/General.ini @@ -284,6 +284,10 @@ GridNeighborTurnOnTime = 1 # Default: 90 GridNeighborTurnOffTime = 90 +# Correct buylist and multisell prices when lower than sell price. +# Default: True +CorrectPrices = True + # --------------------------------------------------------------------------- # Falling Damage diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/Config.java b/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/Config.java index 77f5b95dd8..5d0300239a 100644 --- a/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/Config.java +++ b/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/Config.java @@ -494,6 +494,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; @@ -1953,6 +1954,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"); diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/data/xml/BuyListData.java b/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/data/xml/BuyListData.java index 3f2854fd9b..7258e07114 100644 --- a/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/data/xml/BuyListData.java +++ b/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/data/xml/BuyListData.java @@ -126,7 +126,16 @@ public class BuyListData implements IXmlReader final long restockDelay = parseLong(attrs, "restock_delay", -1L); final long count = parseLong(attrs, "count", -1L); final int baseTax = parseInteger(attrs, "baseTax", defaultBaseTax); - 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 { diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/data/xml/MultisellData.java b/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/data/xml/MultisellData.java index 1f31601a53..105dad8ed4 100644 --- a/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/data/xml/MultisellData.java +++ b/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/data/xml/MultisellData.java @@ -167,7 +167,7 @@ public class MultisellData implements IXmlReader final Item item = ItemTable.getInstance().getTemplate(id); if (item != null) { - totalPrice += (item.getReferencePrice() * count); + totalPrice += ((item.getReferencePrice() / 2) * count); } } else @@ -186,7 +186,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. diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/model/buylist/ProductList.java b/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/model/buylist/ProductList.java index 7ff80ead24..c21638731f 100644 --- a/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/model/buylist/ProductList.java +++ b/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/model/buylist/ProductList.java @@ -70,8 +70,8 @@ public class ProductList return (_allowedNpcs != null) && _allowedNpcs.contains(npcId); } - // public Set getNpcsAllowed() - // { - // return _allowedNpcs; - // } + public Set getNpcsAllowed() + { + return _allowedNpcs; + } } diff --git a/L2J_Mobius_Classic_2.3_SevenSigns/dist/game/config/General.ini b/L2J_Mobius_Classic_2.3_SevenSigns/dist/game/config/General.ini index 1fb2f45932..ed97b6fd69 100644 --- a/L2J_Mobius_Classic_2.3_SevenSigns/dist/game/config/General.ini +++ b/L2J_Mobius_Classic_2.3_SevenSigns/dist/game/config/General.ini @@ -284,6 +284,10 @@ GridNeighborTurnOnTime = 1 # Default: 90 GridNeighborTurnOffTime = 90 +# Correct buylist and multisell prices when lower than sell price. +# Default: True +CorrectPrices = True + # --------------------------------------------------------------------------- # Falling Damage diff --git a/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/Config.java b/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/Config.java index 75c200e47a..4edd504306 100644 --- a/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/Config.java +++ b/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/Config.java @@ -494,6 +494,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; @@ -1954,6 +1955,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"); diff --git a/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/data/xml/BuyListData.java b/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/data/xml/BuyListData.java index 3f2854fd9b..7258e07114 100644 --- a/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/data/xml/BuyListData.java +++ b/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/data/xml/BuyListData.java @@ -126,7 +126,16 @@ public class BuyListData implements IXmlReader final long restockDelay = parseLong(attrs, "restock_delay", -1L); final long count = parseLong(attrs, "count", -1L); final int baseTax = parseInteger(attrs, "baseTax", defaultBaseTax); - 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 { diff --git a/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/data/xml/MultisellData.java b/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/data/xml/MultisellData.java index 1f31601a53..105dad8ed4 100644 --- a/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/data/xml/MultisellData.java +++ b/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/data/xml/MultisellData.java @@ -167,7 +167,7 @@ public class MultisellData implements IXmlReader final Item item = ItemTable.getInstance().getTemplate(id); if (item != null) { - totalPrice += (item.getReferencePrice() * count); + totalPrice += ((item.getReferencePrice() / 2) * count); } } else @@ -186,7 +186,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. diff --git a/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/model/buylist/ProductList.java b/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/model/buylist/ProductList.java index 7ff80ead24..c21638731f 100644 --- a/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/model/buylist/ProductList.java +++ b/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/model/buylist/ProductList.java @@ -70,8 +70,8 @@ public class ProductList return (_allowedNpcs != null) && _allowedNpcs.contains(npcId); } - // public Set getNpcsAllowed() - // { - // return _allowedNpcs; - // } + public Set getNpcsAllowed() + { + return _allowedNpcs; + } } diff --git a/L2J_Mobius_Classic_2.4_SecretOfEmpire/dist/game/config/General.ini b/L2J_Mobius_Classic_2.4_SecretOfEmpire/dist/game/config/General.ini index 1fb2f45932..ed97b6fd69 100644 --- a/L2J_Mobius_Classic_2.4_SecretOfEmpire/dist/game/config/General.ini +++ b/L2J_Mobius_Classic_2.4_SecretOfEmpire/dist/game/config/General.ini @@ -284,6 +284,10 @@ GridNeighborTurnOnTime = 1 # Default: 90 GridNeighborTurnOffTime = 90 +# Correct buylist and multisell prices when lower than sell price. +# Default: True +CorrectPrices = True + # --------------------------------------------------------------------------- # Falling Damage diff --git a/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/Config.java b/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/Config.java index 22a4aa9eca..685a274f9d 100644 --- a/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/Config.java +++ b/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/Config.java @@ -494,6 +494,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; @@ -1963,6 +1964,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"); diff --git a/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/data/xml/BuyListData.java b/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/data/xml/BuyListData.java index 3f2854fd9b..7258e07114 100644 --- a/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/data/xml/BuyListData.java +++ b/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/data/xml/BuyListData.java @@ -126,7 +126,16 @@ public class BuyListData implements IXmlReader final long restockDelay = parseLong(attrs, "restock_delay", -1L); final long count = parseLong(attrs, "count", -1L); final int baseTax = parseInteger(attrs, "baseTax", defaultBaseTax); - 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 { diff --git a/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/data/xml/MultisellData.java b/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/data/xml/MultisellData.java index 1f31601a53..105dad8ed4 100644 --- a/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/data/xml/MultisellData.java +++ b/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/data/xml/MultisellData.java @@ -167,7 +167,7 @@ public class MultisellData implements IXmlReader final Item item = ItemTable.getInstance().getTemplate(id); if (item != null) { - totalPrice += (item.getReferencePrice() * count); + totalPrice += ((item.getReferencePrice() / 2) * count); } } else @@ -186,7 +186,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. diff --git a/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/model/buylist/ProductList.java b/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/model/buylist/ProductList.java index 7ff80ead24..c21638731f 100644 --- a/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/model/buylist/ProductList.java +++ b/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/model/buylist/ProductList.java @@ -70,8 +70,8 @@ public class ProductList return (_allowedNpcs != null) && _allowedNpcs.contains(npcId); } - // public Set getNpcsAllowed() - // { - // return _allowedNpcs; - // } + public Set getNpcsAllowed() + { + return _allowedNpcs; + } } diff --git a/L2J_Mobius_Classic_3.0_TheKamael/dist/game/config/General.ini b/L2J_Mobius_Classic_3.0_TheKamael/dist/game/config/General.ini index 12c35512a7..23b3eecf18 100644 --- a/L2J_Mobius_Classic_3.0_TheKamael/dist/game/config/General.ini +++ b/L2J_Mobius_Classic_3.0_TheKamael/dist/game/config/General.ini @@ -284,6 +284,10 @@ GridNeighborTurnOnTime = 1 # Default: 90 GridNeighborTurnOffTime = 90 +# Correct buylist and multisell prices when lower than sell price. +# Default: True +CorrectPrices = True + # --------------------------------------------------------------------------- # Falling Damage diff --git a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/Config.java b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/Config.java index 2df79fdec5..0536c45953 100644 --- a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/Config.java +++ b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/Config.java @@ -494,6 +494,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; @@ -1976,6 +1977,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); ENABLE_FALLING_DAMAGE = General.getBoolean("EnableFallingDamage", true); PEACE_ZONE_MODE = General.getInt("PeaceZoneMode", 0); DEFAULT_GLOBAL_CHAT = General.getString("GlobalChat", "ON"); diff --git a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/data/xml/BuyListData.java b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/data/xml/BuyListData.java index 3f2854fd9b..7258e07114 100644 --- a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/data/xml/BuyListData.java +++ b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/data/xml/BuyListData.java @@ -126,7 +126,16 @@ public class BuyListData implements IXmlReader final long restockDelay = parseLong(attrs, "restock_delay", -1L); final long count = parseLong(attrs, "count", -1L); final int baseTax = parseInteger(attrs, "baseTax", defaultBaseTax); - 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 { diff --git a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/data/xml/MultisellData.java b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/data/xml/MultisellData.java index 1f31601a53..105dad8ed4 100644 --- a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/data/xml/MultisellData.java +++ b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/data/xml/MultisellData.java @@ -167,7 +167,7 @@ public class MultisellData implements IXmlReader final Item item = ItemTable.getInstance().getTemplate(id); if (item != null) { - totalPrice += (item.getReferencePrice() * count); + totalPrice += ((item.getReferencePrice() / 2) * count); } } else @@ -186,7 +186,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. diff --git a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/buylist/ProductList.java b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/buylist/ProductList.java index 7ff80ead24..c21638731f 100644 --- a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/buylist/ProductList.java +++ b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/buylist/ProductList.java @@ -70,8 +70,8 @@ public class ProductList return (_allowedNpcs != null) && _allowedNpcs.contains(npcId); } - // public Set getNpcsAllowed() - // { - // return _allowedNpcs; - // } + public Set getNpcsAllowed() + { + return _allowedNpcs; + } } diff --git a/L2J_Mobius_Classic_Interlude/dist/game/config/General.ini b/L2J_Mobius_Classic_Interlude/dist/game/config/General.ini index e0dc7e7330..a0a849bfe4 100644 --- a/L2J_Mobius_Classic_Interlude/dist/game/config/General.ini +++ b/L2J_Mobius_Classic_Interlude/dist/game/config/General.ini @@ -284,6 +284,10 @@ GridNeighborTurnOnTime = 1 # Default: 90 GridNeighborTurnOffTime = 90 +# Correct buylist and multisell prices when lower than sell price. +# Default: True +CorrectPrices = True + # --------------------------------------------------------------------------- # Falling Damage diff --git a/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/Config.java b/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/Config.java index bf466231d2..f884d4d24b 100644 --- a/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/Config.java +++ b/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/Config.java @@ -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"); diff --git a/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/data/xml/BuyListData.java b/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/data/xml/BuyListData.java index f9b25fa7f3..e8ec925ba8 100644 --- a/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/data/xml/BuyListData.java +++ b/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/data/xml/BuyListData.java @@ -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 { diff --git a/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/data/xml/MultisellData.java b/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/data/xml/MultisellData.java index 9e0406f746..00fc96d603 100644 --- a/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/data/xml/MultisellData.java +++ b/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/data/xml/MultisellData.java @@ -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. diff --git a/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/model/buylist/ProductList.java b/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/model/buylist/ProductList.java index 7ff80ead24..c21638731f 100644 --- a/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/model/buylist/ProductList.java +++ b/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/model/buylist/ProductList.java @@ -70,8 +70,8 @@ public class ProductList return (_allowedNpcs != null) && _allowedNpcs.contains(npcId); } - // public Set getNpcsAllowed() - // { - // return _allowedNpcs; - // } + public Set getNpcsAllowed() + { + return _allowedNpcs; + } } diff --git a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/config/General.ini b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/config/General.ini index 12c35512a7..23b3eecf18 100644 --- a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/config/General.ini +++ b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/config/General.ini @@ -284,6 +284,10 @@ GridNeighborTurnOnTime = 1 # Default: 90 GridNeighborTurnOffTime = 90 +# Correct buylist and multisell prices when lower than sell price. +# Default: True +CorrectPrices = True + # --------------------------------------------------------------------------- # Falling Damage diff --git a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/Config.java b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/Config.java index 8e2b33d541..8917bc2596 100644 --- a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/Config.java +++ b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/Config.java @@ -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; @@ -2019,6 +2020,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); ENABLE_FALLING_DAMAGE = General.getBoolean("EnableFallingDamage", true); PEACE_ZONE_MODE = General.getInt("PeaceZoneMode", 0); DEFAULT_GLOBAL_CHAT = General.getString("GlobalChat", "ON"); diff --git a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/data/xml/BuyListData.java b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/data/xml/BuyListData.java index 3f2854fd9b..7258e07114 100644 --- a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/data/xml/BuyListData.java +++ b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/data/xml/BuyListData.java @@ -126,7 +126,16 @@ public class BuyListData implements IXmlReader final long restockDelay = parseLong(attrs, "restock_delay", -1L); final long count = parseLong(attrs, "count", -1L); final int baseTax = parseInteger(attrs, "baseTax", defaultBaseTax); - 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 { diff --git a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/data/xml/MultisellData.java b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/data/xml/MultisellData.java index 1f31601a53..105dad8ed4 100644 --- a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/data/xml/MultisellData.java +++ b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/data/xml/MultisellData.java @@ -167,7 +167,7 @@ public class MultisellData implements IXmlReader final Item item = ItemTable.getInstance().getTemplate(id); if (item != null) { - totalPrice += (item.getReferencePrice() * count); + totalPrice += ((item.getReferencePrice() / 2) * count); } } else @@ -186,7 +186,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. diff --git a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/buylist/ProductList.java b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/buylist/ProductList.java index 7ff80ead24..c21638731f 100644 --- a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/buylist/ProductList.java +++ b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/buylist/ProductList.java @@ -70,8 +70,8 @@ public class ProductList return (_allowedNpcs != null) && _allowedNpcs.contains(npcId); } - // public Set getNpcsAllowed() - // { - // return _allowedNpcs; - // } + public Set getNpcsAllowed() + { + return _allowedNpcs; + } } diff --git a/L2J_Mobius_Essence_5.0_Sylph/dist/game/config/General.ini b/L2J_Mobius_Essence_5.0_Sylph/dist/game/config/General.ini index 12c35512a7..23b3eecf18 100644 --- a/L2J_Mobius_Essence_5.0_Sylph/dist/game/config/General.ini +++ b/L2J_Mobius_Essence_5.0_Sylph/dist/game/config/General.ini @@ -284,6 +284,10 @@ GridNeighborTurnOnTime = 1 # Default: 90 GridNeighborTurnOffTime = 90 +# Correct buylist and multisell prices when lower than sell price. +# Default: True +CorrectPrices = True + # --------------------------------------------------------------------------- # Falling Damage diff --git a/L2J_Mobius_Essence_5.0_Sylph/java/org/l2jmobius/Config.java b/L2J_Mobius_Essence_5.0_Sylph/java/org/l2jmobius/Config.java index 56175e2b35..b97139ab55 100644 --- a/L2J_Mobius_Essence_5.0_Sylph/java/org/l2jmobius/Config.java +++ b/L2J_Mobius_Essence_5.0_Sylph/java/org/l2jmobius/Config.java @@ -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; @@ -2019,6 +2020,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); ENABLE_FALLING_DAMAGE = General.getBoolean("EnableFallingDamage", true); PEACE_ZONE_MODE = General.getInt("PeaceZoneMode", 0); DEFAULT_GLOBAL_CHAT = General.getString("GlobalChat", "ON"); diff --git a/L2J_Mobius_Essence_5.0_Sylph/java/org/l2jmobius/gameserver/data/xml/BuyListData.java b/L2J_Mobius_Essence_5.0_Sylph/java/org/l2jmobius/gameserver/data/xml/BuyListData.java index 3f2854fd9b..7258e07114 100644 --- a/L2J_Mobius_Essence_5.0_Sylph/java/org/l2jmobius/gameserver/data/xml/BuyListData.java +++ b/L2J_Mobius_Essence_5.0_Sylph/java/org/l2jmobius/gameserver/data/xml/BuyListData.java @@ -126,7 +126,16 @@ public class BuyListData implements IXmlReader final long restockDelay = parseLong(attrs, "restock_delay", -1L); final long count = parseLong(attrs, "count", -1L); final int baseTax = parseInteger(attrs, "baseTax", defaultBaseTax); - 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 { diff --git a/L2J_Mobius_Essence_5.0_Sylph/java/org/l2jmobius/gameserver/data/xml/MultisellData.java b/L2J_Mobius_Essence_5.0_Sylph/java/org/l2jmobius/gameserver/data/xml/MultisellData.java index 1f31601a53..105dad8ed4 100644 --- a/L2J_Mobius_Essence_5.0_Sylph/java/org/l2jmobius/gameserver/data/xml/MultisellData.java +++ b/L2J_Mobius_Essence_5.0_Sylph/java/org/l2jmobius/gameserver/data/xml/MultisellData.java @@ -167,7 +167,7 @@ public class MultisellData implements IXmlReader final Item item = ItemTable.getInstance().getTemplate(id); if (item != null) { - totalPrice += (item.getReferencePrice() * count); + totalPrice += ((item.getReferencePrice() / 2) * count); } } else @@ -186,7 +186,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. diff --git a/L2J_Mobius_Essence_5.0_Sylph/java/org/l2jmobius/gameserver/model/buylist/ProductList.java b/L2J_Mobius_Essence_5.0_Sylph/java/org/l2jmobius/gameserver/model/buylist/ProductList.java index 7ff80ead24..c21638731f 100644 --- a/L2J_Mobius_Essence_5.0_Sylph/java/org/l2jmobius/gameserver/model/buylist/ProductList.java +++ b/L2J_Mobius_Essence_5.0_Sylph/java/org/l2jmobius/gameserver/model/buylist/ProductList.java @@ -70,8 +70,8 @@ public class ProductList return (_allowedNpcs != null) && _allowedNpcs.contains(npcId); } - // public Set getNpcsAllowed() - // { - // return _allowedNpcs; - // } + public Set getNpcsAllowed() + { + return _allowedNpcs; + } }