Exemplo n.º 1
0
        public override IEnumerable <Thing> GenerateThings(int forTile)
        {
            _003CGenerateThings_003Ec__Iterator0 _003CGenerateThings_003Ec__Iterator = (_003CGenerateThings_003Ec__Iterator0) /*Error near IL_0034: stateMachine*/;
            List <ThingDef> generatedDefs     = new List <ThingDef>();
            int             numThingDefsToUse = thingDefCountRange.RandomInRange;

            for (int i = 0; i < numThingDefsToUse; i++)
            {
                if (!categoryDef.DescendantThingDefs.Where(delegate(ThingDef t)
                {
                    _003CGenerateThings_003Ec__Iterator0 _003CGenerateThings_003Ec__Iterator2 = _003CGenerateThings_003Ec__Iterator;
                    return(t.tradeability.TraderCanSell() && (int)t.techLevel <= (int)_003CGenerateThings_003Ec__Iterator._0024this.maxTechLevelGenerate && !generatedDefs.Contains(t) && (_003CGenerateThings_003Ec__Iterator._0024this.excludedThingDefs == null || !_003CGenerateThings_003Ec__Iterator._0024this.excludedThingDefs.Contains(t)) && (_003CGenerateThings_003Ec__Iterator._0024this.excludedCategories == null || !_003CGenerateThings_003Ec__Iterator._0024this.excludedCategories.Any((ThingCategoryDef c) => c.DescendantThingDefs.Contains(t))));
                }).TryRandomElement(out ThingDef chosenThingDef))
                {
                    break;
                }
                using (IEnumerator <Thing> enumerator = StockGeneratorUtility.TryMakeForStock(chosenThingDef, RandomCountOf(chosenThingDef)).GetEnumerator())
                {
                    if (enumerator.MoveNext())
                    {
                        Thing th = enumerator.Current;
                        yield return(th);

                        /*Error: Unable to find new state assignment for yield return*/;
                    }
                }
                generatedDefs.Add(chosenThingDef);
            }
            yield break;
IL_0183:
            /*Error near IL_0184: Unexpected return in MoveNext()*/;
        }
Exemplo n.º 2
0
        public override IEnumerable <Thing> GenerateThings(int forTile)
        {
            _003CGenerateThings_003Ec__Iterator0 _003CGenerateThings_003Ec__Iterator = (_003CGenerateThings_003Ec__Iterator0) /*Error near IL_0034: stateMachine*/;
            List <ThingDef> generatedDefs     = new List <ThingDef>();
            int             numThingDefsToUse = this.thingDefCountRange.RandomInRange;
            int             i = 0;
            ThingDef        chosenThingDef;

            while (i < numThingDefsToUse && (from d in DefDatabase <ThingDef> .AllDefs
                                             where _003CGenerateThings_003Ec__Iterator._0024this.HandlesThingDef(d) && d.tradeability == Tradeability.Stockable && !generatedDefs.Contains(d)
                                             select d).TryRandomElement <ThingDef>(out chosenThingDef))
            {
                using (IEnumerator <Thing> enumerator = StockGeneratorUtility.TryMakeForStock(chosenThingDef, base.RandomCountOf(chosenThingDef)).GetEnumerator())
                {
                    if (enumerator.MoveNext())
                    {
                        Thing th = enumerator.Current;
                        yield return(th);

                        /*Error: Unable to find new state assignment for yield return*/;
                    }
                }
                generatedDefs.Add(chosenThingDef);
                i++;
            }
            yield break;
IL_0178:
            /*Error near IL_0179: Unexpected return in MoveNext()*/;
        }
Exemplo n.º 3
0
        public override IEnumerable <Thing> GenerateThings(int forTile)
        {
            _003CGenerateThings_003Ec__Iterator0 _003CGenerateThings_003Ec__Iterator = (_003CGenerateThings_003Ec__Iterator0) /*Error near IL_0032: stateMachine*/;
            int numKinds             = this.kindCountRange.RandomInRange;
            int count                = base.countRange.RandomInRange;
            List <PawnKindDef> kinds = new List <PawnKindDef>();
            int         num          = 0;
            PawnKindDef item         = default(PawnKindDef);

            while (num < numKinds && (from k in DefDatabase <PawnKindDef> .AllDefs
                                      where !kinds.Contains(k) && _003CGenerateThings_003Ec__Iterator._0024this.PawnKindAllowed(k, forTile)
                                      select k).TryRandomElementByWeight <PawnKindDef>((Func <PawnKindDef, float>)((PawnKindDef k) => _003CGenerateThings_003Ec__Iterator._0024this.SelectionChance(k)), out item))
            {
                kinds.Add(item);
                num++;
            }
            int         i = 0;
            PawnKindDef kind;

            if (i < count && ((IEnumerable <PawnKindDef>)kinds).TryRandomElement <PawnKindDef>(out kind))
            {
                PawnKindDef           kind2   = kind;
                int                   tile    = forTile;
                PawnGenerationRequest request = new PawnGenerationRequest(kind2, null, PawnGenerationContext.NonPlayer, tile, false, false, false, false, true, false, 1f, false, true, true, false, false, false, false, null, null, null, null, null, null, null);
                yield return((Thing)PawnGenerator.GeneratePawn(request));

                /*Error: Unable to find new state assignment for yield return*/;
            }
        }
Exemplo n.º 4
0
        public override IEnumerable <Thing> GenerateThings(int forTile)
        {
            _003CGenerateThings_003Ec__Iterator0 _003CGenerateThings_003Ec__Iterator = (_003CGenerateThings_003Ec__Iterator0) /*Error near IL_0032: stateMachine*/;
            int numKinds             = kindCountRange.RandomInRange;
            int count                = countRange.RandomInRange;
            List <PawnKindDef> kinds = new List <PawnKindDef>();

            for (int j = 0; j < numKinds; j++)
            {
                if (!(from k in DefDatabase <PawnKindDef> .AllDefs
                      where !kinds.Contains(k) && _003CGenerateThings_003Ec__Iterator._0024this.PawnKindAllowed(k, forTile)
                      select k).TryRandomElementByWeight((PawnKindDef k) => _003CGenerateThings_003Ec__Iterator._0024this.SelectionChance(k), out PawnKindDef result))
                {
                    break;
                }
                kinds.Add(result);
            }
            int i = 0;

            if (i < count && kinds.TryRandomElement(out PawnKindDef kind))
            {
                PawnKindDef           kind2   = kind;
                int                   tile    = forTile;
                PawnGenerationRequest request = new PawnGenerationRequest(kind2, null, PawnGenerationContext.NonPlayer, tile);
                yield return((Thing)PawnGenerator.GeneratePawn(request));

                /*Error: Unable to find new state assignment for yield return*/;
            }
        }