public override IEnumerable <Thing> GenerateThings(int forTile, Faction faction = null) { tmpGenerated.Clear(); int countToGenerate = CountChanceUtility.RandomCount(countChances); int i = 0; while (true) { if (i < countToGenerate) { if (!TechprintUtility.TryGetTechprintDefToGenerate(faction, out var result, tmpGenerated)) { break; } tmpGenerated.Add(result); foreach (Thing item in StockGeneratorUtility.TryMakeForStock(result, 1)) { yield return(item); } i++; continue; } tmpGenerated.Clear(); break; } }
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()*/; }
public override IEnumerable <Thing> GenerateThings(int forTile, Faction faction = null) { foreach (Thing item in StockGeneratorUtility.TryMakeForStock(thingDef, RandomCountOf(thingDef))) { yield return(item); } }
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()*/; }
public static IEnumerable <Thing> TryMakeForStock(ThingDef thingDef, int count) { if (thingDef.MadeFromStuff) { int i = 0; Thing th2; while (true) { if (i < count) { th2 = StockGeneratorUtility.TryMakeForStockSingle(thingDef, 1); if (th2 == null) { i++; continue; } break; } yield break; } yield return(th2); /*Error: Unable to find new state assignment for yield return*/; } Thing th = StockGeneratorUtility.TryMakeForStockSingle(thingDef, count); if (th == null) { yield break; } yield return(th); /*Error: Unable to find new state assignment for yield return*/; }
public override IEnumerable <Thing> GenerateThings(int forTile) { foreach (Thing th in StockGeneratorUtility.TryMakeForStock(this.thingDef, base.RandomCountOf(this.thingDef))) { yield return(th); } }
public override IEnumerable <Thing> GenerateThings(int forTile) { ThingDef td = this.thingDefs.RandomElement <ThingDef>(); foreach (Thing th in StockGeneratorUtility.TryMakeForStock(td, base.RandomCountOf(td))) { yield return(th); } }
public bool MoveNext() { uint num = (uint)this.$PC; this.$PC = -1; bool flag = false; switch (num) { case 0u: td = this.thingDefs.RandomElement <ThingDef>(); enumerator = StockGeneratorUtility.TryMakeForStock(td, base.RandomCountOf(td)).GetEnumerator(); num = 4294967293u; break; case 1u: break; default: return(false); } try { switch (num) { } if (enumerator.MoveNext()) { th = enumerator.Current; this.$current = th; if (!this.$disposing) { this.$PC = 1; } flag = true; return(true); } } finally { if (!flag) { if (enumerator != null) { enumerator.Dispose(); } } } this.$PC = -1; return(false); }
public override IEnumerable <Thing> GenerateThings(int forTile) { using (IEnumerator <Thing> enumerator = StockGeneratorUtility.TryMakeForStock(thingDef, RandomCountOf(thingDef)).GetEnumerator()) { if (enumerator.MoveNext()) { Thing th = enumerator.Current; yield return(th); /*Error: Unable to find new state assignment for yield return*/; } } yield break; IL_00d4: /*Error near IL_00d5: Unexpected return in MoveNext()*/; }
public override IEnumerable <Thing> GenerateThings(int forTile, Faction faction = null) { List <ThingDef> generatedDefs = new List <ThingDef>(); int numThingDefsToUse = thingDefCountRange.RandomInRange; for (int i = 0; i < numThingDefsToUse; i++) { if (!categoryDef.DescendantThingDefs.Where((ThingDef t) => t.tradeability.TraderCanSell() && (int)t.techLevel <= (int)maxTechLevelGenerate && !generatedDefs.Contains(t) && (excludedThingDefs == null || !excludedThingDefs.Contains(t)) && (excludedCategories == null || !excludedCategories.Any((ThingCategoryDef c) => c.DescendantThingDefs.Contains(t)))).TryRandomElement(out var chosenThingDef)) { break; } foreach (Thing item in StockGeneratorUtility.TryMakeForStock(chosenThingDef, RandomCountOf(chosenThingDef))) { yield return(item); } generatedDefs.Add(chosenThingDef); chosenThingDef = null; } }
public override IEnumerable <Thing> GenerateThings(int forTile, Faction faction = null) { List <ThingDef> generatedDefs = new List <ThingDef>(); int numThingDefsToUse = thingDefCountRange.RandomInRange; for (int i = 0; i < numThingDefsToUse; i++) { if (!DefDatabase <ThingDef> .AllDefs.Where((ThingDef d) => HandlesThingDef(d) && d.tradeability.TraderCanSell() && (excludedThingDefs == null || !excludedThingDefs.Contains(d)) && !generatedDefs.Contains(d)).TryRandomElement(out ThingDef chosenThingDef)) { break; } foreach (Thing item in StockGeneratorUtility.TryMakeForStock(chosenThingDef, RandomCountOf(chosenThingDef))) { yield return(item); } generatedDefs.Add(chosenThingDef); chosenThingDef = null; } }
public override IEnumerable <Thing> GenerateThings(int forTile) { List <ThingDef> generatedDefs = new List <ThingDef>(); int numThingDefsToUse = this.thingDefCountRange.RandomInRange; for (int i = 0; i < numThingDefsToUse; i++) { ThingDef chosenThingDef; if (!(from d in DefDatabase <ThingDef> .AllDefs where this.$this.HandlesThingDef(d) && d.tradeability.TraderCanSell() && (this.$this.excludedThingDefs == null || !this.$this.excludedThingDefs.Contains(d)) && !generatedDefs.Contains(d) select d).TryRandomElement(out chosenThingDef)) { break; } foreach (Thing th in StockGeneratorUtility.TryMakeForStock(chosenThingDef, base.RandomCountOf(chosenThingDef))) { yield return(th); } generatedDefs.Add(chosenThingDef); } }
public override IEnumerable <Thing> GenerateThings(int forTile) { List <ThingDef> generatedDefs = new List <ThingDef>(); int numThingDefsToUse = this.thingDefCountRange.RandomInRange; for (int i = 0; i < numThingDefsToUse; i++) { ThingDef chosenThingDef; if (!(from t in this.categoryDef.DescendantThingDefs where t.tradeability.TraderCanSell() && t.techLevel <= this.$this.maxTechLevelGenerate && !generatedDefs.Contains(t) && (this.$this.excludedThingDefs == null || !this.$this.excludedThingDefs.Contains(t)) && (this.$this.excludedCategories == null || !this.$this.excludedCategories.Any((ThingCategoryDef c) => c.DescendantThingDefs.Contains(t))) select t).TryRandomElement(out chosenThingDef)) { break; } foreach (Thing th in StockGeneratorUtility.TryMakeForStock(chosenThingDef, base.RandomCountOf(chosenThingDef))) { yield return(th); } generatedDefs.Add(chosenThingDef); } }
public static IEnumerable <Thing> TryMakeForStock(ThingDef thingDef, int count) { if (thingDef.MadeFromStuff) { for (int i = 0; i < count; i++) { Thing th = StockGeneratorUtility.TryMakeForStockSingle(thingDef, 1); if (th != null) { yield return(th); } } } else { Thing th2 = StockGeneratorUtility.TryMakeForStockSingle(thingDef, count); if (th2 != null) { yield return(th2); } } }
protected virtual Thing MakeThing(ThingDef def) { return(StockGeneratorUtility.TryMakeForStockSingle(def, 1)); }