From 6eb0c90eea239c87868a6fe5cfb25941d697c063 Mon Sep 17 00:00:00 2001 From: MobiusDev <8391001+MobiusDevelopment@users.noreply.github.com> Date: Fri, 4 Aug 2017 17:26:37 +0000 Subject: [PATCH] Addition of buylist price checks. --- .../gameserver/data/xml/impl/BuyListData.java | 11 ++++++++++- .../l2jmobius/gameserver/model/buylist/L2BuyList.java | 5 +++++ .../gameserver/data/xml/impl/BuyListData.java | 11 ++++++++++- .../l2jmobius/gameserver/model/buylist/L2BuyList.java | 5 +++++ .../gameserver/data/xml/impl/BuyListData.java | 11 ++++++++++- .../l2jmobius/gameserver/model/buylist/L2BuyList.java | 5 +++++ 6 files changed, 45 insertions(+), 3 deletions(-) diff --git a/L2J_Mobius_Classic/java/com/l2jmobius/gameserver/data/xml/impl/BuyListData.java b/L2J_Mobius_Classic/java/com/l2jmobius/gameserver/data/xml/impl/BuyListData.java index 486f0d22e4..a0256156ce 100644 --- a/L2J_Mobius_Classic/java/com/l2jmobius/gameserver/data/xml/impl/BuyListData.java +++ b/L2J_Mobius_Classic/java/com/l2jmobius/gameserver/data/xml/impl/BuyListData.java @@ -143,7 +143,16 @@ public final class BuyListData implements IGameXmlReader final L2Item item = ItemTable.getInstance().getTemplate(itemId); if (item != null) { - buyList.addProduct(new Product(buyList.getListId(), item, price, restockDelay, count)); + if ((price > -1) && (item.getReferencePrice() > 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, price, restockDelay, count)); + } + else + { + buyList.addProduct(new Product(buyList.getListId(), item, price, restockDelay, count)); + } } else { diff --git a/L2J_Mobius_Classic/java/com/l2jmobius/gameserver/model/buylist/L2BuyList.java b/L2J_Mobius_Classic/java/com/l2jmobius/gameserver/model/buylist/L2BuyList.java index decb1e18aa..3a2f60297b 100644 --- a/L2J_Mobius_Classic/java/com/l2jmobius/gameserver/model/buylist/L2BuyList.java +++ b/L2J_Mobius_Classic/java/com/l2jmobius/gameserver/model/buylist/L2BuyList.java @@ -69,4 +69,9 @@ public final class L2BuyList { return (_allowedNpcs != null) && _allowedNpcs.contains(npcId); } + + public Set getNpcsAllowed() + { + return _allowedNpcs; + } } diff --git a/L2J_Mobius_Helios/java/com/l2jmobius/gameserver/data/xml/impl/BuyListData.java b/L2J_Mobius_Helios/java/com/l2jmobius/gameserver/data/xml/impl/BuyListData.java index 486f0d22e4..a0256156ce 100644 --- a/L2J_Mobius_Helios/java/com/l2jmobius/gameserver/data/xml/impl/BuyListData.java +++ b/L2J_Mobius_Helios/java/com/l2jmobius/gameserver/data/xml/impl/BuyListData.java @@ -143,7 +143,16 @@ public final class BuyListData implements IGameXmlReader final L2Item item = ItemTable.getInstance().getTemplate(itemId); if (item != null) { - buyList.addProduct(new Product(buyList.getListId(), item, price, restockDelay, count)); + if ((price > -1) && (item.getReferencePrice() > 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, price, restockDelay, count)); + } + else + { + buyList.addProduct(new Product(buyList.getListId(), item, price, restockDelay, count)); + } } else { diff --git a/L2J_Mobius_Helios/java/com/l2jmobius/gameserver/model/buylist/L2BuyList.java b/L2J_Mobius_Helios/java/com/l2jmobius/gameserver/model/buylist/L2BuyList.java index decb1e18aa..3a2f60297b 100644 --- a/L2J_Mobius_Helios/java/com/l2jmobius/gameserver/model/buylist/L2BuyList.java +++ b/L2J_Mobius_Helios/java/com/l2jmobius/gameserver/model/buylist/L2BuyList.java @@ -69,4 +69,9 @@ public final class L2BuyList { return (_allowedNpcs != null) && _allowedNpcs.contains(npcId); } + + public Set getNpcsAllowed() + { + return _allowedNpcs; + } } diff --git a/L2J_Mobius_Underground/java/com/l2jmobius/gameserver/data/xml/impl/BuyListData.java b/L2J_Mobius_Underground/java/com/l2jmobius/gameserver/data/xml/impl/BuyListData.java index 486f0d22e4..a0256156ce 100644 --- a/L2J_Mobius_Underground/java/com/l2jmobius/gameserver/data/xml/impl/BuyListData.java +++ b/L2J_Mobius_Underground/java/com/l2jmobius/gameserver/data/xml/impl/BuyListData.java @@ -143,7 +143,16 @@ public final class BuyListData implements IGameXmlReader final L2Item item = ItemTable.getInstance().getTemplate(itemId); if (item != null) { - buyList.addProduct(new Product(buyList.getListId(), item, price, restockDelay, count)); + if ((price > -1) && (item.getReferencePrice() > 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, price, restockDelay, count)); + } + else + { + buyList.addProduct(new Product(buyList.getListId(), item, price, restockDelay, count)); + } } else { diff --git a/L2J_Mobius_Underground/java/com/l2jmobius/gameserver/model/buylist/L2BuyList.java b/L2J_Mobius_Underground/java/com/l2jmobius/gameserver/model/buylist/L2BuyList.java index decb1e18aa..3a2f60297b 100644 --- a/L2J_Mobius_Underground/java/com/l2jmobius/gameserver/model/buylist/L2BuyList.java +++ b/L2J_Mobius_Underground/java/com/l2jmobius/gameserver/model/buylist/L2BuyList.java @@ -69,4 +69,9 @@ public final class L2BuyList { return (_allowedNpcs != null) && _allowedNpcs.contains(npcId); } + + public Set getNpcsAllowed() + { + return _allowedNpcs; + } }