private static void GeneratePawnRelations(Pawn pawn, ref PawnGenerationRequest request)
        {
            if (!pawn.RaceProps.Humanlike)
            {
                return;
            }
            Pawn[] array = (from x in PawnsFinder.AllMapsWorldAndTemporary_AliveOrDead
                            where x.def == pawn.def
                            select x).ToArray <Pawn>();
            if (array.Length == 0)
            {
                return;
            }
            int num = 0;

            Pawn[] array2 = array;
            for (int i = 0; i < array2.Length; i++)
            {
                Pawn pawn2 = array2[i];
                if (pawn2.Discarded)
                {
                    Log.Warning(string.Concat(new object[]
                    {
                        "Warning during generating pawn relations for ",
                        pawn,
                        ": Pawn ",
                        pawn2,
                        " is discarded, yet he was yielded by PawnUtility. Discarding a pawn means that he is no longer managed by anything."
                    }), false);
                }
                else if (pawn2.Faction != null && pawn2.Faction.IsPlayer)
                {
                    num++;
                }
            }
            float num2 = 45f;

            num2 += (float)num * 2.7f;
            PawnGenerationRequest        localReq = request;
            Pair <Pawn, PawnRelationDef> pair     = PawnGenerator.GenerateSamples(array, PawnGenerator.relationsGeneratableBlood, 40).RandomElementByWeightWithDefault((Pair <Pawn, PawnRelationDef> x) => x.Second.generationChanceFactor * x.Second.Worker.GenerationChance(pawn, x.First, localReq), num2 * 40f / (float)(array.Length * PawnGenerator.relationsGeneratableBlood.Length));

            if (pair.First != null)
            {
                pair.Second.Worker.CreateRelation(pawn, pair.First, ref request);
            }
            Pair <Pawn, PawnRelationDef> pair2 = PawnGenerator.GenerateSamples(array, PawnGenerator.relationsGeneratableNonblood, 40).RandomElementByWeightWithDefault((Pair <Pawn, PawnRelationDef> x) => x.Second.generationChanceFactor * x.Second.Worker.GenerationChance(pawn, x.First, localReq), num2 * 40f / (float)(array.Length * PawnGenerator.relationsGeneratableNonblood.Length));

            if (pair2.First != null)
            {
                pair2.Second.Worker.CreateRelation(pawn, pair2.First, ref request);
            }
        }