Example #1
0
        public static void MakeTablesDialog <T>(IEnumerable <T> dataSources, params TableDataGetter <T>[] getters)
        {
            List <TableDataGetter <T> > list = getters.ToList <TableDataGetter <T> >();
            int num   = dataSources.Count <T>() + 1;
            int count = list.Count;

            string[,] array = new string[count, num];
            int num2 = 0;

            for (int i = 0; i < getters.Length; i++)
            {
                TableDataGetter <T> tableDataGetter = getters[i];
                array[num2, 0] = tableDataGetter.label;
                num2++;
            }
            int num3 = 1;

            foreach (T current in dataSources)
            {
                for (int j = 0; j < count; j++)
                {
                    array[j, num3] = list[j].getter(current);
                }
                num3++;
            }
            Find.WindowStack.Add(new Window_DebugTable(array));
        }
Example #2
0
        public static void PawnKindsBasics()
        {
            IEnumerable <PawnKindDef> arg_36F_0 = from d in DefDatabase <PawnKindDef> .AllDefs
                                                  where d.race != null && d.RaceProps.Humanlike
                                                  select d into k
                                                  orderby(k.defaultFactionType == null) ? string.Empty : k.defaultFactionType.label, k.combatPower
            select k;

            TableDataGetter <PawnKindDef>[] expr_72 = new TableDataGetter <PawnKindDef> [18];
            expr_72[0]  = new TableDataGetter <PawnKindDef>("defName", (PawnKindDef d) => d.defName);
            expr_72[1]  = new TableDataGetter <PawnKindDef>("faction", (PawnKindDef d) => (d.defaultFactionType == null) ? string.Empty : d.defaultFactionType.defName);
            expr_72[2]  = new TableDataGetter <PawnKindDef>("points", (PawnKindDef d) => d.combatPower.ToString("F0"));
            expr_72[3]  = new TableDataGetter <PawnKindDef>("minAge", (PawnKindDef d) => d.minGenerationAge.ToString("F0"));
            expr_72[4]  = new TableDataGetter <PawnKindDef>("maxAge", (PawnKindDef d) => (d.maxGenerationAge >= 10000) ? string.Empty : d.maxGenerationAge.ToString("F0"));
            expr_72[5]  = new TableDataGetter <PawnKindDef>("recruitDiff", (PawnKindDef d) => d.baseRecruitDifficulty.ToStringPercent());
            expr_72[6]  = new TableDataGetter <PawnKindDef>("itemQuality", (PawnKindDef d) => d.itemQuality.ToString());
            expr_72[7]  = new TableDataGetter <PawnKindDef>("forceNormGearQual", (PawnKindDef d) => d.forceNormalGearQuality.ToStringCheckBlank());
            expr_72[8]  = new TableDataGetter <PawnKindDef>("weapon$", (PawnKindDef d) => d.weaponMoney.ToString());
            expr_72[9]  = new TableDataGetter <PawnKindDef>("apparel$", (PawnKindDef d) => d.apparelMoney.ToString());
            expr_72[10] = new TableDataGetter <PawnKindDef>("techHediffsCh", (PawnKindDef d) => d.techHediffsChance.ToStringPercentEmptyZero("F0"));
            expr_72[11] = new TableDataGetter <PawnKindDef>("techHediffs$", (PawnKindDef d) => d.techHediffsMoney.ToString());
            expr_72[12] = new TableDataGetter <PawnKindDef>("gearHealth", (PawnKindDef d) => d.gearHealthRange.ToString());
            expr_72[13] = new TableDataGetter <PawnKindDef>("invNutrition", (PawnKindDef d) => d.invNutrition.ToString());
            expr_72[14] = new TableDataGetter <PawnKindDef>("addictionChance", (PawnKindDef d) => d.chemicalAddictionChance.ToStringPercent());
            expr_72[15] = new TableDataGetter <PawnKindDef>("combatDrugChance", (PawnKindDef d) => (d.combatEnhancingDrugsChance <= 0f) ? string.Empty : d.combatEnhancingDrugsChance.ToStringPercent());
            expr_72[16] = new TableDataGetter <PawnKindDef>("combatDrugCount", (PawnKindDef d) => (d.combatEnhancingDrugsCount.max <= 0) ? string.Empty : d.combatEnhancingDrugsCount.ToString());
            expr_72[17] = new TableDataGetter <PawnKindDef>("bsCryptosleepComm", (PawnKindDef d) => d.backstoryCryptosleepCommonality.ToStringPercentEmptyZero("F0"));
            DebugTables.MakeTablesDialog <PawnKindDef>(arg_36F_0, expr_72);
        }
        private static void DoTableInternalApparel(ThingDef stuff)
        {
            IEnumerable <ThingDef> arg_1D1_0 = from d in DefDatabase <ThingDef> .AllDefs
                                               where d.IsApparel && (stuff == null || (d.MadeFromStuff && stuff.stuffProps.CanMake(d)))
                                               select d;

            TableDataGetter <ThingDef>[] expr_2A = new TableDataGetter <ThingDef> [14];
            expr_2A[0] = new TableDataGetter <ThingDef>("defName", (ThingDef d) => d.defName);
            expr_2A[1] = new TableDataGetter <ThingDef>("bodyParts", (ThingDef d) => GenText.ToSpaceList(from bp in d.apparel.bodyPartGroups
                                                                                                         select bp.defName));
            expr_2A[2] = new TableDataGetter <ThingDef>("layers", (ThingDef d) => GenText.ToSpaceList(from l in d.apparel.layers
                                                                                                      select l.ToString()));
            expr_2A[3] = new TableDataGetter <ThingDef>("tags", (ThingDef d) => GenText.ToSpaceList(from t in d.apparel.tags
                                                                                                    select t.ToString()));
            expr_2A[4]  = new TableDataGetter <ThingDef>("work", (ThingDef d) => d.GetStatValueAbstract(StatDefOf.WorkToMake, stuff).ToString("F0"));
            expr_2A[5]  = new TableDataGetter <ThingDef>("mktval", (ThingDef d) => d.GetStatValueAbstract(StatDefOf.MarketValue, stuff).ToString("F0"));
            expr_2A[6]  = new TableDataGetter <ThingDef>("insCold", (ThingDef d) => d.GetStatValueAbstract(StatDefOf.Insulation_Cold, stuff).ToString("F1"));
            expr_2A[7]  = new TableDataGetter <ThingDef>("insHeat", (ThingDef d) => d.GetStatValueAbstract(StatDefOf.Insulation_Heat, stuff).ToString("F1"));
            expr_2A[8]  = new TableDataGetter <ThingDef>("blunt", (ThingDef d) => d.GetStatValueAbstract(StatDefOf.ArmorRating_Blunt, stuff).ToString("F2"));
            expr_2A[9]  = new TableDataGetter <ThingDef>("sharp", (ThingDef d) => d.GetStatValueAbstract(StatDefOf.ArmorRating_Sharp, stuff).ToString("F2"));
            expr_2A[10] = new TableDataGetter <ThingDef>("SEMultArmor", (ThingDef d) => d.GetStatValueAbstract(StatDefOf.StuffEffectMultiplierArmor, stuff).ToString("F2"));
            expr_2A[11] = new TableDataGetter <ThingDef>("SEMultInsuCold", (ThingDef d) => d.GetStatValueAbstract(StatDefOf.StuffEffectMultiplierInsulation_Cold, stuff).ToString("F2"));
            expr_2A[12] = new TableDataGetter <ThingDef>("SEMultInsuHeat", (ThingDef d) => d.GetStatValueAbstract(StatDefOf.StuffEffectMultiplierInsulation_Heat, stuff).ToString("F2"));
            expr_2A[13] = new TableDataGetter <ThingDef>("equipTime", (ThingDef d) => d.GetStatValueAbstract(StatDefOf.EquipDelay, stuff).ToString("F1"));
            DebugTables.MakeTablesDialog <ThingDef>(arg_1D1_0, expr_2A);
        }
        public static void RecipeSkills()
        {
            IEnumerable <RecipeDef> arg_DD_0 = DefDatabase <RecipeDef> .AllDefs;

            TableDataGetter <RecipeDef>[] expr_0B = new TableDataGetter <RecipeDef> [5];
            expr_0B[0] = new TableDataGetter <RecipeDef>("defName", (RecipeDef d) => d.defName);
            expr_0B[1] = new TableDataGetter <RecipeDef>("workSkill", (RecipeDef d) => (d.workSkill != null) ? d.workSkill.defName : string.Empty);
            expr_0B[2] = new TableDataGetter <RecipeDef>("workSpeedStat", (RecipeDef d) => (d.workSpeedStat != null) ? d.workSpeedStat.defName : string.Empty);
            expr_0B[3] = new TableDataGetter <RecipeDef>("workSpeedStat's skillNeedFactors", delegate(RecipeDef d)
            {
                string arg_67_0;
                if (d.workSpeedStat == null)
                {
                    arg_67_0 = string.Empty;
                }
                else if (d.workSpeedStat.skillNeedFactors.NullOrEmpty <SkillNeed>())
                {
                    arg_67_0 = string.Empty;
                }
                else
                {
                    arg_67_0 = (from fac in d.workSpeedStat.skillNeedFactors
                                select fac.skill.defName).ToCommaList(false);
                }
                return(arg_67_0);
            });
            expr_0B[4] = new TableDataGetter <RecipeDef>("workSkillLearnFactor", (RecipeDef d) => d.workSkillLearnFactor);
            DebugTables.MakeTablesDialog <RecipeDef>(arg_DD_0, expr_0B);
        }
        public static void AnimalBreeding()
        {
            IEnumerable <ThingDef> arg_14B_0 = (from d in DefDatabase <ThingDef> .AllDefs
                                                where d.category == ThingCategory.Pawn && d.race.IsFlesh
                                                select d).OrderByDescending(new Func <ThingDef, float>(DebugOutputsEconomy.GestationDaysEach));

            TableDataGetter <ThingDef>[] expr_4F = new TableDataGetter <ThingDef> [6];
            expr_4F[0] = new TableDataGetter <ThingDef>(string.Empty, (ThingDef d) => d.defName);
            expr_4F[1] = new TableDataGetter <ThingDef>("gestDaysEach", (ThingDef d) => DebugOutputsEconomy.GestationDaysEach(d).ToString("F2"));
            expr_4F[2] = new TableDataGetter <ThingDef>("avgOffspring", (ThingDef d) => (!d.HasComp(typeof(CompEggLayer))) ? ((d.race.litterSizeCurve == null) ? 1f : Rand.ByCurveAverage(d.race.litterSizeCurve)).ToString("F2") : d.GetCompProperties <CompProperties_EggLayer>().eggCountRange.Average.ToString("F2"));
            expr_4F[3] = new TableDataGetter <ThingDef>("gestDaysRaw", (ThingDef d) => (!d.HasComp(typeof(CompEggLayer))) ? d.race.gestationPeriodDays.ToString("F1") : d.GetCompProperties <CompProperties_EggLayer>().eggLayIntervalDays.ToString("F1"));
            expr_4F[4] = new TableDataGetter <ThingDef>("growth per 30d", delegate(ThingDef d)
            {
                float f    = 1f + ((!d.HasComp(typeof(CompEggLayer))) ? ((d.race.litterSizeCurve == null) ? 1f : Rand.ByCurveAverage(d.race.litterSizeCurve)) : d.GetCompProperties <CompProperties_EggLayer>().eggCountRange.Average);
                float num  = d.race.lifeStageAges[d.race.lifeStageAges.Count - 1].minAge * 60f;
                float num2 = num + ((!d.HasComp(typeof(CompEggLayer))) ? d.race.gestationPeriodDays : d.GetCompProperties <CompProperties_EggLayer>().eggLayIntervalDays);
                float p    = 30f / num2;
                return(Mathf.Pow(f, p).ToString("F2"));
            });
            expr_4F[5] = new TableDataGetter <ThingDef>("growth per 60d", delegate(ThingDef d)
            {
                float f    = 1f + ((!d.HasComp(typeof(CompEggLayer))) ? ((d.race.litterSizeCurve == null) ? 1f : Rand.ByCurveAverage(d.race.litterSizeCurve)) : d.GetCompProperties <CompProperties_EggLayer>().eggCountRange.Average);
                float num  = d.race.lifeStageAges[d.race.lifeStageAges.Count - 1].minAge * 60f;
                float num2 = num + ((!d.HasComp(typeof(CompEggLayer))) ? d.race.gestationPeriodDays : d.GetCompProperties <CompProperties_EggLayer>().eggLayIntervalDays);
                float p    = 60f / num2;
                return(Mathf.Pow(f, p).ToString("F2"));
            });
            DebugTables.MakeTablesDialog <ThingDef>(arg_14B_0, expr_4F);
        }
Example #6
0
        public static void AnimalBehavior()
        {
            IEnumerable <PawnKindDef> arg_300_0 = from d in DefDatabase <PawnKindDef> .AllDefs
                                                  where d.race != null && d.RaceProps.Animal
                                                  select d;

            TableDataGetter <PawnKindDef>[] expr_2E = new TableDataGetter <PawnKindDef> [17];
            expr_2E[0]  = new TableDataGetter <PawnKindDef>(string.Empty, (PawnKindDef k) => k.defName);
            expr_2E[1]  = new TableDataGetter <PawnKindDef>("wildness", (PawnKindDef k) => k.RaceProps.wildness.ToStringPercent());
            expr_2E[2]  = new TableDataGetter <PawnKindDef>("manhunterOnDamageChance", (PawnKindDef k) => k.RaceProps.manhunterOnDamageChance.ToStringPercentEmptyZero("F1"));
            expr_2E[3]  = new TableDataGetter <PawnKindDef>("manhunterOnTameFailChance", (PawnKindDef k) => k.RaceProps.manhunterOnTameFailChance.ToStringPercentEmptyZero("F1"));
            expr_2E[4]  = new TableDataGetter <PawnKindDef>("predator", (PawnKindDef k) => k.RaceProps.predator.ToStringCheckBlank());
            expr_2E[5]  = new TableDataGetter <PawnKindDef>("bodySize", (PawnKindDef k) => k.RaceProps.baseBodySize.ToString("F2"));
            expr_2E[6]  = new TableDataGetter <PawnKindDef>("maxPreyBodySize", (PawnKindDef k) => (!k.RaceProps.predator) ? string.Empty : k.RaceProps.maxPreyBodySize.ToString("F2"));
            expr_2E[7]  = new TableDataGetter <PawnKindDef>("canBePredatorPrey", (PawnKindDef k) => k.RaceProps.canBePredatorPrey.ToStringCheckBlank());
            expr_2E[8]  = new TableDataGetter <PawnKindDef>("petness", (PawnKindDef k) => k.RaceProps.petness.ToStringPercent());
            expr_2E[9]  = new TableDataGetter <PawnKindDef>("nuzzleMtbHours", (PawnKindDef k) => (k.RaceProps.nuzzleMtbHours <= 0f) ? string.Empty : k.RaceProps.nuzzleMtbHours.ToString());
            expr_2E[10] = new TableDataGetter <PawnKindDef>("packAnimal", (PawnKindDef k) => k.RaceProps.packAnimal.ToStringCheckBlank());
            expr_2E[11] = new TableDataGetter <PawnKindDef>("herdAnimal", (PawnKindDef k) => k.RaceProps.herdAnimal.ToStringCheckBlank());
            expr_2E[12] = new TableDataGetter <PawnKindDef>("wildGroupSizeMin", (PawnKindDef k) => (k.wildGroupSize.min == 1) ? string.Empty : k.wildGroupSize.min.ToString());
            expr_2E[13] = new TableDataGetter <PawnKindDef>("wildGroupSizeMax", (PawnKindDef k) => (k.wildGroupSize.max == 1) ? string.Empty : k.wildGroupSize.max.ToString());
            expr_2E[14] = new TableDataGetter <PawnKindDef>("CanDoHerdMigration", (PawnKindDef k) => k.RaceProps.CanDoHerdMigration.ToStringCheckBlank());
            expr_2E[15] = new TableDataGetter <PawnKindDef>("herdMigrationAllowed", (PawnKindDef k) => k.RaceProps.herdMigrationAllowed.ToStringCheckBlank());
            expr_2E[16] = new TableDataGetter <PawnKindDef>("mateMtb", (PawnKindDef k) => k.RaceProps.mateMtbHours.ToStringEmptyZero("F0"));
            DebugTables.MakeTablesDialog <PawnKindDef>(arg_300_0, expr_2E);
        }
        public static void MakeTablePairsByThing(List <ThingStuffPair> pairList)
        {
            DefMap <ThingDef, float> totalCommMult = new DefMap <ThingDef, float>();
            DefMap <ThingDef, float> totalComm     = new DefMap <ThingDef, float>();
            DefMap <ThingDef, int>   pairCount     = new DefMap <ThingDef, int>();

            foreach (ThingStuffPair current in pairList)
            {
                DefMap <ThingDef, float> defMap;
                ThingDef thing;
                (defMap = totalCommMult)[thing = current.thing] = defMap[thing] + current.commonalityMultiplier;
                ThingDef thing2;
                (defMap = totalComm)[thing2 = current.thing] = defMap[thing2] + current.Commonality;
                DefMap <ThingDef, int> pairCount2;
                ThingDef thing3;
                (pairCount2 = pairCount)[thing3 = current.thing] = pairCount2[thing3] + 1;
            }
            IEnumerable <ThingDef> arg_192_0 = from d in DefDatabase <ThingDef> .AllDefs
                                               where pairList.Any((ThingStuffPair pa) => pa.thing == d)
                                               select d;

            TableDataGetter <ThingDef>[] expr_F3 = new TableDataGetter <ThingDef> [5];
            expr_F3[0] = new TableDataGetter <ThingDef>("thing", (ThingDef t) => t.defName);
            expr_F3[1] = new TableDataGetter <ThingDef>("pair count", (ThingDef t) => pairCount[t].ToString());
            expr_F3[2] = new TableDataGetter <ThingDef>("total commonality multiplier ", (ThingDef t) => totalCommMult[t].ToString("F4"));
            expr_F3[3] = new TableDataGetter <ThingDef>("total commonality", (ThingDef t) => totalComm[t].ToString("F4"));
            expr_F3[4] = new TableDataGetter <ThingDef>("generateCommonality", (ThingDef t) => t.generateCommonality.ToString("F4"));
            DebugTables.MakeTablesDialog <ThingDef>(arg_192_0, expr_F3);
        }
        public static void Crops()
        {
            Func <ThingDef, float> workCost = delegate(ThingDef d)
            {
                float num = 1.1f;
                num += d.plant.growDays * 1f;
                return(num + (d.plant.sowWork + d.plant.harvestWork) * 0.00612f);
            };
            IEnumerable <ThingDef> arg_297_0 = from d in DefDatabase <ThingDef> .AllDefs
                                               where d.category == ThingCategory.Plant && d.plant.Harvestable && d.plant.Sowable
                                               orderby d.plant.IsTree
                                               select d;

            TableDataGetter <ThingDef>[] expr_79 = new TableDataGetter <ThingDef> [14];
            expr_79[0]  = new TableDataGetter <ThingDef>("plant", (ThingDef d) => d.defName);
            expr_79[1]  = new TableDataGetter <ThingDef>("product", (ThingDef d) => d.plant.harvestedThingDef.defName);
            expr_79[2]  = new TableDataGetter <ThingDef>("grow time", (ThingDef d) => d.plant.growDays.ToString("F1"));
            expr_79[3]  = new TableDataGetter <ThingDef>("work", (ThingDef d) => (d.plant.sowWork + d.plant.harvestWork).ToString("F0"));
            expr_79[4]  = new TableDataGetter <ThingDef>("harvestCount", (ThingDef d) => d.plant.harvestYield.ToString("F1"));
            expr_79[5]  = new TableDataGetter <ThingDef>("work-cost per cycle", (ThingDef d) => workCost(d).ToString("F2"));
            expr_79[6]  = new TableDataGetter <ThingDef>("work-cost per harvestCount", (ThingDef d) => (workCost(d) / d.plant.harvestYield).ToString("F2"));
            expr_79[7]  = new TableDataGetter <ThingDef>("value each", (ThingDef d) => d.plant.harvestedThingDef.BaseMarketValue.ToString("F2"));
            expr_79[8]  = new TableDataGetter <ThingDef>("harvestValueTotal", (ThingDef d) => (d.plant.harvestYield * d.plant.harvestedThingDef.BaseMarketValue).ToString("F2"));
            expr_79[9]  = new TableDataGetter <ThingDef>("profit per growDay", (ThingDef d) => ((d.plant.harvestYield * d.plant.harvestedThingDef.BaseMarketValue - workCost(d)) / d.plant.growDays).ToString("F2"));
            expr_79[10] = new TableDataGetter <ThingDef>("nutrition per growDay", (ThingDef d) => (d.plant.harvestedThingDef.ingestible == null) ? string.Empty : (d.plant.harvestYield * d.plant.harvestedThingDef.GetStatValueAbstract(StatDefOf.Nutrition, null) / d.plant.growDays).ToString("F2"));
            expr_79[11] = new TableDataGetter <ThingDef>("nutrition", (ThingDef d) => (d.plant.harvestedThingDef.ingestible == null) ? string.Empty : d.plant.harvestedThingDef.GetStatValueAbstract(StatDefOf.Nutrition, null).ToString("F2"));
            expr_79[12] = new TableDataGetter <ThingDef>("fertMin", (ThingDef d) => d.plant.fertilityMin.ToStringPercent());
            expr_79[13] = new TableDataGetter <ThingDef>("fertSensitivity", (ThingDef d) => d.plant.fertilitySensitivity.ToStringPercent());
            DebugTables.MakeTablesDialog <ThingDef>(arg_297_0, expr_79);
        }
        public static void WeaponsRanged()
        {
            Func <ThingDef, int>   damage           = (ThingDef d) => (d.Verbs[0].defaultProjectile == null) ? 0 : d.Verbs[0].defaultProjectile.projectile.GetDamageAmount(null, null);
            Func <ThingDef, float> armorPenetration = (ThingDef d) => (d.Verbs[0].defaultProjectile == null) ? 0f : d.Verbs[0].defaultProjectile.projectile.GetArmorPenetration(null, null);
            Func <ThingDef, float> stoppingPower    = (ThingDef d) => (d.Verbs[0].defaultProjectile == null) ? 0f : d.Verbs[0].defaultProjectile.projectile.stoppingPower;
            Func <ThingDef, float> warmup           = (ThingDef d) => d.Verbs[0].warmupTime;
            Func <ThingDef, float> cooldown         = (ThingDef d) => d.GetStatValueAbstract(StatDefOf.RangedWeapon_Cooldown, null);
            Func <ThingDef, int>   burstShots       = (ThingDef d) => d.Verbs[0].burstShotCount;
            Func <ThingDef, float> fullcycle        = (ThingDef d) => warmup(d) + cooldown(d) + ((d.Verbs[0].burstShotCount - 1) * d.Verbs[0].ticksBetweenBurstShots).TicksToSeconds();
            Func <ThingDef, float> dpsMissless      = delegate(ThingDef d)
            {
                int   num  = burstShots(d);
                float num2 = warmup(d) + cooldown(d);
                num2 += (float)(num - 1) * ((float)d.Verbs[0].ticksBetweenBurstShots / 60f);
                return((float)(damage(d) * num) / num2);
            };
            Func <ThingDef, float> accTouch  = (ThingDef d) => d.GetStatValueAbstract(StatDefOf.AccuracyTouch, null);
            Func <ThingDef, float> accShort  = (ThingDef d) => d.GetStatValueAbstract(StatDefOf.AccuracyShort, null);
            Func <ThingDef, float> accMed    = (ThingDef d) => d.GetStatValueAbstract(StatDefOf.AccuracyMedium, null);
            Func <ThingDef, float> accLong   = (ThingDef d) => d.GetStatValueAbstract(StatDefOf.AccuracyLong, null);
            Func <ThingDef, float> accAvg    = (ThingDef d) => (accTouch(d) + accShort(d) + accMed(d) + accLong(d)) / 4f;
            Func <ThingDef, float> dpsAvg    = (ThingDef d) => dpsMissless(d) * accAvg(d);
            IEnumerable <ThingDef> arg_51C_0 = (from d in DefDatabase <ThingDef> .AllDefs
                                                where d.IsRangedWeapon
                                                select d).OrderByDescending(dpsAvg);

            TableDataGetter <ThingDef>[] expr_1E5 = new TableDataGetter <ThingDef> [25];
            expr_1E5[0]  = new TableDataGetter <ThingDef>("defName", (ThingDef d) => d.defName);
            expr_1E5[1]  = new TableDataGetter <ThingDef>("damage", (ThingDef d) => damage(d).ToString());
            expr_1E5[2]  = new TableDataGetter <ThingDef>("AP", (ThingDef d) => armorPenetration(d).ToStringPercent());
            expr_1E5[3]  = new TableDataGetter <ThingDef>("stop\npower", (ThingDef d) => (stoppingPower(d) <= 0f) ? string.Empty : stoppingPower(d).ToString("F1"));
            expr_1E5[4]  = new TableDataGetter <ThingDef>("warmup", (ThingDef d) => warmup(d).ToString("F2"));
            expr_1E5[5]  = new TableDataGetter <ThingDef>("burst\nshots", (ThingDef d) => burstShots(d).ToString());
            expr_1E5[6]  = new TableDataGetter <ThingDef>("cooldown", (ThingDef d) => cooldown(d).ToString("F2"));
            expr_1E5[7]  = new TableDataGetter <ThingDef>("full\ncycle", (ThingDef d) => fullcycle(d).ToString("F2"));
            expr_1E5[8]  = new TableDataGetter <ThingDef>("range", (ThingDef d) => d.Verbs[0].range.ToString("F1"));
            expr_1E5[9]  = new TableDataGetter <ThingDef>("projectile\nspeed", (ThingDef d) => (d.projectile == null) ? string.Empty : d.projectile.speed.ToString("F0"));
            expr_1E5[10] = new TableDataGetter <ThingDef>("dps\nmissless", (ThingDef d) => dpsMissless(d).ToString("F2"));
            expr_1E5[11] = new TableDataGetter <ThingDef>("accuracy\ntouch (" + 3f + ")", (ThingDef d) => accTouch(d).ToStringPercent());
            expr_1E5[12] = new TableDataGetter <ThingDef>("accuracy\nshort (" + 12f + ")", (ThingDef d) => accShort(d).ToStringPercent());
            expr_1E5[13] = new TableDataGetter <ThingDef>("accuracy\nmed (" + 25f + ")", (ThingDef d) => accMed(d).ToStringPercent());
            expr_1E5[14] = new TableDataGetter <ThingDef>("accuracy\nlong (" + 40f + ")", (ThingDef d) => accLong(d).ToStringPercent());
            expr_1E5[15] = new TableDataGetter <ThingDef>("accuracy\navg", (ThingDef d) => accAvg(d).ToString("F2"));
            expr_1E5[16] = new TableDataGetter <ThingDef>("forced\nmiss\nradius", (ThingDef d) => (d.Verbs[0].forcedMissRadius <= 0f) ? string.Empty : d.Verbs[0].forcedMissRadius.ToString());
            expr_1E5[17] = new TableDataGetter <ThingDef>("dps\ntouch", (ThingDef d) => (dpsMissless(d) * accTouch(d)).ToString("F2"));
            expr_1E5[18] = new TableDataGetter <ThingDef>("dps\nshort", (ThingDef d) => (dpsMissless(d) * accShort(d)).ToString("F2"));
            expr_1E5[19] = new TableDataGetter <ThingDef>("dps\nmed", (ThingDef d) => (dpsMissless(d) * accMed(d)).ToString("F2"));
            expr_1E5[20] = new TableDataGetter <ThingDef>("dps\nlong", (ThingDef d) => (dpsMissless(d) * accLong(d)).ToString("F2"));
            expr_1E5[21] = new TableDataGetter <ThingDef>("dps\navg", (ThingDef d) => dpsAvg(d).ToString("F2"));
            expr_1E5[22] = new TableDataGetter <ThingDef>("market\nvalue", (ThingDef d) => d.GetStatValueAbstract(StatDefOf.MarketValue, null).ToString("F0"));
            expr_1E5[23] = new TableDataGetter <ThingDef>("work", (ThingDef d) => d.GetStatValueAbstract(StatDefOf.WorkToMake, null).ToString("F0"));
            expr_1E5[24] = new TableDataGetter <ThingDef>("dpsAvg*100 / market value", (ThingDef d) => (dpsAvg(d) * 100f / d.GetStatValueAbstract(StatDefOf.MarketValue, null)).ToString("F3"));
            DebugTables.MakeTablesDialog <ThingDef>(arg_51C_0, expr_1E5);
        }
        public static void BuildingSkills()
        {
            IEnumerable <BuildableDef> arg_95_0 = from d in DefDatabase <ThingDef> .AllDefs.Cast <BuildableDef>().Concat(DefDatabase <TerrainDef> .AllDefs.Cast <BuildableDef>())
                                                      where d.BuildableByPlayer
                                                  select d;

            TableDataGetter <BuildableDef>[] expr_41 = new TableDataGetter <BuildableDef> [2];
            expr_41[0] = new TableDataGetter <BuildableDef>("defName", (BuildableDef d) => d.defName);
            expr_41[1] = new TableDataGetter <BuildableDef>("construction skill prerequisite", (BuildableDef d) => d.constructionSkillPrerequisite);
            DebugTables.MakeTablesDialog <BuildableDef>(arg_95_0, expr_41);
        }
        public static void ThingFillPercents()
        {
            IEnumerable <ThingDef> arg_CD_0 = from d in DefDatabase <ThingDef> .AllDefs
                                              where d.fillPercent > 0f
                                              orderby d.fillPercent descending
                                              select d;

            TableDataGetter <ThingDef>[] expr_4F = new TableDataGetter <ThingDef> [3];
            expr_4F[0] = new TableDataGetter <ThingDef>("defName", (ThingDef d) => d.defName);
            expr_4F[1] = new TableDataGetter <ThingDef>("fillPercent", (ThingDef d) => d.fillPercent.ToStringPercent());
            expr_4F[2] = new TableDataGetter <ThingDef>("category", (ThingDef d) => d.category.ToString());
            DebugTables.MakeTablesDialog <ThingDef>(arg_CD_0, expr_4F);
        }
        public static void ThingNutritions()
        {
            IEnumerable <ThingDef> arg_D5_0 = from d in DefDatabase <ThingDef> .AllDefs
                                              where d.ingestible != null
                                              select d;

            TableDataGetter <ThingDef>[] expr_2D = new TableDataGetter <ThingDef> [4];
            expr_2D[0] = new TableDataGetter <ThingDef>("defName", (ThingDef d) => d.defName);
            expr_2D[1] = new TableDataGetter <ThingDef>("market value", (ThingDef d) => d.BaseMarketValue.ToString("F1"));
            expr_2D[2] = new TableDataGetter <ThingDef>("nutrition", (ThingDef d) => d.GetStatValueAbstract(StatDefOf.Nutrition, null).ToString("F2"));
            expr_2D[3] = new TableDataGetter <ThingDef>("nutrition per value", (ThingDef d) => (d.GetStatValueAbstract(StatDefOf.Nutrition, null) / d.BaseMarketValue).ToString("F3"));
            DebugTables.MakeTablesDialog <ThingDef>(arg_D5_0, expr_2D);
        }
Example #13
0
        public static void InstallableBodyParts()
        {
            Func <RecipeDef, ThingDef> getThingDef       = (RecipeDef r) => r.fixedIngredientFilter.AllowedThingDefs.FirstOrDefault();
            Func <ThingDef, RecipeDef> recipeToMakeThing = (ThingDef t) => DefDatabase <RecipeDef> .AllDefs.Where((RecipeDef x) => x.ProducedThingDef == t).FirstOrDefault();

            Func <RecipeDef, bool> installsBodyPart = (RecipeDef r) => r.addsHediff != null && getThingDef(r) != null;
            IEnumerable <string>   enumerable       = DefDatabase <RecipeDef> .AllDefs.Where((RecipeDef r) => installsBodyPart(r) && !getThingDef(r).tradeTags.NullOrEmpty()).SelectMany((RecipeDef x) => getThingDef(x).tradeTags).Distinct();

            IEnumerable <string> enumerable2 = DefDatabase <RecipeDef> .AllDefs.Where((RecipeDef r) => installsBodyPart(r) && !getThingDef(r).techHediffsTags.NullOrEmpty()).SelectMany((RecipeDef x) => getThingDef(x).techHediffsTags).Distinct();

            Func <ThingDef, string> getMinCraftingSkill = delegate(ThingDef t)
            {
                if (recipeToMakeThing(t) == null || recipeToMakeThing(t).skillRequirements.NullOrEmpty())
                {
                    return(string.Empty);
                }
                SkillRequirement skillRequirement = recipeToMakeThing(t).skillRequirements.Where((SkillRequirement x) => x.skill == SkillDefOf.Crafting).FirstOrDefault();
                return((skillRequirement != null) ? skillRequirement.minLevel.ToString() : string.Empty);
            };
            List <TableDataGetter <RecipeDef> > list = new List <TableDataGetter <RecipeDef> >
            {
                new TableDataGetter <RecipeDef>("thingDef", (RecipeDef r) => getThingDef(r).defName),
                new TableDataGetter <RecipeDef>("hediffDef", (RecipeDef r) => (r.addsHediff != null) ? r.addsHediff.defName : ""),
                new TableDataGetter <RecipeDef>("mkt val", (RecipeDef r) => getThingDef(r).BaseMarketValue.ToStringMoney()),
                new TableDataGetter <RecipeDef>("tech lvl", (RecipeDef r) => getThingDef(r).techLevel.ToString()),
                new TableDataGetter <RecipeDef>("mass", (RecipeDef r) => getThingDef(r).BaseMass),
                new TableDataGetter <RecipeDef>("work to\nmake", (RecipeDef r) => r.workAmount.ToString()),
                new TableDataGetter <RecipeDef>("min skill\ncrft", (RecipeDef r) => getMinCraftingSkill(getThingDef(r))),
                new TableDataGetter <RecipeDef>("stuff costs", (RecipeDef r) => (!getThingDef(r).costList.NullOrEmpty()) ? getThingDef(r).costList.Select((ThingDefCountClass x) => x.Summary).ToCommaList() : ""),
                new TableDataGetter <RecipeDef>("tradeable", (RecipeDef r) => getThingDef(r).tradeability.ToString()),
                new TableDataGetter <RecipeDef>("recipeDef", (RecipeDef r) => r.defName),
                new TableDataGetter <RecipeDef>("death on\nfail %", (RecipeDef r) => r.deathOnFailedSurgeryChance.ToStringPercent()),
                new TableDataGetter <RecipeDef>("surg sccss\nfctr", (RecipeDef r) => r.surgerySuccessChanceFactor.ToString()),
                new TableDataGetter <RecipeDef>("min skill", (RecipeDef r) => r.MinSkillString.TrimEndNewlines().TrimStart(' ')),
                new TableDataGetter <RecipeDef>("research\nprereq", (RecipeDef r) => (recipeToMakeThing(getThingDef(r)) != null) ? ((recipeToMakeThing(getThingDef(r)).researchPrerequisite != null) ? recipeToMakeThing(getThingDef(r)).researchPrerequisite.defName : "") : ""),
                new TableDataGetter <RecipeDef>("research\nprereqs", (RecipeDef r) => (recipeToMakeThing(getThingDef(r)) != null) ? ((!recipeToMakeThing(getThingDef(r)).researchPrerequisites.NullOrEmpty()) ? recipeToMakeThing(getThingDef(r)).researchPrerequisites.Select((ResearchProjectDef x) => x.defName).ToCommaList() : "") : ""),
                new TableDataGetter <RecipeDef>("recipe\nusers", (RecipeDef r) => (recipeToMakeThing(getThingDef(r)) != null) ? recipeToMakeThing(getThingDef(r)).AllRecipeUsers.Select((ThingDef x) => x.defName).ToCommaList() : "")
            };

            foreach (string c2 in enumerable2)
            {
                TableDataGetter <RecipeDef> item = new TableDataGetter <RecipeDef>("techHediff\n" + c2.Shorten(), (RecipeDef r) => (!getThingDef(r).techHediffsTags.NullOrEmpty() && getThingDef(r).techHediffsTags.Contains(c2)).ToStringCheckBlank());
                list.Add(item);
            }
            foreach (string c in enumerable)
            {
                TableDataGetter <RecipeDef> item2 = new TableDataGetter <RecipeDef>("trade\n" + c.Shorten(), (RecipeDef r) => (!getThingDef(r).tradeTags.NullOrEmpty() && getThingDef(r).tradeTags.Contains(c)).ToStringCheckBlank());
                list.Add(item2);
            }
            DebugTables.MakeTablesDialog(DefDatabase <RecipeDef> .AllDefs.Where((RecipeDef r) => getThingDef(r) != null && installsBodyPart(r)), list.ToArray());
        }
Example #14
0
        public static void RacesFoodConsumption()
        {
            Func <ThingDef, int, string> lsName = delegate(ThingDef d, int lsIndex)
            {
                if (d.race.lifeStageAges.Count <= lsIndex)
                {
                    return(string.Empty);
                }
                LifeStageDef def = d.race.lifeStageAges[lsIndex].def;
                return(def.defName);
            };
            Func <ThingDef, int, string> maxFood = delegate(ThingDef d, int lsIndex)
            {
                if (d.race.lifeStageAges.Count <= lsIndex)
                {
                    return(string.Empty);
                }
                LifeStageDef def = d.race.lifeStageAges[lsIndex].def;
                return((d.race.baseBodySize * def.bodySizeFactor * def.foodMaxFactor).ToString("F2"));
            };
            Func <ThingDef, int, string> hungerRate = delegate(ThingDef d, int lsIndex)
            {
                if (d.race.lifeStageAges.Count <= lsIndex)
                {
                    return(string.Empty);
                }
                LifeStageDef def = d.race.lifeStageAges[lsIndex].def;
                return((d.race.baseHungerRate * def.hungerRateFactor).ToString("F2"));
            };
            IEnumerable <ThingDef> arg_219_0 = from d in DefDatabase <ThingDef> .AllDefs
                                               where d.race != null && d.race.EatsFood
                                               orderby d.race.baseHungerRate descending
                                               select d;

            TableDataGetter <ThingDef>[] expr_BF = new TableDataGetter <ThingDef> [13];
            expr_BF[0]  = new TableDataGetter <ThingDef>("defName", (ThingDef d) => d.defName);
            expr_BF[1]  = new TableDataGetter <ThingDef>("Lifestage 0", (ThingDef d) => lsName(d, 0));
            expr_BF[2]  = new TableDataGetter <ThingDef>("maxFood", (ThingDef d) => maxFood(d, 0));
            expr_BF[3]  = new TableDataGetter <ThingDef>("hungerRate", (ThingDef d) => hungerRate(d, 0));
            expr_BF[4]  = new TableDataGetter <ThingDef>("Lifestage 1", (ThingDef d) => lsName(d, 1));
            expr_BF[5]  = new TableDataGetter <ThingDef>("maxFood", (ThingDef d) => maxFood(d, 1));
            expr_BF[6]  = new TableDataGetter <ThingDef>("hungerRate", (ThingDef d) => hungerRate(d, 1));
            expr_BF[7]  = new TableDataGetter <ThingDef>("Lifestage 2", (ThingDef d) => lsName(d, 2));
            expr_BF[8]  = new TableDataGetter <ThingDef>("maxFood", (ThingDef d) => maxFood(d, 2));
            expr_BF[9]  = new TableDataGetter <ThingDef>("hungerRate", (ThingDef d) => hungerRate(d, 2));
            expr_BF[10] = new TableDataGetter <ThingDef>("Lifestage 3", (ThingDef d) => lsName(d, 3));
            expr_BF[11] = new TableDataGetter <ThingDef>("maxFood", (ThingDef d) => maxFood(d, 3));
            expr_BF[12] = new TableDataGetter <ThingDef>("hungerRate", (ThingDef d) => hungerRate(d, 3));
            DebugTables.MakeTablesDialog <ThingDef>(arg_219_0, expr_BF);
        }
        public static void ItemAccessibility()
        {
            IEnumerable <ThingDef> arg_129_0 = from x in ThingSetMakerUtility.allGeneratableItems
                                               orderby x.defName
                                               select x;

            TableDataGetter <ThingDef>[] expr_2D = new TableDataGetter <ThingDef> [6];
            expr_2D[0] = new TableDataGetter <ThingDef>("defName", (ThingDef d) => d.defName);
            expr_2D[1] = new TableDataGetter <ThingDef>("1", (ThingDef d) => (!PlayerItemAccessibilityUtility.PossiblyAccessible(d, 1, Find.CurrentMap)) ? string.Empty : "✓");
            expr_2D[2] = new TableDataGetter <ThingDef>("10", (ThingDef d) => (!PlayerItemAccessibilityUtility.PossiblyAccessible(d, 10, Find.CurrentMap)) ? string.Empty : "✓");
            expr_2D[3] = new TableDataGetter <ThingDef>("100", (ThingDef d) => (!PlayerItemAccessibilityUtility.PossiblyAccessible(d, 100, Find.CurrentMap)) ? string.Empty : "✓");
            expr_2D[4] = new TableDataGetter <ThingDef>("1000", (ThingDef d) => (!PlayerItemAccessibilityUtility.PossiblyAccessible(d, 1000, Find.CurrentMap)) ? string.Empty : "✓");
            expr_2D[5] = new TableDataGetter <ThingDef>("10000", (ThingDef d) => (!PlayerItemAccessibilityUtility.PossiblyAccessible(d, 10000, Find.CurrentMap)) ? string.Empty : "✓");
            DebugTables.MakeTablesDialog <ThingDef>(arg_129_0, expr_2D);
        }
        public static void PlantsBasics()
        {
            IEnumerable <ThingDef> arg_14B_0 = from d in DefDatabase <ThingDef> .AllDefs
                                               where d.category == ThingCategory.Plant
                                               orderby d.plant.fertilitySensitivity
                                               select d;

            TableDataGetter <ThingDef>[] expr_4F = new TableDataGetter <ThingDef> [6];
            expr_4F[0] = new TableDataGetter <ThingDef>("defName", (ThingDef d) => d.defName);
            expr_4F[1] = new TableDataGetter <ThingDef>("growDays", (ThingDef d) => d.plant.growDays.ToString("F2"));
            expr_4F[2] = new TableDataGetter <ThingDef>("nutrition", (ThingDef d) => (d.ingestible == null) ? "-" : d.GetStatValueAbstract(StatDefOf.Nutrition, null).ToString("F2"));
            expr_4F[3] = new TableDataGetter <ThingDef>("nut/day", (ThingDef d) => (d.ingestible == null) ? "-" : (d.GetStatValueAbstract(StatDefOf.Nutrition, null) / d.plant.growDays).ToString("F4"));
            expr_4F[4] = new TableDataGetter <ThingDef>("fertilityMin", (ThingDef d) => d.plant.fertilityMin.ToString("F2"));
            expr_4F[5] = new TableDataGetter <ThingDef>("fertilitySensitivity", (ThingDef d) => d.plant.fertilitySensitivity.ToString("F2"));
            DebugTables.MakeTablesDialog <ThingDef>(arg_14B_0, expr_4F);
        }
        public static void AnimalWildCountsOnMap()
        {
            Map map = Find.CurrentMap;
            IEnumerable <PawnKindDef> arg_9A_0 = from k in DefDatabase <PawnKindDef> .AllDefs
                                                 where k.race != null && k.RaceProps.Animal && DebugOutputsEcology.ExpectedAnimalCount(k, map.Biome) > 0f
                                                 orderby DebugOutputsEcology.ExpectedAnimalCount(k, map.Biome) descending
                                                 select k;

            TableDataGetter <PawnKindDef>[] expr_3E = new TableDataGetter <PawnKindDef> [3];
            expr_3E[0] = new TableDataGetter <PawnKindDef>("animal", (PawnKindDef k) => k.defName);
            expr_3E[1] = new TableDataGetter <PawnKindDef>("expected count on map (inaccurate)", (PawnKindDef k) => DebugOutputsEcology.ExpectedAnimalCount(k, map.Biome).ToString("F2"));
            expr_3E[2] = new TableDataGetter <PawnKindDef>("actual count on map", (PawnKindDef k) => (from p in map.mapPawns.AllPawnsSpawned
                                                                                                      where p.kindDef == k
                                                                                                      select p).Count <Pawn>().ToString());
            DebugTables.MakeTablesDialog <PawnKindDef>(arg_9A_0, expr_3E);
        }
Example #18
0
        public static void AnimalCombatBalance()
        {
            Func <PawnKindDef, float> meleeDps = delegate(PawnKindDef k)
            {
                Pawn pawn = PawnGenerator.GeneratePawn(new PawnGenerationRequest(k, null, PawnGenerationContext.NonPlayer, -1, false, false, false, false, true, true, 1f, false, true, true, false, false, false, false, null, null, null, null, null, null, null, null));
                while (pawn.health.hediffSet.hediffs.Count > 0)
                {
                    pawn.health.RemoveHediff(pawn.health.hediffSet.hediffs[0]);
                }
                float statValue = pawn.GetStatValue(StatDefOf.MeleeDPS, true);
                Find.WorldPawns.PassToWorld(pawn, PawnDiscardDecideMode.Discard);
                return(statValue);
            };
            Func <PawnKindDef, float> averageArmor = delegate(PawnKindDef k)
            {
                Pawn pawn = PawnGenerator.GeneratePawn(k, null);
                while (pawn.health.hediffSet.hediffs.Count > 0)
                {
                    pawn.health.RemoveHediff(pawn.health.hediffSet.hediffs[0]);
                }
                float result = (pawn.GetStatValue(StatDefOf.ArmorRating_Blunt, true) + pawn.GetStatValue(StatDefOf.ArmorRating_Sharp, true)) / 2f;
                Find.WorldPawns.PassToWorld(pawn, PawnDiscardDecideMode.Discard);
                return(result);
            };
            Func <PawnKindDef, float> combatPowerCalculated = delegate(PawnKindDef k)
            {
                float num  = 1f + meleeDps(k) * 2f;
                float num2 = 1f + (k.RaceProps.baseHealthScale + averageArmor(k) * 1.8f) * 2f;
                float num3 = num * num2 * 2.5f + 10f;
                return(num3 + k.race.GetStatValueAbstract(StatDefOf.MoveSpeed, null) * 2f);
            };
            IEnumerable <PawnKindDef> arg_1A0_0 = from d in DefDatabase <PawnKindDef> .AllDefs
                                                  where d.race != null && d.RaceProps.Animal
                                                  orderby d.combatPower
                                                  select d;

            TableDataGetter <PawnKindDef>[] expr_AD = new TableDataGetter <PawnKindDef> [7];
            expr_AD[0] = new TableDataGetter <PawnKindDef>("animal", (PawnKindDef k) => k.defName);
            expr_AD[1] = new TableDataGetter <PawnKindDef>("meleeDps", (PawnKindDef k) => meleeDps(k).ToString("F1"));
            expr_AD[2] = new TableDataGetter <PawnKindDef>("baseHealthScale", (PawnKindDef k) => k.RaceProps.baseHealthScale.ToString());
            expr_AD[3] = new TableDataGetter <PawnKindDef>("moveSpeed", (PawnKindDef k) => k.race.GetStatValueAbstract(StatDefOf.MoveSpeed, null).ToString());
            expr_AD[4] = new TableDataGetter <PawnKindDef>("averageArmor", (PawnKindDef k) => averageArmor(k).ToStringPercent());
            expr_AD[5] = new TableDataGetter <PawnKindDef>("combatPowerCalculated", (PawnKindDef k) => combatPowerCalculated(k).ToString("F0"));
            expr_AD[6] = new TableDataGetter <PawnKindDef>("combatPower", (PawnKindDef k) => k.combatPower.ToString());
            DebugTables.MakeTablesDialog <PawnKindDef>(arg_1A0_0, expr_AD);
        }
Example #19
0
        public static void AnimalsEcosystem()
        {
            Func <PawnKindDef, float> ecosystemWeightGuess = (PawnKindDef k) => k.RaceProps.baseBodySize * 0.2f + k.RaceProps.baseHungerRate * 0.8f;
            IEnumerable <PawnKindDef> arg_163_0            = from d in DefDatabase <PawnKindDef> .AllDefs
                                                             where d.race != null && d.RaceProps.Animal
                                                             orderby d.ecoSystemWeight descending
                                                             select d;

            TableDataGetter <PawnKindDef>[] expr_78 = new TableDataGetter <PawnKindDef> [6];
            expr_78[0] = new TableDataGetter <PawnKindDef>("defName", (PawnKindDef d) => d.defName);
            expr_78[1] = new TableDataGetter <PawnKindDef>("bodySize", (PawnKindDef d) => d.RaceProps.baseBodySize.ToString("F2"));
            expr_78[2] = new TableDataGetter <PawnKindDef>("hunger rate", (PawnKindDef d) => d.RaceProps.baseHungerRate.ToString("F2"));
            expr_78[3] = new TableDataGetter <PawnKindDef>("ecosystem weight", (PawnKindDef d) => d.ecoSystemWeight.ToString("F2"));
            expr_78[4] = new TableDataGetter <PawnKindDef>("ecosystem weight guess", (PawnKindDef d) => ecosystemWeightGuess(d).ToString("F2"));
            expr_78[5] = new TableDataGetter <PawnKindDef>("predator", (PawnKindDef d) => d.RaceProps.predator.ToStringCheckBlank());
            DebugTables.MakeTablesDialog <PawnKindDef>(arg_163_0, expr_78);
        }
        public static void ThingDamageData()
        {
            IEnumerable <ThingDef> arg_197_0 = from d in DefDatabase <ThingDef> .AllDefs
                                               where d.useHitPoints
                                               orderby d.category, d.defName
            select d;

            TableDataGetter <ThingDef>[] expr_71 = new TableDataGetter <ThingDef> [7];
            expr_71[0] = new TableDataGetter <ThingDef>("category", (ThingDef d) => d.category.ToString());
            expr_71[1] = new TableDataGetter <ThingDef>("defName", (ThingDef d) => d.defName);
            expr_71[2] = new TableDataGetter <ThingDef>("hp", (ThingDef d) => d.BaseMaxHitPoints.ToString());
            expr_71[3] = new TableDataGetter <ThingDef>("flammability", (ThingDef d) => (d.BaseFlammability <= 0f) ? string.Empty : d.BaseFlammability.ToString());
            expr_71[4] = new TableDataGetter <ThingDef>("uses stuff", (ThingDef d) => d.MadeFromStuff.ToStringCheckBlank());
            expr_71[5] = new TableDataGetter <ThingDef>("deterioration rate", (ThingDef d) => (d.GetStatValueAbstract(StatDefOf.DeteriorationRate, null) <= 0f) ? string.Empty : d.GetStatValueAbstract(StatDefOf.DeteriorationRate, null).ToString());
            expr_71[6] = new TableDataGetter <ThingDef>("days to deterioriate", (ThingDef d) => (d.GetStatValueAbstract(StatDefOf.DeteriorationRate, null) <= 0f) ? string.Empty : ((float)d.BaseMaxHitPoints / d.GetStatValueAbstract(StatDefOf.DeteriorationRate, null)).ToString());
            DebugTables.MakeTablesDialog <ThingDef>(arg_197_0, expr_71);
        }
        public static void PlantCountsOnMap()
        {
            Map map = Find.CurrentMap;
            IEnumerable <ThingDef> arg_B3_0 = from p in DefDatabase <ThingDef> .AllDefs
                                              where p.category == ThingCategory.Plant && map.Biome.CommonalityOfPlant(p) > 0f
                                              orderby map.Biome.CommonalityOfPlant(p) descending
                                              select p;

            TableDataGetter <ThingDef>[] expr_3E = new TableDataGetter <ThingDef> [4];
            expr_3E[0] = new TableDataGetter <ThingDef>("plant", (ThingDef p) => p.defName);
            expr_3E[1] = new TableDataGetter <ThingDef>("biome-defined commonality", (ThingDef p) => map.Biome.CommonalityOfPlant(p).ToString("F2"));
            expr_3E[2] = new TableDataGetter <ThingDef>("expected count (rough)", (ThingDef p) => (map.Biome.CommonalityOfPlant(p) * map.Biome.plantDensity * 4000f).ToString("F0"));
            expr_3E[3] = new TableDataGetter <ThingDef>("actual count on map", (ThingDef p) => (from c in map.AllCells
                                                                                                where c.GetPlant(map) != null && c.GetPlant(map).def == p
                                                                                                select c).Count <IntVec3>().ToString());
            DebugTables.MakeTablesDialog <ThingDef>(arg_B3_0, expr_3E);
        }
Example #22
0
        public static void RacesButchery()
        {
            IEnumerable <ThingDef> arg_19F_0 = from d in DefDatabase <ThingDef> .AllDefs
                                               where d.race != null
                                               orderby d.race.baseBodySize
                                               select d;

            TableDataGetter <ThingDef>[] expr_4F = new TableDataGetter <ThingDef> [8];
            expr_4F[0] = new TableDataGetter <ThingDef>("defName", (ThingDef d) => d.defName);
            expr_4F[1] = new TableDataGetter <ThingDef>("mktval", (ThingDef d) => d.GetStatValueAbstract(StatDefOf.MarketValue, null).ToString("F0"));
            expr_4F[2] = new TableDataGetter <ThingDef>("healthScale", (ThingDef d) => d.race.baseHealthScale.ToString("F2"));
            expr_4F[3] = new TableDataGetter <ThingDef>("hunger rate", (ThingDef d) => d.race.baseHungerRate.ToString("F2"));
            expr_4F[4] = new TableDataGetter <ThingDef>("wildness", (ThingDef d) => d.race.wildness.ToStringPercent());
            expr_4F[5] = new TableDataGetter <ThingDef>("bodySize", (ThingDef d) => d.race.baseBodySize.ToString("F2"));
            expr_4F[6] = new TableDataGetter <ThingDef>("meatAmount", (ThingDef d) => d.GetStatValueAbstract(StatDefOf.MeatAmount, null).ToString("F0"));
            expr_4F[7] = new TableDataGetter <ThingDef>("leatherAmount", (ThingDef d) => d.GetStatValueAbstract(StatDefOf.LeatherAmount, null).ToString("F0"));
            DebugTables.MakeTablesDialog <ThingDef>(arg_19F_0, expr_4F);
        }
        public static void Wool()
        {
            IEnumerable <ThingDef> arg_129_0 = from d in DefDatabase <ThingDef> .AllDefs
                                               where d.category == ThingCategory.Pawn && d.race.IsFlesh && d.GetCompProperties <CompProperties_Shearable>() != null
                                               select d;

            TableDataGetter <ThingDef>[] expr_2D = new TableDataGetter <ThingDef> [6];
            expr_2D[0] = new TableDataGetter <ThingDef>("animal", (ThingDef d) => d.defName);
            expr_2D[1] = new TableDataGetter <ThingDef>("woolDef", (ThingDef d) => d.GetCompProperties <CompProperties_Shearable>().woolDef.defName);
            expr_2D[2] = new TableDataGetter <ThingDef>("woolAmount", (ThingDef d) => d.GetCompProperties <CompProperties_Shearable>().woolAmount.ToString());
            expr_2D[3] = new TableDataGetter <ThingDef>("woolValue", (ThingDef d) => d.GetCompProperties <CompProperties_Shearable>().woolDef.BaseMarketValue.ToString("F2"));
            expr_2D[4] = new TableDataGetter <ThingDef>("shear interval", (ThingDef d) => d.GetCompProperties <CompProperties_Shearable>().shearIntervalDays.ToString("F1"));
            expr_2D[5] = new TableDataGetter <ThingDef>("value per year", delegate(ThingDef d)
            {
                CompProperties_Shearable compProperties = d.GetCompProperties <CompProperties_Shearable>();
                return((compProperties.woolDef.BaseMarketValue * (float)compProperties.woolAmount * (60f / (float)compProperties.shearIntervalDays)).ToString("F0"));
            });
            DebugTables.MakeTablesDialog <ThingDef>(arg_129_0, expr_2D);
        }
        public static void Drugs()
        {
            Func <ThingDef, float> realIngredientCost = (ThingDef d) => DebugOutputsEconomy.CostToMake(d, true);
            Func <ThingDef, float> realSellPrice      = (ThingDef d) => d.BaseMarketValue * 0.6f;
            Func <ThingDef, float> realBuyPrice       = (ThingDef d) => d.BaseMarketValue * 1.4f;
            IEnumerable <ThingDef> arg_197_0          = from d in DefDatabase <ThingDef> .AllDefs
                                                        where d.IsWithinCategory(ThingCategoryDefOf.Medicine) || d.IsWithinCategory(ThingCategoryDefOf.Drugs)
                                                        select d;

            TableDataGetter <ThingDef>[] expr_9C = new TableDataGetter <ThingDef> [8];
            expr_9C[0] = new TableDataGetter <ThingDef>("name", (ThingDef d) => d.defName);
            expr_9C[1] = new TableDataGetter <ThingDef>("ingredients", (ThingDef d) => DebugOutputsEconomy.CostListString(d, true, true));
            expr_9C[2] = new TableDataGetter <ThingDef>("work amount", (ThingDef d) => DebugOutputsEconomy.WorkToProduceBest(d).ToString("F0"));
            expr_9C[3] = new TableDataGetter <ThingDef>("real ingredient cost", (ThingDef d) => realIngredientCost(d).ToString("F1"));
            expr_9C[4] = new TableDataGetter <ThingDef>("real sell price", (ThingDef d) => realSellPrice(d).ToString("F1"));
            expr_9C[5] = new TableDataGetter <ThingDef>("real profit per item", (ThingDef d) => (realSellPrice(d) - realIngredientCost(d)).ToString("F1"));
            expr_9C[6] = new TableDataGetter <ThingDef>("real profit per day's work", (ThingDef d) => ((realSellPrice(d) - realIngredientCost(d)) / DebugOutputsEconomy.WorkToProduceBest(d) * 30000f).ToString("F1"));
            expr_9C[7] = new TableDataGetter <ThingDef>("real buy price", (ThingDef d) => realBuyPrice(d).ToString("F1"));
            DebugTables.MakeTablesDialog <ThingDef>(arg_197_0, expr_9C);
        }
        public static void ThingMasses()
        {
            IOrderedEnumerable <ThingDef> orderedEnumerable = from x in DefDatabase <ThingDef> .AllDefsListForReading
                                                              where x.category == ThingCategory.Item || x.Minifiable
                                                              where x.thingClass != typeof(MinifiedThing) && x.thingClass != typeof(UnfinishedThing)
                                                              orderby x.GetStatValueAbstract(StatDefOf.Mass, null), x.GetStatValueAbstract(StatDefOf.MarketValue, null)
            select x;

            Func <ThingDef, float, string> perPawn      = (ThingDef d, float bodySize) => (bodySize * 35f / d.GetStatValueAbstract(StatDefOf.Mass, null)).ToString("F0");
            Func <ThingDef, string>        perNutrition = delegate(ThingDef d)
            {
                if (d.ingestible == null || d.GetStatValueAbstract(StatDefOf.Nutrition, null) == 0f)
                {
                    return(string.Empty);
                }
                return((d.GetStatValueAbstract(StatDefOf.Mass, null) / d.GetStatValueAbstract(StatDefOf.Nutrition, null)).ToString("F2"));
            };
            IEnumerable <ThingDef> arg_1C3_0 = orderedEnumerable;

            TableDataGetter <ThingDef>[] expr_E1 = new TableDataGetter <ThingDef> [7];
            expr_E1[0] = new TableDataGetter <ThingDef>("defName", delegate(ThingDef d)
            {
                if (d.Minifiable)
                {
                    return(d.defName + " (minified)");
                }
                string text = d.defName;
                if (!d.EverHaulable)
                {
                    text += " (not haulable)";
                }
                return(text);
            });
            expr_E1[1] = new TableDataGetter <ThingDef>("mass", (ThingDef d) => d.GetStatValueAbstract(StatDefOf.Mass, null).ToString());
            expr_E1[2] = new TableDataGetter <ThingDef>("per human", (ThingDef d) => perPawn(d, ThingDefOf.Human.race.baseBodySize));
            expr_E1[3] = new TableDataGetter <ThingDef>("per muffalo", (ThingDef d) => perPawn(d, ThingDefOf.Muffalo.race.baseBodySize));
            expr_E1[4] = new TableDataGetter <ThingDef>("per dromedary", (ThingDef d) => perPawn(d, ThingDefOf.Dromedary.race.baseBodySize));
            expr_E1[5] = new TableDataGetter <ThingDef>("per nutrition", (ThingDef d) => perNutrition(d));
            expr_E1[6] = new TableDataGetter <ThingDef>("small volume", (ThingDef d) => (!d.smallVolume) ? string.Empty : "small");
            DebugTables.MakeTablesDialog <ThingDef>(arg_1C3_0, expr_E1);
        }
        public static void Biomes()
        {
            IEnumerable <BiomeDef> arg_1D3_0 = from d in DefDatabase <BiomeDef> .AllDefs
                                               orderby d.plantDensity descending
                                               select d;

            TableDataGetter <BiomeDef>[] expr_2E = new TableDataGetter <BiomeDef> [10];
            expr_2E[0] = new TableDataGetter <BiomeDef>("defName", (BiomeDef d) => d.defName);
            expr_2E[1] = new TableDataGetter <BiomeDef>("animalDensity", (BiomeDef d) => d.animalDensity.ToString("F2"));
            expr_2E[2] = new TableDataGetter <BiomeDef>("plantDensity", (BiomeDef d) => d.plantDensity.ToString("F2"));
            expr_2E[3] = new TableDataGetter <BiomeDef>("diseaseMtbDays", (BiomeDef d) => d.diseaseMtbDays.ToString("F0"));
            expr_2E[4] = new TableDataGetter <BiomeDef>("movementDifficulty", (BiomeDef d) => (!d.impassable) ? d.movementDifficulty.ToString("F1") : "-");
            expr_2E[5] = new TableDataGetter <BiomeDef>("forageability", (BiomeDef d) => d.forageability.ToStringPercent());
            expr_2E[6] = new TableDataGetter <BiomeDef>("forageFood", (BiomeDef d) => (d.foragedFood == null) ? string.Empty : d.foragedFood.label);
            expr_2E[7] = new TableDataGetter <BiomeDef>("forageable plants", (BiomeDef d) => (from pd in d.AllWildPlants
                                                                                              where pd.plant.harvestedThingDef != null && pd.plant.harvestedThingDef.IsNutritionGivingIngestible
                                                                                              select pd.defName).ToCommaList(false));
            expr_2E[8] = new TableDataGetter <BiomeDef>("wildPlantRegrowDays", (BiomeDef d) => d.wildPlantRegrowDays.ToString("F0"));
            expr_2E[9] = new TableDataGetter <BiomeDef>("wildPlantsCareAboutLocalFertility", (BiomeDef d) => d.wildPlantsCareAboutLocalFertility.ToStringCheckBlank());
            DebugTables.MakeTablesDialog <BiomeDef>(arg_1D3_0, expr_2E);
        }
        public static void Recipes()
        {
            IEnumerable <RecipeDef> arg_229_0 = from d in DefDatabase <RecipeDef> .AllDefs
                                                where !d.products.NullOrEmpty <ThingDefCountClass>() && !d.ingredients.NullOrEmpty <IngredientCount>()
                                                select d;

            TableDataGetter <RecipeDef>[] expr_2E = new TableDataGetter <RecipeDef> [12];
            expr_2E[0]  = new TableDataGetter <RecipeDef>("defName", (RecipeDef d) => d.defName);
            expr_2E[1]  = new TableDataGetter <RecipeDef>("work /w carry", (RecipeDef d) => DebugOutputsEconomy.TrueWorkWithCarryTime(d).ToString("F0"));
            expr_2E[2]  = new TableDataGetter <RecipeDef>("work seconds", (RecipeDef d) => (DebugOutputsEconomy.TrueWorkWithCarryTime(d) / 60f).ToString("F0"));
            expr_2E[3]  = new TableDataGetter <RecipeDef>("cheapest products value", (RecipeDef d) => DebugOutputsEconomy.CheapestProductsValue(d).ToString("F1"));
            expr_2E[4]  = new TableDataGetter <RecipeDef>("cheapest ingredients value", (RecipeDef d) => DebugOutputsEconomy.CheapestIngredientValue(d).ToString("F1"));
            expr_2E[5]  = new TableDataGetter <RecipeDef>("work value", (RecipeDef d) => DebugOutputsEconomy.WorkValueEstimate(d).ToString("F1"));
            expr_2E[6]  = new TableDataGetter <RecipeDef>("profit raw", (RecipeDef d) => (DebugOutputsEconomy.CheapestProductsValue(d) - DebugOutputsEconomy.CheapestIngredientValue(d)).ToString("F1"));
            expr_2E[7]  = new TableDataGetter <RecipeDef>("profit with work", (RecipeDef d) => (DebugOutputsEconomy.CheapestProductsValue(d) - DebugOutputsEconomy.WorkValueEstimate(d) - DebugOutputsEconomy.CheapestIngredientValue(d)).ToString("F1"));
            expr_2E[8]  = new TableDataGetter <RecipeDef>("profit per work day", (RecipeDef d) => ((DebugOutputsEconomy.CheapestProductsValue(d) - DebugOutputsEconomy.CheapestIngredientValue(d)) * 60000f / DebugOutputsEconomy.TrueWorkWithCarryTime(d)).ToString("F0"));
            expr_2E[9]  = new TableDataGetter <RecipeDef>("min skill", (RecipeDef d) => (!d.skillRequirements.NullOrEmpty <SkillRequirement>()) ? d.skillRequirements[0].Summary : string.Empty);
            expr_2E[10] = new TableDataGetter <RecipeDef>("cheapest stuff", (RecipeDef d) => (DebugOutputsEconomy.CheapestNonDerpStuff(d) == null) ? string.Empty : DebugOutputsEconomy.CheapestNonDerpStuff(d).defName);
            expr_2E[11] = new TableDataGetter <RecipeDef>("cheapest ingredients", (RecipeDef d) => (from pa in DebugOutputsEconomy.CheapestIngredients(d)
                                                                                                    select pa.First.defName + " x" + pa.Second).ToCommaList(false));
            DebugTables.MakeTablesDialog <RecipeDef>(arg_229_0, expr_2E);
        }
Example #28
0
        public static void TradeRequestsSampled()
        {
            Map currentMap = Find.CurrentMap;
            IncidentWorker_QuestTradeRequest incidentWorker_QuestTradeRequest = (IncidentWorker_QuestTradeRequest)IncidentDefOf.Quest_TradeRequest.Worker;
            Dictionary <ThingDef, int>       counts = new Dictionary <ThingDef, int>();

            for (int i = 0; i < 100; i++)
            {
                SettlementBase settlementBase = IncidentWorker_QuestTradeRequest.RandomNearbyTradeableSettlement(currentMap.Tile);
                if (settlementBase == null)
                {
                    break;
                }
                TradeRequestComp component = settlementBase.GetComponent <TradeRequestComp>();
                if (incidentWorker_QuestTradeRequest.TryGenerateTradeRequest(component, currentMap))
                {
                    if (!counts.ContainsKey(component.requestThingDef))
                    {
                        counts.Add(component.requestThingDef, 0);
                    }
                    Dictionary <ThingDef, int> counts2;
                    ThingDef requestThingDef;
                    (counts2 = counts)[requestThingDef = component.requestThingDef] = counts2[requestThingDef] + 1;
                }
                settlementBase.GetComponent <TradeRequestComp>().Disable();
            }
            IEnumerable <ThingDef> arg_144_0 = from d in DefDatabase <ThingDef> .AllDefs
                                               where counts.ContainsKey(d)
                                               orderby counts[d] descending
                                               select d;

            TableDataGetter <ThingDef>[] expr_F0 = new TableDataGetter <ThingDef> [2];
            expr_F0[0] = new TableDataGetter <ThingDef>("defName", (ThingDef d) => d.defName);
            expr_F0[1] = new TableDataGetter <ThingDef>("appearance rate in " + 100 + " trade requests", (ThingDef d) => ((float)counts[d] / 100f).ToStringPercent());
            DebugTables.MakeTablesDialog <ThingDef>(arg_144_0, expr_F0);
        }
Example #29
0
        private static IEnumerable InfectionSimulatorWorker()
        {
            int         trials    = 2;
            List <Pawn> doctors   = DebugOutputsInfection.GenerateDoctorArray();
            List <int>  testSkill = new List <int>
            {
                4,
                10,
                16
            };
            List <ThingDef> testMedicine = new List <ThingDef>
            {
                null,
                ThingDefOf.MedicineHerbal,
                ThingDefOf.MedicineIndustrial,
                ThingDefOf.MedicineUltratech
            };
            PawnGenerationRequest pawngen = new PawnGenerationRequest(PawnKindDefOf.Colonist, Faction.OfPlayer, PawnGenerationContext.NonPlayer, -1, false, false, false, false, true, false, 1f, false, true, true, false, false, false, false, null, null, null, null, null, null, null, null);
            int originalTicks             = Find.TickManager.TicksGame;
            List <DebugOutputsInfection.InfectionSimRow> results = new List <DebugOutputsInfection.InfectionSimRow>();
            int totalTests  = DebugOutputsInfection.InfectionList().Count <HediffDef>() * testMedicine.Count <ThingDef>() * testSkill.Count <int>() * trials;
            int currentTest = 0;

            foreach (HediffDef hediff in DebugOutputsInfection.InfectionList())
            {
                foreach (ThingDef meds in testMedicine)
                {
                    foreach (int skill in testSkill)
                    {
                        DebugOutputsInfection.InfectionSimRow result = default(DebugOutputsInfection.InfectionSimRow);
                        result.illness  = hediff;
                        result.skill    = skill;
                        result.medicine = meds;
                        Pawn doctor = doctors[skill];
                        for (int i = 0; i < trials; i++)
                        {
                            Pawn patient    = PawnGenerator.GeneratePawn(pawngen);
                            int  startTicks = Find.TickManager.TicksGame;
                            patient.health.AddHediff(result.illness, null, null, null);
                            Hediff activeHediff = patient.health.hediffSet.GetFirstHediffOfDef(result.illness, false);
                            while (!patient.Dead && patient.health.hediffSet.HasHediff(result.illness, false))
                            {
                                if (activeHediff.TendableNow(false))
                                {
                                    activeHediff.Tended(TendUtility.CalculateBaseTendQuality(doctor, patient, meds), 0);
                                    result.medicineUsed += 1f;
                                }
                                foreach (Hediff hediff2 in patient.health.hediffSet.GetHediffsTendable())
                                {
                                    hediff2.Tended(TendUtility.CalculateBaseTendQuality(doctor, patient, meds), 0);
                                }
                                Find.TickManager.DebugSetTicksGame(Find.TickManager.TicksGame + 1);
                                patient.health.HealthTick();
                                if (Find.TickManager.TicksGame % 900 == 0)
                                {
                                    yield return(null);
                                }
                            }
                            if (patient.Dead)
                            {
                                result.deathChance += 1f;
                            }
                            else
                            {
                                result.recoveryTimeDays += (Find.TickManager.TicksGame - startTicks).TicksToDays();
                            }
                            currentTest++;
                            LongEventHandler.SetCurrentEventText(string.Format("Simulating ({0}/{1})", currentTest, totalTests));
                            yield return(null);
                        }
                        result.recoveryTimeDays /= (float)trials - result.deathChance;
                        result.deathChance      /= (float)trials;
                        result.medicineUsed     /= (float)trials;
                        results.Add(result);
                    }
                }
            }
            IEnumerable <DebugOutputsInfection.InfectionSimRow> dataSources = results;

            TableDataGetter <DebugOutputsInfection.InfectionSimRow>[] array = new TableDataGetter <DebugOutputsInfection.InfectionSimRow> [6];
            array[0] = new TableDataGetter <DebugOutputsInfection.InfectionSimRow>("defName", (DebugOutputsInfection.InfectionSimRow isr) => isr.illness.defName);
            array[1] = new TableDataGetter <DebugOutputsInfection.InfectionSimRow>("meds", (DebugOutputsInfection.InfectionSimRow isr) => (isr.medicine == null) ? "(none)" : isr.medicine.defName);
            array[2] = new TableDataGetter <DebugOutputsInfection.InfectionSimRow>("skill", (DebugOutputsInfection.InfectionSimRow isr) => isr.skill.ToString());
            array[3] = new TableDataGetter <DebugOutputsInfection.InfectionSimRow>("death chance", (DebugOutputsInfection.InfectionSimRow isr) => isr.deathChance.ToStringPercent());
            array[4] = new TableDataGetter <DebugOutputsInfection.InfectionSimRow>("recovery time (days)", (DebugOutputsInfection.InfectionSimRow isr) => isr.recoveryTimeDays.ToString("F1"));
            array[5] = new TableDataGetter <DebugOutputsInfection.InfectionSimRow>("medicine used", (DebugOutputsInfection.InfectionSimRow isr) => isr.medicineUsed.ToString());
            DebugTables.MakeTablesDialog <DebugOutputsInfection.InfectionSimRow>(dataSources, array);
            Find.TickManager.DebugSetTicksGame(originalTicks);
            yield break;
        }
        public static void AnimalGrowth()
        {
            Func <ThingDef, float> gestDaysEach       = new Func <ThingDef, float>(DebugOutputsEconomy.GestationDaysEach);
            Func <ThingDef, float> nutritionToGestate = delegate(ThingDef d)
            {
                float        num          = 0f;
                LifeStageAge lifeStageAge = d.race.lifeStageAges[d.race.lifeStageAges.Count - 1];
                return(num + gestDaysEach(d) * lifeStageAge.def.hungerRateFactor * d.race.baseHungerRate);
            };
            Func <ThingDef, float> babyMeatNut = delegate(ThingDef d)
            {
                LifeStageAge lifeStageAge = d.race.lifeStageAges[0];
                return(d.GetStatValueAbstract(StatDefOf.MeatAmount, null) * 0.05f * lifeStageAge.def.bodySizeFactor);
            };
            Func <ThingDef, float> babyMeatNutPerInput  = (ThingDef d) => babyMeatNut(d) / nutritionToGestate(d);
            Func <ThingDef, float> nutritionToAdulthood = delegate(ThingDef d)
            {
                float num = 0f;
                num += nutritionToGestate(d);
                for (int i = 1; i < d.race.lifeStageAges.Count; i++)
                {
                    LifeStageAge lifeStageAge = d.race.lifeStageAges[i];
                    float        num2         = lifeStageAge.minAge - d.race.lifeStageAges[i - 1].minAge;
                    float        num3         = num2 * 60f;
                    num += num3 * lifeStageAge.def.hungerRateFactor * d.race.baseHungerRate;
                }
                return(num);
            };
            Func <ThingDef, float> adultMeatNutPerInput = (ThingDef d) => d.GetStatValueAbstract(StatDefOf.MeatAmount, null) * 0.05f / nutritionToAdulthood(d);
            Func <ThingDef, float> bestMeatPerInput     = delegate(ThingDef d)
            {
                float a = babyMeatNutPerInput(d);
                float b = adultMeatNutPerInput(d);
                return(Mathf.Max(a, b));
            };
            Func <ThingDef, string> eggNut = delegate(ThingDef d)
            {
                CompProperties_EggLayer compProperties = d.GetCompProperties <CompProperties_EggLayer>();
                if (compProperties == null)
                {
                    return(string.Empty);
                }
                return(compProperties.eggFertilizedDef.GetStatValueAbstract(StatDefOf.Nutrition, null).ToString("F2"));
            };
            IEnumerable <ThingDef> arg_352_0 = from d in DefDatabase <ThingDef> .AllDefs
                                               where d.category == ThingCategory.Pawn && d.race.IsFlesh
                                               orderby bestMeatPerInput(d) descending
                                               select d;

            TableDataGetter <ThingDef>[] expr_108 = new TableDataGetter <ThingDef> [17];
            expr_108[0]  = new TableDataGetter <ThingDef>(string.Empty, (ThingDef d) => d.defName);
            expr_108[1]  = new TableDataGetter <ThingDef>("hungerRate", (ThingDef d) => d.race.baseHungerRate.ToString("F2"));
            expr_108[2]  = new TableDataGetter <ThingDef>("gestDaysEach", (ThingDef d) => gestDaysEach(d).ToString("F2"));
            expr_108[3]  = new TableDataGetter <ThingDef>("herbiv", (ThingDef d) => ((d.race.foodType & FoodTypeFlags.Plant) == FoodTypeFlags.None) ? string.Empty : "Y");
            expr_108[4]  = new TableDataGetter <ThingDef>("|", (ThingDef d) => "|");
            expr_108[5]  = new TableDataGetter <ThingDef>("bodySize", (ThingDef d) => d.race.baseBodySize.ToString("F2"));
            expr_108[6]  = new TableDataGetter <ThingDef>("age Adult", (ThingDef d) => d.race.lifeStageAges[d.race.lifeStageAges.Count - 1].minAge.ToString("F2"));
            expr_108[7]  = new TableDataGetter <ThingDef>("nutrition to adulthood", (ThingDef d) => nutritionToAdulthood(d).ToString("F2"));
            expr_108[8]  = new TableDataGetter <ThingDef>("adult meat-nut", (ThingDef d) => (d.GetStatValueAbstract(StatDefOf.MeatAmount, null) * 0.05f).ToString("F2"));
            expr_108[9]  = new TableDataGetter <ThingDef>("adult meat-nut / input-nut", (ThingDef d) => adultMeatNutPerInput(d).ToString("F3"));
            expr_108[10] = new TableDataGetter <ThingDef>("|", (ThingDef d) => "|");
            expr_108[11] = new TableDataGetter <ThingDef>("baby size", (ThingDef d) => (d.race.lifeStageAges[0].def.bodySizeFactor * d.race.baseBodySize).ToString("F2"));
            expr_108[12] = new TableDataGetter <ThingDef>("nutrition to gestate", (ThingDef d) => nutritionToGestate(d).ToString("F2"));
            expr_108[13] = new TableDataGetter <ThingDef>("egg nut", (ThingDef d) => eggNut(d));
            expr_108[14] = new TableDataGetter <ThingDef>("baby meat-nut", (ThingDef d) => babyMeatNut(d).ToString("F2"));
            expr_108[15] = new TableDataGetter <ThingDef>("baby meat-nut / input-nut", (ThingDef d) => babyMeatNutPerInput(d).ToString("F2"));
            expr_108[16] = new TableDataGetter <ThingDef>("baby wins", (ThingDef d) => (babyMeatNutPerInput(d) <= adultMeatNutPerInput(d)) ? string.Empty : "B");
            DebugTables.MakeTablesDialog <ThingDef>(arg_352_0, expr_108);
        }