Example #1
0
        public override void Deserialize(BetterReader reader, string name)
        {
            base.Deserialize(reader, name);

            Unused        = reader.ReadBytes(4);
            RefCount      = reader.ReadUInt32();
            CompiledSize  = reader.ReadUInt32();
            VariableCount = reader.ReadUInt32();
            Type          = (SCHR_Types)reader.ReadUInt16();
            Flags         = (SCHR_Flags)reader.ReadUInt16();
        }
Example #2
0
        public override void Deserialize(BetterReader reader, string name)
        {
            base.Deserialize(reader, name);

            LinkedRoomsCount = reader.ReadUInt16();
            Unknown          = reader.ReadBytes(2);
        }
Example #3
0
        public virtual void Deserialize(BetterReader reader, string name, GameID gameID)
        {
            type     = name;
            dataSize = reader.ReadUInt32();
            flags    = reader.ReadUInt32();
            id       = reader.ReadUInt32();
            revision = reader.ReadUInt32();

            if (gameID != GameID.Oblivion)
            {
                version = reader.ReadUInt16();
                unknow  = reader.ReadUInt16();
            }

            if (Deleted)
            {
                reader.ReadBytes((int)dataSize);
                return;
            }

            if (Compressed)
            {
                var decompSize     = (int)reader.ReadUInt32();
                var compressedData = reader.ReadBytes((int)dataSize - 4);

                Utils.LogBuffer("\t\tCompressed Data {0}", type);

                var decompressedData = Decompress(compressedData);
                using (var betterReader = new BetterMemoryReader(decompressedData))
                    ExtractSubRecords(betterReader, gameID, (uint)betterReader.Length);
            }
            else
            {
                ExtractSubRecords(reader, gameID, dataSize);
            }
        }
Example #4
0
        public override void Deserialize(BetterReader reader, string name)
        {
            base.Deserialize(reader, name);

            Records = new List <VTXTStruct>();

            var currentPosition = 0;

            while (currentPosition < Size)
            {
                Records.Add(new VTXTStruct
                {
                    Position = reader.ReadUInt16(),
                    Unused   = reader.ReadBytes(2),
                    Opacity  = reader.ReadSingle()
                });
                currentPosition += 8;
            }
        }
Example #5
0
        public override void Deserialize(BetterReader reader, string name)
        {
            base.Deserialize(reader, name);

            Flags            = reader.ReadUInt32();
            Fatigue          = reader.ReadUInt16();
            BarterGold       = reader.ReadUInt16();
            LevelOrLevelMult = reader.ReadInt16();
            CalcMin          = reader.ReadUInt16();
            CalcMax          = reader.ReadUInt16();
            SpeedMult        = reader.ReadUInt16();
            KarmaAlignment   = reader.ReadSingle();
            DispositionBase  = reader.ReadInt16();
            TemplateFlags    = (ACBSTemplateFlags)reader.ReadUInt16();
        }
Example #6
0
 public override void Deserialize(BetterReader reader, string name)
 {
     base.Deserialize(reader, name);
     Value = reader.ReadUInt16();
 }
Example #7
0
        public virtual void Deserialize(BetterReader reader, string name, GameID gameID)
        {
            _type = name;
            _subGroups = new Dictionary<GroupType, List<Group>>();
            _records = new Dictionary<string, List<Record>>();

            var headerSize = 24;

            if (gameID == GameID.Oblivion)
                headerSize = 20;

            _groupSize = reader.ReadUInt32();
            _label = reader.ReadBytes(4);
            _groupType = reader.ReadInt32();

            switch ((GroupType)_groupType)
            {
                case GroupType.Top:
                    //if (label[0] >= 32)
                    Label = Utils.ToString(_label);
                    break;
                case GroupType.WorldChildren:
                case GroupType.CellChildren:
                case GroupType.TopicChildren:
                case GroupType.CellPersistentChildren:
                case GroupType.CellTemporaryChildren:
                case GroupType.CellVisibleDistantChildren:
                    //_parentId = _label[0];
                    _parentId = BitConverter.ToUInt32(_label, 0);
                    break;
            }

            _stamp = reader.ReadUInt16();
            _unknow = reader.ReadUInt16();

            if (gameID != GameID.Oblivion)
            {
                _version = reader.ReadUInt16();
                _unknow2 = reader.ReadUInt16();
            }

            if (Label != null)
                Utils.LogBuffer("{0} > {1}", _type, Label);

            var endRead = reader.Position + (_groupSize - headerSize);
            var fname = string.Empty;

            Group group = null;
            Record record = null;

            // Only used for debug helping.
            var logGroupDebugDico = new List<int>();
            var logRecordDebugDico = new List<string>();

            while (reader.Position < endRead)
            {
                fname = reader.ReadString(4);

                if (fname == "GRUP")
                {
                    group = new Group();
                    group.Deserialize(reader, fname, gameID);

                    var groupType = (GroupType)group.Type;

                    if (!_subGroups.ContainsKey(groupType))
                    {
                        var list = new List<Group>();
                        list.Add(group);
                        _subGroups.Add(groupType, list);
                    }
                    else
                        _subGroups[groupType].Add(group);

                    if (!logGroupDebugDico.Contains(group._groupType))
                    {
                        logGroupDebugDico.Add(group._groupType);
                        Utils.LogBuffer("\t# SubGroup: {0}", (GroupType)group._groupType);
                    }
                }
                else
                {
                    record = Record.GetRecord(fname);
                    record.Deserialize(reader, fname, gameID);

                    if (!_records.ContainsKey(record.Type))
                    {
                        var list = new List<Record>();
                        list.Add(record);
                        _records.Add(record.Type, list);
                    }
                    else
                        _records[record.Type].Add(record);

                    if (!logRecordDebugDico.Contains(record.Type))
                    {
                        logRecordDebugDico.Add(record.Type);
                        Utils.LogBuffer("\t- Record: {0}", record.Type);
                    }
                }
            }
        }
Example #8
0
 public virtual void Deserialize(BetterReader reader, string name)
 {
     Name = name;
     Size = reader.ReadUInt16();
 }