Example #1
0
        private static void WriteItemBundleData(this IPacketWriter p, ItemSlotBundle i)
        {
            p.WriteByte(2);

            p.WriteItemBase(i);

            p.WriteShort(i.Number);
            p.WriteString(i.Title);
            p.WriteShort(i.Attribute);

            if ((i.TemplateID / 10000) == 207 || (i.TemplateID / 10000) == 233) // TODO: constants, recharge items
            {
                p.WriteLong(0);
            }
        }
Example #2
0
        public static void Encode(this ItemSlotBundle i, IPacket p)
        {
            p.Encode <byte>(2);

            i.EncodeBase(p);

            p.Encode <short>(i.Number);
            p.Encode <string>(i.Title);
            p.Encode <short>(i.Attribute);

            if (ItemConstants.IsRechargeableItem(i.TemplateID))
            {
                p.Encode <long>(0);
            }
        }
Example #3
0
        public static void Encode(this ItemSlotBundle i, OutPacket p)
        {
            p.Encode <byte>(2);

            (i as ItemSlot).Encode(p);

            p.Encode <short>(i.Number);
            p.Encode <string>(i.Title);
            p.Encode <short>(i.Attribute);

            if (ItemInfo.IsRechargeableItem(i.TemplateID))
            {
                p.Encode <long>(0);
            }
        }
Example #4
0
        public ItemSlotBundle Take(short slot, short count = 1)
        {
            var bundle = (ItemSlotBundle)_inventory.Items[slot];
            var result = new ItemSlotBundle
            {
                TemplateID = bundle.TemplateID,
                Number     = count,
                Attribute  = bundle.Attribute,
                Title      = bundle.Title,
                DateExpire = bundle.DateExpire,
                CashItemSN = bundle.CashItemSN
            };

            Remove(bundle, count);
            return(result);
        }
Example #5
0
 private void UpdateQuantity(ItemSlotBundle item)
 => UpdateQuantity(_inventory.Items.First(i => i.Value == item).Key, item.Number);
Example #6
0
 public ItemSlotBundle Take(ItemSlotBundle bundle, short count = 1)
 => Take(_inventory.Items.First(i => i.Value.Equals(bundle)).Key, count);
Example #7
0
 public ItemSlotBundle Take(ItemSlotBundle bundle, short count = 1)
     => _inventories[(ItemInventoryType) (bundle.TemplateID / 1000000)].Take(bundle, count);