Support for random crafted items.
This commit is contained in:
parent
b3806e7cf2
commit
ffc8deea21
@ -20,6 +20,13 @@
|
||||
<xs:simpleContent>
|
||||
<xs:extension base="xs:string">
|
||||
<xs:attribute type="xs:int" name="id" use="optional"/>
|
||||
<xs:attribute type="xs:long" name="count" use="optional"/>
|
||||
<xs:attribute type="xs:float" name="chance" use="optional"/>
|
||||
<xs:attribute type="xs:int" name="id2" use="optional"/>
|
||||
<xs:attribute type="xs:long" name="count2" use="optional"/>
|
||||
<xs:attribute type="xs:float" name="chance2" use="optional"/>
|
||||
<xs:attribute type="xs:int" name="id3" use="optional"/>
|
||||
<xs:attribute type="xs:long" name="count3" use="optional"/>
|
||||
<xs:attribute type="xs:int" name="accountDailyLimit" use="optional"/>
|
||||
<xs:attribute type="xs:int" name="accountBuyLimit" use="optional"/>
|
||||
</xs:extension>
|
||||
|
@ -158,7 +158,7 @@ public class LCoinShopData implements IXmlReader
|
||||
}
|
||||
}
|
||||
|
||||
_products.add(new LCoinShopProductHolder(id, category, minLevel, maxLevel, ingredientIds, ingredientQuantities, productionId, accountDailyLimit, accountBuyLimit));
|
||||
_products.add(new LCoinShopProductHolder(id, category, minLevel, maxLevel, ingredientIds, ingredientQuantities, productionId, 0, 0, 0, 0, 0, 0, 0, accountDailyLimit, accountBuyLimit));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -99,6 +99,13 @@ public class LCoinShopSpecialCraftData implements IXmlReader
|
||||
ingredientQuantities[1] = 0;
|
||||
ingredientQuantities[2] = 0;
|
||||
int productionId = 0;
|
||||
int productionId2 = 0;
|
||||
int productionId3 = 0;
|
||||
long count = 0;
|
||||
long count2 = 0;
|
||||
long count3 = 0;
|
||||
float chance = 0;
|
||||
float chance2 = 0;
|
||||
int accountDailyLimit = 0;
|
||||
int accountBuyLimit = 0;
|
||||
for (Node b = d.getFirstChild(); b != null; b = b.getNextSibling())
|
||||
@ -146,6 +153,13 @@ public class LCoinShopSpecialCraftData implements IXmlReader
|
||||
else if ("production".equalsIgnoreCase(b.getNodeName()))
|
||||
{
|
||||
productionId = parseInteger(attrs, "id");
|
||||
count = parseLong(attrs, "count", 1L);
|
||||
chance = parseFloat(attrs, "chance", 33.3f);
|
||||
productionId2 = parseInteger(attrs, "id2");
|
||||
count2 = parseLong(attrs, "count2", 1L);
|
||||
chance2 = parseFloat(attrs, "chance2", 33.3f);
|
||||
productionId3 = parseInteger(attrs, "id3");
|
||||
count3 = parseLong(attrs, "count3", 1L);
|
||||
accountDailyLimit = parseInteger(attrs, "accountDailyLimit", 0);
|
||||
accountBuyLimit = parseInteger(attrs, "accountBuyLimit", 0);
|
||||
|
||||
@ -158,7 +172,7 @@ public class LCoinShopSpecialCraftData implements IXmlReader
|
||||
}
|
||||
}
|
||||
|
||||
_products.add(new LCoinShopProductHolder(id, category, minLevel, maxLevel, ingredientIds, ingredientQuantities, productionId, accountDailyLimit, accountBuyLimit));
|
||||
_products.add(new LCoinShopProductHolder(id, category, minLevel, maxLevel, ingredientIds, ingredientQuantities, productionId, count, chance, productionId2, count2, chance2, productionId3, count3, accountDailyLimit, accountBuyLimit));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -28,10 +28,17 @@ public class LCoinShopProductHolder
|
||||
private final int[] _ingredientIds;
|
||||
private final long[] _ingredientQuantities;
|
||||
private final int _productionId;
|
||||
private final long _count;
|
||||
private final float _chance;
|
||||
private final int _productionId2;
|
||||
private final long _count2;
|
||||
private final float _chance2;
|
||||
private final int _productionId3;
|
||||
private final long _count3;
|
||||
private final int _accountDailyLimit;
|
||||
private final int _accountBuyLimit;
|
||||
|
||||
public LCoinShopProductHolder(int id, int category, int minLevel, int maxLevel, int[] ingredientIds, long[] ingredientQuantities, int productionId, int accountDailyLimit, int accountBuyLimit)
|
||||
public LCoinShopProductHolder(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)
|
||||
{
|
||||
_id = id;
|
||||
_category = category;
|
||||
@ -40,6 +47,13 @@ public class LCoinShopProductHolder
|
||||
_ingredientIds = ingredientIds;
|
||||
_ingredientQuantities = ingredientQuantities;
|
||||
_productionId = productionId;
|
||||
_count = count;
|
||||
_chance = chance;
|
||||
_productionId2 = productionId2;
|
||||
_count2 = count2;
|
||||
_chance2 = chance2;
|
||||
_productionId3 = productionId3;
|
||||
_count3 = count3;
|
||||
_accountDailyLimit = accountDailyLimit;
|
||||
_accountBuyLimit = accountBuyLimit;
|
||||
}
|
||||
@ -79,6 +93,41 @@ public class LCoinShopProductHolder
|
||||
return _productionId;
|
||||
}
|
||||
|
||||
public long getCount()
|
||||
{
|
||||
return _count;
|
||||
}
|
||||
|
||||
public float getChance()
|
||||
{
|
||||
return _chance;
|
||||
}
|
||||
|
||||
public int getProductionId2()
|
||||
{
|
||||
return _productionId2;
|
||||
}
|
||||
|
||||
public long getCount2()
|
||||
{
|
||||
return _count2;
|
||||
}
|
||||
|
||||
public float getChance2()
|
||||
{
|
||||
return _chance2;
|
||||
}
|
||||
|
||||
public int getProductionId3()
|
||||
{
|
||||
return _productionId3;
|
||||
}
|
||||
|
||||
public long getCount3()
|
||||
{
|
||||
return _count3;
|
||||
}
|
||||
|
||||
public int getAccountDailyLimit()
|
||||
{
|
||||
return _accountDailyLimit;
|
||||
|
@ -18,6 +18,7 @@ package org.l2jmobius.gameserver.network.clientpackets.limitshop;
|
||||
|
||||
import org.l2jmobius.commons.network.PacketReader;
|
||||
import org.l2jmobius.commons.util.Chronos;
|
||||
import org.l2jmobius.commons.util.Rnd;
|
||||
import org.l2jmobius.gameserver.data.xml.LCoinShopData;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.actor.request.PrimeShopRequest;
|
||||
@ -149,7 +150,25 @@ public class RequestPurchaseLimitShopItemBuy implements IClientIncomingPacket
|
||||
}
|
||||
|
||||
// Reward.
|
||||
player.addItem("LCoinShop", product.getProductionId(), _amount, player, true);
|
||||
if (product.getProductionId2() > 0)
|
||||
{
|
||||
if (Rnd.get(100) < product.getChance())
|
||||
{
|
||||
player.addItem("LCoinShop", product.getProductionId(), product.getCount(), player, true);
|
||||
}
|
||||
else if (Rnd.get(100) < product.getChance2())
|
||||
{
|
||||
player.addItem("LCoinShop", product.getProductionId2(), product.getCount2(), player, true);
|
||||
}
|
||||
else if (product.getProductionId3() > 0)
|
||||
{
|
||||
player.addItem("LCoinShop", product.getProductionId3(), product.getCount3(), player, true);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
player.addItem("LCoinShop", product.getProductionId(), _amount, player, true);
|
||||
}
|
||||
|
||||
// Update account variables.
|
||||
if (product.getAccountDailyLimit() > 0)
|
||||
|
@ -20,6 +20,13 @@
|
||||
<xs:simpleContent>
|
||||
<xs:extension base="xs:string">
|
||||
<xs:attribute type="xs:int" name="id" use="optional"/>
|
||||
<xs:attribute type="xs:long" name="count" use="optional"/>
|
||||
<xs:attribute type="xs:float" name="chance" use="optional"/>
|
||||
<xs:attribute type="xs:int" name="id2" use="optional"/>
|
||||
<xs:attribute type="xs:long" name="count2" use="optional"/>
|
||||
<xs:attribute type="xs:float" name="chance2" use="optional"/>
|
||||
<xs:attribute type="xs:int" name="id3" use="optional"/>
|
||||
<xs:attribute type="xs:long" name="count3" use="optional"/>
|
||||
<xs:attribute type="xs:int" name="accountDailyLimit" use="optional"/>
|
||||
<xs:attribute type="xs:int" name="accountBuyLimit" use="optional"/>
|
||||
</xs:extension>
|
||||
|
@ -178,7 +178,7 @@ public class LCoinShopData implements IXmlReader
|
||||
}
|
||||
}
|
||||
|
||||
_products.add(new LCoinShopProductHolder(id, category, minLevel, maxLevel, ingredientIds, ingredientQuantities, productionId, accountDailyLimit, accountBuyLimit));
|
||||
_products.add(new LCoinShopProductHolder(id, category, minLevel, maxLevel, ingredientIds, ingredientQuantities, productionId, 0, 0, 0, 0, 0, 0, 0, accountDailyLimit, accountBuyLimit));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -99,6 +99,13 @@ public class LCoinShopSpecialCraftData implements IXmlReader
|
||||
ingredientQuantities[1] = 0;
|
||||
ingredientQuantities[2] = 0;
|
||||
int productionId = 0;
|
||||
int productionId2 = 0;
|
||||
int productionId3 = 0;
|
||||
long count = 0;
|
||||
long count2 = 0;
|
||||
long count3 = 0;
|
||||
float chance = 0;
|
||||
float chance2 = 0;
|
||||
int accountDailyLimit = 0;
|
||||
int accountBuyLimit = 0;
|
||||
for (Node b = d.getFirstChild(); b != null; b = b.getNextSibling())
|
||||
@ -146,6 +153,13 @@ public class LCoinShopSpecialCraftData implements IXmlReader
|
||||
else if ("production".equalsIgnoreCase(b.getNodeName()))
|
||||
{
|
||||
productionId = parseInteger(attrs, "id");
|
||||
count = parseLong(attrs, "count", 1L);
|
||||
chance = parseFloat(attrs, "chance", 33.3f);
|
||||
productionId2 = parseInteger(attrs, "id2");
|
||||
count2 = parseLong(attrs, "count2", 1L);
|
||||
chance2 = parseFloat(attrs, "chance2", 33.3f);
|
||||
productionId3 = parseInteger(attrs, "id3");
|
||||
count3 = parseLong(attrs, "count3", 1L);
|
||||
accountDailyLimit = parseInteger(attrs, "accountDailyLimit", 0);
|
||||
accountBuyLimit = parseInteger(attrs, "accountBuyLimit", 0);
|
||||
|
||||
@ -158,7 +172,7 @@ public class LCoinShopSpecialCraftData implements IXmlReader
|
||||
}
|
||||
}
|
||||
|
||||
_products.add(new LCoinShopProductHolder(id, category, minLevel, maxLevel, ingredientIds, ingredientQuantities, productionId, accountDailyLimit, accountBuyLimit));
|
||||
_products.add(new LCoinShopProductHolder(id, category, minLevel, maxLevel, ingredientIds, ingredientQuantities, productionId, count, chance, productionId2, count2, chance2, productionId3, count3, accountDailyLimit, accountBuyLimit));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -28,10 +28,17 @@ public class LCoinShopProductHolder
|
||||
private final int[] _ingredientIds;
|
||||
private final long[] _ingredientQuantities;
|
||||
private final int _productionId;
|
||||
private final long _count;
|
||||
private final float _chance;
|
||||
private final int _productionId2;
|
||||
private final long _count2;
|
||||
private final float _chance2;
|
||||
private final int _productionId3;
|
||||
private final long _count3;
|
||||
private final int _accountDailyLimit;
|
||||
private final int _accountBuyLimit;
|
||||
|
||||
public LCoinShopProductHolder(int id, int category, int minLevel, int maxLevel, int[] ingredientIds, long[] ingredientQuantities, int productionId, int accountDailyLimit, int accountBuyLimit)
|
||||
public LCoinShopProductHolder(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)
|
||||
{
|
||||
_id = id;
|
||||
_category = category;
|
||||
@ -40,6 +47,13 @@ public class LCoinShopProductHolder
|
||||
_ingredientIds = ingredientIds;
|
||||
_ingredientQuantities = ingredientQuantities;
|
||||
_productionId = productionId;
|
||||
_count = count;
|
||||
_chance = chance;
|
||||
_productionId2 = productionId2;
|
||||
_count2 = count2;
|
||||
_chance2 = chance2;
|
||||
_productionId3 = productionId3;
|
||||
_count3 = count3;
|
||||
_accountDailyLimit = accountDailyLimit;
|
||||
_accountBuyLimit = accountBuyLimit;
|
||||
}
|
||||
@ -79,6 +93,41 @@ public class LCoinShopProductHolder
|
||||
return _productionId;
|
||||
}
|
||||
|
||||
public long getCount()
|
||||
{
|
||||
return _count;
|
||||
}
|
||||
|
||||
public float getChance()
|
||||
{
|
||||
return _chance;
|
||||
}
|
||||
|
||||
public int getProductionId2()
|
||||
{
|
||||
return _productionId2;
|
||||
}
|
||||
|
||||
public long getCount2()
|
||||
{
|
||||
return _count2;
|
||||
}
|
||||
|
||||
public float getChance2()
|
||||
{
|
||||
return _chance2;
|
||||
}
|
||||
|
||||
public int getProductionId3()
|
||||
{
|
||||
return _productionId3;
|
||||
}
|
||||
|
||||
public long getCount3()
|
||||
{
|
||||
return _count3;
|
||||
}
|
||||
|
||||
public int getAccountDailyLimit()
|
||||
{
|
||||
return _accountDailyLimit;
|
||||
|
@ -18,6 +18,7 @@ package org.l2jmobius.gameserver.network.clientpackets.limitshop;
|
||||
|
||||
import org.l2jmobius.commons.network.PacketReader;
|
||||
import org.l2jmobius.commons.util.Chronos;
|
||||
import org.l2jmobius.commons.util.Rnd;
|
||||
import org.l2jmobius.gameserver.data.xml.LCoinShopData;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.actor.request.PrimeShopRequest;
|
||||
@ -149,7 +150,25 @@ public class RequestPurchaseLimitShopItemBuy implements IClientIncomingPacket
|
||||
}
|
||||
|
||||
// Reward.
|
||||
player.addItem("LCoinShop", product.getProductionId(), _amount, player, true);
|
||||
if (product.getProductionId2() > 0)
|
||||
{
|
||||
if (Rnd.get(100) < product.getChance())
|
||||
{
|
||||
player.addItem("LCoinShop", product.getProductionId(), product.getCount(), player, true);
|
||||
}
|
||||
else if (Rnd.get(100) < product.getChance2())
|
||||
{
|
||||
player.addItem("LCoinShop", product.getProductionId2(), product.getCount2(), player, true);
|
||||
}
|
||||
else if (product.getProductionId3() > 0)
|
||||
{
|
||||
player.addItem("LCoinShop", product.getProductionId3(), product.getCount3(), player, true);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
player.addItem("LCoinShop", product.getProductionId(), _amount, player, true);
|
||||
}
|
||||
|
||||
// Update account variables.
|
||||
if (product.getAccountDailyLimit() > 0)
|
||||
|
Loading…
Reference in New Issue
Block a user