From 0fc220755ab7f33fd384e59608577c3f6789bff9 Mon Sep 17 00:00:00 2001
From: MobiusDevelopment <8391001+MobiusDevelopment@users.noreply.github.com>
Date: Wed, 19 May 2021 22:46:47 +0000
Subject: [PATCH] Support for limitshop ingedient enchants.
---
.../dist/game/data/xsd/LimitShop.xsd | 1 +
.../data/xml/LimitShopCraftData.java | 20 ++++++++++++-
.../gameserver/data/xml/LimitShopData.java | 20 ++++++++++++-
.../model/holders/LimitShopProductHolder.java | 9 +++++-
.../RequestPurchaseLimitShopItemBuy.java | 23 ++++++++++++--
.../ExPurchaseLimitShopItemListNew.java | 7 ++---
.../dist/game/data/xsd/LimitShop.xsd | 1 +
.../data/xml/LimitShopClanData.java | 30 ++++++++++++++++++-
.../data/xml/LimitShopCraftData.java | 30 ++++++++++++++++++-
.../gameserver/data/xml/LimitShopData.java | 30 ++++++++++++++++++-
.../model/holders/LimitShopProductHolder.java | 9 +++++-
.../RequestPurchaseLimitShopItemBuy.java | 23 ++++++++++++--
.../ExPurchaseLimitShopItemListNew.java | 11 ++++---
13 files changed, 193 insertions(+), 21 deletions(-)
diff --git a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/xsd/LimitShop.xsd b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/xsd/LimitShop.xsd
index 0644ebd28b..a53fcf1178 100644
--- a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/xsd/LimitShop.xsd
+++ b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/xsd/LimitShop.xsd
@@ -11,6 +11,7 @@
+
diff --git a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/data/xml/LimitShopCraftData.java b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/data/xml/LimitShopCraftData.java
index dd73871321..7e99a875ca 100644
--- a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/data/xml/LimitShopCraftData.java
+++ b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/data/xml/LimitShopCraftData.java
@@ -98,6 +98,10 @@ public class LimitShopCraftData implements IXmlReader
ingredientQuantities[0] = 0;
ingredientQuantities[1] = 0;
ingredientQuantities[2] = 0;
+ final int[] ingredientEnchants = new int[3];
+ ingredientEnchants[0] = 0;
+ ingredientEnchants[1] = 0;
+ ingredientEnchants[2] = 0;
int productionId = 0;
int productionId2 = 0;
int productionId3 = 0;
@@ -116,6 +120,7 @@ public class LimitShopCraftData implements IXmlReader
{
final int ingredientId = parseInteger(attrs, "id");
final long ingredientQuantity = parseLong(attrs, "count", 1L);
+ final int ingredientEnchant = parseInteger(attrs, "enchant", 0);
final Item item = ItemTable.getInstance().getTemplate(ingredientId);
if (item == null)
@@ -149,6 +154,19 @@ public class LimitShopCraftData implements IXmlReader
{
ingredientQuantities[2] = ingredientQuantity;
}
+
+ if (ingredientEnchants[0] == 0)
+ {
+ ingredientEnchants[0] = ingredientEnchant;
+ }
+ else if (ingredientEnchants[1] == 0)
+ {
+ ingredientEnchants[1] = ingredientEnchant;
+ }
+ else
+ {
+ ingredientEnchants[2] = ingredientEnchant;
+ }
}
else if ("production".equalsIgnoreCase(b.getNodeName()))
{
@@ -172,7 +190,7 @@ public class LimitShopCraftData implements IXmlReader
}
}
- _products.add(new LimitShopProductHolder(id, category, minLevel, maxLevel, ingredientIds, ingredientQuantities, productionId, count, chance, productionId2, count2, chance2, productionId3, count3, accountDailyLimit, accountBuyLimit));
+ _products.add(new LimitShopProductHolder(id, category, minLevel, maxLevel, ingredientIds, ingredientQuantities, ingredientEnchants, productionId, count, chance, productionId2, count2, chance2, productionId3, count3, accountDailyLimit, accountBuyLimit));
}
}
}
diff --git a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/data/xml/LimitShopData.java b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/data/xml/LimitShopData.java
index 2ffa351cf5..8e6b379545 100644
--- a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/data/xml/LimitShopData.java
+++ b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/data/xml/LimitShopData.java
@@ -98,6 +98,10 @@ public class LimitShopData implements IXmlReader
ingredientQuantities[0] = 0;
ingredientQuantities[1] = 0;
ingredientQuantities[2] = 0;
+ final int[] ingredientEnchants = new int[3];
+ ingredientEnchants[0] = 0;
+ ingredientEnchants[1] = 0;
+ ingredientEnchants[2] = 0;
int productionId = 0;
int accountDailyLimit = 0;
int accountBuyLimit = 0;
@@ -109,6 +113,7 @@ public class LimitShopData implements IXmlReader
{
final int ingredientId = parseInteger(attrs, "id");
final long ingredientQuantity = parseLong(attrs, "count", 1L);
+ final int ingredientEnchant = parseInteger(attrs, "enchant", 0);
final Item item = ItemTable.getInstance().getTemplate(ingredientId);
if (item == null)
@@ -142,6 +147,19 @@ public class LimitShopData implements IXmlReader
{
ingredientQuantities[2] = ingredientQuantity;
}
+
+ if (ingredientEnchants[0] == 0)
+ {
+ ingredientEnchants[0] = ingredientEnchant;
+ }
+ else if (ingredientEnchants[1] == 0)
+ {
+ ingredientEnchants[1] = ingredientEnchant;
+ }
+ else
+ {
+ ingredientEnchants[2] = ingredientEnchant;
+ }
}
else if ("production".equalsIgnoreCase(b.getNodeName()))
{
@@ -158,7 +176,7 @@ public class LimitShopData implements IXmlReader
}
}
- _products.add(new LimitShopProductHolder(id, category, minLevel, maxLevel, ingredientIds, ingredientQuantities, productionId, 0, 0, 0, 0, 0, 0, 0, accountDailyLimit, accountBuyLimit));
+ _products.add(new LimitShopProductHolder(id, category, minLevel, maxLevel, ingredientIds, ingredientQuantities, ingredientEnchants, productionId, 0, 0, 0, 0, 0, 0, 0, accountDailyLimit, accountBuyLimit));
}
}
}
diff --git a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/holders/LimitShopProductHolder.java b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/holders/LimitShopProductHolder.java
index 6354bc1c8f..244131e4b6 100644
--- a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/holders/LimitShopProductHolder.java
+++ b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/holders/LimitShopProductHolder.java
@@ -27,6 +27,7 @@ public class LimitShopProductHolder
private final int _maxLevel;
private final int[] _ingredientIds;
private final long[] _ingredientQuantities;
+ private final int[] _ingredientEnchants;
private final int _productionId;
private final long _count;
private final float _chance;
@@ -38,7 +39,7 @@ public class LimitShopProductHolder
private final int _accountDailyLimit;
private final int _accountBuyLimit;
- public LimitShopProductHolder(int id, int category, int minLevel, int maxLevel, int[] ingredientIds, long[] ingredientQuantities, int productionId, long count, float chance, int productionId2, long count2, float chance2, int productionId3, long count3, int accountDailyLimit, int accountBuyLimit)
+ public LimitShopProductHolder(int id, int category, int minLevel, int maxLevel, int[] ingredientIds, long[] ingredientQuantities, int[] ingredientEnchants, int productionId, long count, float chance, int productionId2, long count2, float chance2, int productionId3, long count3, int accountDailyLimit, int accountBuyLimit)
{
_id = id;
_category = category;
@@ -46,6 +47,7 @@ public class LimitShopProductHolder
_maxLevel = maxLevel;
_ingredientIds = ingredientIds;
_ingredientQuantities = ingredientQuantities;
+ _ingredientEnchants = ingredientEnchants;
_productionId = productionId;
_count = count;
_chance = chance;
@@ -88,6 +90,11 @@ public class LimitShopProductHolder
return _ingredientQuantities;
}
+ public int[] getIngredientEnchants()
+ {
+ return _ingredientEnchants;
+ }
+
public int getProductionId()
{
return _productionId;
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 c61f55c841..a4c45a408e 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
@@ -17,6 +17,7 @@
package org.l2jmobius.gameserver.network.clientpackets.limitshop;
import java.util.ArrayList;
+import java.util.Collection;
import java.util.List;
import org.l2jmobius.Config;
@@ -30,6 +31,7 @@ import org.l2jmobius.gameserver.model.actor.request.PrimeShopRequest;
import org.l2jmobius.gameserver.model.holders.LimitShopProductHolder;
import org.l2jmobius.gameserver.model.holders.LimitShopRandomCraftReward;
import org.l2jmobius.gameserver.model.itemcontainer.Inventory;
+import org.l2jmobius.gameserver.model.items.instance.ItemInstance;
import org.l2jmobius.gameserver.model.variables.AccountVariables;
import org.l2jmobius.gameserver.network.GameClient;
import org.l2jmobius.gameserver.network.SystemMessageId;
@@ -151,7 +153,7 @@ public class RequestPurchaseLimitShopItemBuy implements IClientIncomingPacket
return;
}
}
- else if (player.getInventory().getInventoryItemCount(_product.getIngredientIds()[i], -1, true) < (_product.getIngredientQuantities()[i] * _amount))
+ else if (player.getInventory().getInventoryItemCount(_product.getIngredientIds()[i], _product.getIngredientEnchants()[i], true) < (_product.getIngredientQuantities()[i] * _amount))
{
player.sendPacket(SystemMessageId.INCORRECT_ITEM_COUNT_2);
player.removeRequest(PrimeShopRequest.class);
@@ -172,7 +174,24 @@ public class RequestPurchaseLimitShopItemBuy implements IClientIncomingPacket
}
else
{
- player.destroyItemByItemId("LCoinShop", _product.getIngredientIds()[i], _product.getIngredientQuantities()[i] * _amount, player, true);
+ if (_product.getIngredientEnchants()[i] > 0)
+ {
+ int count = 0;
+ final Collection items = player.getInventory().getAllItemsByItemId(_product.getIngredientIds()[i], _product.getIngredientEnchants()[i]);
+ for (ItemInstance item : items)
+ {
+ if (count == _amount)
+ {
+ break;
+ }
+ count++;
+ player.destroyItem("LCoinShop", item, player, true);
+ }
+ }
+ else
+ {
+ player.destroyItemByItemId("LCoinShop", _product.getIngredientIds()[i], _product.getIngredientQuantities()[i] * _amount, player, true);
+ }
}
if (Config.VIP_SYSTEM_L_SHOP_AFFECT)
{
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 a09ab6765a..0b3a3d7f4a 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
@@ -79,10 +79,9 @@ public class ExPurchaseLimitShopItemListNew implements IClientOutgoingPacket
packet.writeQ(product.getIngredientQuantities()[0]);
packet.writeQ(product.getIngredientQuantities()[1]);
packet.writeQ(product.getIngredientQuantities()[2]);
-
- packet.writeH(0x00); // sCostItemEnchant 1
- packet.writeH(0x00); // sCostItemEnchant 2
- packet.writeH(0x00); // sCostItemEnchant 3
+ packet.writeH(product.getIngredientEnchants()[0]);
+ packet.writeH(product.getIngredientEnchants()[1]);
+ packet.writeH(product.getIngredientEnchants()[2]);
// Check limits.
if (product.getAccountDailyLimit() > 0) // Sale period.
diff --git a/L2J_Mobius_Essence_5.0_Sylph/dist/game/data/xsd/LimitShop.xsd b/L2J_Mobius_Essence_5.0_Sylph/dist/game/data/xsd/LimitShop.xsd
index 48ac6b9ca0..1cf8cc4aab 100644
--- a/L2J_Mobius_Essence_5.0_Sylph/dist/game/data/xsd/LimitShop.xsd
+++ b/L2J_Mobius_Essence_5.0_Sylph/dist/game/data/xsd/LimitShop.xsd
@@ -11,6 +11,7 @@
+
diff --git a/L2J_Mobius_Essence_5.0_Sylph/java/org/l2jmobius/gameserver/data/xml/LimitShopClanData.java b/L2J_Mobius_Essence_5.0_Sylph/java/org/l2jmobius/gameserver/data/xml/LimitShopClanData.java
index 783884e500..d4edfa84fe 100644
--- a/L2J_Mobius_Essence_5.0_Sylph/java/org/l2jmobius/gameserver/data/xml/LimitShopClanData.java
+++ b/L2J_Mobius_Essence_5.0_Sylph/java/org/l2jmobius/gameserver/data/xml/LimitShopClanData.java
@@ -102,6 +102,12 @@ public class LimitShopClanData implements IXmlReader
ingredientQuantities[2] = 0;
ingredientQuantities[3] = 0;
ingredientQuantities[4] = 0;
+ final int[] ingredientEnchants = new int[5];
+ ingredientEnchants[0] = 0;
+ ingredientEnchants[1] = 0;
+ ingredientEnchants[2] = 0;
+ ingredientEnchants[3] = 0;
+ ingredientEnchants[4] = 0;
int productionId = 0;
int accountDailyLimit = 0;
int accountBuyLimit = 0;
@@ -113,6 +119,7 @@ public class LimitShopClanData implements IXmlReader
{
final int ingredientId = parseInteger(attrs, "id");
final long ingredientQuantity = parseLong(attrs, "count", 1L);
+ final int ingredientEnchant = parseInteger(attrs, "enchant", 0);
final Item item = ItemTable.getInstance().getTemplate(ingredientId);
if (item == null)
@@ -162,6 +169,27 @@ public class LimitShopClanData implements IXmlReader
{
ingredientQuantities[4] = ingredientQuantity;
}
+
+ if (ingredientEnchants[0] == 0)
+ {
+ ingredientEnchants[0] = ingredientEnchant;
+ }
+ else if (ingredientEnchants[1] == 0)
+ {
+ ingredientEnchants[1] = ingredientEnchant;
+ }
+ else if (ingredientEnchants[2] == 0)
+ {
+ ingredientEnchants[2] = ingredientEnchant;
+ }
+ else if (ingredientEnchants[3] == 0)
+ {
+ ingredientEnchants[3] = ingredientEnchant;
+ }
+ else
+ {
+ ingredientEnchants[4] = ingredientEnchant;
+ }
}
else if ("production".equalsIgnoreCase(b.getNodeName()))
{
@@ -178,7 +206,7 @@ public class LimitShopClanData implements IXmlReader
}
}
- _products.add(new LimitShopProductHolder(id, category, minLevel, maxLevel, ingredientIds, ingredientQuantities, productionId, 0, 0, 0, 0, 0, 0, 0, accountDailyLimit, accountBuyLimit));
+ _products.add(new LimitShopProductHolder(id, category, minLevel, maxLevel, ingredientIds, ingredientQuantities, ingredientEnchants, productionId, 0, 0, 0, 0, 0, 0, 0, accountDailyLimit, accountBuyLimit));
}
}
}
diff --git a/L2J_Mobius_Essence_5.0_Sylph/java/org/l2jmobius/gameserver/data/xml/LimitShopCraftData.java b/L2J_Mobius_Essence_5.0_Sylph/java/org/l2jmobius/gameserver/data/xml/LimitShopCraftData.java
index 4ab0364806..19409010a0 100644
--- a/L2J_Mobius_Essence_5.0_Sylph/java/org/l2jmobius/gameserver/data/xml/LimitShopCraftData.java
+++ b/L2J_Mobius_Essence_5.0_Sylph/java/org/l2jmobius/gameserver/data/xml/LimitShopCraftData.java
@@ -102,6 +102,12 @@ public class LimitShopCraftData implements IXmlReader
ingredientQuantities[2] = 0;
ingredientQuantities[3] = 0;
ingredientQuantities[4] = 0;
+ final int[] ingredientEnchants = new int[5];
+ ingredientEnchants[0] = 0;
+ ingredientEnchants[1] = 0;
+ ingredientEnchants[2] = 0;
+ ingredientEnchants[3] = 0;
+ ingredientEnchants[4] = 0;
int productionId = 0;
int productionId2 = 0;
int productionId3 = 0;
@@ -120,6 +126,7 @@ public class LimitShopCraftData implements IXmlReader
{
final int ingredientId = parseInteger(attrs, "id");
final long ingredientQuantity = parseLong(attrs, "count", 1L);
+ final int ingredientEnchant = parseInteger(attrs, "enchant", 0);
final Item item = ItemTable.getInstance().getTemplate(ingredientId);
if (item == null)
@@ -169,6 +176,27 @@ public class LimitShopCraftData implements IXmlReader
{
ingredientQuantities[4] = ingredientQuantity;
}
+
+ if (ingredientEnchants[0] == 0)
+ {
+ ingredientEnchants[0] = ingredientEnchant;
+ }
+ else if (ingredientEnchants[1] == 0)
+ {
+ ingredientEnchants[1] = ingredientEnchant;
+ }
+ else if (ingredientEnchants[2] == 0)
+ {
+ ingredientEnchants[2] = ingredientEnchant;
+ }
+ else if (ingredientEnchants[3] == 0)
+ {
+ ingredientEnchants[3] = ingredientEnchant;
+ }
+ else
+ {
+ ingredientEnchants[4] = ingredientEnchant;
+ }
}
else if ("production".equalsIgnoreCase(b.getNodeName()))
{
@@ -192,7 +220,7 @@ public class LimitShopCraftData implements IXmlReader
}
}
- _products.add(new LimitShopProductHolder(id, category, minLevel, maxLevel, ingredientIds, ingredientQuantities, productionId, count, chance, productionId2, count2, chance2, productionId3, count3, accountDailyLimit, accountBuyLimit));
+ _products.add(new LimitShopProductHolder(id, category, minLevel, maxLevel, ingredientIds, ingredientQuantities, ingredientEnchants, productionId, count, chance, productionId2, count2, chance2, productionId3, count3, accountDailyLimit, accountBuyLimit));
}
}
}
diff --git a/L2J_Mobius_Essence_5.0_Sylph/java/org/l2jmobius/gameserver/data/xml/LimitShopData.java b/L2J_Mobius_Essence_5.0_Sylph/java/org/l2jmobius/gameserver/data/xml/LimitShopData.java
index 70446ab60c..34d76bd86c 100644
--- a/L2J_Mobius_Essence_5.0_Sylph/java/org/l2jmobius/gameserver/data/xml/LimitShopData.java
+++ b/L2J_Mobius_Essence_5.0_Sylph/java/org/l2jmobius/gameserver/data/xml/LimitShopData.java
@@ -102,6 +102,12 @@ public class LimitShopData implements IXmlReader
ingredientQuantities[2] = 0;
ingredientQuantities[3] = 0;
ingredientQuantities[4] = 0;
+ final int[] ingredientEnchants = new int[5];
+ ingredientEnchants[0] = 0;
+ ingredientEnchants[1] = 0;
+ ingredientEnchants[2] = 0;
+ ingredientEnchants[3] = 0;
+ ingredientEnchants[4] = 0;
int productionId = 0;
int accountDailyLimit = 0;
int accountBuyLimit = 0;
@@ -113,6 +119,7 @@ public class LimitShopData implements IXmlReader
{
final int ingredientId = parseInteger(attrs, "id");
final long ingredientQuantity = parseLong(attrs, "count", 1L);
+ final int ingredientEnchant = parseInteger(attrs, "enchant", 0);
final Item item = ItemTable.getInstance().getTemplate(ingredientId);
if (item == null)
@@ -162,6 +169,27 @@ public class LimitShopData implements IXmlReader
{
ingredientQuantities[4] = ingredientQuantity;
}
+
+ if (ingredientEnchants[0] == 0)
+ {
+ ingredientEnchants[0] = ingredientEnchant;
+ }
+ else if (ingredientEnchants[1] == 0)
+ {
+ ingredientEnchants[1] = ingredientEnchant;
+ }
+ else if (ingredientEnchants[2] == 0)
+ {
+ ingredientEnchants[2] = ingredientEnchant;
+ }
+ else if (ingredientEnchants[3] == 0)
+ {
+ ingredientEnchants[3] = ingredientEnchant;
+ }
+ else
+ {
+ ingredientEnchants[4] = ingredientEnchant;
+ }
}
else if ("production".equalsIgnoreCase(b.getNodeName()))
{
@@ -178,7 +206,7 @@ public class LimitShopData implements IXmlReader
}
}
- _products.add(new LimitShopProductHolder(id, category, minLevel, maxLevel, ingredientIds, ingredientQuantities, productionId, 0, 0, 0, 0, 0, 0, 0, accountDailyLimit, accountBuyLimit));
+ _products.add(new LimitShopProductHolder(id, category, minLevel, maxLevel, ingredientIds, ingredientQuantities, ingredientEnchants, productionId, 0, 0, 0, 0, 0, 0, 0, accountDailyLimit, accountBuyLimit));
}
}
}
diff --git a/L2J_Mobius_Essence_5.0_Sylph/java/org/l2jmobius/gameserver/model/holders/LimitShopProductHolder.java b/L2J_Mobius_Essence_5.0_Sylph/java/org/l2jmobius/gameserver/model/holders/LimitShopProductHolder.java
index 6354bc1c8f..244131e4b6 100644
--- a/L2J_Mobius_Essence_5.0_Sylph/java/org/l2jmobius/gameserver/model/holders/LimitShopProductHolder.java
+++ b/L2J_Mobius_Essence_5.0_Sylph/java/org/l2jmobius/gameserver/model/holders/LimitShopProductHolder.java
@@ -27,6 +27,7 @@ public class LimitShopProductHolder
private final int _maxLevel;
private final int[] _ingredientIds;
private final long[] _ingredientQuantities;
+ private final int[] _ingredientEnchants;
private final int _productionId;
private final long _count;
private final float _chance;
@@ -38,7 +39,7 @@ public class LimitShopProductHolder
private final int _accountDailyLimit;
private final int _accountBuyLimit;
- public LimitShopProductHolder(int id, int category, int minLevel, int maxLevel, int[] ingredientIds, long[] ingredientQuantities, int productionId, long count, float chance, int productionId2, long count2, float chance2, int productionId3, long count3, int accountDailyLimit, int accountBuyLimit)
+ public LimitShopProductHolder(int id, int category, int minLevel, int maxLevel, int[] ingredientIds, long[] ingredientQuantities, int[] ingredientEnchants, int productionId, long count, float chance, int productionId2, long count2, float chance2, int productionId3, long count3, int accountDailyLimit, int accountBuyLimit)
{
_id = id;
_category = category;
@@ -46,6 +47,7 @@ public class LimitShopProductHolder
_maxLevel = maxLevel;
_ingredientIds = ingredientIds;
_ingredientQuantities = ingredientQuantities;
+ _ingredientEnchants = ingredientEnchants;
_productionId = productionId;
_count = count;
_chance = chance;
@@ -88,6 +90,11 @@ public class LimitShopProductHolder
return _ingredientQuantities;
}
+ public int[] getIngredientEnchants()
+ {
+ return _ingredientEnchants;
+ }
+
public int getProductionId()
{
return _productionId;
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 020206bdc3..36631494f0 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
@@ -17,6 +17,7 @@
package org.l2jmobius.gameserver.network.clientpackets.limitshop;
import java.util.ArrayList;
+import java.util.Collection;
import java.util.List;
import org.l2jmobius.Config;
@@ -32,6 +33,7 @@ import org.l2jmobius.gameserver.model.actor.request.PrimeShopRequest;
import org.l2jmobius.gameserver.model.holders.LimitShopProductHolder;
import org.l2jmobius.gameserver.model.holders.LimitShopRandomCraftReward;
import org.l2jmobius.gameserver.model.itemcontainer.Inventory;
+import org.l2jmobius.gameserver.model.items.instance.ItemInstance;
import org.l2jmobius.gameserver.model.variables.AccountVariables;
import org.l2jmobius.gameserver.network.GameClient;
import org.l2jmobius.gameserver.network.SystemMessageId;
@@ -167,7 +169,7 @@ public class RequestPurchaseLimitShopItemBuy implements IClientIncomingPacket
return;
}
}
- else if (player.getInventory().getInventoryItemCount(_product.getIngredientIds()[i], -1, true) < (_product.getIngredientQuantities()[i] * _amount))
+ else if (player.getInventory().getInventoryItemCount(_product.getIngredientIds()[i], _product.getIngredientEnchants()[i], true) < (_product.getIngredientQuantities()[i] * _amount))
{
player.sendPacket(SystemMessageId.INCORRECT_ITEM_COUNT_2);
player.removeRequest(PrimeShopRequest.class);
@@ -192,7 +194,24 @@ public class RequestPurchaseLimitShopItemBuy implements IClientIncomingPacket
}
else
{
- player.destroyItemByItemId("LCoinShop", _product.getIngredientIds()[i], _product.getIngredientQuantities()[i] * _amount, player, true);
+ if (_product.getIngredientEnchants()[i] > 0)
+ {
+ int count = 0;
+ final Collection items = player.getInventory().getAllItemsByItemId(_product.getIngredientIds()[i], _product.getIngredientEnchants()[i]);
+ for (ItemInstance item : items)
+ {
+ if (count == _amount)
+ {
+ break;
+ }
+ count++;
+ player.destroyItem("LCoinShop", item, player, true);
+ }
+ }
+ else
+ {
+ player.destroyItemByItemId("LCoinShop", _product.getIngredientIds()[i], _product.getIngredientQuantities()[i] * _amount, player, true);
+ }
}
if (Config.VIP_SYSTEM_L_SHOP_AFFECT)
{
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 d6461cf237..a782a35bc5 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
@@ -89,12 +89,11 @@ public class ExPurchaseLimitShopItemListNew implements IClientOutgoingPacket
packet.writeQ(product.getIngredientQuantities()[2]);
packet.writeQ(product.getIngredientQuantities()[3]); // 306
packet.writeQ(product.getIngredientQuantities()[4]); // 306
-
- packet.writeH(0x00); // sCostItemEnchant 1
- packet.writeH(0x00); // sCostItemEnchant 2
- packet.writeH(0x00); // sCostItemEnchant 3
- packet.writeH(0x00); // sCostItemEnchant 4 (306)
- packet.writeH(0x00); // sCostItemEnchant 5 (306)
+ packet.writeH(product.getIngredientEnchants()[0]);
+ packet.writeH(product.getIngredientEnchants()[1]);
+ packet.writeH(product.getIngredientEnchants()[2]);
+ packet.writeH(product.getIngredientEnchants()[3]); // 306
+ packet.writeH(product.getIngredientEnchants()[4]); // 306
// Check limits.
if (product.getAccountDailyLimit() > 0) // Sale period.