Support for announce Special Craft items.
Contributed by petryxa.
This commit is contained in:
@@ -45,6 +45,7 @@
|
||||
<xs:attribute type="xs:byte" name="category" use="optional"/>
|
||||
<xs:attribute type="xs:int" name="minLevel" use="optional"/>
|
||||
<xs:attribute type="xs:int" name="maxLevel" use="optional"/>
|
||||
<xs:attribute type="xs:boolean" name="announce" use="optional"/>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:sequence>
|
||||
|
@@ -90,6 +90,7 @@ public class LimitShopCraftData implements IXmlReader
|
||||
final int category = parseInteger(attrs, "category");
|
||||
final int minLevel = parseInteger(attrs, "minLevel", 1);
|
||||
final int maxLevel = parseInteger(attrs, "maxLevel", 999);
|
||||
final boolean announce = parseBoolean(attrs, "announce", false);
|
||||
final int[] ingredientIds = new int[5];
|
||||
ingredientIds[0] = 0;
|
||||
ingredientIds[1] = 0;
|
||||
@@ -232,7 +233,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, chance3, productionId4, count4, chance4, productionId5, count5, 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, announce));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -90,6 +90,7 @@ public class LimitShopData implements IXmlReader
|
||||
final int category = parseInteger(attrs, "category");
|
||||
final int minLevel = parseInteger(attrs, "minLevel", 1);
|
||||
final int maxLevel = parseInteger(attrs, "maxLevel", 999);
|
||||
final boolean announce = parseBoolean(attrs, "announce", false);
|
||||
final int[] ingredientIds = new int[5];
|
||||
ingredientIds[0] = 0;
|
||||
ingredientIds[1] = 0;
|
||||
@@ -209,7 +210,7 @@ public class LimitShopData implements IXmlReader
|
||||
}
|
||||
}
|
||||
|
||||
_products.add(new LimitShopProductHolder(id, category, minLevel, maxLevel, ingredientIds, ingredientQuantities, ingredientEnchants, productionId, 1, 100, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, accountDailyLimit, accountBuyLimit));
|
||||
_products.add(new LimitShopProductHolder(id, category, minLevel, maxLevel, ingredientIds, ingredientQuantities, ingredientEnchants, productionId, 1, 100, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, accountDailyLimit, accountBuyLimit, announce));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -44,8 +44,9 @@ public class LimitShopProductHolder
|
||||
private final long _count5;
|
||||
private final int _accountDailyLimit;
|
||||
private final int _accountBuyLimit;
|
||||
private final boolean _announce;
|
||||
|
||||
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)
|
||||
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, boolean announce)
|
||||
{
|
||||
_id = id;
|
||||
_category = category;
|
||||
@@ -70,6 +71,7 @@ public class LimitShopProductHolder
|
||||
_count5 = count5;
|
||||
_accountDailyLimit = accountDailyLimit;
|
||||
_accountBuyLimit = accountBuyLimit;
|
||||
_announce = announce;
|
||||
}
|
||||
|
||||
public int getId()
|
||||
@@ -186,4 +188,9 @@ public class LimitShopProductHolder
|
||||
{
|
||||
return _accountBuyLimit;
|
||||
}
|
||||
|
||||
public boolean isAnnounce()
|
||||
{
|
||||
return _announce;
|
||||
}
|
||||
}
|
||||
|
@@ -37,8 +37,10 @@ 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.ClientPacket;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.ExItemAnnounce;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.limitshop.ExPurchaseLimitShopItemResult;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.primeshop.ExBRBuyProduct;
|
||||
import org.l2jmobius.gameserver.util.Broadcast;
|
||||
|
||||
/**
|
||||
* @author Mobius
|
||||
@@ -227,34 +229,58 @@ public class RequestPurchaseLimitShopItemBuy implements ClientPacket
|
||||
if (Rnd.get(100) < _product.getChance())
|
||||
{
|
||||
rewards.computeIfAbsent(0, k -> new LimitShopRandomCraftReward(_product.getProductionId(), 0, 0)).getCount().addAndGet((int) _product.getCount());
|
||||
player.addItem("LCoinShop", _product.getProductionId(), _product.getCount(), player, true);
|
||||
final Item item = player.addItem("LCoinShop", _product.getProductionId(), _product.getCount(), player, true);
|
||||
if (_product.isAnnounce())
|
||||
{
|
||||
Broadcast.toAllOnlinePlayers(new ExItemAnnounce(player, item, ExItemAnnounce.SPECIAL_CREATION));
|
||||
}
|
||||
}
|
||||
else if ((Rnd.get(100) < _product.getChance2()) || (_product.getProductionId3() == 0))
|
||||
{
|
||||
rewards.computeIfAbsent(1, k -> new LimitShopRandomCraftReward(_product.getProductionId2(), 0, 1)).getCount().addAndGet((int) _product.getCount2());
|
||||
player.addItem("LCoinShop", _product.getProductionId2(), _product.getCount2(), player, true);
|
||||
final Item item = player.addItem("LCoinShop", _product.getProductionId2(), _product.getCount2(), player, true);
|
||||
if (_product.isAnnounce())
|
||||
{
|
||||
Broadcast.toAllOnlinePlayers(new ExItemAnnounce(player, item, ExItemAnnounce.SPECIAL_CREATION));
|
||||
}
|
||||
}
|
||||
else if ((Rnd.get(100) < _product.getChance3()) || (_product.getProductionId4() == 0))
|
||||
{
|
||||
rewards.computeIfAbsent(2, k -> new LimitShopRandomCraftReward(_product.getProductionId3(), 0, 2)).getCount().addAndGet((int) _product.getCount3());
|
||||
player.addItem("LCoinShop", _product.getProductionId3(), _product.getCount3(), player, true);
|
||||
final Item item = player.addItem("LCoinShop", _product.getProductionId3(), _product.getCount3(), player, true);
|
||||
if (_product.isAnnounce())
|
||||
{
|
||||
Broadcast.toAllOnlinePlayers(new ExItemAnnounce(player, item, ExItemAnnounce.SPECIAL_CREATION));
|
||||
}
|
||||
}
|
||||
else if ((Rnd.get(100) < _product.getChance4()) || (_product.getProductionId5() == 0))
|
||||
{
|
||||
rewards.computeIfAbsent(3, k -> new LimitShopRandomCraftReward(_product.getProductionId4(), 0, 3)).getCount().addAndGet((int) _product.getCount4());
|
||||
player.addItem("LCoinShop", _product.getProductionId4(), _product.getCount4(), player, true);
|
||||
final Item item = player.addItem("LCoinShop", _product.getProductionId4(), _product.getCount4(), player, true);
|
||||
if (_product.isAnnounce())
|
||||
{
|
||||
Broadcast.toAllOnlinePlayers(new ExItemAnnounce(player, item, ExItemAnnounce.SPECIAL_CREATION));
|
||||
}
|
||||
}
|
||||
else if (_product.getProductionId5() > 0)
|
||||
{
|
||||
rewards.computeIfAbsent(4, k -> new LimitShopRandomCraftReward(_product.getProductionId5(), 0, 4)).getCount().addAndGet((int) _product.getCount5());
|
||||
player.addItem("LCoinShop", _product.getProductionId5(), _product.getCount5(), player, true);
|
||||
final Item item = player.addItem("LCoinShop", _product.getProductionId5(), _product.getCount5(), player, true);
|
||||
if (_product.isAnnounce())
|
||||
{
|
||||
Broadcast.toAllOnlinePlayers(new ExItemAnnounce(player, item, ExItemAnnounce.SPECIAL_CREATION));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (Rnd.get(100) < _product.getChance())
|
||||
{
|
||||
rewards.put(0, new LimitShopRandomCraftReward(_product.getProductionId(), (int) (_product.getCount() * _amount), 0));
|
||||
player.addItem("LCoinShop", _product.getProductionId(), _product.getCount() * _amount, player, true);
|
||||
final Item item = player.addItem("LCoinShop", _product.getProductionId(), _product.getCount() * _amount, player, true);
|
||||
if (_product.isAnnounce())
|
||||
{
|
||||
Broadcast.toAllOnlinePlayers(new ExItemAnnounce(player, item, ExItemAnnounce.SPECIAL_CREATION));
|
||||
}
|
||||
}
|
||||
|
||||
// Update account variables.
|
||||
|
@@ -27,6 +27,7 @@ public class ExItemAnnounce extends ServerPacket
|
||||
{
|
||||
public static final int ENCHANT = 0;
|
||||
public static final int RANDOM_CRAFT = 2;
|
||||
public static final int SPECIAL_CREATION = 3;
|
||||
|
||||
private final Item _item;
|
||||
private final int _type;
|
||||
|
@@ -45,6 +45,7 @@
|
||||
<xs:attribute type="xs:byte" name="category" use="optional"/>
|
||||
<xs:attribute type="xs:int" name="minLevel" use="optional"/>
|
||||
<xs:attribute type="xs:int" name="maxLevel" use="optional"/>
|
||||
<xs:attribute type="xs:boolean" name="announce" use="optional"/>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:sequence>
|
||||
|
@@ -90,6 +90,7 @@ public class LimitShopCraftData implements IXmlReader
|
||||
final int category = parseInteger(attrs, "category");
|
||||
final int minLevel = parseInteger(attrs, "minLevel", 1);
|
||||
final int maxLevel = parseInteger(attrs, "maxLevel", 999);
|
||||
final boolean announce = parseBoolean(attrs, "announce", false);
|
||||
final int[] ingredientIds = new int[5];
|
||||
ingredientIds[0] = 0;
|
||||
ingredientIds[1] = 0;
|
||||
@@ -232,7 +233,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, chance3, productionId4, count4, chance4, productionId5, count5, 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, announce));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -90,6 +90,7 @@ public class LimitShopData implements IXmlReader
|
||||
final int category = parseInteger(attrs, "category");
|
||||
final int minLevel = parseInteger(attrs, "minLevel", 1);
|
||||
final int maxLevel = parseInteger(attrs, "maxLevel", 999);
|
||||
final boolean announce = parseBoolean(attrs, "announce", false);
|
||||
final int[] ingredientIds = new int[5];
|
||||
ingredientIds[0] = 0;
|
||||
ingredientIds[1] = 0;
|
||||
@@ -209,7 +210,7 @@ public class LimitShopData implements IXmlReader
|
||||
}
|
||||
}
|
||||
|
||||
_products.add(new LimitShopProductHolder(id, category, minLevel, maxLevel, ingredientIds, ingredientQuantities, ingredientEnchants, productionId, 1, 100, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, accountDailyLimit, accountBuyLimit));
|
||||
_products.add(new LimitShopProductHolder(id, category, minLevel, maxLevel, ingredientIds, ingredientQuantities, ingredientEnchants, productionId, 1, 100, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, accountDailyLimit, accountBuyLimit, announce));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -44,8 +44,9 @@ public class LimitShopProductHolder
|
||||
private final long _count5;
|
||||
private final int _accountDailyLimit;
|
||||
private final int _accountBuyLimit;
|
||||
private final boolean _announce;
|
||||
|
||||
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)
|
||||
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, boolean announce)
|
||||
{
|
||||
_id = id;
|
||||
_category = category;
|
||||
@@ -70,6 +71,7 @@ public class LimitShopProductHolder
|
||||
_count5 = count5;
|
||||
_accountDailyLimit = accountDailyLimit;
|
||||
_accountBuyLimit = accountBuyLimit;
|
||||
_announce = announce;
|
||||
}
|
||||
|
||||
public int getId()
|
||||
@@ -186,4 +188,9 @@ public class LimitShopProductHolder
|
||||
{
|
||||
return _accountBuyLimit;
|
||||
}
|
||||
|
||||
public boolean isAnnounce()
|
||||
{
|
||||
return _announce;
|
||||
}
|
||||
}
|
||||
|
@@ -37,9 +37,11 @@ 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.ClientPacket;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.ExItemAnnounce;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.ExPCCafePointInfo;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.limitshop.ExPurchaseLimitShopItemResult;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.primeshop.ExBRBuyProduct;
|
||||
import org.l2jmobius.gameserver.util.Broadcast;
|
||||
|
||||
/**
|
||||
* @author Mobius
|
||||
@@ -247,34 +249,58 @@ public class RequestPurchaseLimitShopItemBuy implements ClientPacket
|
||||
if (Rnd.get(100) < _product.getChance())
|
||||
{
|
||||
rewards.computeIfAbsent(0, k -> new LimitShopRandomCraftReward(_product.getProductionId(), 0, 0)).getCount().addAndGet((int) _product.getCount());
|
||||
player.addItem("LCoinShop", _product.getProductionId(), _product.getCount(), player, true);
|
||||
final Item item = player.addItem("LCoinShop", _product.getProductionId(), _product.getCount(), player, true);
|
||||
if (_product.isAnnounce())
|
||||
{
|
||||
Broadcast.toAllOnlinePlayers(new ExItemAnnounce(player, item, ExItemAnnounce.SPECIAL_CREATION));
|
||||
}
|
||||
}
|
||||
else if ((Rnd.get(100) < _product.getChance2()) || (_product.getProductionId3() == 0))
|
||||
{
|
||||
rewards.computeIfAbsent(1, k -> new LimitShopRandomCraftReward(_product.getProductionId2(), 0, 1)).getCount().addAndGet((int) _product.getCount2());
|
||||
player.addItem("LCoinShop", _product.getProductionId2(), _product.getCount2(), player, true);
|
||||
final Item item = player.addItem("LCoinShop", _product.getProductionId2(), _product.getCount2(), player, true);
|
||||
if (_product.isAnnounce())
|
||||
{
|
||||
Broadcast.toAllOnlinePlayers(new ExItemAnnounce(player, item, ExItemAnnounce.SPECIAL_CREATION));
|
||||
}
|
||||
}
|
||||
else if ((Rnd.get(100) < _product.getChance3()) || (_product.getProductionId4() == 0))
|
||||
{
|
||||
rewards.computeIfAbsent(2, k -> new LimitShopRandomCraftReward(_product.getProductionId3(), 0, 2)).getCount().addAndGet((int) _product.getCount3());
|
||||
player.addItem("LCoinShop", _product.getProductionId3(), _product.getCount3(), player, true);
|
||||
final Item item = player.addItem("LCoinShop", _product.getProductionId3(), _product.getCount3(), player, true);
|
||||
if (_product.isAnnounce())
|
||||
{
|
||||
Broadcast.toAllOnlinePlayers(new ExItemAnnounce(player, item, ExItemAnnounce.SPECIAL_CREATION));
|
||||
}
|
||||
}
|
||||
else if ((Rnd.get(100) < _product.getChance4()) || (_product.getProductionId5() == 0))
|
||||
{
|
||||
rewards.computeIfAbsent(3, k -> new LimitShopRandomCraftReward(_product.getProductionId4(), 0, 3)).getCount().addAndGet((int) _product.getCount4());
|
||||
player.addItem("LCoinShop", _product.getProductionId4(), _product.getCount4(), player, true);
|
||||
final Item item = player.addItem("LCoinShop", _product.getProductionId4(), _product.getCount4(), player, true);
|
||||
if (_product.isAnnounce())
|
||||
{
|
||||
Broadcast.toAllOnlinePlayers(new ExItemAnnounce(player, item, ExItemAnnounce.SPECIAL_CREATION));
|
||||
}
|
||||
}
|
||||
else if (_product.getProductionId5() > 0)
|
||||
{
|
||||
rewards.computeIfAbsent(4, k -> new LimitShopRandomCraftReward(_product.getProductionId5(), 0, 4)).getCount().addAndGet((int) _product.getCount5());
|
||||
player.addItem("LCoinShop", _product.getProductionId5(), _product.getCount5(), player, true);
|
||||
final Item item = player.addItem("LCoinShop", _product.getProductionId5(), _product.getCount5(), player, true);
|
||||
if (_product.isAnnounce())
|
||||
{
|
||||
Broadcast.toAllOnlinePlayers(new ExItemAnnounce(player, item, ExItemAnnounce.SPECIAL_CREATION));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (Rnd.get(100) < _product.getChance())
|
||||
{
|
||||
rewards.put(0, new LimitShopRandomCraftReward(_product.getProductionId(), (int) (_product.getCount() * _amount), 0));
|
||||
player.addItem("LCoinShop", _product.getProductionId(), _product.getCount() * _amount, player, true);
|
||||
final Item item = player.addItem("LCoinShop", _product.getProductionId(), _product.getCount() * _amount, player, true);
|
||||
if (_product.isAnnounce())
|
||||
{
|
||||
Broadcast.toAllOnlinePlayers(new ExItemAnnounce(player, item, ExItemAnnounce.SPECIAL_CREATION));
|
||||
}
|
||||
}
|
||||
|
||||
// Update account variables.
|
||||
|
@@ -27,6 +27,7 @@ public class ExItemAnnounce extends ServerPacket
|
||||
{
|
||||
public static final int ENCHANT = 0;
|
||||
public static final int RANDOM_CRAFT = 2;
|
||||
public static final int SPECIAL_CREATION = 3;
|
||||
|
||||
private final Item _item;
|
||||
private final int _type;
|
||||
|
@@ -45,6 +45,7 @@
|
||||
<xs:attribute type="xs:byte" name="category" use="optional"/>
|
||||
<xs:attribute type="xs:int" name="minLevel" use="optional"/>
|
||||
<xs:attribute type="xs:int" name="maxLevel" use="optional"/>
|
||||
<xs:attribute type="xs:boolean" name="announce" use="optional"/>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:sequence>
|
||||
|
@@ -90,6 +90,7 @@ public class LimitShopCraftData implements IXmlReader
|
||||
final int category = parseInteger(attrs, "category");
|
||||
final int minLevel = parseInteger(attrs, "minLevel", 1);
|
||||
final int maxLevel = parseInteger(attrs, "maxLevel", 999);
|
||||
final boolean announce = parseBoolean(attrs, "announce", false);
|
||||
final int[] ingredientIds = new int[3];
|
||||
ingredientIds[0] = 0;
|
||||
ingredientIds[1] = 0;
|
||||
@@ -202,7 +203,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, chance3, productionId4, count4, chance4, productionId5, count5, 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, announce));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -90,6 +90,7 @@ public class LimitShopData implements IXmlReader
|
||||
final int category = parseInteger(attrs, "category");
|
||||
final int minLevel = parseInteger(attrs, "minLevel", 1);
|
||||
final int maxLevel = parseInteger(attrs, "maxLevel", 999);
|
||||
final boolean announce = parseBoolean(attrs, "announce", false);
|
||||
final int[] ingredientIds = new int[3];
|
||||
ingredientIds[0] = 0;
|
||||
ingredientIds[1] = 0;
|
||||
@@ -179,7 +180,7 @@ public class LimitShopData implements IXmlReader
|
||||
}
|
||||
}
|
||||
|
||||
_products.add(new LimitShopProductHolder(id, category, minLevel, maxLevel, ingredientIds, ingredientQuantities, ingredientEnchants, productionId, 1, 100, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, accountDailyLimit, accountBuyLimit));
|
||||
_products.add(new LimitShopProductHolder(id, category, minLevel, maxLevel, ingredientIds, ingredientQuantities, ingredientEnchants, productionId, 1, 100, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, accountDailyLimit, accountBuyLimit, announce));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -44,8 +44,9 @@ public class LimitShopProductHolder
|
||||
private final long _count5;
|
||||
private final int _accountDailyLimit;
|
||||
private final int _accountBuyLimit;
|
||||
private final boolean _announce;
|
||||
|
||||
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)
|
||||
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, boolean announce)
|
||||
{
|
||||
_id = id;
|
||||
_category = category;
|
||||
@@ -70,6 +71,7 @@ public class LimitShopProductHolder
|
||||
_count5 = count5;
|
||||
_accountDailyLimit = accountDailyLimit;
|
||||
_accountBuyLimit = accountBuyLimit;
|
||||
_announce = announce;
|
||||
}
|
||||
|
||||
public int getId()
|
||||
@@ -186,4 +188,9 @@ public class LimitShopProductHolder
|
||||
{
|
||||
return _accountBuyLimit;
|
||||
}
|
||||
|
||||
public boolean isAnnounce()
|
||||
{
|
||||
return _announce;
|
||||
}
|
||||
}
|
||||
|
@@ -37,8 +37,10 @@ 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.ClientPacket;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.ExItemAnnounce;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.limitshop.ExPurchaseLimitShopItemResult;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.primeshop.ExBRBuyProduct;
|
||||
import org.l2jmobius.gameserver.util.Broadcast;
|
||||
|
||||
/**
|
||||
* @author Mobius
|
||||
@@ -217,34 +219,58 @@ public class RequestPurchaseLimitShopItemBuy implements ClientPacket
|
||||
if (Rnd.get(100) < _product.getChance())
|
||||
{
|
||||
rewards.computeIfAbsent(0, k -> new LimitShopRandomCraftReward(_product.getProductionId(), 0, 0)).getCount().addAndGet((int) _product.getCount());
|
||||
player.addItem("LCoinShop", _product.getProductionId(), _product.getCount(), player, true);
|
||||
final Item item = player.addItem("LCoinShop", _product.getProductionId(), _product.getCount(), player, true);
|
||||
if (_product.isAnnounce())
|
||||
{
|
||||
Broadcast.toAllOnlinePlayers(new ExItemAnnounce(player, item, ExItemAnnounce.SPECIAL_CREATION));
|
||||
}
|
||||
}
|
||||
else if ((Rnd.get(100) < _product.getChance2()) || (_product.getProductionId3() == 0))
|
||||
{
|
||||
rewards.computeIfAbsent(1, k -> new LimitShopRandomCraftReward(_product.getProductionId2(), 0, 1)).getCount().addAndGet((int) _product.getCount2());
|
||||
player.addItem("LCoinShop", _product.getProductionId2(), _product.getCount2(), player, true);
|
||||
final Item item = player.addItem("LCoinShop", _product.getProductionId2(), _product.getCount2(), player, true);
|
||||
if (_product.isAnnounce())
|
||||
{
|
||||
Broadcast.toAllOnlinePlayers(new ExItemAnnounce(player, item, ExItemAnnounce.SPECIAL_CREATION));
|
||||
}
|
||||
}
|
||||
else if ((Rnd.get(100) < _product.getChance3()) || (_product.getProductionId4() == 0))
|
||||
{
|
||||
rewards.computeIfAbsent(2, k -> new LimitShopRandomCraftReward(_product.getProductionId3(), 0, 2)).getCount().addAndGet((int) _product.getCount3());
|
||||
player.addItem("LCoinShop", _product.getProductionId3(), _product.getCount3(), player, true);
|
||||
final Item item = player.addItem("LCoinShop", _product.getProductionId3(), _product.getCount3(), player, true);
|
||||
if (_product.isAnnounce())
|
||||
{
|
||||
Broadcast.toAllOnlinePlayers(new ExItemAnnounce(player, item, ExItemAnnounce.SPECIAL_CREATION));
|
||||
}
|
||||
}
|
||||
else if ((Rnd.get(100) < _product.getChance4()) || (_product.getProductionId5() == 0))
|
||||
{
|
||||
rewards.computeIfAbsent(3, k -> new LimitShopRandomCraftReward(_product.getProductionId4(), 0, 3)).getCount().addAndGet((int) _product.getCount4());
|
||||
player.addItem("LCoinShop", _product.getProductionId4(), _product.getCount4(), player, true);
|
||||
final Item item = player.addItem("LCoinShop", _product.getProductionId4(), _product.getCount4(), player, true);
|
||||
if (_product.isAnnounce())
|
||||
{
|
||||
Broadcast.toAllOnlinePlayers(new ExItemAnnounce(player, item, ExItemAnnounce.SPECIAL_CREATION));
|
||||
}
|
||||
}
|
||||
else if (_product.getProductionId5() > 0)
|
||||
{
|
||||
rewards.computeIfAbsent(4, k -> new LimitShopRandomCraftReward(_product.getProductionId5(), 0, 4)).getCount().addAndGet((int) _product.getCount5());
|
||||
player.addItem("LCoinShop", _product.getProductionId5(), _product.getCount5(), player, true);
|
||||
final Item item = player.addItem("LCoinShop", _product.getProductionId5(), _product.getCount5(), player, true);
|
||||
if (_product.isAnnounce())
|
||||
{
|
||||
Broadcast.toAllOnlinePlayers(new ExItemAnnounce(player, item, ExItemAnnounce.SPECIAL_CREATION));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (Rnd.get(100) < _product.getChance())
|
||||
{
|
||||
rewards.put(0, new LimitShopRandomCraftReward(_product.getProductionId(), (int) (_product.getCount() * _amount), 0));
|
||||
player.addItem("LCoinShop", _product.getProductionId(), _product.getCount() * _amount, player, true);
|
||||
final Item item = player.addItem("LCoinShop", _product.getProductionId(), _product.getCount() * _amount, player, true);
|
||||
if (_product.isAnnounce())
|
||||
{
|
||||
Broadcast.toAllOnlinePlayers(new ExItemAnnounce(player, item, ExItemAnnounce.SPECIAL_CREATION));
|
||||
}
|
||||
}
|
||||
|
||||
// Update account variables.
|
||||
|
@@ -27,6 +27,7 @@ public class ExItemAnnounce extends ServerPacket
|
||||
{
|
||||
public static final int ENCHANT = 0;
|
||||
public static final int RANDOM_CRAFT = 2;
|
||||
public static final int SPECIAL_CREATION = 3;
|
||||
|
||||
private final Item _item;
|
||||
private final int _type;
|
||||
|
@@ -45,6 +45,7 @@
|
||||
<xs:attribute type="xs:byte" name="category" use="optional"/>
|
||||
<xs:attribute type="xs:int" name="minLevel" use="optional"/>
|
||||
<xs:attribute type="xs:int" name="maxLevel" use="optional"/>
|
||||
<xs:attribute type="xs:boolean" name="announce" use="optional"/>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:sequence>
|
||||
|
@@ -88,6 +88,7 @@ public class LimitShopClanData implements IXmlReader
|
||||
final int category = parseInteger(attrs, "category");
|
||||
final int minLevel = parseInteger(attrs, "minLevel", 1);
|
||||
final int maxLevel = parseInteger(attrs, "maxLevel", 999);
|
||||
final boolean announce = parseBoolean(attrs, "announce", false);
|
||||
final int[] ingredientIds = new int[5];
|
||||
ingredientIds[0] = 0;
|
||||
ingredientIds[1] = 0;
|
||||
@@ -190,7 +191,7 @@ public class LimitShopClanData implements IXmlReader
|
||||
}
|
||||
}
|
||||
|
||||
_products.add(new LimitShopProductHolder(id, category, minLevel, maxLevel, ingredientIds, ingredientQuantities, ingredientEnchants, productionId, 1, 100, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, accountDailyLimit, accountBuyLimit));
|
||||
_products.add(new LimitShopProductHolder(id, category, minLevel, maxLevel, ingredientIds, ingredientQuantities, ingredientEnchants, productionId, 1, 100, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, accountDailyLimit, accountBuyLimit, announce));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -90,6 +90,7 @@ public class LimitShopCraftData implements IXmlReader
|
||||
final int category = parseInteger(attrs, "category");
|
||||
final int minLevel = parseInteger(attrs, "minLevel", 1);
|
||||
final int maxLevel = parseInteger(attrs, "maxLevel", 999);
|
||||
final boolean announce = parseBoolean(attrs, "announce", false);
|
||||
final int[] ingredientIds = new int[5];
|
||||
ingredientIds[0] = 0;
|
||||
ingredientIds[1] = 0;
|
||||
@@ -232,7 +233,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, chance3, productionId4, count4, chance4, productionId5, count5, 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, announce));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -90,6 +90,7 @@ public class LimitShopData implements IXmlReader
|
||||
final int category = parseInteger(attrs, "category");
|
||||
final int minLevel = parseInteger(attrs, "minLevel", 1);
|
||||
final int maxLevel = parseInteger(attrs, "maxLevel", 999);
|
||||
final boolean announce = parseBoolean(attrs, "announce", false);
|
||||
final int[] ingredientIds = new int[5];
|
||||
ingredientIds[0] = 0;
|
||||
ingredientIds[1] = 0;
|
||||
@@ -209,7 +210,7 @@ public class LimitShopData implements IXmlReader
|
||||
}
|
||||
}
|
||||
|
||||
_products.add(new LimitShopProductHolder(id, category, minLevel, maxLevel, ingredientIds, ingredientQuantities, ingredientEnchants, productionId, 1, 100, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, accountDailyLimit, accountBuyLimit));
|
||||
_products.add(new LimitShopProductHolder(id, category, minLevel, maxLevel, ingredientIds, ingredientQuantities, ingredientEnchants, productionId, 1, 100, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, accountDailyLimit, accountBuyLimit, announce));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -44,8 +44,9 @@ public class LimitShopProductHolder
|
||||
private final long _count5;
|
||||
private final int _accountDailyLimit;
|
||||
private final int _accountBuyLimit;
|
||||
private final boolean _announce;
|
||||
|
||||
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)
|
||||
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, boolean announce)
|
||||
{
|
||||
_id = id;
|
||||
_category = category;
|
||||
@@ -70,6 +71,7 @@ public class LimitShopProductHolder
|
||||
_count5 = count5;
|
||||
_accountDailyLimit = accountDailyLimit;
|
||||
_accountBuyLimit = accountBuyLimit;
|
||||
_announce = announce;
|
||||
}
|
||||
|
||||
public int getId()
|
||||
@@ -186,4 +188,9 @@ public class LimitShopProductHolder
|
||||
{
|
||||
return _accountBuyLimit;
|
||||
}
|
||||
|
||||
public boolean isAnnounce()
|
||||
{
|
||||
return _announce;
|
||||
}
|
||||
}
|
||||
|
@@ -39,8 +39,10 @@ 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.ClientPacket;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.ExItemAnnounce;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.limitshop.ExPurchaseLimitShopItemResult;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.primeshop.ExBRBuyProduct;
|
||||
import org.l2jmobius.gameserver.util.Broadcast;
|
||||
|
||||
/**
|
||||
* @author Mobius
|
||||
@@ -238,34 +240,58 @@ public class RequestPurchaseLimitShopItemBuy implements ClientPacket
|
||||
if (Rnd.get(100) < _product.getChance())
|
||||
{
|
||||
rewards.computeIfAbsent(0, k -> new LimitShopRandomCraftReward(_product.getProductionId(), 0, 0)).getCount().addAndGet((int) _product.getCount());
|
||||
player.addItem("LCoinShop", _product.getProductionId(), _product.getCount(), player, true);
|
||||
final Item item = player.addItem("LCoinShop", _product.getProductionId(), _product.getCount(), player, true);
|
||||
if (_product.isAnnounce())
|
||||
{
|
||||
Broadcast.toAllOnlinePlayers(new ExItemAnnounce(player, item, ExItemAnnounce.SPECIAL_CREATION));
|
||||
}
|
||||
}
|
||||
else if ((Rnd.get(100) < _product.getChance2()) || (_product.getProductionId3() == 0))
|
||||
{
|
||||
rewards.computeIfAbsent(1, k -> new LimitShopRandomCraftReward(_product.getProductionId2(), 0, 1)).getCount().addAndGet((int) _product.getCount2());
|
||||
player.addItem("LCoinShop", _product.getProductionId2(), _product.getCount2(), player, true);
|
||||
final Item item = player.addItem("LCoinShop", _product.getProductionId2(), _product.getCount2(), player, true);
|
||||
if (_product.isAnnounce())
|
||||
{
|
||||
Broadcast.toAllOnlinePlayers(new ExItemAnnounce(player, item, ExItemAnnounce.SPECIAL_CREATION));
|
||||
}
|
||||
}
|
||||
else if ((Rnd.get(100) < _product.getChance3()) || (_product.getProductionId4() == 0))
|
||||
{
|
||||
rewards.computeIfAbsent(2, k -> new LimitShopRandomCraftReward(_product.getProductionId3(), 0, 2)).getCount().addAndGet((int) _product.getCount3());
|
||||
player.addItem("LCoinShop", _product.getProductionId3(), _product.getCount3(), player, true);
|
||||
final Item item = player.addItem("LCoinShop", _product.getProductionId3(), _product.getCount3(), player, true);
|
||||
if (_product.isAnnounce())
|
||||
{
|
||||
Broadcast.toAllOnlinePlayers(new ExItemAnnounce(player, item, ExItemAnnounce.SPECIAL_CREATION));
|
||||
}
|
||||
}
|
||||
else if ((Rnd.get(100) < _product.getChance4()) || (_product.getProductionId5() == 0))
|
||||
{
|
||||
rewards.computeIfAbsent(3, k -> new LimitShopRandomCraftReward(_product.getProductionId4(), 0, 3)).getCount().addAndGet((int) _product.getCount4());
|
||||
player.addItem("LCoinShop", _product.getProductionId4(), _product.getCount4(), player, true);
|
||||
final Item item = player.addItem("LCoinShop", _product.getProductionId4(), _product.getCount4(), player, true);
|
||||
if (_product.isAnnounce())
|
||||
{
|
||||
Broadcast.toAllOnlinePlayers(new ExItemAnnounce(player, item, ExItemAnnounce.SPECIAL_CREATION));
|
||||
}
|
||||
}
|
||||
else if (_product.getProductionId5() > 0)
|
||||
{
|
||||
rewards.computeIfAbsent(4, k -> new LimitShopRandomCraftReward(_product.getProductionId5(), 0, 4)).getCount().addAndGet((int) _product.getCount5());
|
||||
player.addItem("LCoinShop", _product.getProductionId5(), _product.getCount5(), player, true);
|
||||
final Item item = player.addItem("LCoinShop", _product.getProductionId5(), _product.getCount5(), player, true);
|
||||
if (_product.isAnnounce())
|
||||
{
|
||||
Broadcast.toAllOnlinePlayers(new ExItemAnnounce(player, item, ExItemAnnounce.SPECIAL_CREATION));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (Rnd.get(100) < _product.getChance())
|
||||
{
|
||||
rewards.put(0, new LimitShopRandomCraftReward(_product.getProductionId(), (int) (_product.getCount() * _amount), 0));
|
||||
player.addItem("LCoinShop", _product.getProductionId(), _product.getCount() * _amount, player, true);
|
||||
final Item item = player.addItem("LCoinShop", _product.getProductionId(), _product.getCount() * _amount, player, true);
|
||||
if (_product.isAnnounce())
|
||||
{
|
||||
Broadcast.toAllOnlinePlayers(new ExItemAnnounce(player, item, ExItemAnnounce.SPECIAL_CREATION));
|
||||
}
|
||||
}
|
||||
|
||||
// Update account variables.
|
||||
|
@@ -27,6 +27,7 @@ public class ExItemAnnounce extends ServerPacket
|
||||
{
|
||||
public static final int ENCHANT = 0;
|
||||
public static final int RANDOM_CRAFT = 2;
|
||||
public static final int SPECIAL_CREATION = 3;
|
||||
|
||||
private final Item _item;
|
||||
private final int _type;
|
||||
|
@@ -45,6 +45,7 @@
|
||||
<xs:attribute type="xs:byte" name="category" use="optional"/>
|
||||
<xs:attribute type="xs:int" name="minLevel" use="optional"/>
|
||||
<xs:attribute type="xs:int" name="maxLevel" use="optional"/>
|
||||
<xs:attribute type="xs:boolean" name="announce" use="optional"/>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:sequence>
|
||||
|
@@ -88,6 +88,7 @@ public class LimitShopClanData implements IXmlReader
|
||||
final int category = parseInteger(attrs, "category");
|
||||
final int minLevel = parseInteger(attrs, "minLevel", 1);
|
||||
final int maxLevel = parseInteger(attrs, "maxLevel", 999);
|
||||
final boolean announce = parseBoolean(attrs, "announce", false);
|
||||
final int[] ingredientIds = new int[5];
|
||||
ingredientIds[0] = 0;
|
||||
ingredientIds[1] = 0;
|
||||
@@ -190,7 +191,7 @@ public class LimitShopClanData implements IXmlReader
|
||||
}
|
||||
}
|
||||
|
||||
_products.add(new LimitShopProductHolder(id, category, minLevel, maxLevel, ingredientIds, ingredientQuantities, ingredientEnchants, productionId, 1, 100, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, accountDailyLimit, accountBuyLimit));
|
||||
_products.add(new LimitShopProductHolder(id, category, minLevel, maxLevel, ingredientIds, ingredientQuantities, ingredientEnchants, productionId, 1, 100, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, accountDailyLimit, accountBuyLimit, announce));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -90,6 +90,7 @@ public class LimitShopCraftData implements IXmlReader
|
||||
final int category = parseInteger(attrs, "category");
|
||||
final int minLevel = parseInteger(attrs, "minLevel", 1);
|
||||
final int maxLevel = parseInteger(attrs, "maxLevel", 999);
|
||||
final boolean announce = parseBoolean(attrs, "announce", false);
|
||||
final int[] ingredientIds = new int[5];
|
||||
ingredientIds[0] = 0;
|
||||
ingredientIds[1] = 0;
|
||||
@@ -232,7 +233,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, chance3, productionId4, count4, chance4, productionId5, count5, 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, announce));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -90,6 +90,7 @@ public class LimitShopData implements IXmlReader
|
||||
final int category = parseInteger(attrs, "category");
|
||||
final int minLevel = parseInteger(attrs, "minLevel", 1);
|
||||
final int maxLevel = parseInteger(attrs, "maxLevel", 999);
|
||||
final boolean announce = parseBoolean(attrs, "announce", false);
|
||||
final int[] ingredientIds = new int[5];
|
||||
ingredientIds[0] = 0;
|
||||
ingredientIds[1] = 0;
|
||||
@@ -209,7 +210,7 @@ public class LimitShopData implements IXmlReader
|
||||
}
|
||||
}
|
||||
|
||||
_products.add(new LimitShopProductHolder(id, category, minLevel, maxLevel, ingredientIds, ingredientQuantities, ingredientEnchants, productionId, 1, 100, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, accountDailyLimit, accountBuyLimit));
|
||||
_products.add(new LimitShopProductHolder(id, category, minLevel, maxLevel, ingredientIds, ingredientQuantities, ingredientEnchants, productionId, 1, 100, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, accountDailyLimit, accountBuyLimit, announce));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -44,8 +44,9 @@ public class LimitShopProductHolder
|
||||
private final long _count5;
|
||||
private final int _accountDailyLimit;
|
||||
private final int _accountBuyLimit;
|
||||
private final boolean _announce;
|
||||
|
||||
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)
|
||||
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, boolean announce)
|
||||
{
|
||||
_id = id;
|
||||
_category = category;
|
||||
@@ -70,6 +71,7 @@ public class LimitShopProductHolder
|
||||
_count5 = count5;
|
||||
_accountDailyLimit = accountDailyLimit;
|
||||
_accountBuyLimit = accountBuyLimit;
|
||||
_announce = announce;
|
||||
}
|
||||
|
||||
public int getId()
|
||||
@@ -186,4 +188,9 @@ public class LimitShopProductHolder
|
||||
{
|
||||
return _accountBuyLimit;
|
||||
}
|
||||
|
||||
public boolean isAnnounce()
|
||||
{
|
||||
return _announce;
|
||||
}
|
||||
}
|
||||
|
@@ -39,8 +39,10 @@ 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.ClientPacket;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.ExItemAnnounce;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.limitshop.ExPurchaseLimitShopItemResult;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.primeshop.ExBRBuyProduct;
|
||||
import org.l2jmobius.gameserver.util.Broadcast;
|
||||
|
||||
/**
|
||||
* @author Mobius
|
||||
@@ -238,34 +240,58 @@ public class RequestPurchaseLimitShopItemBuy implements ClientPacket
|
||||
if (Rnd.get(100) < _product.getChance())
|
||||
{
|
||||
rewards.computeIfAbsent(0, k -> new LimitShopRandomCraftReward(_product.getProductionId(), 0, 0)).getCount().addAndGet((int) _product.getCount());
|
||||
player.addItem("LCoinShop", _product.getProductionId(), _product.getCount(), player, true);
|
||||
final Item item = player.addItem("LCoinShop", _product.getProductionId(), _product.getCount(), player, true);
|
||||
if (_product.isAnnounce())
|
||||
{
|
||||
Broadcast.toAllOnlinePlayers(new ExItemAnnounce(player, item, ExItemAnnounce.SPECIAL_CREATION));
|
||||
}
|
||||
}
|
||||
else if ((Rnd.get(100) < _product.getChance2()) || (_product.getProductionId3() == 0))
|
||||
{
|
||||
rewards.computeIfAbsent(1, k -> new LimitShopRandomCraftReward(_product.getProductionId2(), 0, 1)).getCount().addAndGet((int) _product.getCount2());
|
||||
player.addItem("LCoinShop", _product.getProductionId2(), _product.getCount2(), player, true);
|
||||
final Item item = player.addItem("LCoinShop", _product.getProductionId2(), _product.getCount2(), player, true);
|
||||
if (_product.isAnnounce())
|
||||
{
|
||||
Broadcast.toAllOnlinePlayers(new ExItemAnnounce(player, item, ExItemAnnounce.SPECIAL_CREATION));
|
||||
}
|
||||
}
|
||||
else if ((Rnd.get(100) < _product.getChance3()) || (_product.getProductionId4() == 0))
|
||||
{
|
||||
rewards.computeIfAbsent(2, k -> new LimitShopRandomCraftReward(_product.getProductionId3(), 0, 2)).getCount().addAndGet((int) _product.getCount3());
|
||||
player.addItem("LCoinShop", _product.getProductionId3(), _product.getCount3(), player, true);
|
||||
final Item item = player.addItem("LCoinShop", _product.getProductionId3(), _product.getCount3(), player, true);
|
||||
if (_product.isAnnounce())
|
||||
{
|
||||
Broadcast.toAllOnlinePlayers(new ExItemAnnounce(player, item, ExItemAnnounce.SPECIAL_CREATION));
|
||||
}
|
||||
}
|
||||
else if ((Rnd.get(100) < _product.getChance4()) || (_product.getProductionId5() == 0))
|
||||
{
|
||||
rewards.computeIfAbsent(3, k -> new LimitShopRandomCraftReward(_product.getProductionId4(), 0, 3)).getCount().addAndGet((int) _product.getCount4());
|
||||
player.addItem("LCoinShop", _product.getProductionId4(), _product.getCount4(), player, true);
|
||||
final Item item = player.addItem("LCoinShop", _product.getProductionId4(), _product.getCount4(), player, true);
|
||||
if (_product.isAnnounce())
|
||||
{
|
||||
Broadcast.toAllOnlinePlayers(new ExItemAnnounce(player, item, ExItemAnnounce.SPECIAL_CREATION));
|
||||
}
|
||||
}
|
||||
else if (_product.getProductionId5() > 0)
|
||||
{
|
||||
rewards.computeIfAbsent(4, k -> new LimitShopRandomCraftReward(_product.getProductionId5(), 0, 4)).getCount().addAndGet((int) _product.getCount5());
|
||||
player.addItem("LCoinShop", _product.getProductionId5(), _product.getCount5(), player, true);
|
||||
final Item item = player.addItem("LCoinShop", _product.getProductionId5(), _product.getCount5(), player, true);
|
||||
if (_product.isAnnounce())
|
||||
{
|
||||
Broadcast.toAllOnlinePlayers(new ExItemAnnounce(player, item, ExItemAnnounce.SPECIAL_CREATION));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (Rnd.get(100) < _product.getChance())
|
||||
{
|
||||
rewards.put(0, new LimitShopRandomCraftReward(_product.getProductionId(), (int) (_product.getCount() * _amount), 0));
|
||||
player.addItem("LCoinShop", _product.getProductionId(), _product.getCount() * _amount, player, true);
|
||||
final Item item = player.addItem("LCoinShop", _product.getProductionId(), _product.getCount() * _amount, player, true);
|
||||
if (_product.isAnnounce())
|
||||
{
|
||||
Broadcast.toAllOnlinePlayers(new ExItemAnnounce(player, item, ExItemAnnounce.SPECIAL_CREATION));
|
||||
}
|
||||
}
|
||||
|
||||
// Update account variables.
|
||||
|
@@ -27,6 +27,7 @@ public class ExItemAnnounce extends ServerPacket
|
||||
{
|
||||
public static final int ENCHANT = 0;
|
||||
public static final int RANDOM_CRAFT = 2;
|
||||
public static final int SPECIAL_CREATION = 3;
|
||||
|
||||
private final Item _item;
|
||||
private final int _type;
|
||||
|
@@ -45,6 +45,7 @@
|
||||
<xs:attribute type="xs:byte" name="category" use="optional"/>
|
||||
<xs:attribute type="xs:int" name="minLevel" use="optional"/>
|
||||
<xs:attribute type="xs:int" name="maxLevel" use="optional"/>
|
||||
<xs:attribute type="xs:boolean" name="announce" use="optional"/>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:sequence>
|
||||
|
@@ -88,6 +88,7 @@ public class LimitShopClanData implements IXmlReader
|
||||
final int category = parseInteger(attrs, "category");
|
||||
final int minLevel = parseInteger(attrs, "minLevel", 1);
|
||||
final int maxLevel = parseInteger(attrs, "maxLevel", 999);
|
||||
final boolean announce = parseBoolean(attrs, "announce", false);
|
||||
final int[] ingredientIds = new int[5];
|
||||
ingredientIds[0] = 0;
|
||||
ingredientIds[1] = 0;
|
||||
@@ -190,7 +191,7 @@ public class LimitShopClanData implements IXmlReader
|
||||
}
|
||||
}
|
||||
|
||||
_products.add(new LimitShopProductHolder(id, category, minLevel, maxLevel, ingredientIds, ingredientQuantities, ingredientEnchants, productionId, 1, 100, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, accountDailyLimit, accountBuyLimit));
|
||||
_products.add(new LimitShopProductHolder(id, category, minLevel, maxLevel, ingredientIds, ingredientQuantities, ingredientEnchants, productionId, 1, 100, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, accountDailyLimit, accountBuyLimit, announce));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -90,6 +90,7 @@ public class LimitShopCraftData implements IXmlReader
|
||||
final int category = parseInteger(attrs, "category");
|
||||
final int minLevel = parseInteger(attrs, "minLevel", 1);
|
||||
final int maxLevel = parseInteger(attrs, "maxLevel", 999);
|
||||
final boolean announce = parseBoolean(attrs, "announce", false);
|
||||
final int[] ingredientIds = new int[5];
|
||||
ingredientIds[0] = 0;
|
||||
ingredientIds[1] = 0;
|
||||
@@ -232,7 +233,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, chance3, productionId4, count4, chance4, productionId5, count5, 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, announce));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -90,6 +90,7 @@ public class LimitShopData implements IXmlReader
|
||||
final int category = parseInteger(attrs, "category");
|
||||
final int minLevel = parseInteger(attrs, "minLevel", 1);
|
||||
final int maxLevel = parseInteger(attrs, "maxLevel", 999);
|
||||
final boolean announce = parseBoolean(attrs, "announce", false);
|
||||
final int[] ingredientIds = new int[5];
|
||||
ingredientIds[0] = 0;
|
||||
ingredientIds[1] = 0;
|
||||
@@ -209,7 +210,7 @@ public class LimitShopData implements IXmlReader
|
||||
}
|
||||
}
|
||||
|
||||
_products.add(new LimitShopProductHolder(id, category, minLevel, maxLevel, ingredientIds, ingredientQuantities, ingredientEnchants, productionId, 1, 100, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, accountDailyLimit, accountBuyLimit));
|
||||
_products.add(new LimitShopProductHolder(id, category, minLevel, maxLevel, ingredientIds, ingredientQuantities, ingredientEnchants, productionId, 1, 100, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, accountDailyLimit, accountBuyLimit, announce));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -44,8 +44,9 @@ public class LimitShopProductHolder
|
||||
private final long _count5;
|
||||
private final int _accountDailyLimit;
|
||||
private final int _accountBuyLimit;
|
||||
private final boolean _announce;
|
||||
|
||||
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)
|
||||
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, boolean announce)
|
||||
{
|
||||
_id = id;
|
||||
_category = category;
|
||||
@@ -70,6 +71,7 @@ public class LimitShopProductHolder
|
||||
_count5 = count5;
|
||||
_accountDailyLimit = accountDailyLimit;
|
||||
_accountBuyLimit = accountBuyLimit;
|
||||
_announce = announce;
|
||||
}
|
||||
|
||||
public int getId()
|
||||
@@ -186,4 +188,9 @@ public class LimitShopProductHolder
|
||||
{
|
||||
return _accountBuyLimit;
|
||||
}
|
||||
|
||||
public boolean isAnnounce()
|
||||
{
|
||||
return _announce;
|
||||
}
|
||||
}
|
||||
|
@@ -39,9 +39,11 @@ 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.ClientPacket;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.ExItemAnnounce;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.ExPCCafePointInfo;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.limitshop.ExPurchaseLimitShopItemResult;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.primeshop.ExBRBuyProduct;
|
||||
import org.l2jmobius.gameserver.util.Broadcast;
|
||||
|
||||
/**
|
||||
* @author Mobius
|
||||
@@ -258,34 +260,58 @@ public class RequestPurchaseLimitShopItemBuy implements ClientPacket
|
||||
if (Rnd.get(100) < _product.getChance())
|
||||
{
|
||||
rewards.computeIfAbsent(0, k -> new LimitShopRandomCraftReward(_product.getProductionId(), 0, 0)).getCount().addAndGet((int) _product.getCount());
|
||||
player.addItem("LCoinShop", _product.getProductionId(), _product.getCount(), player, true);
|
||||
final Item item = player.addItem("LCoinShop", _product.getProductionId(), _product.getCount(), player, true);
|
||||
if (_product.isAnnounce())
|
||||
{
|
||||
Broadcast.toAllOnlinePlayers(new ExItemAnnounce(player, item, ExItemAnnounce.SPECIAL_CREATION));
|
||||
}
|
||||
}
|
||||
else if ((Rnd.get(100) < _product.getChance2()) || (_product.getProductionId3() == 0))
|
||||
{
|
||||
rewards.computeIfAbsent(1, k -> new LimitShopRandomCraftReward(_product.getProductionId2(), 0, 1)).getCount().addAndGet((int) _product.getCount2());
|
||||
player.addItem("LCoinShop", _product.getProductionId2(), _product.getCount2(), player, true);
|
||||
final Item item = player.addItem("LCoinShop", _product.getProductionId2(), _product.getCount2(), player, true);
|
||||
if (_product.isAnnounce())
|
||||
{
|
||||
Broadcast.toAllOnlinePlayers(new ExItemAnnounce(player, item, ExItemAnnounce.SPECIAL_CREATION));
|
||||
}
|
||||
}
|
||||
else if ((Rnd.get(100) < _product.getChance3()) || (_product.getProductionId4() == 0))
|
||||
{
|
||||
rewards.computeIfAbsent(2, k -> new LimitShopRandomCraftReward(_product.getProductionId3(), 0, 2)).getCount().addAndGet((int) _product.getCount3());
|
||||
player.addItem("LCoinShop", _product.getProductionId3(), _product.getCount3(), player, true);
|
||||
final Item item = player.addItem("LCoinShop", _product.getProductionId3(), _product.getCount3(), player, true);
|
||||
if (_product.isAnnounce())
|
||||
{
|
||||
Broadcast.toAllOnlinePlayers(new ExItemAnnounce(player, item, ExItemAnnounce.SPECIAL_CREATION));
|
||||
}
|
||||
}
|
||||
else if ((Rnd.get(100) < _product.getChance4()) || (_product.getProductionId5() == 0))
|
||||
{
|
||||
rewards.computeIfAbsent(3, k -> new LimitShopRandomCraftReward(_product.getProductionId4(), 0, 3)).getCount().addAndGet((int) _product.getCount4());
|
||||
player.addItem("LCoinShop", _product.getProductionId4(), _product.getCount4(), player, true);
|
||||
final Item item = player.addItem("LCoinShop", _product.getProductionId4(), _product.getCount4(), player, true);
|
||||
if (_product.isAnnounce())
|
||||
{
|
||||
Broadcast.toAllOnlinePlayers(new ExItemAnnounce(player, item, ExItemAnnounce.SPECIAL_CREATION));
|
||||
}
|
||||
}
|
||||
else if (_product.getProductionId5() > 0)
|
||||
{
|
||||
rewards.computeIfAbsent(4, k -> new LimitShopRandomCraftReward(_product.getProductionId5(), 0, 4)).getCount().addAndGet((int) _product.getCount5());
|
||||
player.addItem("LCoinShop", _product.getProductionId5(), _product.getCount5(), player, true);
|
||||
final Item item = player.addItem("LCoinShop", _product.getProductionId5(), _product.getCount5(), player, true);
|
||||
if (_product.isAnnounce())
|
||||
{
|
||||
Broadcast.toAllOnlinePlayers(new ExItemAnnounce(player, item, ExItemAnnounce.SPECIAL_CREATION));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (Rnd.get(100) < _product.getChance())
|
||||
{
|
||||
rewards.put(0, new LimitShopRandomCraftReward(_product.getProductionId(), (int) (_product.getCount() * _amount), 0));
|
||||
player.addItem("LCoinShop", _product.getProductionId(), _product.getCount() * _amount, player, true);
|
||||
final Item item = player.addItem("LCoinShop", _product.getProductionId(), _product.getCount() * _amount, player, true);
|
||||
if (_product.isAnnounce())
|
||||
{
|
||||
Broadcast.toAllOnlinePlayers(new ExItemAnnounce(player, item, ExItemAnnounce.SPECIAL_CREATION));
|
||||
}
|
||||
}
|
||||
|
||||
// Update account variables.
|
||||
|
@@ -27,6 +27,7 @@ public class ExItemAnnounce extends ServerPacket
|
||||
{
|
||||
public static final int ENCHANT = 0;
|
||||
public static final int RANDOM_CRAFT = 2;
|
||||
public static final int SPECIAL_CREATION = 3;
|
||||
|
||||
private final Item _item;
|
||||
private final int _type;
|
||||
|
Reference in New Issue
Block a user