diff --git a/L2J_Mobius_1.0_Ertheia/dist/game/config/Custom/MerchantZeroSellPrice.ini b/L2J_Mobius_1.0_Ertheia/dist/game/config/Custom/MerchantZeroSellPrice.ini new file mode 100644 index 0000000000..140490f042 --- /dev/null +++ b/L2J_Mobius_1.0_Ertheia/dist/game/config/Custom/MerchantZeroSellPrice.ini @@ -0,0 +1,6 @@ +# --------------------------------------------------------------------------- +# Merchant Zero Sell Price +# --------------------------------------------------------------------------- + +# All items sold to merchants reward no Adena. +MerchantZeroSellPrice = False 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 ca14c266fa..2505b44fb9 100644 --- a/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/Config.java +++ b/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/Config.java @@ -123,6 +123,7 @@ public class Config private static final String CUSTOM_FACTION_SYSTEM_CONFIG_FILE = "./config/Custom/FactionSystem.ini"; private static final String CUSTOM_FAKE_PLAYERS_CONFIG_FILE = "./config/Custom/FakePlayers.ini"; private static final String CUSTOM_FIND_PVP_CONFIG_FILE = "./config/Custom/FindPvP.ini"; + private static final String CUSTOM_MERCHANT_ZERO_SELL_PRICE_CONFIG_FILE = "./config/Custom/MerchantZeroSellPrice.ini"; private static final String CUSTOM_MULTILANGUAL_SUPPORT_CONFIG_FILE = "./config/Custom/MultilingualSupport.ini"; private static final String CUSTOM_NPC_STAT_MULTIPLIERS_CONFIG_FILE = "./config/Custom/NpcStatMultipliers.ini"; private static final String CUSTOM_OFFLINE_TRADE_CONFIG_FILE = "./config/Custom/OfflineTrade.ini"; @@ -1227,6 +1228,7 @@ public class Config public static boolean FAKE_PLAYER_CAN_DROP_ITEMS; public static boolean FAKE_PLAYER_CAN_PICKUP; public static boolean ENABLE_FIND_PVP; + public static boolean MERCHANT_ZERO_SELL_PRICE; public static boolean PREMIUM_SYSTEM_ENABLED; public static float PREMIUM_RATE_XP; public static float PREMIUM_RATE_SP; @@ -3155,6 +3157,10 @@ public class Config final PropertiesParser FindPvP = new PropertiesParser(CUSTOM_FIND_PVP_CONFIG_FILE); ENABLE_FIND_PVP = FindPvP.getBoolean("EnableFindPvP", false); + // Load MerchantZeroSellPrice config file (if exists) + final PropertiesParser MerchantZeroSellPrice = new PropertiesParser(CUSTOM_MERCHANT_ZERO_SELL_PRICE_CONFIG_FILE); + MERCHANT_ZERO_SELL_PRICE = MerchantZeroSellPrice.getBoolean("MerchantZeroSellPrice", false); + // Load MultilingualSupport config file (if exists) final PropertiesParser MultilingualSupport = new PropertiesParser(CUSTOM_MULTILANGUAL_SUPPORT_CONFIG_FILE); diff --git a/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/model/actor/instance/MerchantInstance.java b/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/model/actor/instance/MerchantInstance.java index 539664a411..3b4c28fadd 100644 --- a/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/model/actor/instance/MerchantInstance.java +++ b/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/model/actor/instance/MerchantInstance.java @@ -88,6 +88,6 @@ public class MerchantInstance extends NpcInstance player.setInventoryBlockingStatus(true); player.sendPacket(new BuyList(buyList, player, (applyCastleTax) ? getCastleTaxRate(TaxType.BUY) : 0)); - player.sendPacket(new ExBuySellList(player, false, (applyCastleTax) ? getCastleTaxRate(TaxType.SELL) : 0)); + player.sendPacket(new ExBuySellList(player, false)); } } diff --git a/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/network/clientpackets/RequestRefundItem.java b/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/network/clientpackets/RequestRefundItem.java index 41cb56d317..027e31909f 100644 --- a/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/network/clientpackets/RequestRefundItem.java +++ b/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/network/clientpackets/RequestRefundItem.java @@ -157,7 +157,7 @@ public class RequestRefundItem implements IClientIncomingPacket final long count = item.getCount(); weight += count * template.getWeight(); - adena += (count * template.getReferencePrice()) / 2; + adena += count * (template.getReferencePrice() / 2); if (!template.isStackable()) { slots += count; @@ -182,7 +182,7 @@ public class RequestRefundItem implements IClientIncomingPacket return; } - if ((adena < 0) || !player.reduceAdena("Refund", adena, player.getLastFolkNPC(), false)) + if (!Config.MERCHANT_ZERO_SELL_PRICE && ((adena < 0) || !player.reduceAdena("Refund", adena, player.getLastFolkNPC(), false))) { client.sendPacket(SystemMessageId.YOU_DO_NOT_HAVE_ENOUGH_ADENA); client.sendPacket(ActionFailed.STATIC_PACKET); diff --git a/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/network/clientpackets/RequestSellItem.java b/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/network/clientpackets/RequestSellItem.java index 70d3e92505..3546aec078 100644 --- a/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/network/clientpackets/RequestSellItem.java +++ b/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/network/clientpackets/RequestSellItem.java @@ -25,7 +25,6 @@ import java.util.List; import org.l2jmobius.Config; import org.l2jmobius.commons.network.PacketReader; import org.l2jmobius.gameserver.data.xml.impl.BuyListData; -import org.l2jmobius.gameserver.enums.TaxType; import org.l2jmobius.gameserver.model.WorldObject; import org.l2jmobius.gameserver.model.actor.instance.MerchantInstance; import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; @@ -170,17 +169,11 @@ public class RequestSellItem implements IClientIncomingPacket } } - // add to castle treasury - if (merchant != null) + if (!Config.MERCHANT_ZERO_SELL_PRICE) { - // Keep here same formula as in {@link ExBuySellList} to produce same result. - final long profit = (long) (totalPrice * (1.0 - merchant.getCastleTaxRate(TaxType.SELL))); - merchant.handleTaxPayment(totalPrice - profit); - totalPrice = profit; + player.addAdena("Sell", totalPrice, merchant, false); } - player.addAdena("Sell", totalPrice, merchant, false); - // Update current load as well client.sendPacket(new ExUserInfoInvenWeight(player)); client.sendPacket(new ExBuySellList(player, true)); diff --git a/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/network/serverpackets/ExBuySellList.java b/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/network/serverpackets/ExBuySellList.java index a3cd6d9afa..66bcb38bb6 100644 --- a/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/network/serverpackets/ExBuySellList.java +++ b/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/network/serverpackets/ExBuySellList.java @@ -18,6 +18,7 @@ package org.l2jmobius.gameserver.network.serverpackets; import java.util.Collection; +import org.l2jmobius.Config; import org.l2jmobius.commons.network.PacketWriter; import org.l2jmobius.gameserver.model.actor.Summon; import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; @@ -33,7 +34,6 @@ public class ExBuySellList extends AbstractItemPacket private Collection _refundList = null; private final boolean _done; private final int _inventorySlots; - private double _castleTaxRate = 1; public ExBuySellList(PlayerInstance player, boolean done) { @@ -47,12 +47,6 @@ public class ExBuySellList extends AbstractItemPacket _done = done; } - public ExBuySellList(PlayerInstance player, boolean done, double castleTaxRate) - { - this(player, done); - _castleTaxRate = 1 - castleTaxRate; - } - @Override public boolean write(PacketWriter packet) { @@ -67,7 +61,7 @@ public class ExBuySellList extends AbstractItemPacket for (ItemInstance item : _sellList) { writeItem(packet, item); - packet.writeQ((long) ((item.getItem().getReferencePrice() / 2) * _castleTaxRate)); + packet.writeQ(Config.MERCHANT_ZERO_SELL_PRICE ? 0 : item.getItem().getReferencePrice() / 2); } } else @@ -83,7 +77,7 @@ public class ExBuySellList extends AbstractItemPacket { writeItem(packet, item); packet.writeD(i++); - packet.writeQ((item.getItem().getReferencePrice() / 2) * item.getCount()); + packet.writeQ(Config.MERCHANT_ZERO_SELL_PRICE ? 0 : (item.getItem().getReferencePrice() / 2) * item.getCount()); } } else diff --git a/L2J_Mobius_2.5_Underground/dist/game/config/Custom/MerchantZeroSellPrice.ini b/L2J_Mobius_2.5_Underground/dist/game/config/Custom/MerchantZeroSellPrice.ini new file mode 100644 index 0000000000..140490f042 --- /dev/null +++ b/L2J_Mobius_2.5_Underground/dist/game/config/Custom/MerchantZeroSellPrice.ini @@ -0,0 +1,6 @@ +# --------------------------------------------------------------------------- +# Merchant Zero Sell Price +# --------------------------------------------------------------------------- + +# All items sold to merchants reward no Adena. +MerchantZeroSellPrice = False 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 b798580743..bf87783eb6 100644 --- a/L2J_Mobius_2.5_Underground/java/org/l2jmobius/Config.java +++ b/L2J_Mobius_2.5_Underground/java/org/l2jmobius/Config.java @@ -124,6 +124,7 @@ public class Config private static final String CUSTOM_FACTION_SYSTEM_CONFIG_FILE = "./config/Custom/FactionSystem.ini"; private static final String CUSTOM_FAKE_PLAYERS_CONFIG_FILE = "./config/Custom/FakePlayers.ini"; private static final String CUSTOM_FIND_PVP_CONFIG_FILE = "./config/Custom/FindPvP.ini"; + private static final String CUSTOM_MERCHANT_ZERO_SELL_PRICE_CONFIG_FILE = "./config/Custom/MerchantZeroSellPrice.ini"; private static final String CUSTOM_MULTILANGUAL_SUPPORT_CONFIG_FILE = "./config/Custom/MultilingualSupport.ini"; private static final String CUSTOM_NPC_STAT_MULTIPLIERS_CONFIG_FILE = "./config/Custom/NpcStatMultipliers.ini"; private static final String CUSTOM_OFFLINE_TRADE_CONFIG_FILE = "./config/Custom/OfflineTrade.ini"; @@ -1234,6 +1235,7 @@ public class Config public static boolean FAKE_PLAYER_CAN_DROP_ITEMS; public static boolean FAKE_PLAYER_CAN_PICKUP; public static boolean ENABLE_FIND_PVP; + public static boolean MERCHANT_ZERO_SELL_PRICE; public static boolean PREMIUM_SYSTEM_ENABLED; public static float PREMIUM_RATE_XP; public static float PREMIUM_RATE_SP; @@ -3172,6 +3174,10 @@ public class Config final PropertiesParser FindPvP = new PropertiesParser(CUSTOM_FIND_PVP_CONFIG_FILE); ENABLE_FIND_PVP = FindPvP.getBoolean("EnableFindPvP", false); + // Load MerchantZeroSellPrice config file (if exists) + final PropertiesParser MerchantZeroSellPrice = new PropertiesParser(CUSTOM_MERCHANT_ZERO_SELL_PRICE_CONFIG_FILE); + MERCHANT_ZERO_SELL_PRICE = MerchantZeroSellPrice.getBoolean("MerchantZeroSellPrice", false); + // Load MultilingualSupport config file (if exists) final PropertiesParser MultilingualSupport = new PropertiesParser(CUSTOM_MULTILANGUAL_SUPPORT_CONFIG_FILE); diff --git a/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/model/actor/instance/MerchantInstance.java b/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/model/actor/instance/MerchantInstance.java index 539664a411..3b4c28fadd 100644 --- a/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/model/actor/instance/MerchantInstance.java +++ b/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/model/actor/instance/MerchantInstance.java @@ -88,6 +88,6 @@ public class MerchantInstance extends NpcInstance player.setInventoryBlockingStatus(true); player.sendPacket(new BuyList(buyList, player, (applyCastleTax) ? getCastleTaxRate(TaxType.BUY) : 0)); - player.sendPacket(new ExBuySellList(player, false, (applyCastleTax) ? getCastleTaxRate(TaxType.SELL) : 0)); + player.sendPacket(new ExBuySellList(player, false)); } } diff --git a/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/network/clientpackets/RequestRefundItem.java b/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/network/clientpackets/RequestRefundItem.java index 41cb56d317..027e31909f 100644 --- a/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/network/clientpackets/RequestRefundItem.java +++ b/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/network/clientpackets/RequestRefundItem.java @@ -157,7 +157,7 @@ public class RequestRefundItem implements IClientIncomingPacket final long count = item.getCount(); weight += count * template.getWeight(); - adena += (count * template.getReferencePrice()) / 2; + adena += count * (template.getReferencePrice() / 2); if (!template.isStackable()) { slots += count; @@ -182,7 +182,7 @@ public class RequestRefundItem implements IClientIncomingPacket return; } - if ((adena < 0) || !player.reduceAdena("Refund", adena, player.getLastFolkNPC(), false)) + if (!Config.MERCHANT_ZERO_SELL_PRICE && ((adena < 0) || !player.reduceAdena("Refund", adena, player.getLastFolkNPC(), false))) { client.sendPacket(SystemMessageId.YOU_DO_NOT_HAVE_ENOUGH_ADENA); client.sendPacket(ActionFailed.STATIC_PACKET); diff --git a/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/network/clientpackets/RequestSellItem.java b/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/network/clientpackets/RequestSellItem.java index 70d3e92505..3546aec078 100644 --- a/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/network/clientpackets/RequestSellItem.java +++ b/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/network/clientpackets/RequestSellItem.java @@ -25,7 +25,6 @@ import java.util.List; import org.l2jmobius.Config; import org.l2jmobius.commons.network.PacketReader; import org.l2jmobius.gameserver.data.xml.impl.BuyListData; -import org.l2jmobius.gameserver.enums.TaxType; import org.l2jmobius.gameserver.model.WorldObject; import org.l2jmobius.gameserver.model.actor.instance.MerchantInstance; import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; @@ -170,17 +169,11 @@ public class RequestSellItem implements IClientIncomingPacket } } - // add to castle treasury - if (merchant != null) + if (!Config.MERCHANT_ZERO_SELL_PRICE) { - // Keep here same formula as in {@link ExBuySellList} to produce same result. - final long profit = (long) (totalPrice * (1.0 - merchant.getCastleTaxRate(TaxType.SELL))); - merchant.handleTaxPayment(totalPrice - profit); - totalPrice = profit; + player.addAdena("Sell", totalPrice, merchant, false); } - player.addAdena("Sell", totalPrice, merchant, false); - // Update current load as well client.sendPacket(new ExUserInfoInvenWeight(player)); client.sendPacket(new ExBuySellList(player, true)); diff --git a/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/network/serverpackets/ExBuySellList.java b/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/network/serverpackets/ExBuySellList.java index a3cd6d9afa..66bcb38bb6 100644 --- a/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/network/serverpackets/ExBuySellList.java +++ b/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/network/serverpackets/ExBuySellList.java @@ -18,6 +18,7 @@ package org.l2jmobius.gameserver.network.serverpackets; import java.util.Collection; +import org.l2jmobius.Config; import org.l2jmobius.commons.network.PacketWriter; import org.l2jmobius.gameserver.model.actor.Summon; import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; @@ -33,7 +34,6 @@ public class ExBuySellList extends AbstractItemPacket private Collection _refundList = null; private final boolean _done; private final int _inventorySlots; - private double _castleTaxRate = 1; public ExBuySellList(PlayerInstance player, boolean done) { @@ -47,12 +47,6 @@ public class ExBuySellList extends AbstractItemPacket _done = done; } - public ExBuySellList(PlayerInstance player, boolean done, double castleTaxRate) - { - this(player, done); - _castleTaxRate = 1 - castleTaxRate; - } - @Override public boolean write(PacketWriter packet) { @@ -67,7 +61,7 @@ public class ExBuySellList extends AbstractItemPacket for (ItemInstance item : _sellList) { writeItem(packet, item); - packet.writeQ((long) ((item.getItem().getReferencePrice() / 2) * _castleTaxRate)); + packet.writeQ(Config.MERCHANT_ZERO_SELL_PRICE ? 0 : item.getItem().getReferencePrice() / 2); } } else @@ -83,7 +77,7 @@ public class ExBuySellList extends AbstractItemPacket { writeItem(packet, item); packet.writeD(i++); - packet.writeQ((item.getItem().getReferencePrice() / 2) * item.getCount()); + packet.writeQ(Config.MERCHANT_ZERO_SELL_PRICE ? 0 : (item.getItem().getReferencePrice() / 2) * item.getCount()); } } else diff --git a/L2J_Mobius_3.0_Helios/dist/game/config/Custom/MerchantZeroSellPrice.ini b/L2J_Mobius_3.0_Helios/dist/game/config/Custom/MerchantZeroSellPrice.ini new file mode 100644 index 0000000000..140490f042 --- /dev/null +++ b/L2J_Mobius_3.0_Helios/dist/game/config/Custom/MerchantZeroSellPrice.ini @@ -0,0 +1,6 @@ +# --------------------------------------------------------------------------- +# Merchant Zero Sell Price +# --------------------------------------------------------------------------- + +# All items sold to merchants reward no Adena. +MerchantZeroSellPrice = False 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 820d18cc05..10ab29ecbd 100644 --- a/L2J_Mobius_3.0_Helios/java/org/l2jmobius/Config.java +++ b/L2J_Mobius_3.0_Helios/java/org/l2jmobius/Config.java @@ -124,6 +124,7 @@ public class Config private static final String CUSTOM_FACTION_SYSTEM_CONFIG_FILE = "./config/Custom/FactionSystem.ini"; private static final String CUSTOM_FAKE_PLAYERS_CONFIG_FILE = "./config/Custom/FakePlayers.ini"; private static final String CUSTOM_FIND_PVP_CONFIG_FILE = "./config/Custom/FindPvP.ini"; + private static final String CUSTOM_MERCHANT_ZERO_SELL_PRICE_CONFIG_FILE = "./config/Custom/MerchantZeroSellPrice.ini"; private static final String CUSTOM_MULTILANGUAL_SUPPORT_CONFIG_FILE = "./config/Custom/MultilingualSupport.ini"; private static final String CUSTOM_NPC_STAT_MULTIPLIERS_CONFIG_FILE = "./config/Custom/NpcStatMultipliers.ini"; private static final String CUSTOM_OFFLINE_TRADE_CONFIG_FILE = "./config/Custom/OfflineTrade.ini"; @@ -1247,6 +1248,7 @@ public class Config public static boolean FAKE_PLAYER_CAN_DROP_ITEMS; public static boolean FAKE_PLAYER_CAN_PICKUP; public static boolean ENABLE_FIND_PVP; + public static boolean MERCHANT_ZERO_SELL_PRICE; public static boolean PREMIUM_SYSTEM_ENABLED; public static float PREMIUM_RATE_XP; public static float PREMIUM_RATE_SP; @@ -3196,6 +3198,10 @@ public class Config final PropertiesParser FindPvP = new PropertiesParser(CUSTOM_FIND_PVP_CONFIG_FILE); ENABLE_FIND_PVP = FindPvP.getBoolean("EnableFindPvP", false); + // Load MerchantZeroSellPrice config file (if exists) + final PropertiesParser MerchantZeroSellPrice = new PropertiesParser(CUSTOM_MERCHANT_ZERO_SELL_PRICE_CONFIG_FILE); + MERCHANT_ZERO_SELL_PRICE = MerchantZeroSellPrice.getBoolean("MerchantZeroSellPrice", false); + // Load MultilingualSupport config file (if exists) final PropertiesParser MultilingualSupport = new PropertiesParser(CUSTOM_MULTILANGUAL_SUPPORT_CONFIG_FILE); diff --git a/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/model/actor/instance/MerchantInstance.java b/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/model/actor/instance/MerchantInstance.java index 539664a411..3b4c28fadd 100644 --- a/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/model/actor/instance/MerchantInstance.java +++ b/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/model/actor/instance/MerchantInstance.java @@ -88,6 +88,6 @@ public class MerchantInstance extends NpcInstance player.setInventoryBlockingStatus(true); player.sendPacket(new BuyList(buyList, player, (applyCastleTax) ? getCastleTaxRate(TaxType.BUY) : 0)); - player.sendPacket(new ExBuySellList(player, false, (applyCastleTax) ? getCastleTaxRate(TaxType.SELL) : 0)); + player.sendPacket(new ExBuySellList(player, false)); } } diff --git a/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/network/clientpackets/RequestRefundItem.java b/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/network/clientpackets/RequestRefundItem.java index 41cb56d317..027e31909f 100644 --- a/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/network/clientpackets/RequestRefundItem.java +++ b/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/network/clientpackets/RequestRefundItem.java @@ -157,7 +157,7 @@ public class RequestRefundItem implements IClientIncomingPacket final long count = item.getCount(); weight += count * template.getWeight(); - adena += (count * template.getReferencePrice()) / 2; + adena += count * (template.getReferencePrice() / 2); if (!template.isStackable()) { slots += count; @@ -182,7 +182,7 @@ public class RequestRefundItem implements IClientIncomingPacket return; } - if ((adena < 0) || !player.reduceAdena("Refund", adena, player.getLastFolkNPC(), false)) + if (!Config.MERCHANT_ZERO_SELL_PRICE && ((adena < 0) || !player.reduceAdena("Refund", adena, player.getLastFolkNPC(), false))) { client.sendPacket(SystemMessageId.YOU_DO_NOT_HAVE_ENOUGH_ADENA); client.sendPacket(ActionFailed.STATIC_PACKET); diff --git a/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/network/clientpackets/RequestSellItem.java b/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/network/clientpackets/RequestSellItem.java index 70d3e92505..3546aec078 100644 --- a/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/network/clientpackets/RequestSellItem.java +++ b/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/network/clientpackets/RequestSellItem.java @@ -25,7 +25,6 @@ import java.util.List; import org.l2jmobius.Config; import org.l2jmobius.commons.network.PacketReader; import org.l2jmobius.gameserver.data.xml.impl.BuyListData; -import org.l2jmobius.gameserver.enums.TaxType; import org.l2jmobius.gameserver.model.WorldObject; import org.l2jmobius.gameserver.model.actor.instance.MerchantInstance; import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; @@ -170,17 +169,11 @@ public class RequestSellItem implements IClientIncomingPacket } } - // add to castle treasury - if (merchant != null) + if (!Config.MERCHANT_ZERO_SELL_PRICE) { - // Keep here same formula as in {@link ExBuySellList} to produce same result. - final long profit = (long) (totalPrice * (1.0 - merchant.getCastleTaxRate(TaxType.SELL))); - merchant.handleTaxPayment(totalPrice - profit); - totalPrice = profit; + player.addAdena("Sell", totalPrice, merchant, false); } - player.addAdena("Sell", totalPrice, merchant, false); - // Update current load as well client.sendPacket(new ExUserInfoInvenWeight(player)); client.sendPacket(new ExBuySellList(player, true)); diff --git a/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/network/serverpackets/ExBuySellList.java b/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/network/serverpackets/ExBuySellList.java index a3cd6d9afa..66bcb38bb6 100644 --- a/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/network/serverpackets/ExBuySellList.java +++ b/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/network/serverpackets/ExBuySellList.java @@ -18,6 +18,7 @@ package org.l2jmobius.gameserver.network.serverpackets; import java.util.Collection; +import org.l2jmobius.Config; import org.l2jmobius.commons.network.PacketWriter; import org.l2jmobius.gameserver.model.actor.Summon; import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; @@ -33,7 +34,6 @@ public class ExBuySellList extends AbstractItemPacket private Collection _refundList = null; private final boolean _done; private final int _inventorySlots; - private double _castleTaxRate = 1; public ExBuySellList(PlayerInstance player, boolean done) { @@ -47,12 +47,6 @@ public class ExBuySellList extends AbstractItemPacket _done = done; } - public ExBuySellList(PlayerInstance player, boolean done, double castleTaxRate) - { - this(player, done); - _castleTaxRate = 1 - castleTaxRate; - } - @Override public boolean write(PacketWriter packet) { @@ -67,7 +61,7 @@ public class ExBuySellList extends AbstractItemPacket for (ItemInstance item : _sellList) { writeItem(packet, item); - packet.writeQ((long) ((item.getItem().getReferencePrice() / 2) * _castleTaxRate)); + packet.writeQ(Config.MERCHANT_ZERO_SELL_PRICE ? 0 : item.getItem().getReferencePrice() / 2); } } else @@ -83,7 +77,7 @@ public class ExBuySellList extends AbstractItemPacket { writeItem(packet, item); packet.writeD(i++); - packet.writeQ((item.getItem().getReferencePrice() / 2) * item.getCount()); + packet.writeQ(Config.MERCHANT_ZERO_SELL_PRICE ? 0 : (item.getItem().getReferencePrice() / 2) * item.getCount()); } } else diff --git a/L2J_Mobius_4.0_GrandCrusade/dist/game/config/Custom/MerchantZeroSellPrice.ini b/L2J_Mobius_4.0_GrandCrusade/dist/game/config/Custom/MerchantZeroSellPrice.ini new file mode 100644 index 0000000000..140490f042 --- /dev/null +++ b/L2J_Mobius_4.0_GrandCrusade/dist/game/config/Custom/MerchantZeroSellPrice.ini @@ -0,0 +1,6 @@ +# --------------------------------------------------------------------------- +# Merchant Zero Sell Price +# --------------------------------------------------------------------------- + +# All items sold to merchants reward no Adena. +MerchantZeroSellPrice = False 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 43fe798bce..fda9083c5c 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/Config.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/Config.java @@ -124,6 +124,7 @@ public class Config private static final String CUSTOM_FACTION_SYSTEM_CONFIG_FILE = "./config/Custom/FactionSystem.ini"; private static final String CUSTOM_FAKE_PLAYERS_CONFIG_FILE = "./config/Custom/FakePlayers.ini"; private static final String CUSTOM_FIND_PVP_CONFIG_FILE = "./config/Custom/FindPvP.ini"; + private static final String CUSTOM_MERCHANT_ZERO_SELL_PRICE_CONFIG_FILE = "./config/Custom/MerchantZeroSellPrice.ini"; private static final String CUSTOM_MULTILANGUAL_SUPPORT_CONFIG_FILE = "./config/Custom/MultilingualSupport.ini"; private static final String CUSTOM_NPC_STAT_MULTIPLIERS_CONFIG_FILE = "./config/Custom/NpcStatMultipliers.ini"; private static final String CUSTOM_OFFLINE_TRADE_CONFIG_FILE = "./config/Custom/OfflineTrade.ini"; @@ -1234,6 +1235,7 @@ public class Config public static boolean FAKE_PLAYER_CAN_DROP_ITEMS; public static boolean FAKE_PLAYER_CAN_PICKUP; public static boolean ENABLE_FIND_PVP; + public static boolean MERCHANT_ZERO_SELL_PRICE; public static boolean PREMIUM_SYSTEM_ENABLED; public static float PREMIUM_RATE_XP; public static float PREMIUM_RATE_SP; @@ -3170,6 +3172,10 @@ public class Config final PropertiesParser FindPvP = new PropertiesParser(CUSTOM_FIND_PVP_CONFIG_FILE); ENABLE_FIND_PVP = FindPvP.getBoolean("EnableFindPvP", false); + // Load MerchantZeroSellPrice config file (if exists) + final PropertiesParser MerchantZeroSellPrice = new PropertiesParser(CUSTOM_MERCHANT_ZERO_SELL_PRICE_CONFIG_FILE); + MERCHANT_ZERO_SELL_PRICE = MerchantZeroSellPrice.getBoolean("MerchantZeroSellPrice", false); + // Load MultilingualSupport config file (if exists) final PropertiesParser MultilingualSupport = new PropertiesParser(CUSTOM_MULTILANGUAL_SUPPORT_CONFIG_FILE); diff --git a/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/model/actor/instance/MerchantInstance.java b/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/model/actor/instance/MerchantInstance.java index 539664a411..3b4c28fadd 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/model/actor/instance/MerchantInstance.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/model/actor/instance/MerchantInstance.java @@ -88,6 +88,6 @@ public class MerchantInstance extends NpcInstance player.setInventoryBlockingStatus(true); player.sendPacket(new BuyList(buyList, player, (applyCastleTax) ? getCastleTaxRate(TaxType.BUY) : 0)); - player.sendPacket(new ExBuySellList(player, false, (applyCastleTax) ? getCastleTaxRate(TaxType.SELL) : 0)); + player.sendPacket(new ExBuySellList(player, false)); } } diff --git a/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/network/clientpackets/RequestRefundItem.java b/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/network/clientpackets/RequestRefundItem.java index 41cb56d317..027e31909f 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/network/clientpackets/RequestRefundItem.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/network/clientpackets/RequestRefundItem.java @@ -157,7 +157,7 @@ public class RequestRefundItem implements IClientIncomingPacket final long count = item.getCount(); weight += count * template.getWeight(); - adena += (count * template.getReferencePrice()) / 2; + adena += count * (template.getReferencePrice() / 2); if (!template.isStackable()) { slots += count; @@ -182,7 +182,7 @@ public class RequestRefundItem implements IClientIncomingPacket return; } - if ((adena < 0) || !player.reduceAdena("Refund", adena, player.getLastFolkNPC(), false)) + if (!Config.MERCHANT_ZERO_SELL_PRICE && ((adena < 0) || !player.reduceAdena("Refund", adena, player.getLastFolkNPC(), false))) { client.sendPacket(SystemMessageId.YOU_DO_NOT_HAVE_ENOUGH_ADENA); client.sendPacket(ActionFailed.STATIC_PACKET); diff --git a/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/network/clientpackets/RequestSellItem.java b/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/network/clientpackets/RequestSellItem.java index 70d3e92505..3546aec078 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/network/clientpackets/RequestSellItem.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/network/clientpackets/RequestSellItem.java @@ -25,7 +25,6 @@ import java.util.List; import org.l2jmobius.Config; import org.l2jmobius.commons.network.PacketReader; import org.l2jmobius.gameserver.data.xml.impl.BuyListData; -import org.l2jmobius.gameserver.enums.TaxType; import org.l2jmobius.gameserver.model.WorldObject; import org.l2jmobius.gameserver.model.actor.instance.MerchantInstance; import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; @@ -170,17 +169,11 @@ public class RequestSellItem implements IClientIncomingPacket } } - // add to castle treasury - if (merchant != null) + if (!Config.MERCHANT_ZERO_SELL_PRICE) { - // Keep here same formula as in {@link ExBuySellList} to produce same result. - final long profit = (long) (totalPrice * (1.0 - merchant.getCastleTaxRate(TaxType.SELL))); - merchant.handleTaxPayment(totalPrice - profit); - totalPrice = profit; + player.addAdena("Sell", totalPrice, merchant, false); } - player.addAdena("Sell", totalPrice, merchant, false); - // Update current load as well client.sendPacket(new ExUserInfoInvenWeight(player)); client.sendPacket(new ExBuySellList(player, true)); diff --git a/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/network/serverpackets/ExBuySellList.java b/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/network/serverpackets/ExBuySellList.java index a3cd6d9afa..66bcb38bb6 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/network/serverpackets/ExBuySellList.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/network/serverpackets/ExBuySellList.java @@ -18,6 +18,7 @@ package org.l2jmobius.gameserver.network.serverpackets; import java.util.Collection; +import org.l2jmobius.Config; import org.l2jmobius.commons.network.PacketWriter; import org.l2jmobius.gameserver.model.actor.Summon; import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; @@ -33,7 +34,6 @@ public class ExBuySellList extends AbstractItemPacket private Collection _refundList = null; private final boolean _done; private final int _inventorySlots; - private double _castleTaxRate = 1; public ExBuySellList(PlayerInstance player, boolean done) { @@ -47,12 +47,6 @@ public class ExBuySellList extends AbstractItemPacket _done = done; } - public ExBuySellList(PlayerInstance player, boolean done, double castleTaxRate) - { - this(player, done); - _castleTaxRate = 1 - castleTaxRate; - } - @Override public boolean write(PacketWriter packet) { @@ -67,7 +61,7 @@ public class ExBuySellList extends AbstractItemPacket for (ItemInstance item : _sellList) { writeItem(packet, item); - packet.writeQ((long) ((item.getItem().getReferencePrice() / 2) * _castleTaxRate)); + packet.writeQ(Config.MERCHANT_ZERO_SELL_PRICE ? 0 : item.getItem().getReferencePrice() / 2); } } else @@ -83,7 +77,7 @@ public class ExBuySellList extends AbstractItemPacket { writeItem(packet, item); packet.writeD(i++); - packet.writeQ((item.getItem().getReferencePrice() / 2) * item.getCount()); + packet.writeQ(Config.MERCHANT_ZERO_SELL_PRICE ? 0 : (item.getItem().getReferencePrice() / 2) * item.getCount()); } } else diff --git a/L2J_Mobius_5.0_Salvation/dist/game/config/Custom/MerchantZeroSellPrice.ini b/L2J_Mobius_5.0_Salvation/dist/game/config/Custom/MerchantZeroSellPrice.ini new file mode 100644 index 0000000000..140490f042 --- /dev/null +++ b/L2J_Mobius_5.0_Salvation/dist/game/config/Custom/MerchantZeroSellPrice.ini @@ -0,0 +1,6 @@ +# --------------------------------------------------------------------------- +# Merchant Zero Sell Price +# --------------------------------------------------------------------------- + +# All items sold to merchants reward no Adena. +MerchantZeroSellPrice = False 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 2db0e2f294..7e0ade40f8 100644 --- a/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/Config.java +++ b/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/Config.java @@ -125,6 +125,7 @@ public class Config private static final String CUSTOM_FACTION_SYSTEM_CONFIG_FILE = "./config/Custom/FactionSystem.ini"; private static final String CUSTOM_FAKE_PLAYERS_CONFIG_FILE = "./config/Custom/FakePlayers.ini"; private static final String CUSTOM_FIND_PVP_CONFIG_FILE = "./config/Custom/FindPvP.ini"; + private static final String CUSTOM_MERCHANT_ZERO_SELL_PRICE_CONFIG_FILE = "./config/Custom/MerchantZeroSellPrice.ini"; private static final String CUSTOM_MULTILANGUAL_SUPPORT_CONFIG_FILE = "./config/Custom/MultilingualSupport.ini"; private static final String CUSTOM_NPC_STAT_MULTIPLIERS_CONFIG_FILE = "./config/Custom/NpcStatMultipliers.ini"; private static final String CUSTOM_OFFLINE_TRADE_CONFIG_FILE = "./config/Custom/OfflineTrade.ini"; @@ -1229,6 +1230,7 @@ public class Config public static boolean FAKE_PLAYER_CAN_DROP_ITEMS; public static boolean FAKE_PLAYER_CAN_PICKUP; public static boolean ENABLE_FIND_PVP; + public static boolean MERCHANT_ZERO_SELL_PRICE; public static boolean PREMIUM_SYSTEM_ENABLED; public static float PREMIUM_RATE_XP; public static float PREMIUM_RATE_SP; @@ -3172,6 +3174,10 @@ public class Config final PropertiesParser FindPvP = new PropertiesParser(CUSTOM_FIND_PVP_CONFIG_FILE); ENABLE_FIND_PVP = FindPvP.getBoolean("EnableFindPvP", false); + // Load MerchantZeroSellPrice config file (if exists) + final PropertiesParser MerchantZeroSellPrice = new PropertiesParser(CUSTOM_MERCHANT_ZERO_SELL_PRICE_CONFIG_FILE); + MERCHANT_ZERO_SELL_PRICE = MerchantZeroSellPrice.getBoolean("MerchantZeroSellPrice", false); + // Load MultilingualSupport config file (if exists) final PropertiesParser MultilingualSupport = new PropertiesParser(CUSTOM_MULTILANGUAL_SUPPORT_CONFIG_FILE); diff --git a/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/model/actor/instance/MerchantInstance.java b/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/model/actor/instance/MerchantInstance.java index 539664a411..3b4c28fadd 100644 --- a/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/model/actor/instance/MerchantInstance.java +++ b/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/model/actor/instance/MerchantInstance.java @@ -88,6 +88,6 @@ public class MerchantInstance extends NpcInstance player.setInventoryBlockingStatus(true); player.sendPacket(new BuyList(buyList, player, (applyCastleTax) ? getCastleTaxRate(TaxType.BUY) : 0)); - player.sendPacket(new ExBuySellList(player, false, (applyCastleTax) ? getCastleTaxRate(TaxType.SELL) : 0)); + player.sendPacket(new ExBuySellList(player, false)); } } diff --git a/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/network/clientpackets/RequestRefundItem.java b/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/network/clientpackets/RequestRefundItem.java index 41cb56d317..027e31909f 100644 --- a/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/network/clientpackets/RequestRefundItem.java +++ b/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/network/clientpackets/RequestRefundItem.java @@ -157,7 +157,7 @@ public class RequestRefundItem implements IClientIncomingPacket final long count = item.getCount(); weight += count * template.getWeight(); - adena += (count * template.getReferencePrice()) / 2; + adena += count * (template.getReferencePrice() / 2); if (!template.isStackable()) { slots += count; @@ -182,7 +182,7 @@ public class RequestRefundItem implements IClientIncomingPacket return; } - if ((adena < 0) || !player.reduceAdena("Refund", adena, player.getLastFolkNPC(), false)) + if (!Config.MERCHANT_ZERO_SELL_PRICE && ((adena < 0) || !player.reduceAdena("Refund", adena, player.getLastFolkNPC(), false))) { client.sendPacket(SystemMessageId.YOU_DO_NOT_HAVE_ENOUGH_ADENA); client.sendPacket(ActionFailed.STATIC_PACKET); diff --git a/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/network/clientpackets/RequestSellItem.java b/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/network/clientpackets/RequestSellItem.java index 70d3e92505..3546aec078 100644 --- a/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/network/clientpackets/RequestSellItem.java +++ b/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/network/clientpackets/RequestSellItem.java @@ -25,7 +25,6 @@ import java.util.List; import org.l2jmobius.Config; import org.l2jmobius.commons.network.PacketReader; import org.l2jmobius.gameserver.data.xml.impl.BuyListData; -import org.l2jmobius.gameserver.enums.TaxType; import org.l2jmobius.gameserver.model.WorldObject; import org.l2jmobius.gameserver.model.actor.instance.MerchantInstance; import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; @@ -170,17 +169,11 @@ public class RequestSellItem implements IClientIncomingPacket } } - // add to castle treasury - if (merchant != null) + if (!Config.MERCHANT_ZERO_SELL_PRICE) { - // Keep here same formula as in {@link ExBuySellList} to produce same result. - final long profit = (long) (totalPrice * (1.0 - merchant.getCastleTaxRate(TaxType.SELL))); - merchant.handleTaxPayment(totalPrice - profit); - totalPrice = profit; + player.addAdena("Sell", totalPrice, merchant, false); } - player.addAdena("Sell", totalPrice, merchant, false); - // Update current load as well client.sendPacket(new ExUserInfoInvenWeight(player)); client.sendPacket(new ExBuySellList(player, true)); diff --git a/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/network/serverpackets/ExBuySellList.java b/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/network/serverpackets/ExBuySellList.java index a3cd6d9afa..66bcb38bb6 100644 --- a/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/network/serverpackets/ExBuySellList.java +++ b/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/network/serverpackets/ExBuySellList.java @@ -18,6 +18,7 @@ package org.l2jmobius.gameserver.network.serverpackets; import java.util.Collection; +import org.l2jmobius.Config; import org.l2jmobius.commons.network.PacketWriter; import org.l2jmobius.gameserver.model.actor.Summon; import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; @@ -33,7 +34,6 @@ public class ExBuySellList extends AbstractItemPacket private Collection _refundList = null; private final boolean _done; private final int _inventorySlots; - private double _castleTaxRate = 1; public ExBuySellList(PlayerInstance player, boolean done) { @@ -47,12 +47,6 @@ public class ExBuySellList extends AbstractItemPacket _done = done; } - public ExBuySellList(PlayerInstance player, boolean done, double castleTaxRate) - { - this(player, done); - _castleTaxRate = 1 - castleTaxRate; - } - @Override public boolean write(PacketWriter packet) { @@ -67,7 +61,7 @@ public class ExBuySellList extends AbstractItemPacket for (ItemInstance item : _sellList) { writeItem(packet, item); - packet.writeQ((long) ((item.getItem().getReferencePrice() / 2) * _castleTaxRate)); + packet.writeQ(Config.MERCHANT_ZERO_SELL_PRICE ? 0 : item.getItem().getReferencePrice() / 2); } } else @@ -83,7 +77,7 @@ public class ExBuySellList extends AbstractItemPacket { writeItem(packet, item); packet.writeD(i++); - packet.writeQ((item.getItem().getReferencePrice() / 2) * item.getCount()); + packet.writeQ(Config.MERCHANT_ZERO_SELL_PRICE ? 0 : (item.getItem().getReferencePrice() / 2) * item.getCount()); } } else diff --git a/L2J_Mobius_5.5_EtinasFate/dist/game/config/Custom/MerchantZeroSellPrice.ini b/L2J_Mobius_5.5_EtinasFate/dist/game/config/Custom/MerchantZeroSellPrice.ini new file mode 100644 index 0000000000..140490f042 --- /dev/null +++ b/L2J_Mobius_5.5_EtinasFate/dist/game/config/Custom/MerchantZeroSellPrice.ini @@ -0,0 +1,6 @@ +# --------------------------------------------------------------------------- +# Merchant Zero Sell Price +# --------------------------------------------------------------------------- + +# All items sold to merchants reward no Adena. +MerchantZeroSellPrice = False 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 2db0e2f294..7e0ade40f8 100644 --- a/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/Config.java +++ b/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/Config.java @@ -125,6 +125,7 @@ public class Config private static final String CUSTOM_FACTION_SYSTEM_CONFIG_FILE = "./config/Custom/FactionSystem.ini"; private static final String CUSTOM_FAKE_PLAYERS_CONFIG_FILE = "./config/Custom/FakePlayers.ini"; private static final String CUSTOM_FIND_PVP_CONFIG_FILE = "./config/Custom/FindPvP.ini"; + private static final String CUSTOM_MERCHANT_ZERO_SELL_PRICE_CONFIG_FILE = "./config/Custom/MerchantZeroSellPrice.ini"; private static final String CUSTOM_MULTILANGUAL_SUPPORT_CONFIG_FILE = "./config/Custom/MultilingualSupport.ini"; private static final String CUSTOM_NPC_STAT_MULTIPLIERS_CONFIG_FILE = "./config/Custom/NpcStatMultipliers.ini"; private static final String CUSTOM_OFFLINE_TRADE_CONFIG_FILE = "./config/Custom/OfflineTrade.ini"; @@ -1229,6 +1230,7 @@ public class Config public static boolean FAKE_PLAYER_CAN_DROP_ITEMS; public static boolean FAKE_PLAYER_CAN_PICKUP; public static boolean ENABLE_FIND_PVP; + public static boolean MERCHANT_ZERO_SELL_PRICE; public static boolean PREMIUM_SYSTEM_ENABLED; public static float PREMIUM_RATE_XP; public static float PREMIUM_RATE_SP; @@ -3172,6 +3174,10 @@ public class Config final PropertiesParser FindPvP = new PropertiesParser(CUSTOM_FIND_PVP_CONFIG_FILE); ENABLE_FIND_PVP = FindPvP.getBoolean("EnableFindPvP", false); + // Load MerchantZeroSellPrice config file (if exists) + final PropertiesParser MerchantZeroSellPrice = new PropertiesParser(CUSTOM_MERCHANT_ZERO_SELL_PRICE_CONFIG_FILE); + MERCHANT_ZERO_SELL_PRICE = MerchantZeroSellPrice.getBoolean("MerchantZeroSellPrice", false); + // Load MultilingualSupport config file (if exists) final PropertiesParser MultilingualSupport = new PropertiesParser(CUSTOM_MULTILANGUAL_SUPPORT_CONFIG_FILE); diff --git a/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/model/actor/instance/MerchantInstance.java b/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/model/actor/instance/MerchantInstance.java index 539664a411..3b4c28fadd 100644 --- a/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/model/actor/instance/MerchantInstance.java +++ b/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/model/actor/instance/MerchantInstance.java @@ -88,6 +88,6 @@ public class MerchantInstance extends NpcInstance player.setInventoryBlockingStatus(true); player.sendPacket(new BuyList(buyList, player, (applyCastleTax) ? getCastleTaxRate(TaxType.BUY) : 0)); - player.sendPacket(new ExBuySellList(player, false, (applyCastleTax) ? getCastleTaxRate(TaxType.SELL) : 0)); + player.sendPacket(new ExBuySellList(player, false)); } } diff --git a/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/network/clientpackets/RequestRefundItem.java b/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/network/clientpackets/RequestRefundItem.java index 41cb56d317..027e31909f 100644 --- a/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/network/clientpackets/RequestRefundItem.java +++ b/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/network/clientpackets/RequestRefundItem.java @@ -157,7 +157,7 @@ public class RequestRefundItem implements IClientIncomingPacket final long count = item.getCount(); weight += count * template.getWeight(); - adena += (count * template.getReferencePrice()) / 2; + adena += count * (template.getReferencePrice() / 2); if (!template.isStackable()) { slots += count; @@ -182,7 +182,7 @@ public class RequestRefundItem implements IClientIncomingPacket return; } - if ((adena < 0) || !player.reduceAdena("Refund", adena, player.getLastFolkNPC(), false)) + if (!Config.MERCHANT_ZERO_SELL_PRICE && ((adena < 0) || !player.reduceAdena("Refund", adena, player.getLastFolkNPC(), false))) { client.sendPacket(SystemMessageId.YOU_DO_NOT_HAVE_ENOUGH_ADENA); client.sendPacket(ActionFailed.STATIC_PACKET); diff --git a/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/network/clientpackets/RequestSellItem.java b/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/network/clientpackets/RequestSellItem.java index 70d3e92505..3546aec078 100644 --- a/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/network/clientpackets/RequestSellItem.java +++ b/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/network/clientpackets/RequestSellItem.java @@ -25,7 +25,6 @@ import java.util.List; import org.l2jmobius.Config; import org.l2jmobius.commons.network.PacketReader; import org.l2jmobius.gameserver.data.xml.impl.BuyListData; -import org.l2jmobius.gameserver.enums.TaxType; import org.l2jmobius.gameserver.model.WorldObject; import org.l2jmobius.gameserver.model.actor.instance.MerchantInstance; import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; @@ -170,17 +169,11 @@ public class RequestSellItem implements IClientIncomingPacket } } - // add to castle treasury - if (merchant != null) + if (!Config.MERCHANT_ZERO_SELL_PRICE) { - // Keep here same formula as in {@link ExBuySellList} to produce same result. - final long profit = (long) (totalPrice * (1.0 - merchant.getCastleTaxRate(TaxType.SELL))); - merchant.handleTaxPayment(totalPrice - profit); - totalPrice = profit; + player.addAdena("Sell", totalPrice, merchant, false); } - player.addAdena("Sell", totalPrice, merchant, false); - // Update current load as well client.sendPacket(new ExUserInfoInvenWeight(player)); client.sendPacket(new ExBuySellList(player, true)); diff --git a/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/network/serverpackets/ExBuySellList.java b/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/network/serverpackets/ExBuySellList.java index a3cd6d9afa..66bcb38bb6 100644 --- a/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/network/serverpackets/ExBuySellList.java +++ b/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/network/serverpackets/ExBuySellList.java @@ -18,6 +18,7 @@ package org.l2jmobius.gameserver.network.serverpackets; import java.util.Collection; +import org.l2jmobius.Config; import org.l2jmobius.commons.network.PacketWriter; import org.l2jmobius.gameserver.model.actor.Summon; import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; @@ -33,7 +34,6 @@ public class ExBuySellList extends AbstractItemPacket private Collection _refundList = null; private final boolean _done; private final int _inventorySlots; - private double _castleTaxRate = 1; public ExBuySellList(PlayerInstance player, boolean done) { @@ -47,12 +47,6 @@ public class ExBuySellList extends AbstractItemPacket _done = done; } - public ExBuySellList(PlayerInstance player, boolean done, double castleTaxRate) - { - this(player, done); - _castleTaxRate = 1 - castleTaxRate; - } - @Override public boolean write(PacketWriter packet) { @@ -67,7 +61,7 @@ public class ExBuySellList extends AbstractItemPacket for (ItemInstance item : _sellList) { writeItem(packet, item); - packet.writeQ((long) ((item.getItem().getReferencePrice() / 2) * _castleTaxRate)); + packet.writeQ(Config.MERCHANT_ZERO_SELL_PRICE ? 0 : item.getItem().getReferencePrice() / 2); } } else @@ -83,7 +77,7 @@ public class ExBuySellList extends AbstractItemPacket { writeItem(packet, item); packet.writeD(i++); - packet.writeQ((item.getItem().getReferencePrice() / 2) * item.getCount()); + packet.writeQ(Config.MERCHANT_ZERO_SELL_PRICE ? 0 : (item.getItem().getReferencePrice() / 2) * item.getCount()); } } else diff --git a/L2J_Mobius_6.0_Fafurion/dist/game/config/Custom/MerchantZeroSellPrice.ini b/L2J_Mobius_6.0_Fafurion/dist/game/config/Custom/MerchantZeroSellPrice.ini new file mode 100644 index 0000000000..140490f042 --- /dev/null +++ b/L2J_Mobius_6.0_Fafurion/dist/game/config/Custom/MerchantZeroSellPrice.ini @@ -0,0 +1,6 @@ +# --------------------------------------------------------------------------- +# Merchant Zero Sell Price +# --------------------------------------------------------------------------- + +# All items sold to merchants reward no Adena. +MerchantZeroSellPrice = False 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 1daf3724b7..42fe4ba5a1 100644 --- a/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/Config.java +++ b/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/Config.java @@ -125,6 +125,7 @@ public class Config private static final String CUSTOM_FACTION_SYSTEM_CONFIG_FILE = "./config/Custom/FactionSystem.ini"; private static final String CUSTOM_FAKE_PLAYERS_CONFIG_FILE = "./config/Custom/FakePlayers.ini"; private static final String CUSTOM_FIND_PVP_CONFIG_FILE = "./config/Custom/FindPvP.ini"; + private static final String CUSTOM_MERCHANT_ZERO_SELL_PRICE_CONFIG_FILE = "./config/Custom/MerchantZeroSellPrice.ini"; private static final String CUSTOM_MULTILANGUAL_SUPPORT_CONFIG_FILE = "./config/Custom/MultilingualSupport.ini"; private static final String CUSTOM_NPC_STAT_MULTIPLIERS_CONFIG_FILE = "./config/Custom/NpcStatMultipliers.ini"; private static final String CUSTOM_OFFLINE_TRADE_CONFIG_FILE = "./config/Custom/OfflineTrade.ini"; @@ -1251,6 +1252,7 @@ public class Config public static boolean FAKE_PLAYER_CAN_DROP_ITEMS; public static boolean FAKE_PLAYER_CAN_PICKUP; public static boolean ENABLE_FIND_PVP; + public static boolean MERCHANT_ZERO_SELL_PRICE; public static boolean PREMIUM_SYSTEM_ENABLED; public static float PREMIUM_RATE_XP; public static float PREMIUM_RATE_SP; @@ -3215,6 +3217,10 @@ public class Config final PropertiesParser FindPvP = new PropertiesParser(CUSTOM_FIND_PVP_CONFIG_FILE); ENABLE_FIND_PVP = FindPvP.getBoolean("EnableFindPvP", false); + // Load MerchantZeroSellPrice config file (if exists) + final PropertiesParser MerchantZeroSellPrice = new PropertiesParser(CUSTOM_MERCHANT_ZERO_SELL_PRICE_CONFIG_FILE); + MERCHANT_ZERO_SELL_PRICE = MerchantZeroSellPrice.getBoolean("MerchantZeroSellPrice", false); + // Load MultilingualSupport config file (if exists) final PropertiesParser MultilingualSupport = new PropertiesParser(CUSTOM_MULTILANGUAL_SUPPORT_CONFIG_FILE); diff --git a/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/model/actor/instance/MerchantInstance.java b/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/model/actor/instance/MerchantInstance.java index 539664a411..3b4c28fadd 100644 --- a/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/model/actor/instance/MerchantInstance.java +++ b/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/model/actor/instance/MerchantInstance.java @@ -88,6 +88,6 @@ public class MerchantInstance extends NpcInstance player.setInventoryBlockingStatus(true); player.sendPacket(new BuyList(buyList, player, (applyCastleTax) ? getCastleTaxRate(TaxType.BUY) : 0)); - player.sendPacket(new ExBuySellList(player, false, (applyCastleTax) ? getCastleTaxRate(TaxType.SELL) : 0)); + player.sendPacket(new ExBuySellList(player, false)); } } diff --git a/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/network/clientpackets/RequestRefundItem.java b/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/network/clientpackets/RequestRefundItem.java index 41cb56d317..027e31909f 100644 --- a/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/network/clientpackets/RequestRefundItem.java +++ b/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/network/clientpackets/RequestRefundItem.java @@ -157,7 +157,7 @@ public class RequestRefundItem implements IClientIncomingPacket final long count = item.getCount(); weight += count * template.getWeight(); - adena += (count * template.getReferencePrice()) / 2; + adena += count * (template.getReferencePrice() / 2); if (!template.isStackable()) { slots += count; @@ -182,7 +182,7 @@ public class RequestRefundItem implements IClientIncomingPacket return; } - if ((adena < 0) || !player.reduceAdena("Refund", adena, player.getLastFolkNPC(), false)) + if (!Config.MERCHANT_ZERO_SELL_PRICE && ((adena < 0) || !player.reduceAdena("Refund", adena, player.getLastFolkNPC(), false))) { client.sendPacket(SystemMessageId.YOU_DO_NOT_HAVE_ENOUGH_ADENA); client.sendPacket(ActionFailed.STATIC_PACKET); diff --git a/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/network/clientpackets/RequestSellItem.java b/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/network/clientpackets/RequestSellItem.java index 70d3e92505..3546aec078 100644 --- a/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/network/clientpackets/RequestSellItem.java +++ b/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/network/clientpackets/RequestSellItem.java @@ -25,7 +25,6 @@ import java.util.List; import org.l2jmobius.Config; import org.l2jmobius.commons.network.PacketReader; import org.l2jmobius.gameserver.data.xml.impl.BuyListData; -import org.l2jmobius.gameserver.enums.TaxType; import org.l2jmobius.gameserver.model.WorldObject; import org.l2jmobius.gameserver.model.actor.instance.MerchantInstance; import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; @@ -170,17 +169,11 @@ public class RequestSellItem implements IClientIncomingPacket } } - // add to castle treasury - if (merchant != null) + if (!Config.MERCHANT_ZERO_SELL_PRICE) { - // Keep here same formula as in {@link ExBuySellList} to produce same result. - final long profit = (long) (totalPrice * (1.0 - merchant.getCastleTaxRate(TaxType.SELL))); - merchant.handleTaxPayment(totalPrice - profit); - totalPrice = profit; + player.addAdena("Sell", totalPrice, merchant, false); } - player.addAdena("Sell", totalPrice, merchant, false); - // Update current load as well client.sendPacket(new ExUserInfoInvenWeight(player)); client.sendPacket(new ExBuySellList(player, true)); diff --git a/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/network/serverpackets/ExBuySellList.java b/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/network/serverpackets/ExBuySellList.java index a3cd6d9afa..66bcb38bb6 100644 --- a/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/network/serverpackets/ExBuySellList.java +++ b/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/network/serverpackets/ExBuySellList.java @@ -18,6 +18,7 @@ package org.l2jmobius.gameserver.network.serverpackets; import java.util.Collection; +import org.l2jmobius.Config; import org.l2jmobius.commons.network.PacketWriter; import org.l2jmobius.gameserver.model.actor.Summon; import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; @@ -33,7 +34,6 @@ public class ExBuySellList extends AbstractItemPacket private Collection _refundList = null; private final boolean _done; private final int _inventorySlots; - private double _castleTaxRate = 1; public ExBuySellList(PlayerInstance player, boolean done) { @@ -47,12 +47,6 @@ public class ExBuySellList extends AbstractItemPacket _done = done; } - public ExBuySellList(PlayerInstance player, boolean done, double castleTaxRate) - { - this(player, done); - _castleTaxRate = 1 - castleTaxRate; - } - @Override public boolean write(PacketWriter packet) { @@ -67,7 +61,7 @@ public class ExBuySellList extends AbstractItemPacket for (ItemInstance item : _sellList) { writeItem(packet, item); - packet.writeQ((long) ((item.getItem().getReferencePrice() / 2) * _castleTaxRate)); + packet.writeQ(Config.MERCHANT_ZERO_SELL_PRICE ? 0 : item.getItem().getReferencePrice() / 2); } } else @@ -83,7 +77,7 @@ public class ExBuySellList extends AbstractItemPacket { writeItem(packet, item); packet.writeD(i++); - packet.writeQ((item.getItem().getReferencePrice() / 2) * item.getCount()); + packet.writeQ(Config.MERCHANT_ZERO_SELL_PRICE ? 0 : (item.getItem().getReferencePrice() / 2) * item.getCount()); } } else diff --git a/L2J_Mobius_7.0_PreludeOfWar/dist/game/config/Custom/MerchantZeroSellPrice.ini b/L2J_Mobius_7.0_PreludeOfWar/dist/game/config/Custom/MerchantZeroSellPrice.ini new file mode 100644 index 0000000000..140490f042 --- /dev/null +++ b/L2J_Mobius_7.0_PreludeOfWar/dist/game/config/Custom/MerchantZeroSellPrice.ini @@ -0,0 +1,6 @@ +# --------------------------------------------------------------------------- +# Merchant Zero Sell Price +# --------------------------------------------------------------------------- + +# All items sold to merchants reward no Adena. +MerchantZeroSellPrice = False 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 1f81d6eee5..b5749becfd 100644 --- a/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/Config.java +++ b/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/Config.java @@ -125,6 +125,7 @@ public class Config private static final String CUSTOM_FACTION_SYSTEM_CONFIG_FILE = "./config/Custom/FactionSystem.ini"; private static final String CUSTOM_FAKE_PLAYERS_CONFIG_FILE = "./config/Custom/FakePlayers.ini"; private static final String CUSTOM_FIND_PVP_CONFIG_FILE = "./config/Custom/FindPvP.ini"; + private static final String CUSTOM_MERCHANT_ZERO_SELL_PRICE_CONFIG_FILE = "./config/Custom/MerchantZeroSellPrice.ini"; private static final String CUSTOM_MULTILANGUAL_SUPPORT_CONFIG_FILE = "./config/Custom/MultilingualSupport.ini"; private static final String CUSTOM_NPC_STAT_MULTIPLIERS_CONFIG_FILE = "./config/Custom/NpcStatMultipliers.ini"; private static final String CUSTOM_OFFLINE_TRADE_CONFIG_FILE = "./config/Custom/OfflineTrade.ini"; @@ -1252,6 +1253,7 @@ public class Config public static boolean FAKE_PLAYER_CAN_DROP_ITEMS; public static boolean FAKE_PLAYER_CAN_PICKUP; public static boolean ENABLE_FIND_PVP; + public static boolean MERCHANT_ZERO_SELL_PRICE; public static boolean PREMIUM_SYSTEM_ENABLED; public static float PREMIUM_RATE_XP; public static float PREMIUM_RATE_SP; @@ -3217,6 +3219,10 @@ public class Config final PropertiesParser FindPvP = new PropertiesParser(CUSTOM_FIND_PVP_CONFIG_FILE); ENABLE_FIND_PVP = FindPvP.getBoolean("EnableFindPvP", false); + // Load MerchantZeroSellPrice config file (if exists) + final PropertiesParser MerchantZeroSellPrice = new PropertiesParser(CUSTOM_MERCHANT_ZERO_SELL_PRICE_CONFIG_FILE); + MERCHANT_ZERO_SELL_PRICE = MerchantZeroSellPrice.getBoolean("MerchantZeroSellPrice", false); + // Load MultilingualSupport config file (if exists) final PropertiesParser MultilingualSupport = new PropertiesParser(CUSTOM_MULTILANGUAL_SUPPORT_CONFIG_FILE); diff --git a/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/model/actor/instance/MerchantInstance.java b/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/model/actor/instance/MerchantInstance.java index 539664a411..3b4c28fadd 100644 --- a/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/model/actor/instance/MerchantInstance.java +++ b/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/model/actor/instance/MerchantInstance.java @@ -88,6 +88,6 @@ public class MerchantInstance extends NpcInstance player.setInventoryBlockingStatus(true); player.sendPacket(new BuyList(buyList, player, (applyCastleTax) ? getCastleTaxRate(TaxType.BUY) : 0)); - player.sendPacket(new ExBuySellList(player, false, (applyCastleTax) ? getCastleTaxRate(TaxType.SELL) : 0)); + player.sendPacket(new ExBuySellList(player, false)); } } diff --git a/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/network/clientpackets/RequestRefundItem.java b/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/network/clientpackets/RequestRefundItem.java index 41cb56d317..027e31909f 100644 --- a/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/network/clientpackets/RequestRefundItem.java +++ b/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/network/clientpackets/RequestRefundItem.java @@ -157,7 +157,7 @@ public class RequestRefundItem implements IClientIncomingPacket final long count = item.getCount(); weight += count * template.getWeight(); - adena += (count * template.getReferencePrice()) / 2; + adena += count * (template.getReferencePrice() / 2); if (!template.isStackable()) { slots += count; @@ -182,7 +182,7 @@ public class RequestRefundItem implements IClientIncomingPacket return; } - if ((adena < 0) || !player.reduceAdena("Refund", adena, player.getLastFolkNPC(), false)) + if (!Config.MERCHANT_ZERO_SELL_PRICE && ((adena < 0) || !player.reduceAdena("Refund", adena, player.getLastFolkNPC(), false))) { client.sendPacket(SystemMessageId.YOU_DO_NOT_HAVE_ENOUGH_ADENA); client.sendPacket(ActionFailed.STATIC_PACKET); diff --git a/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/network/clientpackets/RequestSellItem.java b/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/network/clientpackets/RequestSellItem.java index 70d3e92505..3546aec078 100644 --- a/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/network/clientpackets/RequestSellItem.java +++ b/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/network/clientpackets/RequestSellItem.java @@ -25,7 +25,6 @@ import java.util.List; import org.l2jmobius.Config; import org.l2jmobius.commons.network.PacketReader; import org.l2jmobius.gameserver.data.xml.impl.BuyListData; -import org.l2jmobius.gameserver.enums.TaxType; import org.l2jmobius.gameserver.model.WorldObject; import org.l2jmobius.gameserver.model.actor.instance.MerchantInstance; import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; @@ -170,17 +169,11 @@ public class RequestSellItem implements IClientIncomingPacket } } - // add to castle treasury - if (merchant != null) + if (!Config.MERCHANT_ZERO_SELL_PRICE) { - // Keep here same formula as in {@link ExBuySellList} to produce same result. - final long profit = (long) (totalPrice * (1.0 - merchant.getCastleTaxRate(TaxType.SELL))); - merchant.handleTaxPayment(totalPrice - profit); - totalPrice = profit; + player.addAdena("Sell", totalPrice, merchant, false); } - player.addAdena("Sell", totalPrice, merchant, false); - // Update current load as well client.sendPacket(new ExUserInfoInvenWeight(player)); client.sendPacket(new ExBuySellList(player, true)); diff --git a/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/network/serverpackets/ExBuySellList.java b/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/network/serverpackets/ExBuySellList.java index a3cd6d9afa..66bcb38bb6 100644 --- a/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/network/serverpackets/ExBuySellList.java +++ b/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/network/serverpackets/ExBuySellList.java @@ -18,6 +18,7 @@ package org.l2jmobius.gameserver.network.serverpackets; import java.util.Collection; +import org.l2jmobius.Config; import org.l2jmobius.commons.network.PacketWriter; import org.l2jmobius.gameserver.model.actor.Summon; import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; @@ -33,7 +34,6 @@ public class ExBuySellList extends AbstractItemPacket private Collection _refundList = null; private final boolean _done; private final int _inventorySlots; - private double _castleTaxRate = 1; public ExBuySellList(PlayerInstance player, boolean done) { @@ -47,12 +47,6 @@ public class ExBuySellList extends AbstractItemPacket _done = done; } - public ExBuySellList(PlayerInstance player, boolean done, double castleTaxRate) - { - this(player, done); - _castleTaxRate = 1 - castleTaxRate; - } - @Override public boolean write(PacketWriter packet) { @@ -67,7 +61,7 @@ public class ExBuySellList extends AbstractItemPacket for (ItemInstance item : _sellList) { writeItem(packet, item); - packet.writeQ((long) ((item.getItem().getReferencePrice() / 2) * _castleTaxRate)); + packet.writeQ(Config.MERCHANT_ZERO_SELL_PRICE ? 0 : item.getItem().getReferencePrice() / 2); } } else @@ -83,7 +77,7 @@ public class ExBuySellList extends AbstractItemPacket { writeItem(packet, item); packet.writeD(i++); - packet.writeQ((item.getItem().getReferencePrice() / 2) * item.getCount()); + packet.writeQ(Config.MERCHANT_ZERO_SELL_PRICE ? 0 : (item.getItem().getReferencePrice() / 2) * item.getCount()); } } else diff --git a/L2J_Mobius_C6_Interlude/dist/game/config/custom/MerchantZeroSellPrice.ini b/L2J_Mobius_C6_Interlude/dist/game/config/custom/MerchantZeroSellPrice.ini new file mode 100644 index 0000000000..140490f042 --- /dev/null +++ b/L2J_Mobius_C6_Interlude/dist/game/config/custom/MerchantZeroSellPrice.ini @@ -0,0 +1,6 @@ +# --------------------------------------------------------------------------- +# Merchant Zero Sell Price +# --------------------------------------------------------------------------- + +# All items sold to merchants reward no Adena. +MerchantZeroSellPrice = False diff --git a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/Config.java b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/Config.java index 5036391884..89be4915d4 100644 --- a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/Config.java +++ b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/Config.java @@ -90,7 +90,8 @@ public class Config // custom private static final String AWAY_CONFIG_FILE = "./config/custom/Away.ini"; private static final String BANK_CONFIG_FILE = "./config/custom/Bank.ini"; - private static final String EVENT_CHAMPION_CONFIG_FILE = "./config/custom/Champion.ini"; + private static final String CHAMPION_CONFIG_FILE = "./config/custom/Champion.ini"; + private static final String MERCHANT_ZERO_SELL_PRICE_CONFIG_FILE = "./config/custom/MerchantZeroSellPrice.ini"; private static final String OFFLINE_CONFIG_FILE = "./config/custom/Offline.ini"; private static final String OTHER_CONFIG_FILE = "./config/custom/Other.ini"; private static final String SCHEME_BUFFER_CONFIG_FILE = "./config/custom/SchemeBuffer.ini"; @@ -482,6 +483,8 @@ public class Config public static int L2JMOD_CHAMPION_REWARD_QTY; public static String L2JMOD_CHAMP_TITLE; + public static boolean MERCHANT_ZERO_SELL_PRICE; + public static boolean L2JMOD_ALLOW_WEDDING; public static int L2JMOD_WEDDING_PRICE; public static boolean L2JMOD_WEDDING_PUNISH_INFIDELITY; @@ -1854,7 +1857,7 @@ public class Config try { final Properties ChampionSettings = new Properties(); - final InputStream is = new FileInputStream(new File(EVENT_CHAMPION_CONFIG_FILE)); + final InputStream is = new FileInputStream(new File(CHAMPION_CONFIG_FILE)); ChampionSettings.load(is); is.close(); @@ -1877,7 +1880,25 @@ public class Config catch (Exception e) { e.printStackTrace(); - throw new Error("Failed to Load " + EVENT_CHAMPION_CONFIG_FILE + " File."); + throw new Error("Failed to Load " + CHAMPION_CONFIG_FILE + " File."); + } + } + + public static void loadMerchantZeroPriceConfig() + { + try + { + final Properties MerchantZeroSellPrice = new Properties(); + final InputStream is = new FileInputStream(new File(MERCHANT_ZERO_SELL_PRICE_CONFIG_FILE)); + MerchantZeroSellPrice.load(is); + is.close(); + + MERCHANT_ZERO_SELL_PRICE = Boolean.parseBoolean(MerchantZeroSellPrice.getProperty("MerchantZeroSellPrice", "false")); + } + catch (Exception e) + { + e.printStackTrace(); + throw new Error("Failed to Load " + CHAMPION_CONFIG_FILE + " File."); } } @@ -3838,6 +3859,7 @@ public class Config // Custom loadChampionConfig(); + loadMerchantZeroPriceConfig(); loadWeddingConfig(); loadREBIRTHConfig(); loadAWAYConfig(); diff --git a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/network/clientpackets/RequestSellItem.java b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/network/clientpackets/RequestSellItem.java index a26d48bacc..bb197562c1 100644 --- a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/network/clientpackets/RequestSellItem.java +++ b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/network/clientpackets/RequestSellItem.java @@ -129,8 +129,6 @@ public class RequestSellItem extends GameClientPacket for (int i = 0; i < _count; i++) { final int objectId = _items[(i * 3) + 0]; - @SuppressWarnings("unused") - final int itemId = _items[(i * 3) + 1]; final int count = _items[(i * 3) + 2]; // Check count @@ -171,12 +169,15 @@ public class RequestSellItem extends GameClientPacket return; } - item = player.getInventory().destroyItem("Sell", objectId, count, player, null); + player.getInventory().destroyItem("Sell", objectId, count, player, null); + } + + if (!Config.MERCHANT_ZERO_SELL_PRICE) + { + player.addAdena("Sell", (int) totalPrice, merchant, false); } - player.addAdena("Sell", (int) totalPrice, merchant, false); final String html = HtmCache.getInstance().getHtm("data/html/" + htmlFolder + "/" + merchant.getNpcId() + "-sold.htm"); - if (html != null) { final NpcHtmlMessage soldMsg = new NpcHtmlMessage(merchant.getObjectId()); diff --git a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/network/serverpackets/SellList.java b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/network/serverpackets/SellList.java index b9814673c5..3301d60f88 100644 --- a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/network/serverpackets/SellList.java +++ b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/network/serverpackets/SellList.java @@ -19,7 +19,7 @@ package org.l2jmobius.gameserver.network.serverpackets; import java.util.ArrayList; import java.util.List; -import org.l2jmobius.gameserver.model.actor.instance.MerchantInstance; +import org.l2jmobius.Config; import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import org.l2jmobius.gameserver.model.items.instance.ItemInstance; @@ -29,40 +29,23 @@ import org.l2jmobius.gameserver.model.items.instance.ItemInstance; public class SellList extends GameServerPacket { private final PlayerInstance _player; - private final MerchantInstance _lease; private final int _money; private final List _selllist = new ArrayList<>(); public SellList(PlayerInstance player) { _player = player; - _lease = null; _money = _player.getAdena(); - doLease(); - } - - public SellList(PlayerInstance player, MerchantInstance lease) - { - _player = player; - _lease = lease; - _money = _player.getAdena(); - doLease(); - } - - private void doLease() - { - if (_lease == null) + + for (ItemInstance item : _player.getInventory().getItems()) { - for (ItemInstance item : _player.getInventory().getItems()) + if ((item != null) && !item.isEquipped() && // Not equipped + item.getItem().isSellable() && // Item is sellable + (item.getItem().getItemId() != 57) && // Adena is not sellable + ((_player.getPet() == null) || // Pet not summoned or + (item.getObjectId() != _player.getPet().getControlItemId()))) // Pet is summoned and not the item that summoned the pet { - if ((item != null) && !item.isEquipped() && // Not equipped - item.getItem().isSellable() && // Item is sellable - (item.getItem().getItemId() != 57) && // Adena is not sellable - ((_player.getPet() == null) || // Pet not summoned or - (item.getObjectId() != _player.getPet().getControlItemId()))) // Pet is summoned and not the item that summoned the pet - { - _selllist.add(item); - } + _selllist.add(item); } } } @@ -72,7 +55,7 @@ public class SellList extends GameServerPacket { writeC(0x10); writeD(_money); - writeD(_lease == null ? 0x00 : 1000000 + _lease.getTemplate().npcId); + writeD(0x00); writeH(_selllist.size()); @@ -88,11 +71,7 @@ public class SellList extends GameServerPacket writeH(item.getEnchantLevel()); writeH(0x00); writeH(0x00); - - if (_lease == null) - { - writeD(item.getItem().getReferencePrice() / 2); // wtf??? there is no conditional part in SellList!! this d should allways be here 0.o! fortunately the lease stuff are never ever use so the if allways exectues - } + writeD(Config.MERCHANT_ZERO_SELL_PRICE ? 0 : item.getItem().getReferencePrice() / 2); } } } \ No newline at end of file diff --git a/L2J_Mobius_CT_2.4_Epilogue/dist/game/config/Custom/MerchantZeroSellPrice.ini b/L2J_Mobius_CT_2.4_Epilogue/dist/game/config/Custom/MerchantZeroSellPrice.ini new file mode 100644 index 0000000000..140490f042 --- /dev/null +++ b/L2J_Mobius_CT_2.4_Epilogue/dist/game/config/Custom/MerchantZeroSellPrice.ini @@ -0,0 +1,6 @@ +# --------------------------------------------------------------------------- +# Merchant Zero Sell Price +# --------------------------------------------------------------------------- + +# All items sold to merchants reward no Adena. +MerchantZeroSellPrice = False 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 9ed83da220..7b8f14d2e2 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 @@ -120,6 +120,7 @@ public class Config private static final String CUSTOM_FAKE_PLAYERS_CONFIG_FILE = "./config/Custom/FakePlayers.ini"; private static final String CUSTOM_FIND_PVP_CONFIG_FILE = "./config/Custom/FindPvP.ini"; private static final String CUSTOM_HELLBOUND_STATUS_CONFIG_FILE = "./config/Custom/HellboundStatus.ini"; + private static final String CUSTOM_MERCHANT_ZERO_SELL_PRICE_CONFIG_FILE = "./config/Custom/MerchantZeroSellPrice.ini"; private static final String CUSTOM_MULTILANGUAL_SUPPORT_CONFIG_FILE = "./config/Custom/MultilingualSupport.ini"; private static final String CUSTOM_NPC_STAT_MULTIPLIERS_CONFIG_FILE = "./config/Custom/NpcStatMultipliers.ini"; private static final String CUSTOM_OFFLINE_TRADE_CONFIG_FILE = "./config/Custom/OfflineTrade.ini"; @@ -1302,6 +1303,7 @@ public class Config public static boolean FAKE_PLAYER_CAN_DROP_ITEMS; public static boolean FAKE_PLAYER_CAN_PICKUP; public static boolean ENABLE_FIND_PVP; + public static boolean MERCHANT_ZERO_SELL_PRICE; public static boolean PREMIUM_SYSTEM_ENABLED; public static float PREMIUM_RATE_XP; public static float PREMIUM_RATE_SP; @@ -2850,14 +2852,16 @@ public class Config // Load FindPvP config file (if exists) final PropertiesParser FindPvP = new PropertiesParser(CUSTOM_FIND_PVP_CONFIG_FILE); - ENABLE_FIND_PVP = FindPvP.getBoolean("EnableFindPvP", false); // Load HellboundStatus config file (if exists) final PropertiesParser HellboundStatus = new PropertiesParser(CUSTOM_HELLBOUND_STATUS_CONFIG_FILE); - HELLBOUND_STATUS = HellboundStatus.getBoolean("HellboundStatus", false); + // Load MerchantZeroSellPrice config file (if exists) + final PropertiesParser MerchantZeroSellPrice = new PropertiesParser(CUSTOM_MERCHANT_ZERO_SELL_PRICE_CONFIG_FILE); + MERCHANT_ZERO_SELL_PRICE = MerchantZeroSellPrice.getBoolean("MerchantZeroSellPrice", false); + // Load MultilingualSupport config file (if exists) final PropertiesParser MultilingualSupport = new PropertiesParser(CUSTOM_MULTILANGUAL_SUPPORT_CONFIG_FILE); diff --git a/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/network/clientpackets/RequestRefundItem.java b/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/network/clientpackets/RequestRefundItem.java index 55f3df699c..5925d872d8 100644 --- a/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/network/clientpackets/RequestRefundItem.java +++ b/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/network/clientpackets/RequestRefundItem.java @@ -158,7 +158,7 @@ public class RequestRefundItem implements IClientIncomingPacket final long count = item.getCount(); weight += count * template.getWeight(); - adena += (count * template.getReferencePrice()) / 2; + adena += count * (template.getReferencePrice() / 2); if (!template.isStackable()) { slots += count; @@ -183,7 +183,7 @@ public class RequestRefundItem implements IClientIncomingPacket return; } - if ((adena < 0) || !player.reduceAdena("Refund", adena, player.getLastFolkNPC(), false)) + if (!Config.MERCHANT_ZERO_SELL_PRICE && ((adena < 0) || !player.reduceAdena("Refund", adena, player.getLastFolkNPC(), false))) { client.sendPacket(SystemMessageId.YOU_DO_NOT_HAVE_ENOUGH_ADENA); client.sendPacket(ActionFailed.STATIC_PACKET); diff --git a/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/network/clientpackets/RequestSellItem.java b/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/network/clientpackets/RequestSellItem.java index 55495dfbc2..1063059528 100644 --- a/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/network/clientpackets/RequestSellItem.java +++ b/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/network/clientpackets/RequestSellItem.java @@ -146,7 +146,7 @@ public class RequestSellItem implements IClientIncomingPacket // Proceed the sell for (UniqueItemHolder i : _items) { - ItemInstance item = player.checkItemManipulation(i.getObjectId(), i.getCount(), "sell"); + final ItemInstance item = player.checkItemManipulation(i.getObjectId(), i.getCount(), "sell"); if ((item == null) || (!item.isSellable())) { continue; @@ -162,14 +162,18 @@ public class RequestSellItem implements IClientIncomingPacket if (Config.ALLOW_REFUND) { - item = player.getInventory().transferItem("Sell", i.getObjectId(), i.getCount(), player.getRefund(), player, merchant); + player.getInventory().transferItem("Sell", i.getObjectId(), i.getCount(), player.getRefund(), player, merchant); } else { - item = player.getInventory().destroyItem("Sell", i.getObjectId(), i.getCount(), player, merchant); + player.getInventory().destroyItem("Sell", i.getObjectId(), i.getCount(), player, merchant); } } - player.addAdena("Sell", totalPrice, merchant, false); + + if (!Config.MERCHANT_ZERO_SELL_PRICE) + { + player.addAdena("Sell", totalPrice, merchant, false); + } // Update current load as well final StatusUpdate su = new StatusUpdate(player); diff --git a/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/network/serverpackets/ExBuySellList.java b/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/network/serverpackets/ExBuySellList.java index d48305a616..4215216fd2 100644 --- a/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/network/serverpackets/ExBuySellList.java +++ b/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/network/serverpackets/ExBuySellList.java @@ -148,7 +148,7 @@ public class ExBuySellList implements IClientOutgoingPacket packet.writeH(item.getEnchantLevel()); packet.writeH(0x00); packet.writeH(0x00); - packet.writeQ(item.getItem().getReferencePrice() / 2); + packet.writeQ(Config.MERCHANT_ZERO_SELL_PRICE ? 0 : item.getItem().getReferencePrice() / 2); // T1 packet.writeH(item.getAttackElementType()); @@ -180,7 +180,7 @@ public class ExBuySellList implements IClientOutgoingPacket packet.writeH(0x00); // ? packet.writeH(item.getEnchantLevel()); packet.writeH(0x00); // ? - packet.writeQ((item.getCount() * item.getItem().getReferencePrice()) / 2); + packet.writeQ(Config.MERCHANT_ZERO_SELL_PRICE ? 0 : (item.getItem().getReferencePrice() / 2) * item.getCount()); // T1 packet.writeH(item.getAttackElementType()); diff --git a/L2J_Mobius_CT_2.6_HighFive/dist/game/config/Custom/MerchantZeroSellPrice.ini b/L2J_Mobius_CT_2.6_HighFive/dist/game/config/Custom/MerchantZeroSellPrice.ini new file mode 100644 index 0000000000..140490f042 --- /dev/null +++ b/L2J_Mobius_CT_2.6_HighFive/dist/game/config/Custom/MerchantZeroSellPrice.ini @@ -0,0 +1,6 @@ +# --------------------------------------------------------------------------- +# Merchant Zero Sell Price +# --------------------------------------------------------------------------- + +# All items sold to merchants reward no Adena. +MerchantZeroSellPrice = False 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 65887ca8f8..864abbca0a 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 @@ -120,6 +120,7 @@ public class Config private static final String CUSTOM_FAKE_PLAYERS_CONFIG_FILE = "./config/Custom/FakePlayers.ini"; private static final String CUSTOM_FIND_PVP_CONFIG_FILE = "./config/Custom/FindPvP.ini"; private static final String CUSTOM_HELLBOUND_STATUS_CONFIG_FILE = "./config/Custom/HellboundStatus.ini"; + private static final String CUSTOM_MERCHANT_ZERO_SELL_PRICE_CONFIG_FILE = "./config/Custom/MerchantZeroSellPrice.ini"; private static final String CUSTOM_MULTILANGUAL_SUPPORT_CONFIG_FILE = "./config/Custom/MultilingualSupport.ini"; private static final String CUSTOM_NPC_STAT_MULTIPLIERS_CONFIG_FILE = "./config/Custom/NpcStatMultipliers.ini"; private static final String CUSTOM_OFFLINE_TRADE_CONFIG_FILE = "./config/Custom/OfflineTrade.ini"; @@ -1303,6 +1304,7 @@ public class Config public static boolean FAKE_PLAYER_CAN_DROP_ITEMS; public static boolean FAKE_PLAYER_CAN_PICKUP; public static boolean ENABLE_FIND_PVP; + public static boolean MERCHANT_ZERO_SELL_PRICE; public static boolean PREMIUM_SYSTEM_ENABLED; public static float PREMIUM_RATE_XP; public static float PREMIUM_RATE_SP; @@ -2857,14 +2859,16 @@ public class Config // Load FindPvP config file (if exists) final PropertiesParser FindPvP = new PropertiesParser(CUSTOM_FIND_PVP_CONFIG_FILE); - ENABLE_FIND_PVP = FindPvP.getBoolean("EnableFindPvP", false); // Load HellboundStatus config file (if exists) final PropertiesParser HellboundStatus = new PropertiesParser(CUSTOM_HELLBOUND_STATUS_CONFIG_FILE); - HELLBOUND_STATUS = HellboundStatus.getBoolean("HellboundStatus", false); + // Load MerchantZeroSellPrice config file (if exists) + final PropertiesParser MerchantZeroSellPrice = new PropertiesParser(CUSTOM_MERCHANT_ZERO_SELL_PRICE_CONFIG_FILE); + MERCHANT_ZERO_SELL_PRICE = MerchantZeroSellPrice.getBoolean("MerchantZeroSellPrice", false); + // Load MultilingualSupport config file (if exists) final PropertiesParser MultilingualSupport = new PropertiesParser(CUSTOM_MULTILANGUAL_SUPPORT_CONFIG_FILE); diff --git a/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/network/clientpackets/RequestRefundItem.java b/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/network/clientpackets/RequestRefundItem.java index 4fda6e8d61..d6460675fd 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/network/clientpackets/RequestRefundItem.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/network/clientpackets/RequestRefundItem.java @@ -158,7 +158,7 @@ public class RequestRefundItem implements IClientIncomingPacket final long count = item.getCount(); weight += count * template.getWeight(); - adena += (count * template.getReferencePrice()) / 2; + adena += count * (template.getReferencePrice() / 2); if (!template.isStackable()) { slots += count; @@ -183,7 +183,7 @@ public class RequestRefundItem implements IClientIncomingPacket return; } - if ((adena < 0) || !player.reduceAdena("Refund", adena, player.getLastFolkNPC(), false)) + if (!Config.MERCHANT_ZERO_SELL_PRICE && ((adena < 0) || !player.reduceAdena("Refund", adena, player.getLastFolkNPC(), false))) { client.sendPacket(SystemMessageId.YOU_DO_NOT_HAVE_ENOUGH_ADENA); client.sendPacket(ActionFailed.STATIC_PACKET); diff --git a/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/network/clientpackets/RequestSellItem.java b/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/network/clientpackets/RequestSellItem.java index 62efcc44da..867d1da6c6 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/network/clientpackets/RequestSellItem.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/network/clientpackets/RequestSellItem.java @@ -146,7 +146,7 @@ public class RequestSellItem implements IClientIncomingPacket // Proceed the sell for (UniqueItemHolder i : _items) { - ItemInstance item = player.checkItemManipulation(i.getObjectId(), i.getCount(), "sell"); + final ItemInstance item = player.checkItemManipulation(i.getObjectId(), i.getCount(), "sell"); if ((item == null) || (!item.isSellable())) { continue; @@ -162,14 +162,18 @@ public class RequestSellItem implements IClientIncomingPacket if (Config.ALLOW_REFUND) { - item = player.getInventory().transferItem("Sell", i.getObjectId(), i.getCount(), player.getRefund(), player, merchant); + player.getInventory().transferItem("Sell", i.getObjectId(), i.getCount(), player.getRefund(), player, merchant); } else { - item = player.getInventory().destroyItem("Sell", i.getObjectId(), i.getCount(), player, merchant); + player.getInventory().destroyItem("Sell", i.getObjectId(), i.getCount(), player, merchant); } } - player.addAdena("Sell", totalPrice, merchant, false); + + if (!Config.MERCHANT_ZERO_SELL_PRICE) + { + player.addAdena("Sell", totalPrice, merchant, false); + } // Update current load as well final StatusUpdate su = new StatusUpdate(player); diff --git a/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/network/serverpackets/ExBuySellList.java b/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/network/serverpackets/ExBuySellList.java index 3cdf4eecc9..fbf86a615a 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/network/serverpackets/ExBuySellList.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/network/serverpackets/ExBuySellList.java @@ -18,6 +18,7 @@ package org.l2jmobius.gameserver.network.serverpackets; import java.util.Collection; +import org.l2jmobius.Config; import org.l2jmobius.commons.network.PacketWriter; import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import org.l2jmobius.gameserver.model.items.instance.ItemInstance; @@ -28,7 +29,7 @@ import org.l2jmobius.gameserver.network.OutgoingPackets; */ public class ExBuySellList extends AbstractItemPacket { - private Collection _sellList = null; + private final Collection _sellList; private Collection _refundList = null; private final boolean _done; @@ -54,7 +55,7 @@ public class ExBuySellList extends AbstractItemPacket for (ItemInstance item : _sellList) { writeItem(packet, item); - packet.writeQ(item.getItem().getReferencePrice() / 2); + packet.writeQ(Config.MERCHANT_ZERO_SELL_PRICE ? 0 : item.getItem().getReferencePrice() / 2); } } else @@ -62,7 +63,7 @@ public class ExBuySellList extends AbstractItemPacket packet.writeH(0x00); } - if ((_refundList != null) && (!_refundList.isEmpty())) + if ((_refundList != null) && !_refundList.isEmpty()) { packet.writeH(_refundList.size()); int i = 0; @@ -70,7 +71,7 @@ public class ExBuySellList extends AbstractItemPacket { writeItem(packet, item); packet.writeD(i++); - packet.writeQ((item.getItem().getReferencePrice() / 2) * item.getCount()); + packet.writeQ(Config.MERCHANT_ZERO_SELL_PRICE ? 0 : (item.getItem().getReferencePrice() / 2) * item.getCount()); } } else diff --git a/L2J_Mobius_Classic_2.0_Saviors/dist/game/config/Custom/MerchantZeroSellPrice.ini b/L2J_Mobius_Classic_2.0_Saviors/dist/game/config/Custom/MerchantZeroSellPrice.ini new file mode 100644 index 0000000000..140490f042 --- /dev/null +++ b/L2J_Mobius_Classic_2.0_Saviors/dist/game/config/Custom/MerchantZeroSellPrice.ini @@ -0,0 +1,6 @@ +# --------------------------------------------------------------------------- +# Merchant Zero Sell Price +# --------------------------------------------------------------------------- + +# All items sold to merchants reward no Adena. +MerchantZeroSellPrice = False 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 0299b7f758..d3448a95be 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 @@ -124,6 +124,7 @@ public class Config private static final String CUSTOM_FACTION_SYSTEM_CONFIG_FILE = "./config/Custom/FactionSystem.ini"; private static final String CUSTOM_FAKE_PLAYERS_CONFIG_FILE = "./config/Custom/FakePlayers.ini"; private static final String CUSTOM_FIND_PVP_CONFIG_FILE = "./config/Custom/FindPvP.ini"; + private static final String CUSTOM_MERCHANT_ZERO_SELL_PRICE_CONFIG_FILE = "./config/Custom/MerchantZeroSellPrice.ini"; private static final String CUSTOM_MULTILANGUAL_SUPPORT_CONFIG_FILE = "./config/Custom/MultilingualSupport.ini"; private static final String CUSTOM_NPC_STAT_MULTIPLIERS_CONFIG_FILE = "./config/Custom/NpcStatMultipliers.ini"; private static final String CUSTOM_OFFLINE_TRADE_CONFIG_FILE = "./config/Custom/OfflineTrade.ini"; @@ -1170,6 +1171,7 @@ public class Config public static boolean FAKE_PLAYER_CAN_DROP_ITEMS; public static boolean FAKE_PLAYER_CAN_PICKUP; public static boolean ENABLE_FIND_PVP; + public static boolean MERCHANT_ZERO_SELL_PRICE; public static boolean PREMIUM_SYSTEM_ENABLED; public static float PREMIUM_RATE_XP; public static float PREMIUM_RATE_SP; @@ -3031,6 +3033,10 @@ public class Config final PropertiesParser FindPvP = new PropertiesParser(CUSTOM_FIND_PVP_CONFIG_FILE); ENABLE_FIND_PVP = FindPvP.getBoolean("EnableFindPvP", false); + // Load MerchantZeroSellPrice config file (if exists) + final PropertiesParser MerchantZeroSellPrice = new PropertiesParser(CUSTOM_MERCHANT_ZERO_SELL_PRICE_CONFIG_FILE); + MERCHANT_ZERO_SELL_PRICE = MerchantZeroSellPrice.getBoolean("MerchantZeroSellPrice", false); + // Load MultilingualSupport config file (if exists) final PropertiesParser MultilingualSupport = new PropertiesParser(CUSTOM_MULTILANGUAL_SUPPORT_CONFIG_FILE); diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/actor/instance/MerchantInstance.java b/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/actor/instance/MerchantInstance.java index 539664a411..3b4c28fadd 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/actor/instance/MerchantInstance.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/actor/instance/MerchantInstance.java @@ -88,6 +88,6 @@ public class MerchantInstance extends NpcInstance player.setInventoryBlockingStatus(true); player.sendPacket(new BuyList(buyList, player, (applyCastleTax) ? getCastleTaxRate(TaxType.BUY) : 0)); - player.sendPacket(new ExBuySellList(player, false, (applyCastleTax) ? getCastleTaxRate(TaxType.SELL) : 0)); + player.sendPacket(new ExBuySellList(player, false)); } } diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/network/clientpackets/RequestRefundItem.java b/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/network/clientpackets/RequestRefundItem.java index 41cb56d317..027e31909f 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/network/clientpackets/RequestRefundItem.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/network/clientpackets/RequestRefundItem.java @@ -157,7 +157,7 @@ public class RequestRefundItem implements IClientIncomingPacket final long count = item.getCount(); weight += count * template.getWeight(); - adena += (count * template.getReferencePrice()) / 2; + adena += count * (template.getReferencePrice() / 2); if (!template.isStackable()) { slots += count; @@ -182,7 +182,7 @@ public class RequestRefundItem implements IClientIncomingPacket return; } - if ((adena < 0) || !player.reduceAdena("Refund", adena, player.getLastFolkNPC(), false)) + if (!Config.MERCHANT_ZERO_SELL_PRICE && ((adena < 0) || !player.reduceAdena("Refund", adena, player.getLastFolkNPC(), false))) { client.sendPacket(SystemMessageId.YOU_DO_NOT_HAVE_ENOUGH_ADENA); client.sendPacket(ActionFailed.STATIC_PACKET); diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/network/clientpackets/RequestSellItem.java b/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/network/clientpackets/RequestSellItem.java index 70d3e92505..3546aec078 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/network/clientpackets/RequestSellItem.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/network/clientpackets/RequestSellItem.java @@ -25,7 +25,6 @@ import java.util.List; import org.l2jmobius.Config; import org.l2jmobius.commons.network.PacketReader; import org.l2jmobius.gameserver.data.xml.impl.BuyListData; -import org.l2jmobius.gameserver.enums.TaxType; import org.l2jmobius.gameserver.model.WorldObject; import org.l2jmobius.gameserver.model.actor.instance.MerchantInstance; import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; @@ -170,17 +169,11 @@ public class RequestSellItem implements IClientIncomingPacket } } - // add to castle treasury - if (merchant != null) + if (!Config.MERCHANT_ZERO_SELL_PRICE) { - // Keep here same formula as in {@link ExBuySellList} to produce same result. - final long profit = (long) (totalPrice * (1.0 - merchant.getCastleTaxRate(TaxType.SELL))); - merchant.handleTaxPayment(totalPrice - profit); - totalPrice = profit; + player.addAdena("Sell", totalPrice, merchant, false); } - player.addAdena("Sell", totalPrice, merchant, false); - // Update current load as well client.sendPacket(new ExUserInfoInvenWeight(player)); client.sendPacket(new ExBuySellList(player, true)); diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/network/serverpackets/ExBuySellList.java b/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/network/serverpackets/ExBuySellList.java index a3cd6d9afa..66bcb38bb6 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/network/serverpackets/ExBuySellList.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/network/serverpackets/ExBuySellList.java @@ -18,6 +18,7 @@ package org.l2jmobius.gameserver.network.serverpackets; import java.util.Collection; +import org.l2jmobius.Config; import org.l2jmobius.commons.network.PacketWriter; import org.l2jmobius.gameserver.model.actor.Summon; import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; @@ -33,7 +34,6 @@ public class ExBuySellList extends AbstractItemPacket private Collection _refundList = null; private final boolean _done; private final int _inventorySlots; - private double _castleTaxRate = 1; public ExBuySellList(PlayerInstance player, boolean done) { @@ -47,12 +47,6 @@ public class ExBuySellList extends AbstractItemPacket _done = done; } - public ExBuySellList(PlayerInstance player, boolean done, double castleTaxRate) - { - this(player, done); - _castleTaxRate = 1 - castleTaxRate; - } - @Override public boolean write(PacketWriter packet) { @@ -67,7 +61,7 @@ public class ExBuySellList extends AbstractItemPacket for (ItemInstance item : _sellList) { writeItem(packet, item); - packet.writeQ((long) ((item.getItem().getReferencePrice() / 2) * _castleTaxRate)); + packet.writeQ(Config.MERCHANT_ZERO_SELL_PRICE ? 0 : item.getItem().getReferencePrice() / 2); } } else @@ -83,7 +77,7 @@ public class ExBuySellList extends AbstractItemPacket { writeItem(packet, item); packet.writeD(i++); - packet.writeQ((item.getItem().getReferencePrice() / 2) * item.getCount()); + packet.writeQ(Config.MERCHANT_ZERO_SELL_PRICE ? 0 : (item.getItem().getReferencePrice() / 2) * item.getCount()); } } else diff --git a/L2J_Mobius_Classic_2.1_Zaken/dist/game/config/Custom/MerchantZeroSellPrice.ini b/L2J_Mobius_Classic_2.1_Zaken/dist/game/config/Custom/MerchantZeroSellPrice.ini new file mode 100644 index 0000000000..140490f042 --- /dev/null +++ b/L2J_Mobius_Classic_2.1_Zaken/dist/game/config/Custom/MerchantZeroSellPrice.ini @@ -0,0 +1,6 @@ +# --------------------------------------------------------------------------- +# Merchant Zero Sell Price +# --------------------------------------------------------------------------- + +# All items sold to merchants reward no Adena. +MerchantZeroSellPrice = False 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 c5e651277b..e234f62489 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 @@ -124,6 +124,7 @@ public class Config private static final String CUSTOM_FACTION_SYSTEM_CONFIG_FILE = "./config/Custom/FactionSystem.ini"; private static final String CUSTOM_FAKE_PLAYERS_CONFIG_FILE = "./config/Custom/FakePlayers.ini"; private static final String CUSTOM_FIND_PVP_CONFIG_FILE = "./config/Custom/FindPvP.ini"; + private static final String CUSTOM_MERCHANT_ZERO_SELL_PRICE_CONFIG_FILE = "./config/Custom/MerchantZeroSellPrice.ini"; private static final String CUSTOM_MULTILANGUAL_SUPPORT_CONFIG_FILE = "./config/Custom/MultilingualSupport.ini"; private static final String CUSTOM_NPC_STAT_MULTIPLIERS_CONFIG_FILE = "./config/Custom/NpcStatMultipliers.ini"; private static final String CUSTOM_OFFLINE_TRADE_CONFIG_FILE = "./config/Custom/OfflineTrade.ini"; @@ -1174,6 +1175,7 @@ public class Config public static boolean FAKE_PLAYER_CAN_DROP_ITEMS; public static boolean FAKE_PLAYER_CAN_PICKUP; public static boolean ENABLE_FIND_PVP; + public static boolean MERCHANT_ZERO_SELL_PRICE; public static boolean PREMIUM_SYSTEM_ENABLED; public static float PREMIUM_RATE_XP; public static float PREMIUM_RATE_SP; @@ -3038,6 +3040,10 @@ public class Config final PropertiesParser FindPvP = new PropertiesParser(CUSTOM_FIND_PVP_CONFIG_FILE); ENABLE_FIND_PVP = FindPvP.getBoolean("EnableFindPvP", false); + // Load MerchantZeroSellPrice config file (if exists) + final PropertiesParser MerchantZeroSellPrice = new PropertiesParser(CUSTOM_MERCHANT_ZERO_SELL_PRICE_CONFIG_FILE); + MERCHANT_ZERO_SELL_PRICE = MerchantZeroSellPrice.getBoolean("MerchantZeroSellPrice", false); + // Load MultilingualSupport config file (if exists) final PropertiesParser MultilingualSupport = new PropertiesParser(CUSTOM_MULTILANGUAL_SUPPORT_CONFIG_FILE); diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/model/actor/instance/MerchantInstance.java b/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/model/actor/instance/MerchantInstance.java index 539664a411..3b4c28fadd 100644 --- a/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/model/actor/instance/MerchantInstance.java +++ b/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/model/actor/instance/MerchantInstance.java @@ -88,6 +88,6 @@ public class MerchantInstance extends NpcInstance player.setInventoryBlockingStatus(true); player.sendPacket(new BuyList(buyList, player, (applyCastleTax) ? getCastleTaxRate(TaxType.BUY) : 0)); - player.sendPacket(new ExBuySellList(player, false, (applyCastleTax) ? getCastleTaxRate(TaxType.SELL) : 0)); + player.sendPacket(new ExBuySellList(player, false)); } } diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/network/clientpackets/RequestRefundItem.java b/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/network/clientpackets/RequestRefundItem.java index 41cb56d317..027e31909f 100644 --- a/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/network/clientpackets/RequestRefundItem.java +++ b/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/network/clientpackets/RequestRefundItem.java @@ -157,7 +157,7 @@ public class RequestRefundItem implements IClientIncomingPacket final long count = item.getCount(); weight += count * template.getWeight(); - adena += (count * template.getReferencePrice()) / 2; + adena += count * (template.getReferencePrice() / 2); if (!template.isStackable()) { slots += count; @@ -182,7 +182,7 @@ public class RequestRefundItem implements IClientIncomingPacket return; } - if ((adena < 0) || !player.reduceAdena("Refund", adena, player.getLastFolkNPC(), false)) + if (!Config.MERCHANT_ZERO_SELL_PRICE && ((adena < 0) || !player.reduceAdena("Refund", adena, player.getLastFolkNPC(), false))) { client.sendPacket(SystemMessageId.YOU_DO_NOT_HAVE_ENOUGH_ADENA); client.sendPacket(ActionFailed.STATIC_PACKET); diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/network/clientpackets/RequestSellItem.java b/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/network/clientpackets/RequestSellItem.java index 70d3e92505..3546aec078 100644 --- a/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/network/clientpackets/RequestSellItem.java +++ b/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/network/clientpackets/RequestSellItem.java @@ -25,7 +25,6 @@ import java.util.List; import org.l2jmobius.Config; import org.l2jmobius.commons.network.PacketReader; import org.l2jmobius.gameserver.data.xml.impl.BuyListData; -import org.l2jmobius.gameserver.enums.TaxType; import org.l2jmobius.gameserver.model.WorldObject; import org.l2jmobius.gameserver.model.actor.instance.MerchantInstance; import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; @@ -170,17 +169,11 @@ public class RequestSellItem implements IClientIncomingPacket } } - // add to castle treasury - if (merchant != null) + if (!Config.MERCHANT_ZERO_SELL_PRICE) { - // Keep here same formula as in {@link ExBuySellList} to produce same result. - final long profit = (long) (totalPrice * (1.0 - merchant.getCastleTaxRate(TaxType.SELL))); - merchant.handleTaxPayment(totalPrice - profit); - totalPrice = profit; + player.addAdena("Sell", totalPrice, merchant, false); } - player.addAdena("Sell", totalPrice, merchant, false); - // Update current load as well client.sendPacket(new ExUserInfoInvenWeight(player)); client.sendPacket(new ExBuySellList(player, true)); diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/network/serverpackets/ExBuySellList.java b/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/network/serverpackets/ExBuySellList.java index a3cd6d9afa..66bcb38bb6 100644 --- a/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/network/serverpackets/ExBuySellList.java +++ b/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/network/serverpackets/ExBuySellList.java @@ -18,6 +18,7 @@ package org.l2jmobius.gameserver.network.serverpackets; import java.util.Collection; +import org.l2jmobius.Config; import org.l2jmobius.commons.network.PacketWriter; import org.l2jmobius.gameserver.model.actor.Summon; import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; @@ -33,7 +34,6 @@ public class ExBuySellList extends AbstractItemPacket private Collection _refundList = null; private final boolean _done; private final int _inventorySlots; - private double _castleTaxRate = 1; public ExBuySellList(PlayerInstance player, boolean done) { @@ -47,12 +47,6 @@ public class ExBuySellList extends AbstractItemPacket _done = done; } - public ExBuySellList(PlayerInstance player, boolean done, double castleTaxRate) - { - this(player, done); - _castleTaxRate = 1 - castleTaxRate; - } - @Override public boolean write(PacketWriter packet) { @@ -67,7 +61,7 @@ public class ExBuySellList extends AbstractItemPacket for (ItemInstance item : _sellList) { writeItem(packet, item); - packet.writeQ((long) ((item.getItem().getReferencePrice() / 2) * _castleTaxRate)); + packet.writeQ(Config.MERCHANT_ZERO_SELL_PRICE ? 0 : item.getItem().getReferencePrice() / 2); } } else @@ -83,7 +77,7 @@ public class ExBuySellList extends AbstractItemPacket { writeItem(packet, item); packet.writeD(i++); - packet.writeQ((item.getItem().getReferencePrice() / 2) * item.getCount()); + packet.writeQ(Config.MERCHANT_ZERO_SELL_PRICE ? 0 : (item.getItem().getReferencePrice() / 2) * item.getCount()); } } else diff --git a/L2J_Mobius_Classic_2.2_Antharas/dist/game/config/Custom/MerchantZeroSellPrice.ini b/L2J_Mobius_Classic_2.2_Antharas/dist/game/config/Custom/MerchantZeroSellPrice.ini new file mode 100644 index 0000000000..140490f042 --- /dev/null +++ b/L2J_Mobius_Classic_2.2_Antharas/dist/game/config/Custom/MerchantZeroSellPrice.ini @@ -0,0 +1,6 @@ +# --------------------------------------------------------------------------- +# Merchant Zero Sell Price +# --------------------------------------------------------------------------- + +# All items sold to merchants reward no Adena. +MerchantZeroSellPrice = False 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 c5e651277b..e234f62489 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 @@ -124,6 +124,7 @@ public class Config private static final String CUSTOM_FACTION_SYSTEM_CONFIG_FILE = "./config/Custom/FactionSystem.ini"; private static final String CUSTOM_FAKE_PLAYERS_CONFIG_FILE = "./config/Custom/FakePlayers.ini"; private static final String CUSTOM_FIND_PVP_CONFIG_FILE = "./config/Custom/FindPvP.ini"; + private static final String CUSTOM_MERCHANT_ZERO_SELL_PRICE_CONFIG_FILE = "./config/Custom/MerchantZeroSellPrice.ini"; private static final String CUSTOM_MULTILANGUAL_SUPPORT_CONFIG_FILE = "./config/Custom/MultilingualSupport.ini"; private static final String CUSTOM_NPC_STAT_MULTIPLIERS_CONFIG_FILE = "./config/Custom/NpcStatMultipliers.ini"; private static final String CUSTOM_OFFLINE_TRADE_CONFIG_FILE = "./config/Custom/OfflineTrade.ini"; @@ -1174,6 +1175,7 @@ public class Config public static boolean FAKE_PLAYER_CAN_DROP_ITEMS; public static boolean FAKE_PLAYER_CAN_PICKUP; public static boolean ENABLE_FIND_PVP; + public static boolean MERCHANT_ZERO_SELL_PRICE; public static boolean PREMIUM_SYSTEM_ENABLED; public static float PREMIUM_RATE_XP; public static float PREMIUM_RATE_SP; @@ -3038,6 +3040,10 @@ public class Config final PropertiesParser FindPvP = new PropertiesParser(CUSTOM_FIND_PVP_CONFIG_FILE); ENABLE_FIND_PVP = FindPvP.getBoolean("EnableFindPvP", false); + // Load MerchantZeroSellPrice config file (if exists) + final PropertiesParser MerchantZeroSellPrice = new PropertiesParser(CUSTOM_MERCHANT_ZERO_SELL_PRICE_CONFIG_FILE); + MERCHANT_ZERO_SELL_PRICE = MerchantZeroSellPrice.getBoolean("MerchantZeroSellPrice", false); + // Load MultilingualSupport config file (if exists) final PropertiesParser MultilingualSupport = new PropertiesParser(CUSTOM_MULTILANGUAL_SUPPORT_CONFIG_FILE); diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/model/actor/instance/MerchantInstance.java b/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/model/actor/instance/MerchantInstance.java index 539664a411..3b4c28fadd 100644 --- a/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/model/actor/instance/MerchantInstance.java +++ b/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/model/actor/instance/MerchantInstance.java @@ -88,6 +88,6 @@ public class MerchantInstance extends NpcInstance player.setInventoryBlockingStatus(true); player.sendPacket(new BuyList(buyList, player, (applyCastleTax) ? getCastleTaxRate(TaxType.BUY) : 0)); - player.sendPacket(new ExBuySellList(player, false, (applyCastleTax) ? getCastleTaxRate(TaxType.SELL) : 0)); + player.sendPacket(new ExBuySellList(player, false)); } } diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/network/clientpackets/RequestRefundItem.java b/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/network/clientpackets/RequestRefundItem.java index 41cb56d317..027e31909f 100644 --- a/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/network/clientpackets/RequestRefundItem.java +++ b/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/network/clientpackets/RequestRefundItem.java @@ -157,7 +157,7 @@ public class RequestRefundItem implements IClientIncomingPacket final long count = item.getCount(); weight += count * template.getWeight(); - adena += (count * template.getReferencePrice()) / 2; + adena += count * (template.getReferencePrice() / 2); if (!template.isStackable()) { slots += count; @@ -182,7 +182,7 @@ public class RequestRefundItem implements IClientIncomingPacket return; } - if ((adena < 0) || !player.reduceAdena("Refund", adena, player.getLastFolkNPC(), false)) + if (!Config.MERCHANT_ZERO_SELL_PRICE && ((adena < 0) || !player.reduceAdena("Refund", adena, player.getLastFolkNPC(), false))) { client.sendPacket(SystemMessageId.YOU_DO_NOT_HAVE_ENOUGH_ADENA); client.sendPacket(ActionFailed.STATIC_PACKET); diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/network/clientpackets/RequestSellItem.java b/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/network/clientpackets/RequestSellItem.java index 70d3e92505..3546aec078 100644 --- a/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/network/clientpackets/RequestSellItem.java +++ b/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/network/clientpackets/RequestSellItem.java @@ -25,7 +25,6 @@ import java.util.List; import org.l2jmobius.Config; import org.l2jmobius.commons.network.PacketReader; import org.l2jmobius.gameserver.data.xml.impl.BuyListData; -import org.l2jmobius.gameserver.enums.TaxType; import org.l2jmobius.gameserver.model.WorldObject; import org.l2jmobius.gameserver.model.actor.instance.MerchantInstance; import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; @@ -170,17 +169,11 @@ public class RequestSellItem implements IClientIncomingPacket } } - // add to castle treasury - if (merchant != null) + if (!Config.MERCHANT_ZERO_SELL_PRICE) { - // Keep here same formula as in {@link ExBuySellList} to produce same result. - final long profit = (long) (totalPrice * (1.0 - merchant.getCastleTaxRate(TaxType.SELL))); - merchant.handleTaxPayment(totalPrice - profit); - totalPrice = profit; + player.addAdena("Sell", totalPrice, merchant, false); } - player.addAdena("Sell", totalPrice, merchant, false); - // Update current load as well client.sendPacket(new ExUserInfoInvenWeight(player)); client.sendPacket(new ExBuySellList(player, true)); diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/network/serverpackets/ExBuySellList.java b/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/network/serverpackets/ExBuySellList.java index a3cd6d9afa..66bcb38bb6 100644 --- a/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/network/serverpackets/ExBuySellList.java +++ b/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/network/serverpackets/ExBuySellList.java @@ -18,6 +18,7 @@ package org.l2jmobius.gameserver.network.serverpackets; import java.util.Collection; +import org.l2jmobius.Config; import org.l2jmobius.commons.network.PacketWriter; import org.l2jmobius.gameserver.model.actor.Summon; import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; @@ -33,7 +34,6 @@ public class ExBuySellList extends AbstractItemPacket private Collection _refundList = null; private final boolean _done; private final int _inventorySlots; - private double _castleTaxRate = 1; public ExBuySellList(PlayerInstance player, boolean done) { @@ -47,12 +47,6 @@ public class ExBuySellList extends AbstractItemPacket _done = done; } - public ExBuySellList(PlayerInstance player, boolean done, double castleTaxRate) - { - this(player, done); - _castleTaxRate = 1 - castleTaxRate; - } - @Override public boolean write(PacketWriter packet) { @@ -67,7 +61,7 @@ public class ExBuySellList extends AbstractItemPacket for (ItemInstance item : _sellList) { writeItem(packet, item); - packet.writeQ((long) ((item.getItem().getReferencePrice() / 2) * _castleTaxRate)); + packet.writeQ(Config.MERCHANT_ZERO_SELL_PRICE ? 0 : item.getItem().getReferencePrice() / 2); } } else @@ -83,7 +77,7 @@ public class ExBuySellList extends AbstractItemPacket { writeItem(packet, item); packet.writeD(i++); - packet.writeQ((item.getItem().getReferencePrice() / 2) * item.getCount()); + packet.writeQ(Config.MERCHANT_ZERO_SELL_PRICE ? 0 : (item.getItem().getReferencePrice() / 2) * item.getCount()); } } else diff --git a/L2J_Mobius_Classic_2.3_SevenSigns/dist/game/config/Custom/MerchantZeroSellPrice.ini b/L2J_Mobius_Classic_2.3_SevenSigns/dist/game/config/Custom/MerchantZeroSellPrice.ini new file mode 100644 index 0000000000..140490f042 --- /dev/null +++ b/L2J_Mobius_Classic_2.3_SevenSigns/dist/game/config/Custom/MerchantZeroSellPrice.ini @@ -0,0 +1,6 @@ +# --------------------------------------------------------------------------- +# Merchant Zero Sell Price +# --------------------------------------------------------------------------- + +# All items sold to merchants reward no Adena. +MerchantZeroSellPrice = False 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 c5e651277b..e234f62489 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 @@ -124,6 +124,7 @@ public class Config private static final String CUSTOM_FACTION_SYSTEM_CONFIG_FILE = "./config/Custom/FactionSystem.ini"; private static final String CUSTOM_FAKE_PLAYERS_CONFIG_FILE = "./config/Custom/FakePlayers.ini"; private static final String CUSTOM_FIND_PVP_CONFIG_FILE = "./config/Custom/FindPvP.ini"; + private static final String CUSTOM_MERCHANT_ZERO_SELL_PRICE_CONFIG_FILE = "./config/Custom/MerchantZeroSellPrice.ini"; private static final String CUSTOM_MULTILANGUAL_SUPPORT_CONFIG_FILE = "./config/Custom/MultilingualSupport.ini"; private static final String CUSTOM_NPC_STAT_MULTIPLIERS_CONFIG_FILE = "./config/Custom/NpcStatMultipliers.ini"; private static final String CUSTOM_OFFLINE_TRADE_CONFIG_FILE = "./config/Custom/OfflineTrade.ini"; @@ -1174,6 +1175,7 @@ public class Config public static boolean FAKE_PLAYER_CAN_DROP_ITEMS; public static boolean FAKE_PLAYER_CAN_PICKUP; public static boolean ENABLE_FIND_PVP; + public static boolean MERCHANT_ZERO_SELL_PRICE; public static boolean PREMIUM_SYSTEM_ENABLED; public static float PREMIUM_RATE_XP; public static float PREMIUM_RATE_SP; @@ -3038,6 +3040,10 @@ public class Config final PropertiesParser FindPvP = new PropertiesParser(CUSTOM_FIND_PVP_CONFIG_FILE); ENABLE_FIND_PVP = FindPvP.getBoolean("EnableFindPvP", false); + // Load MerchantZeroSellPrice config file (if exists) + final PropertiesParser MerchantZeroSellPrice = new PropertiesParser(CUSTOM_MERCHANT_ZERO_SELL_PRICE_CONFIG_FILE); + MERCHANT_ZERO_SELL_PRICE = MerchantZeroSellPrice.getBoolean("MerchantZeroSellPrice", false); + // Load MultilingualSupport config file (if exists) final PropertiesParser MultilingualSupport = new PropertiesParser(CUSTOM_MULTILANGUAL_SUPPORT_CONFIG_FILE); diff --git a/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/model/actor/instance/MerchantInstance.java b/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/model/actor/instance/MerchantInstance.java index 539664a411..3b4c28fadd 100644 --- a/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/model/actor/instance/MerchantInstance.java +++ b/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/model/actor/instance/MerchantInstance.java @@ -88,6 +88,6 @@ public class MerchantInstance extends NpcInstance player.setInventoryBlockingStatus(true); player.sendPacket(new BuyList(buyList, player, (applyCastleTax) ? getCastleTaxRate(TaxType.BUY) : 0)); - player.sendPacket(new ExBuySellList(player, false, (applyCastleTax) ? getCastleTaxRate(TaxType.SELL) : 0)); + player.sendPacket(new ExBuySellList(player, false)); } } diff --git a/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/network/clientpackets/RequestRefundItem.java b/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/network/clientpackets/RequestRefundItem.java index 41cb56d317..027e31909f 100644 --- a/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/network/clientpackets/RequestRefundItem.java +++ b/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/network/clientpackets/RequestRefundItem.java @@ -157,7 +157,7 @@ public class RequestRefundItem implements IClientIncomingPacket final long count = item.getCount(); weight += count * template.getWeight(); - adena += (count * template.getReferencePrice()) / 2; + adena += count * (template.getReferencePrice() / 2); if (!template.isStackable()) { slots += count; @@ -182,7 +182,7 @@ public class RequestRefundItem implements IClientIncomingPacket return; } - if ((adena < 0) || !player.reduceAdena("Refund", adena, player.getLastFolkNPC(), false)) + if (!Config.MERCHANT_ZERO_SELL_PRICE && ((adena < 0) || !player.reduceAdena("Refund", adena, player.getLastFolkNPC(), false))) { client.sendPacket(SystemMessageId.YOU_DO_NOT_HAVE_ENOUGH_ADENA); client.sendPacket(ActionFailed.STATIC_PACKET); diff --git a/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/network/clientpackets/RequestSellItem.java b/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/network/clientpackets/RequestSellItem.java index 70d3e92505..3546aec078 100644 --- a/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/network/clientpackets/RequestSellItem.java +++ b/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/network/clientpackets/RequestSellItem.java @@ -25,7 +25,6 @@ import java.util.List; import org.l2jmobius.Config; import org.l2jmobius.commons.network.PacketReader; import org.l2jmobius.gameserver.data.xml.impl.BuyListData; -import org.l2jmobius.gameserver.enums.TaxType; import org.l2jmobius.gameserver.model.WorldObject; import org.l2jmobius.gameserver.model.actor.instance.MerchantInstance; import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; @@ -170,17 +169,11 @@ public class RequestSellItem implements IClientIncomingPacket } } - // add to castle treasury - if (merchant != null) + if (!Config.MERCHANT_ZERO_SELL_PRICE) { - // Keep here same formula as in {@link ExBuySellList} to produce same result. - final long profit = (long) (totalPrice * (1.0 - merchant.getCastleTaxRate(TaxType.SELL))); - merchant.handleTaxPayment(totalPrice - profit); - totalPrice = profit; + player.addAdena("Sell", totalPrice, merchant, false); } - player.addAdena("Sell", totalPrice, merchant, false); - // Update current load as well client.sendPacket(new ExUserInfoInvenWeight(player)); client.sendPacket(new ExBuySellList(player, true)); diff --git a/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/network/serverpackets/ExBuySellList.java b/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/network/serverpackets/ExBuySellList.java index a3cd6d9afa..66bcb38bb6 100644 --- a/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/network/serverpackets/ExBuySellList.java +++ b/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/network/serverpackets/ExBuySellList.java @@ -18,6 +18,7 @@ package org.l2jmobius.gameserver.network.serverpackets; import java.util.Collection; +import org.l2jmobius.Config; import org.l2jmobius.commons.network.PacketWriter; import org.l2jmobius.gameserver.model.actor.Summon; import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; @@ -33,7 +34,6 @@ public class ExBuySellList extends AbstractItemPacket private Collection _refundList = null; private final boolean _done; private final int _inventorySlots; - private double _castleTaxRate = 1; public ExBuySellList(PlayerInstance player, boolean done) { @@ -47,12 +47,6 @@ public class ExBuySellList extends AbstractItemPacket _done = done; } - public ExBuySellList(PlayerInstance player, boolean done, double castleTaxRate) - { - this(player, done); - _castleTaxRate = 1 - castleTaxRate; - } - @Override public boolean write(PacketWriter packet) { @@ -67,7 +61,7 @@ public class ExBuySellList extends AbstractItemPacket for (ItemInstance item : _sellList) { writeItem(packet, item); - packet.writeQ((long) ((item.getItem().getReferencePrice() / 2) * _castleTaxRate)); + packet.writeQ(Config.MERCHANT_ZERO_SELL_PRICE ? 0 : item.getItem().getReferencePrice() / 2); } } else @@ -83,7 +77,7 @@ public class ExBuySellList extends AbstractItemPacket { writeItem(packet, item); packet.writeD(i++); - packet.writeQ((item.getItem().getReferencePrice() / 2) * item.getCount()); + packet.writeQ(Config.MERCHANT_ZERO_SELL_PRICE ? 0 : (item.getItem().getReferencePrice() / 2) * item.getCount()); } } else diff --git a/L2J_Mobius_Classic_2.4_SecretOfEmpire/dist/game/config/Custom/MerchantZeroSellPrice.ini b/L2J_Mobius_Classic_2.4_SecretOfEmpire/dist/game/config/Custom/MerchantZeroSellPrice.ini new file mode 100644 index 0000000000..140490f042 --- /dev/null +++ b/L2J_Mobius_Classic_2.4_SecretOfEmpire/dist/game/config/Custom/MerchantZeroSellPrice.ini @@ -0,0 +1,6 @@ +# --------------------------------------------------------------------------- +# Merchant Zero Sell Price +# --------------------------------------------------------------------------- + +# All items sold to merchants reward no Adena. +MerchantZeroSellPrice = False 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 b1e537b4e4..c1c25bce5e 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 @@ -124,6 +124,7 @@ public class Config private static final String CUSTOM_FACTION_SYSTEM_CONFIG_FILE = "./config/Custom/FactionSystem.ini"; private static final String CUSTOM_FAKE_PLAYERS_CONFIG_FILE = "./config/Custom/FakePlayers.ini"; private static final String CUSTOM_FIND_PVP_CONFIG_FILE = "./config/Custom/FindPvP.ini"; + private static final String CUSTOM_MERCHANT_ZERO_SELL_PRICE_CONFIG_FILE = "./config/Custom/MerchantZeroSellPrice.ini"; private static final String CUSTOM_MULTILANGUAL_SUPPORT_CONFIG_FILE = "./config/Custom/MultilingualSupport.ini"; private static final String CUSTOM_NPC_STAT_MULTIPLIERS_CONFIG_FILE = "./config/Custom/NpcStatMultipliers.ini"; private static final String CUSTOM_OFFLINE_TRADE_CONFIG_FILE = "./config/Custom/OfflineTrade.ini"; @@ -1179,6 +1180,7 @@ public class Config public static boolean FAKE_PLAYER_CAN_DROP_ITEMS; public static boolean FAKE_PLAYER_CAN_PICKUP; public static boolean ENABLE_FIND_PVP; + public static boolean MERCHANT_ZERO_SELL_PRICE; public static boolean PREMIUM_SYSTEM_ENABLED; public static float PREMIUM_RATE_XP; public static float PREMIUM_RATE_SP; @@ -3046,6 +3048,10 @@ public class Config final PropertiesParser FindPvP = new PropertiesParser(CUSTOM_FIND_PVP_CONFIG_FILE); ENABLE_FIND_PVP = FindPvP.getBoolean("EnableFindPvP", false); + // Load MerchantZeroSellPrice config file (if exists) + final PropertiesParser MerchantZeroSellPrice = new PropertiesParser(CUSTOM_MERCHANT_ZERO_SELL_PRICE_CONFIG_FILE); + MERCHANT_ZERO_SELL_PRICE = MerchantZeroSellPrice.getBoolean("MerchantZeroSellPrice", false); + // Load MultilingualSupport config file (if exists) final PropertiesParser MultilingualSupport = new PropertiesParser(CUSTOM_MULTILANGUAL_SUPPORT_CONFIG_FILE); diff --git a/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/model/actor/instance/MerchantInstance.java b/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/model/actor/instance/MerchantInstance.java index 539664a411..3b4c28fadd 100644 --- a/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/model/actor/instance/MerchantInstance.java +++ b/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/model/actor/instance/MerchantInstance.java @@ -88,6 +88,6 @@ public class MerchantInstance extends NpcInstance player.setInventoryBlockingStatus(true); player.sendPacket(new BuyList(buyList, player, (applyCastleTax) ? getCastleTaxRate(TaxType.BUY) : 0)); - player.sendPacket(new ExBuySellList(player, false, (applyCastleTax) ? getCastleTaxRate(TaxType.SELL) : 0)); + player.sendPacket(new ExBuySellList(player, false)); } } diff --git a/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/network/clientpackets/RequestRefundItem.java b/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/network/clientpackets/RequestRefundItem.java index 41cb56d317..027e31909f 100644 --- a/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/network/clientpackets/RequestRefundItem.java +++ b/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/network/clientpackets/RequestRefundItem.java @@ -157,7 +157,7 @@ public class RequestRefundItem implements IClientIncomingPacket final long count = item.getCount(); weight += count * template.getWeight(); - adena += (count * template.getReferencePrice()) / 2; + adena += count * (template.getReferencePrice() / 2); if (!template.isStackable()) { slots += count; @@ -182,7 +182,7 @@ public class RequestRefundItem implements IClientIncomingPacket return; } - if ((adena < 0) || !player.reduceAdena("Refund", adena, player.getLastFolkNPC(), false)) + if (!Config.MERCHANT_ZERO_SELL_PRICE && ((adena < 0) || !player.reduceAdena("Refund", adena, player.getLastFolkNPC(), false))) { client.sendPacket(SystemMessageId.YOU_DO_NOT_HAVE_ENOUGH_ADENA); client.sendPacket(ActionFailed.STATIC_PACKET); diff --git a/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/network/clientpackets/RequestSellItem.java b/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/network/clientpackets/RequestSellItem.java index 70d3e92505..3546aec078 100644 --- a/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/network/clientpackets/RequestSellItem.java +++ b/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/network/clientpackets/RequestSellItem.java @@ -25,7 +25,6 @@ import java.util.List; import org.l2jmobius.Config; import org.l2jmobius.commons.network.PacketReader; import org.l2jmobius.gameserver.data.xml.impl.BuyListData; -import org.l2jmobius.gameserver.enums.TaxType; import org.l2jmobius.gameserver.model.WorldObject; import org.l2jmobius.gameserver.model.actor.instance.MerchantInstance; import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; @@ -170,17 +169,11 @@ public class RequestSellItem implements IClientIncomingPacket } } - // add to castle treasury - if (merchant != null) + if (!Config.MERCHANT_ZERO_SELL_PRICE) { - // Keep here same formula as in {@link ExBuySellList} to produce same result. - final long profit = (long) (totalPrice * (1.0 - merchant.getCastleTaxRate(TaxType.SELL))); - merchant.handleTaxPayment(totalPrice - profit); - totalPrice = profit; + player.addAdena("Sell", totalPrice, merchant, false); } - player.addAdena("Sell", totalPrice, merchant, false); - // Update current load as well client.sendPacket(new ExUserInfoInvenWeight(player)); client.sendPacket(new ExBuySellList(player, true)); diff --git a/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/network/serverpackets/ExBuySellList.java b/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/network/serverpackets/ExBuySellList.java index a3cd6d9afa..66bcb38bb6 100644 --- a/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/network/serverpackets/ExBuySellList.java +++ b/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/network/serverpackets/ExBuySellList.java @@ -18,6 +18,7 @@ package org.l2jmobius.gameserver.network.serverpackets; import java.util.Collection; +import org.l2jmobius.Config; import org.l2jmobius.commons.network.PacketWriter; import org.l2jmobius.gameserver.model.actor.Summon; import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; @@ -33,7 +34,6 @@ public class ExBuySellList extends AbstractItemPacket private Collection _refundList = null; private final boolean _done; private final int _inventorySlots; - private double _castleTaxRate = 1; public ExBuySellList(PlayerInstance player, boolean done) { @@ -47,12 +47,6 @@ public class ExBuySellList extends AbstractItemPacket _done = done; } - public ExBuySellList(PlayerInstance player, boolean done, double castleTaxRate) - { - this(player, done); - _castleTaxRate = 1 - castleTaxRate; - } - @Override public boolean write(PacketWriter packet) { @@ -67,7 +61,7 @@ public class ExBuySellList extends AbstractItemPacket for (ItemInstance item : _sellList) { writeItem(packet, item); - packet.writeQ((long) ((item.getItem().getReferencePrice() / 2) * _castleTaxRate)); + packet.writeQ(Config.MERCHANT_ZERO_SELL_PRICE ? 0 : item.getItem().getReferencePrice() / 2); } } else @@ -83,7 +77,7 @@ public class ExBuySellList extends AbstractItemPacket { writeItem(packet, item); packet.writeD(i++); - packet.writeQ((item.getItem().getReferencePrice() / 2) * item.getCount()); + packet.writeQ(Config.MERCHANT_ZERO_SELL_PRICE ? 0 : (item.getItem().getReferencePrice() / 2) * item.getCount()); } } else diff --git a/L2J_Mobius_Classic_3.0_TheKamael/dist/game/config/Custom/MerchantZeroSellPrice.ini b/L2J_Mobius_Classic_3.0_TheKamael/dist/game/config/Custom/MerchantZeroSellPrice.ini new file mode 100644 index 0000000000..140490f042 --- /dev/null +++ b/L2J_Mobius_Classic_3.0_TheKamael/dist/game/config/Custom/MerchantZeroSellPrice.ini @@ -0,0 +1,6 @@ +# --------------------------------------------------------------------------- +# Merchant Zero Sell Price +# --------------------------------------------------------------------------- + +# All items sold to merchants reward no Adena. +MerchantZeroSellPrice = False 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 6d8c26ab5e..a07e1dd7bf 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 @@ -124,6 +124,7 @@ public class Config private static final String CUSTOM_FACTION_SYSTEM_CONFIG_FILE = "./config/Custom/FactionSystem.ini"; private static final String CUSTOM_FAKE_PLAYERS_CONFIG_FILE = "./config/Custom/FakePlayers.ini"; private static final String CUSTOM_FIND_PVP_CONFIG_FILE = "./config/Custom/FindPvP.ini"; + private static final String CUSTOM_MERCHANT_ZERO_SELL_PRICE_CONFIG_FILE = "./config/Custom/MerchantZeroSellPrice.ini"; private static final String CUSTOM_MULTILANGUAL_SUPPORT_CONFIG_FILE = "./config/Custom/MultilingualSupport.ini"; private static final String CUSTOM_NPC_STAT_MULTIPLIERS_CONFIG_FILE = "./config/Custom/NpcStatMultipliers.ini"; private static final String CUSTOM_OFFLINE_TRADE_CONFIG_FILE = "./config/Custom/OfflineTrade.ini"; @@ -1178,6 +1179,7 @@ public class Config public static boolean FAKE_PLAYER_CAN_DROP_ITEMS; public static boolean FAKE_PLAYER_CAN_PICKUP; public static boolean ENABLE_FIND_PVP; + public static boolean MERCHANT_ZERO_SELL_PRICE; public static boolean PREMIUM_SYSTEM_ENABLED; public static float PREMIUM_RATE_XP; public static float PREMIUM_RATE_SP; @@ -3044,6 +3046,10 @@ public class Config final PropertiesParser FindPvP = new PropertiesParser(CUSTOM_FIND_PVP_CONFIG_FILE); ENABLE_FIND_PVP = FindPvP.getBoolean("EnableFindPvP", false); + // Load MerchantZeroSellPrice config file (if exists) + final PropertiesParser MerchantZeroSellPrice = new PropertiesParser(CUSTOM_MERCHANT_ZERO_SELL_PRICE_CONFIG_FILE); + MERCHANT_ZERO_SELL_PRICE = MerchantZeroSellPrice.getBoolean("MerchantZeroSellPrice", false); + // Load MultilingualSupport config file (if exists) final PropertiesParser MultilingualSupport = new PropertiesParser(CUSTOM_MULTILANGUAL_SUPPORT_CONFIG_FILE); diff --git a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/actor/instance/MerchantInstance.java b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/actor/instance/MerchantInstance.java index 539664a411..3b4c28fadd 100644 --- a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/actor/instance/MerchantInstance.java +++ b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/actor/instance/MerchantInstance.java @@ -88,6 +88,6 @@ public class MerchantInstance extends NpcInstance player.setInventoryBlockingStatus(true); player.sendPacket(new BuyList(buyList, player, (applyCastleTax) ? getCastleTaxRate(TaxType.BUY) : 0)); - player.sendPacket(new ExBuySellList(player, false, (applyCastleTax) ? getCastleTaxRate(TaxType.SELL) : 0)); + player.sendPacket(new ExBuySellList(player, false)); } } diff --git a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/network/clientpackets/RequestRefundItem.java b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/network/clientpackets/RequestRefundItem.java index 41cb56d317..027e31909f 100644 --- a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/network/clientpackets/RequestRefundItem.java +++ b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/network/clientpackets/RequestRefundItem.java @@ -157,7 +157,7 @@ public class RequestRefundItem implements IClientIncomingPacket final long count = item.getCount(); weight += count * template.getWeight(); - adena += (count * template.getReferencePrice()) / 2; + adena += count * (template.getReferencePrice() / 2); if (!template.isStackable()) { slots += count; @@ -182,7 +182,7 @@ public class RequestRefundItem implements IClientIncomingPacket return; } - if ((adena < 0) || !player.reduceAdena("Refund", adena, player.getLastFolkNPC(), false)) + if (!Config.MERCHANT_ZERO_SELL_PRICE && ((adena < 0) || !player.reduceAdena("Refund", adena, player.getLastFolkNPC(), false))) { client.sendPacket(SystemMessageId.YOU_DO_NOT_HAVE_ENOUGH_ADENA); client.sendPacket(ActionFailed.STATIC_PACKET); diff --git a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/network/clientpackets/RequestSellItem.java b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/network/clientpackets/RequestSellItem.java index 70d3e92505..3546aec078 100644 --- a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/network/clientpackets/RequestSellItem.java +++ b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/network/clientpackets/RequestSellItem.java @@ -25,7 +25,6 @@ import java.util.List; import org.l2jmobius.Config; import org.l2jmobius.commons.network.PacketReader; import org.l2jmobius.gameserver.data.xml.impl.BuyListData; -import org.l2jmobius.gameserver.enums.TaxType; import org.l2jmobius.gameserver.model.WorldObject; import org.l2jmobius.gameserver.model.actor.instance.MerchantInstance; import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; @@ -170,17 +169,11 @@ public class RequestSellItem implements IClientIncomingPacket } } - // add to castle treasury - if (merchant != null) + if (!Config.MERCHANT_ZERO_SELL_PRICE) { - // Keep here same formula as in {@link ExBuySellList} to produce same result. - final long profit = (long) (totalPrice * (1.0 - merchant.getCastleTaxRate(TaxType.SELL))); - merchant.handleTaxPayment(totalPrice - profit); - totalPrice = profit; + player.addAdena("Sell", totalPrice, merchant, false); } - player.addAdena("Sell", totalPrice, merchant, false); - // Update current load as well client.sendPacket(new ExUserInfoInvenWeight(player)); client.sendPacket(new ExBuySellList(player, true)); diff --git a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/network/serverpackets/ExBuySellList.java b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/network/serverpackets/ExBuySellList.java index a3cd6d9afa..66bcb38bb6 100644 --- a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/network/serverpackets/ExBuySellList.java +++ b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/network/serverpackets/ExBuySellList.java @@ -18,6 +18,7 @@ package org.l2jmobius.gameserver.network.serverpackets; import java.util.Collection; +import org.l2jmobius.Config; import org.l2jmobius.commons.network.PacketWriter; import org.l2jmobius.gameserver.model.actor.Summon; import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; @@ -33,7 +34,6 @@ public class ExBuySellList extends AbstractItemPacket private Collection _refundList = null; private final boolean _done; private final int _inventorySlots; - private double _castleTaxRate = 1; public ExBuySellList(PlayerInstance player, boolean done) { @@ -47,12 +47,6 @@ public class ExBuySellList extends AbstractItemPacket _done = done; } - public ExBuySellList(PlayerInstance player, boolean done, double castleTaxRate) - { - this(player, done); - _castleTaxRate = 1 - castleTaxRate; - } - @Override public boolean write(PacketWriter packet) { @@ -67,7 +61,7 @@ public class ExBuySellList extends AbstractItemPacket for (ItemInstance item : _sellList) { writeItem(packet, item); - packet.writeQ((long) ((item.getItem().getReferencePrice() / 2) * _castleTaxRate)); + packet.writeQ(Config.MERCHANT_ZERO_SELL_PRICE ? 0 : item.getItem().getReferencePrice() / 2); } } else @@ -83,7 +77,7 @@ public class ExBuySellList extends AbstractItemPacket { writeItem(packet, item); packet.writeD(i++); - packet.writeQ((item.getItem().getReferencePrice() / 2) * item.getCount()); + packet.writeQ(Config.MERCHANT_ZERO_SELL_PRICE ? 0 : (item.getItem().getReferencePrice() / 2) * item.getCount()); } } else diff --git a/L2J_Mobius_Classic_Interlude/dist/game/config/Custom/MerchantZeroSellPrice.ini b/L2J_Mobius_Classic_Interlude/dist/game/config/Custom/MerchantZeroSellPrice.ini new file mode 100644 index 0000000000..140490f042 --- /dev/null +++ b/L2J_Mobius_Classic_Interlude/dist/game/config/Custom/MerchantZeroSellPrice.ini @@ -0,0 +1,6 @@ +# --------------------------------------------------------------------------- +# Merchant Zero Sell Price +# --------------------------------------------------------------------------- + +# All items sold to merchants reward no Adena. +MerchantZeroSellPrice = False diff --git a/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/Config.java b/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/Config.java index 114b30a14c..868044d83f 100644 --- a/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/Config.java +++ b/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/Config.java @@ -125,6 +125,7 @@ public class Config private static final String CUSTOM_FACTION_SYSTEM_CONFIG_FILE = "./config/Custom/FactionSystem.ini"; private static final String CUSTOM_FAKE_PLAYERS_CONFIG_FILE = "./config/Custom/FakePlayers.ini"; private static final String CUSTOM_FIND_PVP_CONFIG_FILE = "./config/Custom/FindPvP.ini"; + private static final String CUSTOM_MERCHANT_ZERO_SELL_PRICE_CONFIG_FILE = "./config/Custom/MerchantZeroSellPrice.ini"; private static final String CUSTOM_MULTILANGUAL_SUPPORT_CONFIG_FILE = "./config/Custom/MultilingualSupport.ini"; private static final String CUSTOM_NPC_STAT_MULTIPLIERS_CONFIG_FILE = "./config/Custom/NpcStatMultipliers.ini"; private static final String CUSTOM_OFFLINE_TRADE_CONFIG_FILE = "./config/Custom/OfflineTrade.ini"; @@ -1181,6 +1182,7 @@ public class Config public static boolean FAKE_PLAYER_CAN_DROP_ITEMS; public static boolean FAKE_PLAYER_CAN_PICKUP; public static boolean ENABLE_FIND_PVP; + public static boolean MERCHANT_ZERO_SELL_PRICE; public static boolean PREMIUM_SYSTEM_ENABLED; public static float PREMIUM_RATE_XP; public static float PREMIUM_RATE_SP; @@ -3050,6 +3052,10 @@ public class Config final PropertiesParser FindPvP = new PropertiesParser(CUSTOM_FIND_PVP_CONFIG_FILE); ENABLE_FIND_PVP = FindPvP.getBoolean("EnableFindPvP", false); + // Load MerchantZeroSellPrice config file (if exists) + final PropertiesParser MerchantZeroSellPrice = new PropertiesParser(CUSTOM_MERCHANT_ZERO_SELL_PRICE_CONFIG_FILE); + MERCHANT_ZERO_SELL_PRICE = MerchantZeroSellPrice.getBoolean("MerchantZeroSellPrice", false); + // Load MultilingualSupport config file (if exists) final PropertiesParser MultilingualSupport = new PropertiesParser(CUSTOM_MULTILANGUAL_SUPPORT_CONFIG_FILE); diff --git a/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/model/actor/instance/MerchantInstance.java b/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/model/actor/instance/MerchantInstance.java index 539664a411..3b4c28fadd 100644 --- a/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/model/actor/instance/MerchantInstance.java +++ b/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/model/actor/instance/MerchantInstance.java @@ -88,6 +88,6 @@ public class MerchantInstance extends NpcInstance player.setInventoryBlockingStatus(true); player.sendPacket(new BuyList(buyList, player, (applyCastleTax) ? getCastleTaxRate(TaxType.BUY) : 0)); - player.sendPacket(new ExBuySellList(player, false, (applyCastleTax) ? getCastleTaxRate(TaxType.SELL) : 0)); + player.sendPacket(new ExBuySellList(player, false)); } } diff --git a/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/network/clientpackets/RequestRefundItem.java b/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/network/clientpackets/RequestRefundItem.java index 41cb56d317..027e31909f 100644 --- a/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/network/clientpackets/RequestRefundItem.java +++ b/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/network/clientpackets/RequestRefundItem.java @@ -157,7 +157,7 @@ public class RequestRefundItem implements IClientIncomingPacket final long count = item.getCount(); weight += count * template.getWeight(); - adena += (count * template.getReferencePrice()) / 2; + adena += count * (template.getReferencePrice() / 2); if (!template.isStackable()) { slots += count; @@ -182,7 +182,7 @@ public class RequestRefundItem implements IClientIncomingPacket return; } - if ((adena < 0) || !player.reduceAdena("Refund", adena, player.getLastFolkNPC(), false)) + if (!Config.MERCHANT_ZERO_SELL_PRICE && ((adena < 0) || !player.reduceAdena("Refund", adena, player.getLastFolkNPC(), false))) { client.sendPacket(SystemMessageId.YOU_DO_NOT_HAVE_ENOUGH_ADENA); client.sendPacket(ActionFailed.STATIC_PACKET); diff --git a/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/network/clientpackets/RequestSellItem.java b/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/network/clientpackets/RequestSellItem.java index 70d3e92505..3546aec078 100644 --- a/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/network/clientpackets/RequestSellItem.java +++ b/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/network/clientpackets/RequestSellItem.java @@ -25,7 +25,6 @@ import java.util.List; import org.l2jmobius.Config; import org.l2jmobius.commons.network.PacketReader; import org.l2jmobius.gameserver.data.xml.impl.BuyListData; -import org.l2jmobius.gameserver.enums.TaxType; import org.l2jmobius.gameserver.model.WorldObject; import org.l2jmobius.gameserver.model.actor.instance.MerchantInstance; import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; @@ -170,17 +169,11 @@ public class RequestSellItem implements IClientIncomingPacket } } - // add to castle treasury - if (merchant != null) + if (!Config.MERCHANT_ZERO_SELL_PRICE) { - // Keep here same formula as in {@link ExBuySellList} to produce same result. - final long profit = (long) (totalPrice * (1.0 - merchant.getCastleTaxRate(TaxType.SELL))); - merchant.handleTaxPayment(totalPrice - profit); - totalPrice = profit; + player.addAdena("Sell", totalPrice, merchant, false); } - player.addAdena("Sell", totalPrice, merchant, false); - // Update current load as well client.sendPacket(new ExUserInfoInvenWeight(player)); client.sendPacket(new ExBuySellList(player, true)); diff --git a/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/network/serverpackets/ExBuySellList.java b/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/network/serverpackets/ExBuySellList.java index a3cd6d9afa..66bcb38bb6 100644 --- a/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/network/serverpackets/ExBuySellList.java +++ b/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/network/serverpackets/ExBuySellList.java @@ -18,6 +18,7 @@ package org.l2jmobius.gameserver.network.serverpackets; import java.util.Collection; +import org.l2jmobius.Config; import org.l2jmobius.commons.network.PacketWriter; import org.l2jmobius.gameserver.model.actor.Summon; import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; @@ -33,7 +34,6 @@ public class ExBuySellList extends AbstractItemPacket private Collection _refundList = null; private final boolean _done; private final int _inventorySlots; - private double _castleTaxRate = 1; public ExBuySellList(PlayerInstance player, boolean done) { @@ -47,12 +47,6 @@ public class ExBuySellList extends AbstractItemPacket _done = done; } - public ExBuySellList(PlayerInstance player, boolean done, double castleTaxRate) - { - this(player, done); - _castleTaxRate = 1 - castleTaxRate; - } - @Override public boolean write(PacketWriter packet) { @@ -67,7 +61,7 @@ public class ExBuySellList extends AbstractItemPacket for (ItemInstance item : _sellList) { writeItem(packet, item); - packet.writeQ((long) ((item.getItem().getReferencePrice() / 2) * _castleTaxRate)); + packet.writeQ(Config.MERCHANT_ZERO_SELL_PRICE ? 0 : item.getItem().getReferencePrice() / 2); } } else @@ -83,7 +77,7 @@ public class ExBuySellList extends AbstractItemPacket { writeItem(packet, item); packet.writeD(i++); - packet.writeQ((item.getItem().getReferencePrice() / 2) * item.getCount()); + packet.writeQ(Config.MERCHANT_ZERO_SELL_PRICE ? 0 : (item.getItem().getReferencePrice() / 2) * item.getCount()); } } else