Esempio n. 1
0
        // Issue 5 - End
        static TileData()
        {
            using (FileStream fileStream = FileManager.GetFile("tiledata.mul"))
            {
                BinaryReader binaryReader = new BinaryReader(fileStream);

                LandData landData;

                for (int i = 0; i < 0x4000; i++)
                {
                    landData = new LandData();

                    if ((i & 0x1F) == 0)
                    {
                        binaryReader.ReadInt32();
                    }

                    TileFlag flags = (TileFlag)binaryReader.ReadInt32();

                    int iTextureID = binaryReader.ReadInt16();

                    binaryReader.BaseStream.Seek(20, SeekOrigin.Current);

                    landData.Flags = flags;
                    landData.TextureID = iTextureID;

                    LandData[i] = landData;
                }

                ItemData itemData;

                for (int i = 0; i < 0x4000; i++)
                {
                    itemData = new ItemData();

                    if ((i & 0x1F) == 0)
                    {
                        binaryReader.ReadInt32();
                    }

                    itemData.Flags = (TileFlag)binaryReader.ReadInt32();
                    itemData.Weight = binaryReader.ReadByte();
                    itemData.Quality = binaryReader.ReadByte();

                    itemData.Unknown1 = binaryReader.ReadByte();
                    itemData.Unknown2 = binaryReader.ReadByte();
                    itemData.Unknown3 = binaryReader.ReadByte();

                    itemData.Quantity = binaryReader.ReadByte();
                    itemData.AnimID = binaryReader.ReadInt16();

                    binaryReader.BaseStream.Seek(2, SeekOrigin.Current); // hue?
                    itemData.Unknown4 = binaryReader.ReadByte();

                    itemData.Value = binaryReader.ReadByte();
                    itemData.Height = binaryReader.ReadByte();

                    itemData.Name = System.Text.ASCIIEncoding.ASCII.GetString((binaryReader.ReadBytes(20)));
                    itemData.Name = itemData.Name.Trim('\0');
                    // binaryReader.BaseStream.Seek(20, SeekOrigin.Current);

                    // Issue 5 - Statics (bridge, stairs, etc) should be walkable - http://code.google.com/p/ultimaxna/issues/detail?id=5 - Smjert
                    if(i > 1005 && i < 7640)
                        itemData.IsStairs = !(Array.BinarySearch(m_StairsID, i) < 0);
                    // Issue 5 - End

                    ItemData[i] = itemData;
                }

                Metrics.ReportDataRead((int)binaryReader.BaseStream.Position);
            }
        }
Esempio n. 2
0
 private bool matchNames(ItemData m1, ItemData m2)
 {
     return (m1.Name == m2.Name);
 }