Exemplo n.º 1
0
        const int MAX_VALUE = 14; // This may need tweaking, but it works well enough for now. Only used in older replays

        public static ProductAttribute Deserialize(BitReader br, UInt32 engineVersion, UInt32 licenseeVersion, string[] objectNames)
        {
            var pa = new ProductAttribute();

            pa.Unknown1   = br.ReadBit();
            pa.ClassIndex = br.ReadUInt32();
            pa.ClassName  = objectNames[pa.ClassIndex];

            if (pa.ClassName == "TAGame.ProductAttribute_UserColor_TA")
            {
                if (pa.HasValue = br.ReadBit())
                {
                    pa.Value = br.ReadUInt32FromBits(31);
                }
            }
            else if (pa.ClassName == "TAGame.ProductAttribute_Painted_TA")
            {
                if (engineVersion >= 868 && licenseeVersion >= 18)
                {
                    pa.Value = br.ReadUInt32FromBits(31);
                }
                else
                {
                    pa.Value = br.ReadUInt32Max(MAX_VALUE);
                }
            }
            // I've never encountered this attribute, but Psyonix_Cone mentioned it serialized as below. Leaving it commented out until I can test it.

            /*
             * else if (pa.ClassName == "ProductAttribute_Certified_TA")
             * {
             *  var statId = br.ReadUInt32();
             *  var statValue = br.ReadUInt32();
             * }
             */
            else
            {
                throw new Exception("Unknown product attribute class " + pa.ClassName);
            }
            return(pa);
        }
Exemplo n.º 2
0
        public static ClientLoadoutOnline Deserialize(BitReader br, UInt32 engineVersion, UInt32 licenseeVersion, string[] objectNames)
        {
            var clo = new ClientLoadoutOnline();

            clo.ProductAttributeLists = new List <List <ProductAttribute> >();

            var listCount = br.ReadByte();

            for (int i = 0; i < listCount; ++i)
            {
                var productAttributes = new List <ProductAttribute>();

                var productAttributeCount = br.ReadByte();
                for (int j = 0; j < productAttributeCount; ++j)
                {
                    productAttributes.Add(ProductAttribute.Deserialize(br, engineVersion, licenseeVersion, objectNames));
                }

                clo.ProductAttributeLists.Add(productAttributes);
            }
            return(clo);
        }