Ejemplo n.º 1
0
 internal ItemStack(PacketReader stream)
 {
     Type = stream.ReadShort();
     if (Type >= 0)
     {
         Count = stream.ReadSByte();
         Durability = stream.ReadShort();
     }
 }
Ejemplo n.º 2
0
        internal ItemStack(PacketReader stream)
        {
            Type = stream.ReadShort();
            if (Type >= 0)
            {
                Count = stream.ReadSByte();
                Durability = stream.ReadShort();

                // TODO: Implement extra data read (enchantment) and items
                if (Durability > 0 || IsEnchantable())
                    stream.ReadShort();
            }
        }
Ejemplo n.º 3
0
        public static ItemInventory GetInstance(PacketReader stream)
        {
            ItemInventory item = null;
            Type itemClass;
            short type = stream.ReadShort();
            sbyte count;
            short durability;
            if (type >= 0)
            {
                count = stream.ReadSByte();
                durability = stream.ReadShort();
                if (_itemClasses.TryGetValue(type, out itemClass))
                {
                    item = (ItemInventory)itemClass.GetConstructor(Type.EmptyTypes).Invoke(null);
                    item.Count = count;
                    item.Durability = durability;
                    // TODO: Implement extra data read (enchantment) and items

                    //if (durability > 0 || item.IsEnchantable)
                        stream.ReadShort();
                }
            }
            return item;
        }
Ejemplo n.º 4
0
 internal static ItemStack Read(PacketReader stream)
 {
     ItemStack retval = new ItemStack(stream.ReadShort());
     if (retval.Type >= 0)
     {
         retval.Count = stream.ReadSByte();
         retval.Durability = stream.ReadShort();
     }
     return retval;
 }
Ejemplo n.º 5
0
        internal static ItemStack Read(PacketReader stream)
        {
            ItemStack retval = new ItemStack(stream.ReadShort());
            if (retval.Type >= 0)
            {
                retval.Count = stream.ReadSByte();
                retval.Durability = stream.ReadShort();

                // TODO: Implement extra data read (enchantment) and items

                if (retval.Durability > 0 || retval.IsEnchantable())
                    stream.ReadShort();
            }
            return retval;
        }
Ejemplo n.º 6
0
        public ItemBase(PacketReader stream)
        {
            Type = stream.ReadShort();
            if (Type >= 0)
            {
                Count = stream.ReadSByte();
                Durability = stream.ReadShort();

                // TODO: Implement extra data read (enchantment) and items

                //if (Durability > 0 || IsEnchantable)
                    stream.ReadShort();
            }
        }