public static void SetBody(ref BodyProperties bodyProperties, int build, int weight)
        {
            FaceGenerationParams faceGenerationParams = FaceGenerationParams.Create();

            MBBodyProperties.GetParamsFromKey(ref faceGenerationParams, bodyProperties, false);
            MBBodyProperties.ProduceNumericKeyWithParams(faceGenerationParams, false, ref bodyProperties);
        }
        public static void SetPigmentation(
            ref BodyProperties bodyProperties,
            int skinColor,
            int hairColor,
            int eyeColor)
        {
            FaceGenerationParams faceGenerationParams = FaceGenerationParams.Create();

            MBBodyProperties.GetParamsFromKey(ref faceGenerationParams, bodyProperties, false);
            MBBodyProperties.ProduceNumericKeyWithParams(faceGenerationParams, false, ref bodyProperties);
        }
        public static BodyProperties GetBodyPropertiesWithAge(
            ref BodyProperties bodyProperties,
            float age)
        {
            FaceGenerationParams faceGenerationParams = new FaceGenerationParams();

            MBBodyProperties.GetParamsFromKey(ref faceGenerationParams, bodyProperties, false);
            faceGenerationParams._curAge = age;
            BodyProperties bodyProperties1 = new BodyProperties();

            MBBodyProperties.ProduceNumericKeyWithParams(faceGenerationParams, false, ref bodyProperties1);
            return(bodyProperties1);
        }
        public static void SetHair(ref BodyProperties bodyProperties, int hair, int beard, int tattoo)
        {
            FaceGenerationParams faceGenerationParams = FaceGenerationParams.Create();

            MBBodyProperties.GetParamsFromKey(ref faceGenerationParams, bodyProperties, false);
            if (hair > -1)
            {
                faceGenerationParams._currentHair = hair;
            }
            if (beard > -1)
            {
                faceGenerationParams._curBeard = beard;
            }
            if (tattoo > -1)
            {
                faceGenerationParams._curFaceTattoo = tattoo;
            }
            MBBodyProperties.ProduceNumericKeyWithParams(faceGenerationParams, false, ref bodyProperties);
        }
        public static void GenerateParentKey(
            BodyProperties childBodyProperties,
            ref BodyProperties motherBodyProperties,
            ref BodyProperties fatherBodyProperties)
        {
            FaceGenerationParams faceGenerationParams1 = FaceGenerationParams.Create();
            FaceGenerationParams faceGenerationParams2 = FaceGenerationParams.Create();
            FaceGenerationParams faceGenerationParams3 = FaceGenerationParams.Create();

            MBBodyProperties.GenerationType[] generationTypeArray = new MBBodyProperties.GenerationType[4];
            for (int index = 0; index < generationTypeArray.Length; ++index)
            {
                generationTypeArray[index] = (MBBodyProperties.GenerationType)MBRandom.RandomInt(2);
            }
            MBBodyProperties.GetParamsFromKey(ref faceGenerationParams1, childBodyProperties, false);
            int genInstancesLength = MBBodyProperties.GetFaceGenInstancesLength(faceGenerationParams1._currentGender, (int)faceGenerationParams1._curAge);

            for (int keyNo = 0; keyNo < genInstancesLength; ++keyNo)
            {
                DeformKeyData deformKeyData = MBBodyProperties.GetDeformKeyData(keyNo, faceGenerationParams1._currentGender, (int)faceGenerationParams1._curAge);
                if (deformKeyData.GroupId >= 0 && deformKeyData.GroupId != 0 && (deformKeyData.GroupId != 5 && deformKeyData.GroupId != 6))
                {
                    float num = MBRandom.RandomFloat * Math.Min(faceGenerationParams1.KeyWeights[keyNo], 1f - faceGenerationParams1.KeyWeights[keyNo]);
                    if (generationTypeArray[deformKeyData.GroupId - 1] == MBBodyProperties.GenerationType.FromMother)
                    {
                        faceGenerationParams3.KeyWeights[keyNo] = faceGenerationParams1.KeyWeights[keyNo];
                        faceGenerationParams2.KeyWeights[keyNo] = faceGenerationParams1.KeyWeights[keyNo] + num;
                    }
                    else if (generationTypeArray[deformKeyData.GroupId - 1] == MBBodyProperties.GenerationType.FromFather)
                    {
                        faceGenerationParams2.KeyWeights[keyNo] = faceGenerationParams1.KeyWeights[keyNo];
                        faceGenerationParams3.KeyWeights[keyNo] = faceGenerationParams1.KeyWeights[keyNo] + num;
                    }
                    else
                    {
                        faceGenerationParams3.KeyWeights[keyNo] = faceGenerationParams1.KeyWeights[keyNo] + num;
                        faceGenerationParams2.KeyWeights[keyNo] = faceGenerationParams1.KeyWeights[keyNo] - num;
                    }
                }
            }
            faceGenerationParams2._curAge = faceGenerationParams1._curAge + (float)MBRandom.RandomInt(18, 25);
            faceGenerationParams2.SetRandomParamsExceptKeys(0, (int)faceGenerationParams2._curAge, out float _);
            faceGenerationParams2._curFaceTattoo = 0;
            faceGenerationParams3._curAge        = faceGenerationParams1._curAge + (float)MBRandom.RandomInt(18, 22);
            faceGenerationParams3.SetRandomParamsExceptKeys(1, (int)faceGenerationParams3._curAge, out float _);
            faceGenerationParams3._curFaceTattoo    = 0;
            faceGenerationParams3._heightMultiplier = faceGenerationParams2._heightMultiplier * MBRandom.RandomFloatRanged(0.7f, 0.9f);
            if (faceGenerationParams3._currentHair == 0)
            {
                faceGenerationParams3._currentHair = 1;
            }
            float num1 = MBRandom.RandomFloat * Math.Min(faceGenerationParams1._curSkinColorOffset, 1f - faceGenerationParams1._curSkinColorOffset);

            if (MBRandom.RandomInt(2) == 1)
            {
                faceGenerationParams2._curSkinColorOffset = faceGenerationParams1._curSkinColorOffset + num1;
                faceGenerationParams3._curSkinColorOffset = faceGenerationParams1._curSkinColorOffset - num1;
            }
            else
            {
                faceGenerationParams2._curSkinColorOffset = faceGenerationParams1._curSkinColorOffset - num1;
                faceGenerationParams3._curSkinColorOffset = faceGenerationParams1._curSkinColorOffset + num1;
            }
            MBBodyProperties.ProduceNumericKeyWithParams(faceGenerationParams3, false, ref motherBodyProperties);
            MBBodyProperties.ProduceNumericKeyWithParams(faceGenerationParams2, false, ref fatherBodyProperties);
        }
 public void RefreshFace(FaceGenerationParams faceGenerationParams)
 {
     MBBodyProperties.ProduceNumericKeyWithParams(faceGenerationParams, this.Character.Equipment.EarsAreHidden, ref this.CurrentBodyProperties);
     this.IsFemale = faceGenerationParams._currentGender == 1;
 }