Addition of merchant zero sell price configuration.
This commit is contained in:
6
L2J_Mobius_CT_2.4_Epilogue/dist/game/config/Custom/MerchantZeroSellPrice.ini
vendored
Normal file
6
L2J_Mobius_CT_2.4_Epilogue/dist/game/config/Custom/MerchantZeroSellPrice.ini
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
# ---------------------------------------------------------------------------
|
||||
# Merchant Zero Sell Price
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
# All items sold to merchants reward no Adena.
|
||||
MerchantZeroSellPrice = False
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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());
|
||||
|
||||
Reference in New Issue
Block a user