Support for limitshop ingedient enchants.
This commit is contained in:
parent
713970df65
commit
0fc220755a
@ -11,6 +11,7 @@
|
|||||||
<xs:extension base="xs:string">
|
<xs:extension base="xs:string">
|
||||||
<xs:attribute type="xs:int" name="id" use="optional"/>
|
<xs:attribute type="xs:int" name="id" use="optional"/>
|
||||||
<xs:attribute type="xs:long" name="count" use="optional"/>
|
<xs:attribute type="xs:long" name="count" use="optional"/>
|
||||||
|
<xs:attribute type="xs:int" name="enchant" use="optional"/>
|
||||||
</xs:extension>
|
</xs:extension>
|
||||||
</xs:simpleContent>
|
</xs:simpleContent>
|
||||||
</xs:complexType>
|
</xs:complexType>
|
||||||
|
@ -98,6 +98,10 @@ public class LimitShopCraftData implements IXmlReader
|
|||||||
ingredientQuantities[0] = 0;
|
ingredientQuantities[0] = 0;
|
||||||
ingredientQuantities[1] = 0;
|
ingredientQuantities[1] = 0;
|
||||||
ingredientQuantities[2] = 0;
|
ingredientQuantities[2] = 0;
|
||||||
|
final int[] ingredientEnchants = new int[3];
|
||||||
|
ingredientEnchants[0] = 0;
|
||||||
|
ingredientEnchants[1] = 0;
|
||||||
|
ingredientEnchants[2] = 0;
|
||||||
int productionId = 0;
|
int productionId = 0;
|
||||||
int productionId2 = 0;
|
int productionId2 = 0;
|
||||||
int productionId3 = 0;
|
int productionId3 = 0;
|
||||||
@ -116,6 +120,7 @@ public class LimitShopCraftData implements IXmlReader
|
|||||||
{
|
{
|
||||||
final int ingredientId = parseInteger(attrs, "id");
|
final int ingredientId = parseInteger(attrs, "id");
|
||||||
final long ingredientQuantity = parseLong(attrs, "count", 1L);
|
final long ingredientQuantity = parseLong(attrs, "count", 1L);
|
||||||
|
final int ingredientEnchant = parseInteger(attrs, "enchant", 0);
|
||||||
|
|
||||||
final Item item = ItemTable.getInstance().getTemplate(ingredientId);
|
final Item item = ItemTable.getInstance().getTemplate(ingredientId);
|
||||||
if (item == null)
|
if (item == null)
|
||||||
@ -149,6 +154,19 @@ public class LimitShopCraftData implements IXmlReader
|
|||||||
{
|
{
|
||||||
ingredientQuantities[2] = ingredientQuantity;
|
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()))
|
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));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -98,6 +98,10 @@ public class LimitShopData implements IXmlReader
|
|||||||
ingredientQuantities[0] = 0;
|
ingredientQuantities[0] = 0;
|
||||||
ingredientQuantities[1] = 0;
|
ingredientQuantities[1] = 0;
|
||||||
ingredientQuantities[2] = 0;
|
ingredientQuantities[2] = 0;
|
||||||
|
final int[] ingredientEnchants = new int[3];
|
||||||
|
ingredientEnchants[0] = 0;
|
||||||
|
ingredientEnchants[1] = 0;
|
||||||
|
ingredientEnchants[2] = 0;
|
||||||
int productionId = 0;
|
int productionId = 0;
|
||||||
int accountDailyLimit = 0;
|
int accountDailyLimit = 0;
|
||||||
int accountBuyLimit = 0;
|
int accountBuyLimit = 0;
|
||||||
@ -109,6 +113,7 @@ public class LimitShopData implements IXmlReader
|
|||||||
{
|
{
|
||||||
final int ingredientId = parseInteger(attrs, "id");
|
final int ingredientId = parseInteger(attrs, "id");
|
||||||
final long ingredientQuantity = parseLong(attrs, "count", 1L);
|
final long ingredientQuantity = parseLong(attrs, "count", 1L);
|
||||||
|
final int ingredientEnchant = parseInteger(attrs, "enchant", 0);
|
||||||
|
|
||||||
final Item item = ItemTable.getInstance().getTemplate(ingredientId);
|
final Item item = ItemTable.getInstance().getTemplate(ingredientId);
|
||||||
if (item == null)
|
if (item == null)
|
||||||
@ -142,6 +147,19 @@ public class LimitShopData implements IXmlReader
|
|||||||
{
|
{
|
||||||
ingredientQuantities[2] = ingredientQuantity;
|
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()))
|
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));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -27,6 +27,7 @@ public class LimitShopProductHolder
|
|||||||
private final int _maxLevel;
|
private final int _maxLevel;
|
||||||
private final int[] _ingredientIds;
|
private final int[] _ingredientIds;
|
||||||
private final long[] _ingredientQuantities;
|
private final long[] _ingredientQuantities;
|
||||||
|
private final int[] _ingredientEnchants;
|
||||||
private final int _productionId;
|
private final int _productionId;
|
||||||
private final long _count;
|
private final long _count;
|
||||||
private final float _chance;
|
private final float _chance;
|
||||||
@ -38,7 +39,7 @@ public class LimitShopProductHolder
|
|||||||
private final int _accountDailyLimit;
|
private final int _accountDailyLimit;
|
||||||
private final int _accountBuyLimit;
|
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;
|
_id = id;
|
||||||
_category = category;
|
_category = category;
|
||||||
@ -46,6 +47,7 @@ public class LimitShopProductHolder
|
|||||||
_maxLevel = maxLevel;
|
_maxLevel = maxLevel;
|
||||||
_ingredientIds = ingredientIds;
|
_ingredientIds = ingredientIds;
|
||||||
_ingredientQuantities = ingredientQuantities;
|
_ingredientQuantities = ingredientQuantities;
|
||||||
|
_ingredientEnchants = ingredientEnchants;
|
||||||
_productionId = productionId;
|
_productionId = productionId;
|
||||||
_count = count;
|
_count = count;
|
||||||
_chance = chance;
|
_chance = chance;
|
||||||
@ -88,6 +90,11 @@ public class LimitShopProductHolder
|
|||||||
return _ingredientQuantities;
|
return _ingredientQuantities;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int[] getIngredientEnchants()
|
||||||
|
{
|
||||||
|
return _ingredientEnchants;
|
||||||
|
}
|
||||||
|
|
||||||
public int getProductionId()
|
public int getProductionId()
|
||||||
{
|
{
|
||||||
return _productionId;
|
return _productionId;
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
package org.l2jmobius.gameserver.network.clientpackets.limitshop;
|
package org.l2jmobius.gameserver.network.clientpackets.limitshop;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.l2jmobius.Config;
|
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.LimitShopProductHolder;
|
||||||
import org.l2jmobius.gameserver.model.holders.LimitShopRandomCraftReward;
|
import org.l2jmobius.gameserver.model.holders.LimitShopRandomCraftReward;
|
||||||
import org.l2jmobius.gameserver.model.itemcontainer.Inventory;
|
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.model.variables.AccountVariables;
|
||||||
import org.l2jmobius.gameserver.network.GameClient;
|
import org.l2jmobius.gameserver.network.GameClient;
|
||||||
import org.l2jmobius.gameserver.network.SystemMessageId;
|
import org.l2jmobius.gameserver.network.SystemMessageId;
|
||||||
@ -151,7 +153,7 @@ public class RequestPurchaseLimitShopItemBuy implements IClientIncomingPacket
|
|||||||
return;
|
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.sendPacket(SystemMessageId.INCORRECT_ITEM_COUNT_2);
|
||||||
player.removeRequest(PrimeShopRequest.class);
|
player.removeRequest(PrimeShopRequest.class);
|
||||||
@ -172,7 +174,24 @@ public class RequestPurchaseLimitShopItemBuy implements IClientIncomingPacket
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
player.destroyItemByItemId("LCoinShop", _product.getIngredientIds()[i], _product.getIngredientQuantities()[i] * _amount, player, true);
|
if (_product.getIngredientEnchants()[i] > 0)
|
||||||
|
{
|
||||||
|
int count = 0;
|
||||||
|
final Collection<ItemInstance> 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)
|
if (Config.VIP_SYSTEM_L_SHOP_AFFECT)
|
||||||
{
|
{
|
||||||
|
@ -79,10 +79,9 @@ public class ExPurchaseLimitShopItemListNew implements IClientOutgoingPacket
|
|||||||
packet.writeQ(product.getIngredientQuantities()[0]);
|
packet.writeQ(product.getIngredientQuantities()[0]);
|
||||||
packet.writeQ(product.getIngredientQuantities()[1]);
|
packet.writeQ(product.getIngredientQuantities()[1]);
|
||||||
packet.writeQ(product.getIngredientQuantities()[2]);
|
packet.writeQ(product.getIngredientQuantities()[2]);
|
||||||
|
packet.writeH(product.getIngredientEnchants()[0]);
|
||||||
packet.writeH(0x00); // sCostItemEnchant 1
|
packet.writeH(product.getIngredientEnchants()[1]);
|
||||||
packet.writeH(0x00); // sCostItemEnchant 2
|
packet.writeH(product.getIngredientEnchants()[2]);
|
||||||
packet.writeH(0x00); // sCostItemEnchant 3
|
|
||||||
|
|
||||||
// Check limits.
|
// Check limits.
|
||||||
if (product.getAccountDailyLimit() > 0) // Sale period.
|
if (product.getAccountDailyLimit() > 0) // Sale period.
|
||||||
|
@ -11,6 +11,7 @@
|
|||||||
<xs:extension base="xs:string">
|
<xs:extension base="xs:string">
|
||||||
<xs:attribute type="xs:int" name="id" use="optional"/>
|
<xs:attribute type="xs:int" name="id" use="optional"/>
|
||||||
<xs:attribute type="xs:long" name="count" use="optional"/>
|
<xs:attribute type="xs:long" name="count" use="optional"/>
|
||||||
|
<xs:attribute type="xs:int" name="enchant" use="optional"/>
|
||||||
</xs:extension>
|
</xs:extension>
|
||||||
</xs:simpleContent>
|
</xs:simpleContent>
|
||||||
</xs:complexType>
|
</xs:complexType>
|
||||||
|
@ -102,6 +102,12 @@ public class LimitShopClanData implements IXmlReader
|
|||||||
ingredientQuantities[2] = 0;
|
ingredientQuantities[2] = 0;
|
||||||
ingredientQuantities[3] = 0;
|
ingredientQuantities[3] = 0;
|
||||||
ingredientQuantities[4] = 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 productionId = 0;
|
||||||
int accountDailyLimit = 0;
|
int accountDailyLimit = 0;
|
||||||
int accountBuyLimit = 0;
|
int accountBuyLimit = 0;
|
||||||
@ -113,6 +119,7 @@ public class LimitShopClanData implements IXmlReader
|
|||||||
{
|
{
|
||||||
final int ingredientId = parseInteger(attrs, "id");
|
final int ingredientId = parseInteger(attrs, "id");
|
||||||
final long ingredientQuantity = parseLong(attrs, "count", 1L);
|
final long ingredientQuantity = parseLong(attrs, "count", 1L);
|
||||||
|
final int ingredientEnchant = parseInteger(attrs, "enchant", 0);
|
||||||
|
|
||||||
final Item item = ItemTable.getInstance().getTemplate(ingredientId);
|
final Item item = ItemTable.getInstance().getTemplate(ingredientId);
|
||||||
if (item == null)
|
if (item == null)
|
||||||
@ -162,6 +169,27 @@ public class LimitShopClanData implements IXmlReader
|
|||||||
{
|
{
|
||||||
ingredientQuantities[4] = ingredientQuantity;
|
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()))
|
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));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -102,6 +102,12 @@ public class LimitShopCraftData implements IXmlReader
|
|||||||
ingredientQuantities[2] = 0;
|
ingredientQuantities[2] = 0;
|
||||||
ingredientQuantities[3] = 0;
|
ingredientQuantities[3] = 0;
|
||||||
ingredientQuantities[4] = 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 productionId = 0;
|
||||||
int productionId2 = 0;
|
int productionId2 = 0;
|
||||||
int productionId3 = 0;
|
int productionId3 = 0;
|
||||||
@ -120,6 +126,7 @@ public class LimitShopCraftData implements IXmlReader
|
|||||||
{
|
{
|
||||||
final int ingredientId = parseInteger(attrs, "id");
|
final int ingredientId = parseInteger(attrs, "id");
|
||||||
final long ingredientQuantity = parseLong(attrs, "count", 1L);
|
final long ingredientQuantity = parseLong(attrs, "count", 1L);
|
||||||
|
final int ingredientEnchant = parseInteger(attrs, "enchant", 0);
|
||||||
|
|
||||||
final Item item = ItemTable.getInstance().getTemplate(ingredientId);
|
final Item item = ItemTable.getInstance().getTemplate(ingredientId);
|
||||||
if (item == null)
|
if (item == null)
|
||||||
@ -169,6 +176,27 @@ public class LimitShopCraftData implements IXmlReader
|
|||||||
{
|
{
|
||||||
ingredientQuantities[4] = ingredientQuantity;
|
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()))
|
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));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -102,6 +102,12 @@ public class LimitShopData implements IXmlReader
|
|||||||
ingredientQuantities[2] = 0;
|
ingredientQuantities[2] = 0;
|
||||||
ingredientQuantities[3] = 0;
|
ingredientQuantities[3] = 0;
|
||||||
ingredientQuantities[4] = 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 productionId = 0;
|
||||||
int accountDailyLimit = 0;
|
int accountDailyLimit = 0;
|
||||||
int accountBuyLimit = 0;
|
int accountBuyLimit = 0;
|
||||||
@ -113,6 +119,7 @@ public class LimitShopData implements IXmlReader
|
|||||||
{
|
{
|
||||||
final int ingredientId = parseInteger(attrs, "id");
|
final int ingredientId = parseInteger(attrs, "id");
|
||||||
final long ingredientQuantity = parseLong(attrs, "count", 1L);
|
final long ingredientQuantity = parseLong(attrs, "count", 1L);
|
||||||
|
final int ingredientEnchant = parseInteger(attrs, "enchant", 0);
|
||||||
|
|
||||||
final Item item = ItemTable.getInstance().getTemplate(ingredientId);
|
final Item item = ItemTable.getInstance().getTemplate(ingredientId);
|
||||||
if (item == null)
|
if (item == null)
|
||||||
@ -162,6 +169,27 @@ public class LimitShopData implements IXmlReader
|
|||||||
{
|
{
|
||||||
ingredientQuantities[4] = ingredientQuantity;
|
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()))
|
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));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -27,6 +27,7 @@ public class LimitShopProductHolder
|
|||||||
private final int _maxLevel;
|
private final int _maxLevel;
|
||||||
private final int[] _ingredientIds;
|
private final int[] _ingredientIds;
|
||||||
private final long[] _ingredientQuantities;
|
private final long[] _ingredientQuantities;
|
||||||
|
private final int[] _ingredientEnchants;
|
||||||
private final int _productionId;
|
private final int _productionId;
|
||||||
private final long _count;
|
private final long _count;
|
||||||
private final float _chance;
|
private final float _chance;
|
||||||
@ -38,7 +39,7 @@ public class LimitShopProductHolder
|
|||||||
private final int _accountDailyLimit;
|
private final int _accountDailyLimit;
|
||||||
private final int _accountBuyLimit;
|
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;
|
_id = id;
|
||||||
_category = category;
|
_category = category;
|
||||||
@ -46,6 +47,7 @@ public class LimitShopProductHolder
|
|||||||
_maxLevel = maxLevel;
|
_maxLevel = maxLevel;
|
||||||
_ingredientIds = ingredientIds;
|
_ingredientIds = ingredientIds;
|
||||||
_ingredientQuantities = ingredientQuantities;
|
_ingredientQuantities = ingredientQuantities;
|
||||||
|
_ingredientEnchants = ingredientEnchants;
|
||||||
_productionId = productionId;
|
_productionId = productionId;
|
||||||
_count = count;
|
_count = count;
|
||||||
_chance = chance;
|
_chance = chance;
|
||||||
@ -88,6 +90,11 @@ public class LimitShopProductHolder
|
|||||||
return _ingredientQuantities;
|
return _ingredientQuantities;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int[] getIngredientEnchants()
|
||||||
|
{
|
||||||
|
return _ingredientEnchants;
|
||||||
|
}
|
||||||
|
|
||||||
public int getProductionId()
|
public int getProductionId()
|
||||||
{
|
{
|
||||||
return _productionId;
|
return _productionId;
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
package org.l2jmobius.gameserver.network.clientpackets.limitshop;
|
package org.l2jmobius.gameserver.network.clientpackets.limitshop;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.l2jmobius.Config;
|
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.LimitShopProductHolder;
|
||||||
import org.l2jmobius.gameserver.model.holders.LimitShopRandomCraftReward;
|
import org.l2jmobius.gameserver.model.holders.LimitShopRandomCraftReward;
|
||||||
import org.l2jmobius.gameserver.model.itemcontainer.Inventory;
|
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.model.variables.AccountVariables;
|
||||||
import org.l2jmobius.gameserver.network.GameClient;
|
import org.l2jmobius.gameserver.network.GameClient;
|
||||||
import org.l2jmobius.gameserver.network.SystemMessageId;
|
import org.l2jmobius.gameserver.network.SystemMessageId;
|
||||||
@ -167,7 +169,7 @@ public class RequestPurchaseLimitShopItemBuy implements IClientIncomingPacket
|
|||||||
return;
|
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.sendPacket(SystemMessageId.INCORRECT_ITEM_COUNT_2);
|
||||||
player.removeRequest(PrimeShopRequest.class);
|
player.removeRequest(PrimeShopRequest.class);
|
||||||
@ -192,7 +194,24 @@ public class RequestPurchaseLimitShopItemBuy implements IClientIncomingPacket
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
player.destroyItemByItemId("LCoinShop", _product.getIngredientIds()[i], _product.getIngredientQuantities()[i] * _amount, player, true);
|
if (_product.getIngredientEnchants()[i] > 0)
|
||||||
|
{
|
||||||
|
int count = 0;
|
||||||
|
final Collection<ItemInstance> 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)
|
if (Config.VIP_SYSTEM_L_SHOP_AFFECT)
|
||||||
{
|
{
|
||||||
|
@ -89,12 +89,11 @@ public class ExPurchaseLimitShopItemListNew implements IClientOutgoingPacket
|
|||||||
packet.writeQ(product.getIngredientQuantities()[2]);
|
packet.writeQ(product.getIngredientQuantities()[2]);
|
||||||
packet.writeQ(product.getIngredientQuantities()[3]); // 306
|
packet.writeQ(product.getIngredientQuantities()[3]); // 306
|
||||||
packet.writeQ(product.getIngredientQuantities()[4]); // 306
|
packet.writeQ(product.getIngredientQuantities()[4]); // 306
|
||||||
|
packet.writeH(product.getIngredientEnchants()[0]);
|
||||||
packet.writeH(0x00); // sCostItemEnchant 1
|
packet.writeH(product.getIngredientEnchants()[1]);
|
||||||
packet.writeH(0x00); // sCostItemEnchant 2
|
packet.writeH(product.getIngredientEnchants()[2]);
|
||||||
packet.writeH(0x00); // sCostItemEnchant 3
|
packet.writeH(product.getIngredientEnchants()[3]); // 306
|
||||||
packet.writeH(0x00); // sCostItemEnchant 4 (306)
|
packet.writeH(product.getIngredientEnchants()[4]); // 306
|
||||||
packet.writeH(0x00); // sCostItemEnchant 5 (306)
|
|
||||||
|
|
||||||
// Check limits.
|
// Check limits.
|
||||||
if (product.getAccountDailyLimit() > 0) // Sale period.
|
if (product.getAccountDailyLimit() > 0) // Sale period.
|
||||||
|
Loading…
Reference in New Issue
Block a user