private static Pawn GenerateParent(Pawn generatedChild, Pawn existingChild, Gender genderToGenerate, PawnGenerationRequest childRequest, bool newlyGeneratedParentsWillBeSpousesIfNotGay)
        {
            float  ageChronologicalYearsFloat  = generatedChild.ageTracker.AgeChronologicalYearsFloat;
            float  ageChronologicalYearsFloat2 = existingChild.ageTracker.AgeChronologicalYearsFloat;
            float  num  = (float)((genderToGenerate != Gender.Male) ? 16.0 : 14.0);
            float  num2 = (float)((genderToGenerate != Gender.Male) ? 45.0 : 50.0);
            float  num3 = (float)((genderToGenerate != Gender.Male) ? 27.0 : 30.0);
            float  num4 = Mathf.Max(ageChronologicalYearsFloat, ageChronologicalYearsFloat2) + num;
            float  maxChronologicalAge = num4 + (num2 - num);
            float  midChronologicalAge = num4 + (num3 - num);
            float  value  = default(float);
            float  value2 = default(float);
            float  value3 = default(float);
            string last   = default(string);

            PawnRelationWorker_Sibling.GenerateParentParams(num4, maxChronologicalAge, midChronologicalAge, num, generatedChild, existingChild, childRequest, out value, out value2, out value3, out last);
            bool allowGay = true;

            if (newlyGeneratedParentsWillBeSpousesIfNotGay && last.NullOrEmpty() && Rand.Value < 0.800000011920929)
            {
                if (genderToGenerate == Gender.Male && existingChild.GetMother() != null && !existingChild.GetMother().story.traits.HasTrait(TraitDefOf.Gay))
                {
                    last     = ((NameTriple)existingChild.GetMother().Name).Last;
                    allowGay = false;
                }
                else if (genderToGenerate == Gender.Female && existingChild.GetFather() != null && !existingChild.GetFather().story.traits.HasTrait(TraitDefOf.Gay))
                {
                    last     = ((NameTriple)existingChild.GetFather().Name).Last;
                    allowGay = false;
                }
            }
            Faction faction = existingChild.Faction;

            if (faction == null || faction.IsPlayer)
            {
                bool tryMedievalOrBetter = faction != null && (int)faction.def.techLevel >= 3;
                if (!Find.FactionManager.TryGetRandomNonColonyHumanlikeFaction(out faction, tryMedievalOrBetter, true, TechLevel.Undefined))
                {
                    faction = Faction.OfSpacer;
                }
            }
            PawnKindDef           kindDef                  = existingChild.kindDef;
            Faction               faction2                 = faction;
            bool                  forceGenerateNewPawn     = true;
            bool                  allowDead                = true;
            bool                  allowDowned              = true;
            bool                  canGeneratePawnRelations = false;
            Gender?               fixedGender              = genderToGenerate;
            float?                fixedMelanin             = value3;
            string                fixedLastName            = last;
            PawnGenerationRequest request                  = new PawnGenerationRequest(kindDef, faction2, PawnGenerationContext.NonPlayer, -1, forceGenerateNewPawn, false, allowDead, allowDowned, canGeneratePawnRelations, false, 1f, false, allowGay, true, false, false, false, false, null, null, value, value2, fixedGender, fixedMelanin, fixedLastName);
            Pawn                  pawn = PawnGenerator.GeneratePawn(request);

            if (!Find.WorldPawns.Contains(pawn))
            {
                Find.WorldPawns.PassToWorld(pawn, PawnDiscardDecideMode.Decide);
            }
            return(pawn);
        }
        public override void CreateRelation(Pawn generated, Pawn other, ref PawnGenerationRequest request)
        {
            bool flag  = other.GetMother() != null;
            bool flag2 = other.GetFather() != null;
            bool flag3 = Rand.Value < 0.85f;

            if (flag && LovePartnerRelationUtility.HasAnyLovePartner(other.GetMother()))
            {
                flag3 = false;
            }
            if (flag2 && LovePartnerRelationUtility.HasAnyLovePartner(other.GetFather()))
            {
                flag3 = false;
            }
            if (!flag)
            {
                Pawn newMother = PawnRelationWorker_Sibling.GenerateParent(generated, other, Gender.Female, request, flag3);
                other.SetMother(newMother);
            }
            generated.SetMother(other.GetMother());
            if (!flag2)
            {
                Pawn newFather = PawnRelationWorker_Sibling.GenerateParent(generated, other, Gender.Male, request, flag3);
                other.SetFather(newFather);
            }
            generated.SetFather(other.GetFather());
            if (!flag || !flag2)
            {
                bool flag4 = other.GetMother().story.traits.HasTrait(TraitDefOf.Gay) || other.GetFather().story.traits.HasTrait(TraitDefOf.Gay);
                if (flag4)
                {
                    other.GetFather().relations.AddDirectRelation(PawnRelationDefOf.ExLover, other.GetMother());
                }
                else if (flag3)
                {
                    other.GetFather().relations.AddDirectRelation(PawnRelationDefOf.Spouse, other.GetMother());
                }
                else
                {
                    LovePartnerRelationUtility.GiveRandomExLoverOrExSpouseRelation(other.GetFather(), other.GetMother());
                }
            }
            PawnRelationWorker_Sibling.ResolveMyName(ref request, generated);
            PawnRelationWorker_Sibling.ResolveMySkinColor(ref request, generated);
        }