Support for LCoin player level and buy limit.
This commit is contained in:
@@ -20,7 +20,8 @@
|
||||
<xs:simpleContent>
|
||||
<xs:extension base="xs:string">
|
||||
<xs:attribute type="xs:int" name="id" use="optional"/>
|
||||
<xs:attribute type="xs:long" name="accountDailyLimit" use="optional"/>
|
||||
<xs:attribute type="xs:int" name="accountDailyLimit" use="optional"/>
|
||||
<xs:attribute type="xs:int" name="accountBuyLimit" use="optional"/>
|
||||
</xs:extension>
|
||||
</xs:simpleContent>
|
||||
</xs:complexType>
|
||||
@@ -28,6 +29,8 @@
|
||||
</xs:sequence>
|
||||
<xs:attribute type="xs:int" name="id" use="optional"/>
|
||||
<xs:attribute type="xs:byte" name="category" use="optional"/>
|
||||
<xs:attribute type="xs:int" name="minLevel" use="optional"/>
|
||||
<xs:attribute type="xs:int" name="maxLevel" use="optional"/>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:sequence>
|
||||
|
@@ -88,6 +88,8 @@ public class LCoinShopData implements IXmlReader
|
||||
|
||||
final int id = parseInteger(attrs, "id");
|
||||
final int category = parseInteger(attrs, "category");
|
||||
final int minLevel = parseInteger(attrs, "minLevel", 1);
|
||||
final int maxLevel = parseInteger(attrs, "maxLevel", 999);
|
||||
final int[] ingredientIds = new int[3];
|
||||
ingredientIds[0] = 0;
|
||||
ingredientIds[1] = 0;
|
||||
@@ -98,6 +100,7 @@ public class LCoinShopData implements IXmlReader
|
||||
ingredientQuantities[2] = 0;
|
||||
int productionId = 0;
|
||||
int accountDailyLimit = 0;
|
||||
int accountBuyLimit = 0;
|
||||
for (Node b = d.getFirstChild(); b != null; b = b.getNextSibling())
|
||||
{
|
||||
attrs = b.getAttributes();
|
||||
@@ -144,6 +147,7 @@ public class LCoinShopData implements IXmlReader
|
||||
{
|
||||
productionId = parseInteger(attrs, "id");
|
||||
accountDailyLimit = parseInteger(attrs, "accountDailyLimit", 0);
|
||||
accountBuyLimit = parseInteger(attrs, "accountBuyLimit", 0);
|
||||
|
||||
final Item item = ItemTable.getInstance().getTemplate(productionId);
|
||||
if (item == null)
|
||||
@@ -154,7 +158,7 @@ public class LCoinShopData implements IXmlReader
|
||||
}
|
||||
}
|
||||
|
||||
_products.add(new LCoinShopProductHolder(id, category, ingredientIds, ingredientQuantities, productionId, accountDailyLimit));
|
||||
_products.add(new LCoinShopProductHolder(id, category, minLevel, maxLevel, ingredientIds, ingredientQuantities, productionId, accountDailyLimit, accountBuyLimit));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -23,19 +23,25 @@ public class LCoinShopProductHolder
|
||||
{
|
||||
private final int _id;
|
||||
private final int _category;
|
||||
private final int _minLevel;
|
||||
private final int _maxLevel;
|
||||
private final int[] _ingredientIds;
|
||||
private final long[] _ingredientQuantities;
|
||||
private final int _productionId;
|
||||
private final int _accountDailyLimit;
|
||||
private final int _accountBuyLimit;
|
||||
|
||||
public LCoinShopProductHolder(int id, int category, int[] ingredientIds, long[] ingredientQuantities, int productionId, int accountDailyLimit)
|
||||
public LCoinShopProductHolder(int id, int category, int minLevel, int maxLevel, int[] ingredientIds, long[] ingredientQuantities, int productionId, int accountDailyLimit, int accountBuyLimit)
|
||||
{
|
||||
_id = id;
|
||||
_category = category;
|
||||
_minLevel = minLevel;
|
||||
_maxLevel = maxLevel;
|
||||
_ingredientIds = ingredientIds;
|
||||
_ingredientQuantities = ingredientQuantities;
|
||||
_productionId = productionId;
|
||||
_accountDailyLimit = accountDailyLimit;
|
||||
_accountBuyLimit = accountBuyLimit;
|
||||
}
|
||||
|
||||
public int getId()
|
||||
@@ -48,6 +54,16 @@ public class LCoinShopProductHolder
|
||||
return _category;
|
||||
}
|
||||
|
||||
public int getMinLevel()
|
||||
{
|
||||
return _minLevel;
|
||||
}
|
||||
|
||||
public int getMaxLevel()
|
||||
{
|
||||
return _maxLevel;
|
||||
}
|
||||
|
||||
public int[] getIngredientIds()
|
||||
{
|
||||
return _ingredientIds;
|
||||
@@ -67,4 +83,9 @@ public class LCoinShopProductHolder
|
||||
{
|
||||
return _accountDailyLimit;
|
||||
}
|
||||
|
||||
public int getAccountBuyLimit()
|
||||
{
|
||||
return _accountBuyLimit;
|
||||
}
|
||||
}
|
||||
|
@@ -41,6 +41,8 @@ public class AccountVariables extends AbstractVariables
|
||||
// Public variable names
|
||||
public static final String HWID = "HWID";
|
||||
public static final String HWIDSLIT_VAR = " ";
|
||||
public static final String LCOIN_SHOP_PRODUCT_TIME = "LCSTime";
|
||||
public static final String LCOIN_SHOP_PRODUCT_COUNT = "LCSCount";
|
||||
|
||||
private final String _accountName;
|
||||
|
||||
|
@@ -23,6 +23,7 @@ import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.actor.request.PrimeShopRequest;
|
||||
import org.l2jmobius.gameserver.model.holders.LCoinShopProductHolder;
|
||||
import org.l2jmobius.gameserver.model.itemcontainer.Inventory;
|
||||
import org.l2jmobius.gameserver.model.variables.AccountVariables;
|
||||
import org.l2jmobius.gameserver.network.GameClient;
|
||||
import org.l2jmobius.gameserver.network.SystemMessageId;
|
||||
import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
|
||||
@@ -68,6 +69,12 @@ public class RequestPurchaseLimitShopItemBuy implements IClientIncomingPacket
|
||||
return;
|
||||
}
|
||||
|
||||
if ((player.getLevel() < product.getMinLevel()) || (player.getLevel() > product.getMaxLevel()))
|
||||
{
|
||||
player.sendPacket(SystemMessageId.YOUR_LEVEL_CANNOT_PURCHASE_THIS_ITEM);
|
||||
return;
|
||||
}
|
||||
|
||||
if (player.hasItemRequest() || player.hasRequest(PrimeShopRequest.class))
|
||||
{
|
||||
player.sendPacket(new ExBRBuyProduct(ExBrProductReplyType.INVALID_USER_STATE));
|
||||
@@ -77,19 +84,28 @@ public class RequestPurchaseLimitShopItemBuy implements IClientIncomingPacket
|
||||
// Add request.
|
||||
player.addRequest(new PrimeShopRequest(player));
|
||||
|
||||
// Check account daily limit.
|
||||
if (product.getAccountDailyLimit() > 0)
|
||||
// Check limits.
|
||||
if (product.getAccountDailyLimit() > 0) // Sale period.
|
||||
{
|
||||
if (player.getAccountVariables().getInt("LCSCount" + product.getProductionId(), 0) >= product.getAccountDailyLimit())
|
||||
if (player.getAccountVariables().getInt(AccountVariables.LCOIN_SHOP_PRODUCT_COUNT + product.getProductionId(), 0) >= product.getAccountDailyLimit())
|
||||
{
|
||||
if ((player.getAccountVariables().getLong("LCSTime" + product.getProductionId(), 0) + 86400000) > Chronos.currentTimeMillis())
|
||||
if ((player.getAccountVariables().getLong(AccountVariables.LCOIN_SHOP_PRODUCT_TIME + product.getProductionId(), 0) + 86400000) > Chronos.currentTimeMillis())
|
||||
{
|
||||
player.sendMessage("You have reached your daily limit."); // TODO: Retail system message?
|
||||
player.removeRequest(PrimeShopRequest.class);
|
||||
return;
|
||||
}
|
||||
// Reset limit.
|
||||
player.getAccountVariables().set("LCSCount" + product.getProductionId(), 0);
|
||||
player.getAccountVariables().set(AccountVariables.LCOIN_SHOP_PRODUCT_COUNT + product.getProductionId(), 0);
|
||||
}
|
||||
}
|
||||
else if (product.getAccountBuyLimit() > 0) // Count limit.
|
||||
{
|
||||
if (player.getAccountVariables().getInt(AccountVariables.LCOIN_SHOP_PRODUCT_COUNT + product.getProductionId(), 0) >= product.getAccountBuyLimit())
|
||||
{
|
||||
player.sendMessage("You cannot buy any more of this item."); // TODO: Retail system message?
|
||||
player.removeRequest(PrimeShopRequest.class);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -137,11 +153,15 @@ public class RequestPurchaseLimitShopItemBuy implements IClientIncomingPacket
|
||||
// Reward.
|
||||
player.addItem("LCoinShop", product.getProductionId(), _amount, player, true);
|
||||
|
||||
// Update player variables.
|
||||
// Update account variables.
|
||||
if (product.getAccountDailyLimit() > 0)
|
||||
{
|
||||
player.getAccountVariables().set("LCSTime" + product.getProductionId(), Chronos.currentTimeMillis());
|
||||
player.getAccountVariables().set("LCSCount" + product.getProductionId(), player.getAccountVariables().getInt("LCSCount" + product.getProductionId(), 0) + 1);
|
||||
player.getAccountVariables().set(AccountVariables.LCOIN_SHOP_PRODUCT_TIME + product.getProductionId(), Chronos.currentTimeMillis());
|
||||
player.getAccountVariables().set(AccountVariables.LCOIN_SHOP_PRODUCT_COUNT + product.getProductionId(), player.getAccountVariables().getInt(AccountVariables.LCOIN_SHOP_PRODUCT_COUNT + product.getProductionId(), 0) + 1);
|
||||
}
|
||||
else if (product.getAccountBuyLimit() > 0)
|
||||
{
|
||||
player.getAccountVariables().set(AccountVariables.LCOIN_SHOP_PRODUCT_COUNT + product.getProductionId(), player.getAccountVariables().getInt(AccountVariables.LCOIN_SHOP_PRODUCT_COUNT + product.getProductionId(), 0) + 1);
|
||||
}
|
||||
|
||||
// Remove request.
|
||||
|
@@ -23,6 +23,7 @@ import org.l2jmobius.commons.util.Chronos;
|
||||
import org.l2jmobius.gameserver.data.xml.LCoinShopData;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.holders.LCoinShopProductHolder;
|
||||
import org.l2jmobius.gameserver.model.variables.AccountVariables;
|
||||
import org.l2jmobius.gameserver.network.OutgoingPackets;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket;
|
||||
|
||||
@@ -69,27 +70,38 @@ public class ExPurchaseLimitShopItemListNew implements IClientOutgoingPacket
|
||||
packet.writeC(-1); // ?
|
||||
packet.writeC(-1); // ?
|
||||
|
||||
// Sale period.
|
||||
if (product.getAccountDailyLimit() > 0)
|
||||
// Check limits.
|
||||
if (product.getAccountDailyLimit() > 0) // Sale period.
|
||||
{
|
||||
if (_player.getAccountVariables().getInt("LCSCount" + product.getProductionId(), 0) >= product.getAccountDailyLimit())
|
||||
if (_player.getAccountVariables().getInt(AccountVariables.LCOIN_SHOP_PRODUCT_COUNT + product.getProductionId(), 0) >= product.getAccountDailyLimit())
|
||||
{
|
||||
if ((_player.getAccountVariables().getLong("LCSTime" + product.getProductionId(), 0) + 86400000) > Chronos.currentTimeMillis())
|
||||
if ((_player.getAccountVariables().getLong(AccountVariables.LCOIN_SHOP_PRODUCT_TIME + product.getProductionId(), 0) + 86400000) > Chronos.currentTimeMillis())
|
||||
{
|
||||
packet.writeD(0x00);
|
||||
}
|
||||
else // Reset limit.
|
||||
{
|
||||
_player.getAccountVariables().remove("LCSCount" + product.getProductionId());
|
||||
_player.getAccountVariables().remove(AccountVariables.LCOIN_SHOP_PRODUCT_COUNT + product.getProductionId());
|
||||
packet.writeD(product.getAccountDailyLimit());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
packet.writeD(product.getAccountDailyLimit() - _player.getAccountVariables().getInt("LCSCount" + product.getProductionId(), 0));
|
||||
packet.writeD(product.getAccountDailyLimit() - _player.getAccountVariables().getInt(AccountVariables.LCOIN_SHOP_PRODUCT_COUNT + product.getProductionId(), 0));
|
||||
}
|
||||
}
|
||||
else // No account daily limit.
|
||||
else if (product.getAccountBuyLimit() > 0) // Count limit.
|
||||
{
|
||||
if (_player.getAccountVariables().getInt(AccountVariables.LCOIN_SHOP_PRODUCT_COUNT + product.getProductionId(), 0) >= product.getAccountBuyLimit())
|
||||
{
|
||||
packet.writeD(0x00);
|
||||
}
|
||||
else
|
||||
{
|
||||
packet.writeD(product.getAccountBuyLimit() - _player.getAccountVariables().getInt(AccountVariables.LCOIN_SHOP_PRODUCT_COUNT + product.getProductionId(), 0));
|
||||
}
|
||||
}
|
||||
else // No account limits.
|
||||
{
|
||||
packet.writeD(0x01);
|
||||
}
|
||||
|
@@ -20,7 +20,8 @@
|
||||
<xs:simpleContent>
|
||||
<xs:extension base="xs:string">
|
||||
<xs:attribute type="xs:int" name="id" use="optional"/>
|
||||
<xs:attribute type="xs:long" name="accountDailyLimit" use="optional"/>
|
||||
<xs:attribute type="xs:int" name="accountDailyLimit" use="optional"/>
|
||||
<xs:attribute type="xs:int" name="accountBuyLimit" use="optional"/>
|
||||
</xs:extension>
|
||||
</xs:simpleContent>
|
||||
</xs:complexType>
|
||||
@@ -28,6 +29,8 @@
|
||||
</xs:sequence>
|
||||
<xs:attribute type="xs:int" name="id" use="optional"/>
|
||||
<xs:attribute type="xs:byte" name="category" use="optional"/>
|
||||
<xs:attribute type="xs:int" name="minLevel" use="optional"/>
|
||||
<xs:attribute type="xs:int" name="maxLevel" use="optional"/>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:sequence>
|
||||
|
@@ -88,6 +88,8 @@ public class LCoinShopData implements IXmlReader
|
||||
|
||||
final int id = parseInteger(attrs, "id");
|
||||
final int category = parseInteger(attrs, "category");
|
||||
final int minLevel = parseInteger(attrs, "minLevel", 1);
|
||||
final int maxLevel = parseInteger(attrs, "maxLevel", 999);
|
||||
final int[] ingredientIds = new int[5];
|
||||
ingredientIds[0] = 0;
|
||||
ingredientIds[1] = 0;
|
||||
@@ -102,6 +104,7 @@ public class LCoinShopData implements IXmlReader
|
||||
ingredientQuantities[4] = 0;
|
||||
int productionId = 0;
|
||||
int accountDailyLimit = 0;
|
||||
int accountBuyLimit = 0;
|
||||
for (Node b = d.getFirstChild(); b != null; b = b.getNextSibling())
|
||||
{
|
||||
attrs = b.getAttributes();
|
||||
@@ -164,6 +167,7 @@ public class LCoinShopData implements IXmlReader
|
||||
{
|
||||
productionId = parseInteger(attrs, "id");
|
||||
accountDailyLimit = parseInteger(attrs, "accountDailyLimit", 0);
|
||||
accountBuyLimit = parseInteger(attrs, "accountBuyLimit", 0);
|
||||
|
||||
final Item item = ItemTable.getInstance().getTemplate(productionId);
|
||||
if (item == null)
|
||||
@@ -174,7 +178,7 @@ public class LCoinShopData implements IXmlReader
|
||||
}
|
||||
}
|
||||
|
||||
_products.add(new LCoinShopProductHolder(id, category, ingredientIds, ingredientQuantities, productionId, accountDailyLimit));
|
||||
_products.add(new LCoinShopProductHolder(id, category, minLevel, maxLevel, ingredientIds, ingredientQuantities, productionId, accountDailyLimit, accountBuyLimit));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -23,19 +23,25 @@ public class LCoinShopProductHolder
|
||||
{
|
||||
private final int _id;
|
||||
private final int _category;
|
||||
private final int _minLevel;
|
||||
private final int _maxLevel;
|
||||
private final int[] _ingredientIds;
|
||||
private final long[] _ingredientQuantities;
|
||||
private final int _productionId;
|
||||
private final int _accountDailyLimit;
|
||||
private final int _accountBuyLimit;
|
||||
|
||||
public LCoinShopProductHolder(int id, int category, int[] ingredientIds, long[] ingredientQuantities, int productionId, int accountDailyLimit)
|
||||
public LCoinShopProductHolder(int id, int category, int minLevel, int maxLevel, int[] ingredientIds, long[] ingredientQuantities, int productionId, int accountDailyLimit, int accountBuyLimit)
|
||||
{
|
||||
_id = id;
|
||||
_category = category;
|
||||
_minLevel = minLevel;
|
||||
_maxLevel = maxLevel;
|
||||
_ingredientIds = ingredientIds;
|
||||
_ingredientQuantities = ingredientQuantities;
|
||||
_productionId = productionId;
|
||||
_accountDailyLimit = accountDailyLimit;
|
||||
_accountBuyLimit = accountBuyLimit;
|
||||
}
|
||||
|
||||
public int getId()
|
||||
@@ -48,6 +54,16 @@ public class LCoinShopProductHolder
|
||||
return _category;
|
||||
}
|
||||
|
||||
public int getMinLevel()
|
||||
{
|
||||
return _minLevel;
|
||||
}
|
||||
|
||||
public int getMaxLevel()
|
||||
{
|
||||
return _maxLevel;
|
||||
}
|
||||
|
||||
public int[] getIngredientIds()
|
||||
{
|
||||
return _ingredientIds;
|
||||
@@ -67,4 +83,9 @@ public class LCoinShopProductHolder
|
||||
{
|
||||
return _accountDailyLimit;
|
||||
}
|
||||
|
||||
public int getAccountBuyLimit()
|
||||
{
|
||||
return _accountBuyLimit;
|
||||
}
|
||||
}
|
||||
|
@@ -41,6 +41,8 @@ public class AccountVariables extends AbstractVariables
|
||||
// Public variable names
|
||||
public static final String HWID = "HWID";
|
||||
public static final String HWIDSLIT_VAR = " ";
|
||||
public static final String LCOIN_SHOP_PRODUCT_TIME = "LCSTime";
|
||||
public static final String LCOIN_SHOP_PRODUCT_COUNT = "LCSCount";
|
||||
|
||||
private final String _accountName;
|
||||
|
||||
|
@@ -23,6 +23,7 @@ import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.actor.request.PrimeShopRequest;
|
||||
import org.l2jmobius.gameserver.model.holders.LCoinShopProductHolder;
|
||||
import org.l2jmobius.gameserver.model.itemcontainer.Inventory;
|
||||
import org.l2jmobius.gameserver.model.variables.AccountVariables;
|
||||
import org.l2jmobius.gameserver.network.GameClient;
|
||||
import org.l2jmobius.gameserver.network.SystemMessageId;
|
||||
import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket;
|
||||
@@ -68,6 +69,12 @@ public class RequestPurchaseLimitShopItemBuy implements IClientIncomingPacket
|
||||
return;
|
||||
}
|
||||
|
||||
if ((player.getLevel() < product.getMinLevel()) || (player.getLevel() > product.getMaxLevel()))
|
||||
{
|
||||
player.sendPacket(SystemMessageId.YOUR_LEVEL_CANNOT_PURCHASE_THIS_ITEM);
|
||||
return;
|
||||
}
|
||||
|
||||
if (player.hasItemRequest() || player.hasRequest(PrimeShopRequest.class))
|
||||
{
|
||||
player.sendPacket(new ExBRBuyProduct(ExBrProductReplyType.INVALID_USER_STATE));
|
||||
@@ -77,19 +84,28 @@ public class RequestPurchaseLimitShopItemBuy implements IClientIncomingPacket
|
||||
// Add request.
|
||||
player.addRequest(new PrimeShopRequest(player));
|
||||
|
||||
// Check account daily limit.
|
||||
if (product.getAccountDailyLimit() > 0)
|
||||
// Check limits.
|
||||
if (product.getAccountDailyLimit() > 0) // Sale period.
|
||||
{
|
||||
if (player.getAccountVariables().getInt("LCSCount" + product.getProductionId(), 0) >= product.getAccountDailyLimit())
|
||||
if (player.getAccountVariables().getInt(AccountVariables.LCOIN_SHOP_PRODUCT_COUNT + product.getProductionId(), 0) >= product.getAccountDailyLimit())
|
||||
{
|
||||
if ((player.getAccountVariables().getLong("LCSTime" + product.getProductionId(), 0) + 86400000) > Chronos.currentTimeMillis())
|
||||
if ((player.getAccountVariables().getLong(AccountVariables.LCOIN_SHOP_PRODUCT_TIME + product.getProductionId(), 0) + 86400000) > Chronos.currentTimeMillis())
|
||||
{
|
||||
player.sendMessage("You have reached your daily limit."); // TODO: Retail system message?
|
||||
player.removeRequest(PrimeShopRequest.class);
|
||||
return;
|
||||
}
|
||||
// Reset limit.
|
||||
player.getAccountVariables().set("LCSCount" + product.getProductionId(), 0);
|
||||
player.getAccountVariables().set(AccountVariables.LCOIN_SHOP_PRODUCT_COUNT + product.getProductionId(), 0);
|
||||
}
|
||||
}
|
||||
else if (product.getAccountBuyLimit() > 0) // Count limit.
|
||||
{
|
||||
if (player.getAccountVariables().getInt(AccountVariables.LCOIN_SHOP_PRODUCT_COUNT + product.getProductionId(), 0) >= product.getAccountBuyLimit())
|
||||
{
|
||||
player.sendMessage("You cannot buy any more of this item."); // TODO: Retail system message?
|
||||
player.removeRequest(PrimeShopRequest.class);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -137,11 +153,15 @@ public class RequestPurchaseLimitShopItemBuy implements IClientIncomingPacket
|
||||
// Reward.
|
||||
player.addItem("LCoinShop", product.getProductionId(), _amount, player, true);
|
||||
|
||||
// Update player variables.
|
||||
// Update account variables.
|
||||
if (product.getAccountDailyLimit() > 0)
|
||||
{
|
||||
player.getAccountVariables().set("LCSTime" + product.getProductionId(), Chronos.currentTimeMillis());
|
||||
player.getAccountVariables().set("LCSCount" + product.getProductionId(), player.getAccountVariables().getInt("LCSCount" + product.getProductionId(), 0) + 1);
|
||||
player.getAccountVariables().set(AccountVariables.LCOIN_SHOP_PRODUCT_TIME + product.getProductionId(), Chronos.currentTimeMillis());
|
||||
player.getAccountVariables().set(AccountVariables.LCOIN_SHOP_PRODUCT_COUNT + product.getProductionId(), player.getAccountVariables().getInt(AccountVariables.LCOIN_SHOP_PRODUCT_COUNT + product.getProductionId(), 0) + 1);
|
||||
}
|
||||
else if (product.getAccountBuyLimit() > 0)
|
||||
{
|
||||
player.getAccountVariables().set(AccountVariables.LCOIN_SHOP_PRODUCT_COUNT + product.getProductionId(), player.getAccountVariables().getInt(AccountVariables.LCOIN_SHOP_PRODUCT_COUNT + product.getProductionId(), 0) + 1);
|
||||
}
|
||||
|
||||
// Remove request.
|
||||
|
@@ -23,6 +23,7 @@ import org.l2jmobius.commons.util.Chronos;
|
||||
import org.l2jmobius.gameserver.data.xml.LCoinShopData;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.holders.LCoinShopProductHolder;
|
||||
import org.l2jmobius.gameserver.model.variables.AccountVariables;
|
||||
import org.l2jmobius.gameserver.network.OutgoingPackets;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket;
|
||||
|
||||
@@ -75,27 +76,38 @@ public class ExPurchaseLimitShopItemListNew implements IClientOutgoingPacket
|
||||
packet.writeC(-1); // ?
|
||||
packet.writeC(-1); // ?
|
||||
|
||||
// Sale period.
|
||||
if (product.getAccountDailyLimit() > 0)
|
||||
// Check limits.
|
||||
if (product.getAccountDailyLimit() > 0) // Sale period.
|
||||
{
|
||||
if (_player.getAccountVariables().getInt("LCSCount" + product.getProductionId(), 0) >= product.getAccountDailyLimit())
|
||||
if (_player.getAccountVariables().getInt(AccountVariables.LCOIN_SHOP_PRODUCT_COUNT + product.getProductionId(), 0) >= product.getAccountDailyLimit())
|
||||
{
|
||||
if ((_player.getAccountVariables().getLong("LCSTime" + product.getProductionId(), 0) + 86400000) > Chronos.currentTimeMillis())
|
||||
if ((_player.getAccountVariables().getLong(AccountVariables.LCOIN_SHOP_PRODUCT_TIME + product.getProductionId(), 0) + 86400000) > Chronos.currentTimeMillis())
|
||||
{
|
||||
packet.writeD(0x00);
|
||||
}
|
||||
else // Reset limit.
|
||||
{
|
||||
_player.getAccountVariables().remove("LCSCount" + product.getProductionId());
|
||||
_player.getAccountVariables().remove(AccountVariables.LCOIN_SHOP_PRODUCT_COUNT + product.getProductionId());
|
||||
packet.writeD(product.getAccountDailyLimit());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
packet.writeD(product.getAccountDailyLimit() - _player.getAccountVariables().getInt("LCSCount" + product.getProductionId(), 0));
|
||||
packet.writeD(product.getAccountDailyLimit() - _player.getAccountVariables().getInt(AccountVariables.LCOIN_SHOP_PRODUCT_COUNT + product.getProductionId(), 0));
|
||||
}
|
||||
}
|
||||
else // No account daily limit.
|
||||
else if (product.getAccountBuyLimit() > 0) // Count limit.
|
||||
{
|
||||
if (_player.getAccountVariables().getInt(AccountVariables.LCOIN_SHOP_PRODUCT_COUNT + product.getProductionId(), 0) >= product.getAccountBuyLimit())
|
||||
{
|
||||
packet.writeD(0x00);
|
||||
}
|
||||
else
|
||||
{
|
||||
packet.writeD(product.getAccountBuyLimit() - _player.getAccountVariables().getInt(AccountVariables.LCOIN_SHOP_PRODUCT_COUNT + product.getProductionId(), 0));
|
||||
}
|
||||
}
|
||||
else // No account limits.
|
||||
{
|
||||
packet.writeD(0x01);
|
||||
}
|
||||
|
Reference in New Issue
Block a user