internal static BoolValue Read(IFieldReader reader)
        {
            var value1 = reader.ReadValueB8();

            reader.SkipBytes(3);
            var value2 = reader.ReadValueB8();

            reader.SkipBytes(3);
            return(new BoolValue(value1, value2));
        }
        internal static Property Read(IFieldReader reader)
        {
            var valueType = (ValueType)reader.ReadValueU8(); // & 7

            reader.SkipBytes(3);
            var function = (FunctionType)reader.ReadValueU8(); // & 3

            reader.SkipBytes(3);
            var index = reader.ReadValueU16(); // & 0x7FF

            reader.SkipBytes(2);
            var value  = ReadValue(valueType, reader);
            var factor = reader.Version >= 88 ? reader.ReadValueF32() : 0;

            return(new Property(index, function, value, factor));
        }
Beispiel #3
0
        internal static ConditionData Read(IFieldReader reader)
        {
            ConditionData instance;

            instance.Unknown00 = reader.ReadValueU8();
            reader.SkipBytes(3);
            instance.Unknown04 = reader.ReadValueU32();
            instance.Unknown08 = reader.ReadValueU16();
            reader.SkipBytes(2);
            instance.Unknown0C = reader.ReadValueU32();
            instance.Unknown10 = reader.ReadValueU32();
            instance.Unknown14 = reader.ReadValueU8();
            reader.SkipBytes(3);
            instance.Unknown18 = reader.ReadValueU32();
            instance.Unknown1C = reader.ReadValueU32();
            return(instance);
        }
        internal override void Read(IFieldReader reader)
        {
            if (reader.Version < 53)
            {
                reader.SkipBytes(4);
            }

            var includeCount  = reader.Version >= 48 ? reader.ReadValueU32() : 0;
            var propertyCount = reader.Version >= 48 ? reader.ReadValueU32() : 0;

            if (reader.Version < 52)
            {
                reader.SkipBytes(4);
            }

            this._Unknown1B  = reader.Version >= 48 && reader.ReadValueB8();
            this._Unknown1C  = reader.Version >= 48 && reader.ReadValueB8();
            this._ObjectType = reader.Version >= 63
                                  ? (FormType)reader.ReadValueU32()
                                  : (reader.Version >= 53
                                         ? FormTypes.GetTypeFromIndex(reader.ReadValueU8())
                                         : FormType.WEAP);

            this._Unknown19 = reader.Version >= 90 ? reader.ReadValueU8() : (byte)0;
            this._Unknown1A = reader.Version >= 107 ? reader.ReadValueU8() : (byte)0;
            this._KeywordId = reader.ReadValueU32();

            var keywordCount = reader.ReadValueU32();
            var keywordIds   = new uint[keywordCount];

            for (uint i = 0; i < keywordCount; i++)
            {
                keywordIds[i] = reader.ReadValueU32();
            }
            this._KeywordIds.Clear();
            this._KeywordIds.AddRange(keywordIds);

            this._Unknown98.Clear();
            if (reader.Version >= 57)
            {
                var count3 = reader.ReadValueU32();
                var items  = new Tuple <uint, uint> [count3];
                for (int i = 0; i < count3; i++)
                {
                    var item1 = reader.ReadValueU32();
                    var item2 = reader.ReadValueU32();
                    items[i] = new Tuple <uint, uint>(item1, item2);
                }
                this._Unknown98.AddRange(items);
            }

            var includes = new Tuple <uint, byte, bool, bool> [includeCount];

            for (int i = 0; i < includeCount; i++)
            {
                var unknown17 = reader.ReadValueU32();
                var unknown18 = reader.Version >= 49 ? reader.ReadValueU8() : (byte)0;
                var unknown19 = reader.Version < 49 || reader.ReadValueB8();
                var unknown20 = reader.Version < 49 || reader.ReadValueB8();
                includes[i] = new Tuple <uint, byte, bool, bool>(unknown17, unknown18, unknown19, unknown20);
            }
            this._Includes.Clear();
            this._Includes.AddRange(includes);

            var properties = new Property[propertyCount];

            for (int i = 0; i < propertyCount; i++)
            {
                properties[i] = Property.Read(reader);
            }
            this._Properties.Clear();
            this._Properties.AddRange(properties);
        }