Esempio n. 1
0
        public void Parse()
        {
            DatSignature = m_BinaryReader.GetU32();
            Console.WriteLine("Dat Signature: 0x" + DatSignature.ToString("X"));
            ContentRevision = (ushort)DatSignature;

            int[] counts = new int[(int)ThingCategory.LastCategory];
            for (int category = 0; category < (int)ThingCategory.LastCategory; category++)
            {
                int count = m_BinaryReader.GetU16() + 1;
                counts[category] = count;
            }

            for (int category = 0; category < (int)ThingCategory.LastCategory; category++)
            {
                ushort firstId = 1;
                if (category == (int)ThingCategory.Item)
                {
                    firstId = 100;
                }

                ThingTypeDictionaries[category] = new ThingTypesDict();
                for (ushort id = firstId; id < counts[category]; id++)
                {
                    ThingType thingType = new ThingType()
                    {
                        ID       = id,
                        Category = (ThingCategory)category,
                    };

                    thingType.Unserialize(m_BinaryReader, m_ClientVersion);
                    ThingTypeDictionaries[category][id] = thingType;
                }
            }
        }
        private void Parse()
        {
            DatSignature    = m_BinaryReader.ReadUnsignedInt();
            ContentRevision = (ushort)DatSignature;

            int[] counts = new int[(int)ThingCategory.LastCategory];
            for (int category = 0; category < (int)ThingCategory.LastCategory; category++)
            {
                int count = m_BinaryReader.ReadUnsignedShort() + 1;
                counts[category] = count;
            }

            for (int category = 0; category < (int)ThingCategory.LastCategory; category++)
            {
                ushort firstId = 1;
                if (category == (int)ThingCategory.Item)
                {
                    firstId = 100;
                }

                ThingTypeDictionaries[category] = new ThingTypesDict();
                for (ushort id = firstId; id < counts[category]; id++)
                {
                    ThingType thingType = new ThingType()
                    {
                        ID       = id,
                        Category = (ThingCategory)category,
                    };

                    thingType.Unserialize(m_BinaryReader, m_ClientVersion);
                    ThingTypeDictionaries[category][id] = thingType;
                }
            }
        }
Esempio n. 3
0
        public void Parse()
        {
            DatSignature    = m_BinaryReader.GetU32();
            ContentRevision = (ushort)DatSignature;

            int[] counts = new int[(int)ThingCategory.LastCategory];
            for (int category = 0; category < (int)ThingCategory.LastCategory; category++)
            {
                int count = m_BinaryReader.GetU16() + 1;
                counts[category] = count;
            }

            for (int category = 0; category < (int)ThingCategory.LastCategory; category++)
            {
                ushort firstId = 1;
                if (category == (int)ThingCategory.Item)
                {
                    firstId = 100;
                }

                ThingTypes[category] = new ThingTypesDict();
                for (ushort id = firstId; id < counts[category]; id++)
                {
                    ThingType thingType = ThingType.Serialize(id, (ThingCategory)category, ref m_BinaryReader);
                    ThingTypes[category][id] = thingType;
                }
            }
        }