private DFItem ReadNextItem(BinaryReader reader)
        {
            DFItem item = new DFItem();
            item.position = reader.BaseStream.Position;
            item.name = reader.ReadBytes(nameLength);
            item.baseWeightUnits = reader.ReadInt32();
            item.hitPoints = reader.ReadInt16();
            item.capacityOrTarget = reader.ReadInt32();
            item.basePrice = reader.ReadInt32();
            item.enchantmentPoints = reader.ReadInt16();
            item.unknown = reader.ReadByte();
            item.variants = reader.ReadByte();
            item.drawOrderOrEffect = reader.ReadByte();
            item.propertiesBitfield = reader.ReadByte();
            item.worldTextureBitfield = reader.ReadInt16();
            item.playerTextureBitfield = reader.ReadInt16();

            return item;
        }
 /// <summary>
 /// Rewrites item data back into disk file.
 /// Must have been opened with FileUsage.UseDisk and readOnly flag false.
 /// </summary>
 /// <param name="item">Item to rewrite.</param>
 public void RewriteItem(DFItem item)
 {
     if (isOpen && fallExeFile.Usage == FileUsage.UseDisk && fallExeFile.ReadOnly == false)
     {
         BinaryWriter writer = fallExeFile.GetWriter();
         writer.BaseStream.Position = item.position;
         writer.Write(item.name);
         writer.Write(item.baseWeightUnits);
         writer.Write(item.hitPoints);
         writer.Write(item.capacityOrTarget);
         writer.Write(item.basePrice);
         writer.Write(item.enchantmentPoints);
         writer.Write(item.unknown);
         writer.Write(item.variants);
         writer.Write(item.drawOrderOrEffect);
         writer.Write(item.propertiesBitfield);
         writer.Write(item.worldTextureBitfield);
         writer.Write(item.playerTextureBitfield);
         writer.Close();
     }
 }
예제 #3
0
        private DFItem ReadNextItem(BinaryReader reader)
        {
            DFItem item = new DFItem();
            item.position = reader.BaseStream.Position;
            item.name = reader.ReadBytes(nameLength);
            item.baseWeightUnits = reader.ReadInt32();
            item.hitPoints = reader.ReadInt16();
            item.Unknown1 = reader.ReadInt32();
            item.baseCost = reader.ReadInt32();
            item.enchantmentPoints = reader.ReadInt16();
            item.Unknown2 = reader.ReadInt16();
            item.drawOrder = reader.ReadByte();
            item.Unknown3 = reader.ReadByte();
            item.inventoryTextureBitfield = reader.ReadInt16();
            item.paperDollTextureBitfield = reader.ReadInt16();

            return item;
        }
        /// <summary>
        /// Gets native item data as read from FALL.EXE.
        /// </summary>
        /// <param name="index">index of item.</param>
        /// <returns>DFItem</returns>
        public DFItem GetItem(int index)
        {
            DFItem item = new DFItem();
            if (items.Count > 0 && index >= 0 && index < items.Count)
            {
                item = items[index];
            }

            return item;
        }
예제 #5
0
 /// <summary>
 /// Rewrites item data back into disk file.
 /// Must have been opened with FileUsage.UseDisk and readOnly flag false.
 /// </summary>
 /// <param name="item">Item to rewrite.</param>
 public void RewriteItem(DFItem item)
 {
     if (isOpen && fallExeFile.Usage == FileUsage.UseDisk && fallExeFile.ReadOnly == false)
     {
         BinaryWriter writer = fallExeFile.GetWriter();
         writer.BaseStream.Position = item.position;
         writer.Write(item.name);
         writer.Write(item.baseWeightUnits);
         writer.Write(item.hitPoints);
         writer.Write(item.Unknown1);
         writer.Write(item.baseCost);
         writer.Write(item.enchantmentPoints);
         writer.Write(item.Unknown2);
         writer.Write(item.drawOrder);
         writer.Write(item.Unknown3);
         writer.Write(item.inventoryTextureBitfield);
         writer.Write(item.paperDollTextureBitfield);
         writer.Close();
     }
 }