Proper limit shop packet structure.

This commit is contained in:
MobiusDevelopment 2021-04-27 11:38:42 +00:00
parent 2a8c7f5614
commit c9e2128873
4 changed files with 30 additions and 42 deletions

View File

@ -7,7 +7,7 @@
<product id="1002" category="1"> <!-- TODO: It has a 33% chance of giving the item, or 33% chance of giving a Package: Sword of Ipos (+0) and 33% chance of giving 6 Giran Seals -->
<ingredient id="92314" count="41" /> <!-- Giran Seal -->
<production id="94574" /> <!-- Package: +5 Sword of Ipos -->
</product>
</product>
<product id="1003" category="1"> <!-- TODO: It has a 33% chance of giving the item, or 33% chance of giving a Package: Barakiel's Axe (+0) and 33% chance of giving 6 Giran Seals -->
<ingredient id="92314" count="41" /> <!-- Giran Seal -->
<production id="94575" /> <!-- Package: +5 Barakiel's Axe -->

View File

@ -35,21 +35,14 @@ public class ExPurchaseLimitShopItemListNew implements IClientOutgoingPacket
{
private final int _shopType; // 3 = Lcoin Shop - 4 = Special Craft
private final PlayerInstance _player;
private Collection<LCoinShopProductHolder> _products;
private final Collection<LCoinShopProductHolder> _products;
public ExPurchaseLimitShopItemListNew(int shopType, PlayerInstance player)
{
_shopType = shopType;
_player = player;
_products = null;
}
@Override
public boolean write(PacketWriter packet)
{
OutgoingPackets.EX_PURCHASE_LIMIT_SHOP_ITEM_LIST_NEW.writeId(packet);
switch (_shopType)
switch (shopType) // 3 = Lcoin Shop - 4 = Special Craft
{
case 3: // Normal Lcoin Shop
{
@ -66,10 +59,15 @@ public class ExPurchaseLimitShopItemListNew implements IClientOutgoingPacket
_products = LCoinShopData.getInstance().getProducts();
}
}
}
@Override
public boolean write(PacketWriter packet)
{
OutgoingPackets.EX_PURCHASE_LIMIT_SHOP_ITEM_LIST_NEW.writeId(packet);
packet.writeC(_shopType); //
packet.writeD(_products.size());
for (LCoinShopProductHolder product : _products)
{
packet.writeD(product.getId());
@ -81,13 +79,9 @@ public class ExPurchaseLimitShopItemListNew implements IClientOutgoingPacket
packet.writeQ(product.getIngredientQuantities()[1]);
packet.writeQ(product.getIngredientQuantities()[2]);
packet.writeH(0x00); // ?
packet.writeC(-1); // remaining amount?
packet.writeC(-1); // remaining time?
packet.writeC(-1); // ?
packet.writeC(-1); // ?
packet.writeH(0x00); // sCostItemEnchant 1
packet.writeH(0x00); // sCostItemEnchant 2
packet.writeH(0x00); // sCostItemEnchant 3
// Check limits.
if (product.getAccountDailyLimit() > 0) // Sale period.
@ -124,8 +118,8 @@ public class ExPurchaseLimitShopItemListNew implements IClientOutgoingPacket
{
packet.writeD(0x01);
}
packet.writeD(0x00);
packet.writeD(0x00);
packet.writeD(0x00); // nRemainSec
packet.writeD(0x00); // nRemainServerItemAmount
}
return true;

View File

@ -7,7 +7,7 @@
<product id="1002" category="1"> <!-- TODO: It has a 33% chance of giving the item, or 33% chance of giving a Package: Sword of Ipos (+0) and 33% chance of giving 6 Giran Seals -->
<ingredient id="92314" count="41" /> <!-- Giran Seal -->
<production id="94574" /> <!-- Package: +5 Sword of Ipos -->
</product>
</product>
<product id="1003" category="1"> <!-- TODO: It has a 33% chance of giving the item, or 33% chance of giving a Package: Barakiel's Axe (+0) and 33% chance of giving 6 Giran Seals -->
<ingredient id="92314" count="41" /> <!-- Giran Seal -->
<production id="94575" /> <!-- Package: +5 Barakiel's Axe -->

View File

@ -35,21 +35,14 @@ public class ExPurchaseLimitShopItemListNew implements IClientOutgoingPacket
{
private final int _shopType; // 3 = Lcoin Shop - 4 = Special Craft
private final PlayerInstance _player;
private Collection<LCoinShopProductHolder> _products;
private final Collection<LCoinShopProductHolder> _products;
public ExPurchaseLimitShopItemListNew(int shopType, PlayerInstance player)
{
_shopType = shopType;
_player = player;
_products = null;
}
@Override
public boolean write(PacketWriter packet)
{
OutgoingPackets.EX_PURCHASE_LIMIT_SHOP_ITEM_LIST_NEW.writeId(packet);
switch (_shopType)
switch (shopType) // 3 = Lcoin Shop - 4 = Special Craft
{
case 3: // Normal Lcoin Shop
{
@ -66,10 +59,15 @@ public class ExPurchaseLimitShopItemListNew implements IClientOutgoingPacket
_products = LCoinShopData.getInstance().getProducts();
}
}
}
@Override
public boolean write(PacketWriter packet)
{
OutgoingPackets.EX_PURCHASE_LIMIT_SHOP_ITEM_LIST_NEW.writeId(packet);
packet.writeC(_shopType); //
packet.writeD(_products.size());
for (LCoinShopProductHolder product : _products)
{
packet.writeD(product.getId());
@ -85,15 +83,11 @@ public class ExPurchaseLimitShopItemListNew implements IClientOutgoingPacket
packet.writeQ(product.getIngredientQuantities()[3]); // 306
packet.writeQ(product.getIngredientQuantities()[4]); // 306
packet.writeH(0x00); // ?
packet.writeH(0x00); // ? 306
packet.writeH(0x00); // ? 306
packet.writeC(-1); // remaining amount?
packet.writeC(-1); // remaining time?
packet.writeC(-1); // ?
packet.writeC(-1); // ?
packet.writeH(0x00); // sCostItemEnchant 1
packet.writeH(0x00); // sCostItemEnchant 2
packet.writeH(0x00); // sCostItemEnchant 3
packet.writeH(0x00); // sCostItemEnchant 4 (306)
packet.writeH(0x00); // sCostItemEnchant 5 (306)
// Check limits.
if (product.getAccountDailyLimit() > 0) // Sale period.
@ -130,8 +124,8 @@ public class ExPurchaseLimitShopItemListNew implements IClientOutgoingPacket
{
packet.writeD(0x01);
}
packet.writeD(0x00);
packet.writeD(0x00);
packet.writeD(0x00); // nRemainSec
packet.writeD(0x00); // nRemainServerItemAmount
}
return true;