Support for 5 limit shop products.

This commit is contained in:
MobiusDevelopment 2021-05-19 23:22:28 +00:00
parent e09d574f6d
commit c3a8bd0cd3
11 changed files with 149 additions and 9 deletions

View File

@ -28,6 +28,12 @@
<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:float" name="chance3" use="optional"/>
<xs:attribute type="xs:int" name="id4" use="optional"/>
<xs:attribute type="xs:long" name="count4" use="optional"/>
<xs:attribute type="xs:float" name="chance4" use="optional"/>
<xs:attribute type="xs:int" name="id5" use="optional"/>
<xs:attribute type="xs:long" name="count5" use="optional"/>
<xs:attribute type="xs:int" name="accountDailyLimit" use="optional"/>
<xs:attribute type="xs:int" name="accountBuyLimit" use="optional"/>
</xs:extension>

View File

@ -105,11 +105,17 @@ public class LimitShopCraftData implements IXmlReader
int productionId = 0;
int productionId2 = 0;
int productionId3 = 0;
int productionId4 = 0;
int productionId5 = 0;
long count = 1L;
long count2 = 1L;
long count3 = 1L;
long count4 = 1L;
long count5 = 1L;
float chance = 100f;
float chance2 = 100f;
float chance3 = 100f;
float chance4 = 100f;
int accountDailyLimit = 0;
int accountBuyLimit = 0;
for (Node b = d.getFirstChild(); b != null; b = b.getNextSibling())
@ -178,6 +184,12 @@ public class LimitShopCraftData implements IXmlReader
chance2 = parseFloat(attrs, "chance2", 100f);
productionId3 = parseInteger(attrs, "id3", 0);
count3 = parseLong(attrs, "count3", 1L);
chance3 = parseFloat(attrs, "chance3", 100f);
productionId4 = parseInteger(attrs, "id4", 0);
count4 = parseLong(attrs, "count4", 1L);
chance4 = parseFloat(attrs, "chance4", 100f);
productionId5 = parseInteger(attrs, "id5", 0);
count5 = parseLong(attrs, "count5", 1L);
accountDailyLimit = parseInteger(attrs, "accountDailyLimit", 0);
accountBuyLimit = parseInteger(attrs, "accountBuyLimit", 0);
@ -190,7 +202,7 @@ public class LimitShopCraftData implements IXmlReader
}
}
_products.add(new LimitShopProductHolder(id, category, minLevel, maxLevel, ingredientIds, ingredientQuantities, ingredientEnchants, 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, chance3, productionId4, count4, chance4, productionId5, count5, accountDailyLimit, accountBuyLimit));
}
}
}

View File

@ -176,7 +176,7 @@ public class LimitShopData implements IXmlReader
}
}
_products.add(new LimitShopProductHolder(id, category, minLevel, maxLevel, ingredientIds, ingredientQuantities, ingredientEnchants, 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, 0, 0, 0, 0, 0, 0, accountDailyLimit, accountBuyLimit));
}
}
}

View File

@ -36,10 +36,16 @@ public class LimitShopProductHolder
private final float _chance2;
private final int _productionId3;
private final long _count3;
private final float _chance3;
private final int _productionId4;
private final long _count4;
private final float _chance4;
private final int _productionId5;
private final long _count5;
private final int _accountDailyLimit;
private final 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)
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, float chance3, int productionId4, long count4, float chance4, int productionId5, long count5, int accountDailyLimit, int accountBuyLimit)
{
_id = id;
_category = category;
@ -56,6 +62,12 @@ public class LimitShopProductHolder
_chance2 = chance2;
_productionId3 = productionId3;
_count3 = count3;
_chance3 = chance3;
_productionId4 = productionId4;
_count4 = count4;
_chance4 = chance4;
_productionId5 = productionId5;
_count5 = count5;
_accountDailyLimit = accountDailyLimit;
_accountBuyLimit = accountBuyLimit;
}
@ -135,6 +147,36 @@ public class LimitShopProductHolder
return _count3;
}
public float getChance3()
{
return _chance3;
}
public int getProductionId4()
{
return _productionId4;
}
public long getCount4()
{
return _count4;
}
public float getChance4()
{
return _chance4;
}
public int getProductionId5()
{
return _productionId5;
}
public long getCount5()
{
return _count5;
}
public int getAccountDailyLimit()
{
return _accountDailyLimit;

View File

@ -215,11 +215,21 @@ public class RequestPurchaseLimitShopItemBuy implements IClientIncomingPacket
rewards.add(new LimitShopRandomCraftReward(_product.getProductionId2(), (int) _product.getCount2(), 1));
player.addItem("LCoinShop", _product.getProductionId2(), _product.getCount2(), player, true);
}
else if (_product.getProductionId3() > 0)
else if (Rnd.get(100) < _product.getChance3())
{
rewards.add(new LimitShopRandomCraftReward(_product.getProductionId3(), (int) _product.getCount3(), 2));
player.addItem("LCoinShop", _product.getProductionId3(), _product.getCount3(), player, true);
}
else if (Rnd.get(100) < _product.getChance4())
{
rewards.add(new LimitShopRandomCraftReward(_product.getProductionId4(), (int) _product.getCount4(), 3));
player.addItem("LCoinShop", _product.getProductionId4(), _product.getCount4(), player, true);
}
else if (_product.getProductionId5() > 0)
{
rewards.add(new LimitShopRandomCraftReward(_product.getProductionId5(), (int) _product.getCount5(), 4));
player.addItem("LCoinShop", _product.getProductionId5(), _product.getCount5(), player, true);
}
}
}
else

View File

@ -28,6 +28,12 @@
<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:float" name="chance3" use="optional"/>
<xs:attribute type="xs:int" name="id4" use="optional"/>
<xs:attribute type="xs:long" name="count4" use="optional"/>
<xs:attribute type="xs:float" name="chance4" use="optional"/>
<xs:attribute type="xs:int" name="id5" use="optional"/>
<xs:attribute type="xs:long" name="count5" use="optional"/>
<xs:attribute type="xs:int" name="accountDailyLimit" use="optional"/>
<xs:attribute type="xs:int" name="accountBuyLimit" use="optional"/>
</xs:extension>

View File

@ -206,7 +206,7 @@ public class LimitShopClanData implements IXmlReader
}
}
_products.add(new LimitShopProductHolder(id, category, minLevel, maxLevel, ingredientIds, ingredientQuantities, ingredientEnchants, 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, 0, 0, 0, 0, 0, 0, accountDailyLimit, accountBuyLimit));
}
}
}

View File

@ -111,11 +111,17 @@ public class LimitShopCraftData implements IXmlReader
int productionId = 0;
int productionId2 = 0;
int productionId3 = 0;
int productionId4 = 0;
int productionId5 = 0;
long count = 1L;
long count2 = 1L;
long count3 = 1L;
long count4 = 1L;
long count5 = 1L;
float chance = 100f;
float chance2 = 100f;
float chance3 = 100f;
float chance4 = 100f;
int accountDailyLimit = 0;
int accountBuyLimit = 0;
for (Node b = d.getFirstChild(); b != null; b = b.getNextSibling())
@ -208,6 +214,12 @@ public class LimitShopCraftData implements IXmlReader
chance2 = parseFloat(attrs, "chance2", 100f);
productionId3 = parseInteger(attrs, "id3", 0);
count3 = parseLong(attrs, "count3", 1L);
chance3 = parseFloat(attrs, "chance3", 100f);
productionId4 = parseInteger(attrs, "id4", 0);
count4 = parseLong(attrs, "count4", 1L);
chance4 = parseFloat(attrs, "chance4", 100f);
productionId5 = parseInteger(attrs, "id5", 0);
count5 = parseLong(attrs, "count5", 1L);
accountDailyLimit = parseInteger(attrs, "accountDailyLimit", 0);
accountBuyLimit = parseInteger(attrs, "accountBuyLimit", 0);
@ -220,7 +232,7 @@ public class LimitShopCraftData implements IXmlReader
}
}
_products.add(new LimitShopProductHolder(id, category, minLevel, maxLevel, ingredientIds, ingredientQuantities, ingredientEnchants, 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, chance3, productionId4, count4, chance4, productionId5, count5, accountDailyLimit, accountBuyLimit));
}
}
}

View File

@ -206,7 +206,7 @@ public class LimitShopData implements IXmlReader
}
}
_products.add(new LimitShopProductHolder(id, category, minLevel, maxLevel, ingredientIds, ingredientQuantities, ingredientEnchants, 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, 0, 0, 0, 0, 0, 0, accountDailyLimit, accountBuyLimit));
}
}
}

View File

@ -36,10 +36,16 @@ public class LimitShopProductHolder
private final float _chance2;
private final int _productionId3;
private final long _count3;
private final float _chance3;
private final int _productionId4;
private final long _count4;
private final float _chance4;
private final int _productionId5;
private final long _count5;
private final int _accountDailyLimit;
private final 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)
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, float chance3, int productionId4, long count4, float chance4, int productionId5, long count5, int accountDailyLimit, int accountBuyLimit)
{
_id = id;
_category = category;
@ -56,6 +62,12 @@ public class LimitShopProductHolder
_chance2 = chance2;
_productionId3 = productionId3;
_count3 = count3;
_chance3 = chance3;
_productionId4 = productionId4;
_count4 = count4;
_chance4 = chance4;
_productionId5 = productionId5;
_count5 = count5;
_accountDailyLimit = accountDailyLimit;
_accountBuyLimit = accountBuyLimit;
}
@ -135,6 +147,36 @@ public class LimitShopProductHolder
return _count3;
}
public float getChance3()
{
return _chance3;
}
public int getProductionId4()
{
return _productionId4;
}
public long getCount4()
{
return _count4;
}
public float getChance4()
{
return _chance4;
}
public int getProductionId5()
{
return _productionId5;
}
public long getCount5()
{
return _count5;
}
public int getAccountDailyLimit()
{
return _accountDailyLimit;

View File

@ -235,11 +235,21 @@ public class RequestPurchaseLimitShopItemBuy implements IClientIncomingPacket
rewards.add(new LimitShopRandomCraftReward(_product.getProductionId2(), (int) _product.getCount2(), 1));
player.addItem("LCoinShop", _product.getProductionId2(), _product.getCount2(), player, true);
}
else if (_product.getProductionId3() > 0)
else if (Rnd.get(100) < _product.getChance3())
{
rewards.add(new LimitShopRandomCraftReward(_product.getProductionId3(), (int) _product.getCount3(), 2));
player.addItem("LCoinShop", _product.getProductionId3(), _product.getCount3(), player, true);
}
else if (Rnd.get(100) < _product.getChance4())
{
rewards.add(new LimitShopRandomCraftReward(_product.getProductionId4(), (int) _product.getCount4(), 3));
player.addItem("LCoinShop", _product.getProductionId4(), _product.getCount4(), player, true);
}
else if (_product.getProductionId5() > 0)
{
rewards.add(new LimitShopRandomCraftReward(_product.getProductionId5(), (int) _product.getCount5(), 4));
player.addItem("LCoinShop", _product.getProductionId5(), _product.getCount5(), player, true);
}
}
}
else