Addition of merchant zero sell price configuration.

This commit is contained in:
MobiusDevelopment 2020-01-04 02:29:32 +00:00
parent d268e06690
commit 1cdcd2f8b0
104 changed files with 399 additions and 377 deletions

View File

@ -0,0 +1,6 @@
# ---------------------------------------------------------------------------
# Merchant Zero Sell Price
# ---------------------------------------------------------------------------
# All items sold to merchants reward no Adena.
MerchantZeroSellPrice = False

View File

@ -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);

View File

@ -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));
}
}

View File

@ -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);

View File

@ -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));

View File

@ -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<ItemInstance> _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

View File

@ -0,0 +1,6 @@
# ---------------------------------------------------------------------------
# Merchant Zero Sell Price
# ---------------------------------------------------------------------------
# All items sold to merchants reward no Adena.
MerchantZeroSellPrice = False

View File

@ -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);

View File

@ -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));
}
}

View File

@ -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);

View File

@ -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));

View File

@ -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<ItemInstance> _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

View File

@ -0,0 +1,6 @@
# ---------------------------------------------------------------------------
# Merchant Zero Sell Price
# ---------------------------------------------------------------------------
# All items sold to merchants reward no Adena.
MerchantZeroSellPrice = False

View File

@ -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);

View File

@ -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));
}
}

View File

@ -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);

View File

@ -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));

View File

@ -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<ItemInstance> _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

View File

@ -0,0 +1,6 @@
# ---------------------------------------------------------------------------
# Merchant Zero Sell Price
# ---------------------------------------------------------------------------
# All items sold to merchants reward no Adena.
MerchantZeroSellPrice = False

View File

@ -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);

View File

@ -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));
}
}

View File

@ -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);

View File

@ -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));

View File

@ -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<ItemInstance> _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

View File

@ -0,0 +1,6 @@
# ---------------------------------------------------------------------------
# Merchant Zero Sell Price
# ---------------------------------------------------------------------------
# All items sold to merchants reward no Adena.
MerchantZeroSellPrice = False

View File

@ -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);

View File

@ -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));
}
}

View File

@ -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);

View File

@ -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));

View File

@ -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<ItemInstance> _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

View File

@ -0,0 +1,6 @@
# ---------------------------------------------------------------------------
# Merchant Zero Sell Price
# ---------------------------------------------------------------------------
# All items sold to merchants reward no Adena.
MerchantZeroSellPrice = False

View File

@ -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);

View File

@ -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));
}
}

View File

@ -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);

View File

@ -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));

View File

@ -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<ItemInstance> _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

View File

@ -0,0 +1,6 @@
# ---------------------------------------------------------------------------
# Merchant Zero Sell Price
# ---------------------------------------------------------------------------
# All items sold to merchants reward no Adena.
MerchantZeroSellPrice = False

View File

@ -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);

View File

@ -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));
}
}

View File

@ -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);

View File

@ -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));

View File

@ -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<ItemInstance> _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

View File

@ -0,0 +1,6 @@
# ---------------------------------------------------------------------------
# Merchant Zero Sell Price
# ---------------------------------------------------------------------------
# All items sold to merchants reward no Adena.
MerchantZeroSellPrice = False

View File

@ -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);

View File

@ -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));
}
}

View File

@ -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);

View File

@ -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));

View File

@ -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<ItemInstance> _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

View File

@ -0,0 +1,6 @@
# ---------------------------------------------------------------------------
# Merchant Zero Sell Price
# ---------------------------------------------------------------------------
# All items sold to merchants reward no Adena.
MerchantZeroSellPrice = False

View File

@ -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();

View File

@ -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());

View File

@ -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<ItemInstance> _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);
}
}
}

View File

@ -0,0 +1,6 @@
# ---------------------------------------------------------------------------
# Merchant Zero Sell Price
# ---------------------------------------------------------------------------
# All items sold to merchants reward no Adena.
MerchantZeroSellPrice = False

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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());

View File

@ -0,0 +1,6 @@
# ---------------------------------------------------------------------------
# Merchant Zero Sell Price
# ---------------------------------------------------------------------------
# All items sold to merchants reward no Adena.
MerchantZeroSellPrice = False

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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<ItemInstance> _sellList = null;
private final Collection<ItemInstance> _sellList;
private Collection<ItemInstance> _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

View File

@ -0,0 +1,6 @@
# ---------------------------------------------------------------------------
# Merchant Zero Sell Price
# ---------------------------------------------------------------------------
# All items sold to merchants reward no Adena.
MerchantZeroSellPrice = False

View File

@ -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);

View File

@ -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));
}
}

View File

@ -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);

View File

@ -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));

View File

@ -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<ItemInstance> _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

View File

@ -0,0 +1,6 @@
# ---------------------------------------------------------------------------
# Merchant Zero Sell Price
# ---------------------------------------------------------------------------
# All items sold to merchants reward no Adena.
MerchantZeroSellPrice = False

View File

@ -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);

View File

@ -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));
}
}

View File

@ -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);

View File

@ -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));

View File

@ -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<ItemInstance> _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

View File

@ -0,0 +1,6 @@
# ---------------------------------------------------------------------------
# Merchant Zero Sell Price
# ---------------------------------------------------------------------------
# All items sold to merchants reward no Adena.
MerchantZeroSellPrice = False

View File

@ -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);

View File

@ -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));
}
}

View File

@ -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);

View File

@ -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));

View File

@ -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<ItemInstance> _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

View File

@ -0,0 +1,6 @@
# ---------------------------------------------------------------------------
# Merchant Zero Sell Price
# ---------------------------------------------------------------------------
# All items sold to merchants reward no Adena.
MerchantZeroSellPrice = False

View File

@ -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);

View File

@ -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));
}
}

View File

@ -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);

View File

@ -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));

View File

@ -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<ItemInstance> _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

View File

@ -0,0 +1,6 @@
# ---------------------------------------------------------------------------
# Merchant Zero Sell Price
# ---------------------------------------------------------------------------
# All items sold to merchants reward no Adena.
MerchantZeroSellPrice = False

View File

@ -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);

View File

@ -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));
}
}

View File

@ -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);

View File

@ -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));

View File

@ -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<ItemInstance> _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

View File

@ -0,0 +1,6 @@
# ---------------------------------------------------------------------------
# Merchant Zero Sell Price
# ---------------------------------------------------------------------------
# All items sold to merchants reward no Adena.
MerchantZeroSellPrice = False

View File

@ -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);

View File

@ -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));
}
}

View File

@ -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);

View File

@ -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));

View File

@ -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<ItemInstance> _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

View File

@ -0,0 +1,6 @@
# ---------------------------------------------------------------------------
# Merchant Zero Sell Price
# ---------------------------------------------------------------------------
# All items sold to merchants reward no Adena.
MerchantZeroSellPrice = False

View File

@ -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);

Some files were not shown because too many files have changed in this diff Show More