diff --git a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/xsd/LCoinShop.xsd b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/xsd/LCoinShop.xsd
index 52db6697a9..a5faea8ffe 100644
--- a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/xsd/LCoinShop.xsd
+++ b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/xsd/LCoinShop.xsd
@@ -20,7 +20,8 @@
-
+
+
@@ -28,6 +29,8 @@
+
+
diff --git a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/data/xml/LCoinShopData.java b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/data/xml/LCoinShopData.java
index 80f0d76d19..5c48bf717e 100644
--- a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/data/xml/LCoinShopData.java
+++ b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/data/xml/LCoinShopData.java
@@ -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));
}
}
}
diff --git a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/holders/LCoinShopProductHolder.java b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/holders/LCoinShopProductHolder.java
index bf614f5891..e5049dde97 100644
--- a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/holders/LCoinShopProductHolder.java
+++ b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/holders/LCoinShopProductHolder.java
@@ -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;
+ }
}
diff --git a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/variables/AccountVariables.java b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/variables/AccountVariables.java
index dbce4c8eea..dbb4b300bd 100644
--- a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/variables/AccountVariables.java
+++ b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/variables/AccountVariables.java
@@ -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;
diff --git a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/network/clientpackets/limitshop/RequestPurchaseLimitShopItemBuy.java b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/network/clientpackets/limitshop/RequestPurchaseLimitShopItemBuy.java
index 2c397d9bea..4918ba77d4 100644
--- a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/network/clientpackets/limitshop/RequestPurchaseLimitShopItemBuy.java
+++ b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/network/clientpackets/limitshop/RequestPurchaseLimitShopItemBuy.java
@@ -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.
diff --git a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/network/serverpackets/limitshop/ExPurchaseLimitShopItemListNew.java b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/network/serverpackets/limitshop/ExPurchaseLimitShopItemListNew.java
index e17e7dffe1..5e31da4c70 100644
--- a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/network/serverpackets/limitshop/ExPurchaseLimitShopItemListNew.java
+++ b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/network/serverpackets/limitshop/ExPurchaseLimitShopItemListNew.java
@@ -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);
}
diff --git a/L2J_Mobius_Essence_5.0_Sylph/dist/game/data/xsd/LCoinShop.xsd b/L2J_Mobius_Essence_5.0_Sylph/dist/game/data/xsd/LCoinShop.xsd
index 52db6697a9..a5faea8ffe 100644
--- a/L2J_Mobius_Essence_5.0_Sylph/dist/game/data/xsd/LCoinShop.xsd
+++ b/L2J_Mobius_Essence_5.0_Sylph/dist/game/data/xsd/LCoinShop.xsd
@@ -20,7 +20,8 @@
-
+
+
@@ -28,6 +29,8 @@
+
+
diff --git a/L2J_Mobius_Essence_5.0_Sylph/java/org/l2jmobius/gameserver/data/xml/LCoinShopData.java b/L2J_Mobius_Essence_5.0_Sylph/java/org/l2jmobius/gameserver/data/xml/LCoinShopData.java
index fd3fdb0492..f0c56c3d75 100644
--- a/L2J_Mobius_Essence_5.0_Sylph/java/org/l2jmobius/gameserver/data/xml/LCoinShopData.java
+++ b/L2J_Mobius_Essence_5.0_Sylph/java/org/l2jmobius/gameserver/data/xml/LCoinShopData.java
@@ -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));
}
}
}
diff --git a/L2J_Mobius_Essence_5.0_Sylph/java/org/l2jmobius/gameserver/model/holders/LCoinShopProductHolder.java b/L2J_Mobius_Essence_5.0_Sylph/java/org/l2jmobius/gameserver/model/holders/LCoinShopProductHolder.java
index bf614f5891..e5049dde97 100644
--- a/L2J_Mobius_Essence_5.0_Sylph/java/org/l2jmobius/gameserver/model/holders/LCoinShopProductHolder.java
+++ b/L2J_Mobius_Essence_5.0_Sylph/java/org/l2jmobius/gameserver/model/holders/LCoinShopProductHolder.java
@@ -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;
+ }
}
diff --git a/L2J_Mobius_Essence_5.0_Sylph/java/org/l2jmobius/gameserver/model/variables/AccountVariables.java b/L2J_Mobius_Essence_5.0_Sylph/java/org/l2jmobius/gameserver/model/variables/AccountVariables.java
index dbce4c8eea..dbb4b300bd 100644
--- a/L2J_Mobius_Essence_5.0_Sylph/java/org/l2jmobius/gameserver/model/variables/AccountVariables.java
+++ b/L2J_Mobius_Essence_5.0_Sylph/java/org/l2jmobius/gameserver/model/variables/AccountVariables.java
@@ -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;
diff --git a/L2J_Mobius_Essence_5.0_Sylph/java/org/l2jmobius/gameserver/network/clientpackets/limitshop/RequestPurchaseLimitShopItemBuy.java b/L2J_Mobius_Essence_5.0_Sylph/java/org/l2jmobius/gameserver/network/clientpackets/limitshop/RequestPurchaseLimitShopItemBuy.java
index 2c397d9bea..4918ba77d4 100644
--- a/L2J_Mobius_Essence_5.0_Sylph/java/org/l2jmobius/gameserver/network/clientpackets/limitshop/RequestPurchaseLimitShopItemBuy.java
+++ b/L2J_Mobius_Essence_5.0_Sylph/java/org/l2jmobius/gameserver/network/clientpackets/limitshop/RequestPurchaseLimitShopItemBuy.java
@@ -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.
diff --git a/L2J_Mobius_Essence_5.0_Sylph/java/org/l2jmobius/gameserver/network/serverpackets/limitshop/ExPurchaseLimitShopItemListNew.java b/L2J_Mobius_Essence_5.0_Sylph/java/org/l2jmobius/gameserver/network/serverpackets/limitshop/ExPurchaseLimitShopItemListNew.java
index 2efed4cd0e..b9d2ef7bf9 100644
--- a/L2J_Mobius_Essence_5.0_Sylph/java/org/l2jmobius/gameserver/network/serverpackets/limitshop/ExPurchaseLimitShopItemListNew.java
+++ b/L2J_Mobius_Essence_5.0_Sylph/java/org/l2jmobius/gameserver/network/serverpackets/limitshop/ExPurchaseLimitShopItemListNew.java
@@ -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);
}