using ODMO.Commons.Models.Base;
using ODMO.Commons.Models.TamerShop;
using ODMO.Commons.Writers;
namespace ODMO.Commons.Packets.PersonalShop
{
public class ConsignedShopItemsViewPacket : PacketWriter
{
private const int PacketNumber = 1520;
///
/// Shows the selling item list in the target consigned shop.
///
/// The consigned shop basic information.
/// The consigned shop items.
/// The consigned shop owner name.
public ConsignedShopItemsViewPacket(ConsignedShop consignedShop, ItemListModel consignedShopItems, string ownerName, bool isOwner = false)
{
Type(PacketNumber);
WriteInt(100);
WriteInt(consignedShop.ItemId);
WriteString(consignedShop.ShopName);
WriteString(ownerName);
WriteInt(consignedShopItems.Count);
foreach (var item in consignedShopItems.Items.Where(x => x.ItemId > 0))
{
WriteBytes(item.ToArray());
WriteInt64(item.TamerShopSellPrice);
}
WriteInt(consignedShopItems.Count);
foreach (var item in consignedShopItems.Items.Where(x => x.ItemId > 0))
{
WriteBytes(item.ToArray());
WriteInt64(item.TamerShopSellPrice);
}
WriteByte(isOwner ? (byte)1 : (byte)0);
}
public ConsignedShopItemsViewPacket()
{
Type(PacketNumber);
WriteInt(0);
}
}
}