public static void PawnKindsApparelUsage()
        {
            List <TableDataGetter <PawnKindDef> > list = new List <TableDataGetter <PawnKindDef> >();

            list.Add(new TableDataGetter <PawnKindDef>("defName", (PawnKindDef x) => x.defName));
            list.Add(new TableDataGetter <PawnKindDef>("avg $", (PawnKindDef x) => x.apparelMoney.Average.ToString()));
            list.Add(new TableDataGetter <PawnKindDef>("min $", (PawnKindDef x) => x.apparelMoney.min.ToString()));
            list.Add(new TableDataGetter <PawnKindDef>("max $", (PawnKindDef x) => x.apparelMoney.max.ToString()));
            list.Add(new TableDataGetter <PawnKindDef>("points", (PawnKindDef x) => x.combatPower.ToString()));
            list.AddRange(from a in DefDatabase <ThingDef> .AllDefs
                          where a.IsApparel
                          orderby PawnApparelGenerator.IsHeadgear(a), a.techLevel, a.BaseMarketValue
                          select new TableDataGetter <PawnKindDef>(a.label.Shorten() + "\n$" + a.BaseMarketValue.ToString("F0"), delegate(PawnKindDef k)
            {
                if (k.apparelRequired != null && k.apparelRequired.Contains(a))
                {
                    return("Rq");
                }
                if (k.apparelDisallowTags != null && k.apparelDisallowTags.Any((string tag) => a.apparel.tags.Contains(tag)))
                {
                    return("distag");
                }
                if (k.apparelAllowHeadgearChance <= 0f && PawnApparelGenerator.IsHeadgear(a))
                {
                    return("nohat");
                }
                List <SpecificApparelRequirement> specificApparelRequirements = k.specificApparelRequirements;
                if (specificApparelRequirements != null)
                {
                    for (int i = 0; i < specificApparelRequirements.Count; i++)
                    {
                        if (PawnApparelGenerator.ApparelRequirementHandlesThing(specificApparelRequirements[i], a) && PawnApparelGenerator.ApparelRequirementTagsMatch(specificApparelRequirements[i], a))
                        {
                            return("SpRq");
                        }
                    }
                }
                if (k.apparelTags != null && a.apparel.tags.Any((string z) => k.apparelTags.Contains(z)))
                {
                    float baseMarketValue = a.BaseMarketValue;
                    if (k.apparelMoney.max < baseMarketValue)
                    {
                        return("-");
                    }
                    if (k.apparelMoney.min > baseMarketValue)
                    {
                        return("✓");
                    }
                    return((1f - (baseMarketValue - k.apparelMoney.min) / (k.apparelMoney.max - k.apparelMoney.min)).ToStringPercent("F0"));
                }
                return("");
            }));
            DebugTables.MakeTablesDialog(from x in DefDatabase <PawnKindDef> .AllDefs
                                         where x.RaceProps.Humanlike
                                         orderby(x.defaultFactionType == null) ? int.MaxValue : ((int)x.defaultFactionType.techLevel), x.combatPower
                                         select x, list.ToArray());
        }
Ejemplo n.º 2
0
        static bool CanWear(Zombie zombie, ThingStuffPair pair)
        {
            if (pair.thing == null)
            {
                return(false);
            }

            if (zombie.isMiner && PawnApparelGenerator.IsHeadgear(pair.thing))
            {
                return(false);
            }

            return(ApparelUtility.HasPartsToWear(zombie, pair.thing));
        }
Ejemplo n.º 3
0
        public static void PawnKindsApparelUsage()
        {
            List <TableDataGetter <PawnKindDef> > list = new List <TableDataGetter <PawnKindDef> >();

            list.Add(new TableDataGetter <PawnKindDef>("defName", (PawnKindDef x) => x.defName));
            list.Add(new TableDataGetter <PawnKindDef>("avg $", (PawnKindDef x) => x.apparelMoney.Average.ToString()));
            list.Add(new TableDataGetter <PawnKindDef>("min $", (PawnKindDef x) => x.apparelMoney.min.ToString()));
            list.Add(new TableDataGetter <PawnKindDef>("max $", (PawnKindDef x) => x.apparelMoney.max.ToString()));
            list.Add(new TableDataGetter <PawnKindDef>("points", (PawnKindDef x) => x.combatPower.ToString()));
            list.AddRange(from a in (from a in DefDatabase <ThingDef> .AllDefs
                                     where a.IsApparel
                                     select a).OrderBy(PawnApparelGenerator.IsHeadgear).ThenBy((ThingDef a) => a.BaseMarketValue)
                          select new TableDataGetter <PawnKindDef>(a.label.Shorten() + "\n$" + a.BaseMarketValue.ToString("F0"), delegate(PawnKindDef k)
            {
                if (k.apparelRequired != null && k.apparelRequired.Contains(a))
                {
                    return("Rq");
                }
                if (k.apparelAllowHeadgearChance <= 0f && PawnApparelGenerator.IsHeadgear(a))
                {
                    return("nohat");
                }
                if (k.apparelTags != null && a.apparel.tags.Any((string z) => k.apparelTags.Contains(z)))
                {
                    float baseMarketValue = a.BaseMarketValue;
                    if (k.apparelMoney.max < baseMarketValue)
                    {
                        return("-");
                    }
                    if (k.apparelMoney.min > baseMarketValue)
                    {
                        return("✓");
                    }
                    return((1f - (baseMarketValue - k.apparelMoney.min) / (k.apparelMoney.max - k.apparelMoney.min)).ToStringPercent("F0"));
                }
                return(string.Empty);
            }));
            DebugTables.MakeTablesDialog(from x in DefDatabase <PawnKindDef> .AllDefs
                                         where x.RaceProps.Humanlike
                                         orderby(x.defaultFactionType == null) ? 2147483647 : ((int)x.defaultFactionType.techLevel), x.combatPower
                                         select x, list.ToArray());
        }