예제 #1
0
        public Task Enter(IFieldObjUser user)
        {
            var items = Info.Items.Values
                        .OrderBy(i => i.ID)
                        .ToList();
            var packet = new UnstructuredOutgoingPacket(PacketSendOperations.OpenShopDlg);

            packet.WriteInt(TemplateID);
            packet.WriteShort((short)items.Count);

            items.ForEach(i =>
            {
                packet.WriteInt(i.TemplateID);
                packet.WriteInt(i.Price);
                packet.WriteByte(i.DiscountRate);
                packet.WriteInt(i.TokenTemplateID);
                packet.WriteInt(i.TokenPrice);
                packet.WriteInt(i.ItemPeriod);
                packet.WriteInt(i.LevelLimited);

                if (GameConstants.IsRechargeableItem(i.TemplateID))
                {
                    packet.WriteDouble(i.UnitPrice);
                }
                else
                {
                    packet.WriteShort((short)i.Quantity);
                }

                packet.WriteShort(i.MaxPerSlot);
            });

            return(user.Dispatch(packet));
        }