예제 #1
0
        private static bool TryFindRandomRequestedThingDef_NewTmp(Map map, out ThingDef thingDef, out int count, List <ThingDef> dontRequest)
        {
            requestCountDict.Clear();
            Func <ThingDef, bool> globalValidator = delegate(ThingDef td)
            {
                if (td.BaseMarketValue / td.BaseMass < 5f)
                {
                    return(false);
                }
                if (!td.alwaysHaulable)
                {
                    return(false);
                }
                CompProperties_Rottable compProperties = td.GetCompProperties <CompProperties_Rottable>();
                if (compProperties != null && compProperties.daysToRotStart < 10f)
                {
                    return(false);
                }
                if (td.ingestible != null && td.ingestible.HumanEdible)
                {
                    return(false);
                }
                if (td == ThingDefOf.Silver)
                {
                    return(false);
                }
                if (!td.PlayerAcquirable)
                {
                    return(false);
                }
                int num = RandomRequestCount(td, map);
                requestCountDict.Add(td, num);
                if (!PlayerItemAccessibilityUtility.PossiblyAccessible(td, num, map))
                {
                    return(false);
                }
                if (!PlayerItemAccessibilityUtility.PlayerCanMake(td, map))
                {
                    return(false);
                }
                if (td.thingSetMakerTags != null && td.thingSetMakerTags.Contains("RewardStandardHighFreq"))
                {
                    return(false);
                }
                return((dontRequest.NullOrEmpty() || !dontRequest.Contains(td)) ? true : false);
            };

            if (ThingSetMakerUtility.allGeneratableItems.Where((ThingDef td) => globalValidator(td)).TryRandomElement(out thingDef))
            {
                count = requestCountDict[thingDef];
                return(true);
            }
            count = 0;
            return(false);
        }
예제 #2
0
        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);
        }
예제 #3
0
 public static void ItemAccessibility()
 {
     DebugTables.MakeTablesDialog(from x in ThingSetMakerUtility.allGeneratableItems
                                  orderby x.defName
                                  select x, new TableDataGetter <ThingDef>("defName", (ThingDef d) => d.defName), new TableDataGetter <ThingDef>("1", (ThingDef d) => (!PlayerItemAccessibilityUtility.PossiblyAccessible(d, 1, Find.CurrentMap)) ? string.Empty : "✓"), new TableDataGetter <ThingDef>("10", (ThingDef d) => (!PlayerItemAccessibilityUtility.PossiblyAccessible(d, 10, Find.CurrentMap)) ? string.Empty : "✓"), new TableDataGetter <ThingDef>("100", (ThingDef d) => (!PlayerItemAccessibilityUtility.PossiblyAccessible(d, 100, Find.CurrentMap)) ? string.Empty : "✓"), new TableDataGetter <ThingDef>("1000", (ThingDef d) => (!PlayerItemAccessibilityUtility.PossiblyAccessible(d, 1000, Find.CurrentMap)) ? string.Empty : "✓"), new TableDataGetter <ThingDef>("10000", (ThingDef d) => (!PlayerItemAccessibilityUtility.PossiblyAccessible(d, 10000, Find.CurrentMap)) ? string.Empty : "✓"));
 }
예제 #4
0
 public static void ItemAccessibility()
 {
     DebugTables.MakeTablesDialog(ThingSetMakerUtility.allGeneratableItems.OrderBy((ThingDef x) => x.defName), new TableDataGetter <ThingDef>("defName", (ThingDef d) => d.defName), new TableDataGetter <ThingDef>("1", (ThingDef d) => (!PlayerItemAccessibilityUtility.PossiblyAccessible(d, 1, Find.CurrentMap)) ? "" : "✓"), new TableDataGetter <ThingDef>("10", (ThingDef d) => (!PlayerItemAccessibilityUtility.PossiblyAccessible(d, 10, Find.CurrentMap)) ? "" : "✓"), new TableDataGetter <ThingDef>("100", (ThingDef d) => (!PlayerItemAccessibilityUtility.PossiblyAccessible(d, 100, Find.CurrentMap)) ? "" : "✓"), new TableDataGetter <ThingDef>("1000", (ThingDef d) => (!PlayerItemAccessibilityUtility.PossiblyAccessible(d, 1000, Find.CurrentMap)) ? "" : "✓"), new TableDataGetter <ThingDef>("10000", (ThingDef d) => (!PlayerItemAccessibilityUtility.PossiblyAccessible(d, 10000, Find.CurrentMap)) ? "" : "✓"));
 }