Пример #1
0
 public IEnumerable <ThingDef> PotentiallyMissingIngredients(Pawn billDoer, Map map)
 {
     for (int i = 0; i < this.ingredients.Count; i++)
     {
         IngredientCount ing       = this.ingredients[i];
         bool            foundIng  = false;
         List <Thing>    thingList = map.listerThings.ThingsInGroup(ThingRequestGroup.HaulableEver);
         for (int j = 0; j < thingList.Count; j++)
         {
             Thing thing = thingList[j];
             if ((billDoer == null || !thing.IsForbidden(billDoer)) && !thing.Position.Fogged(map) && (ing.IsFixedIngredient || this.fixedIngredientFilter.Allows(thing)) && ing.filter.Allows(thing))
             {
                 foundIng = true;
                 break;
             }
         }
         if (!foundIng)
         {
             if (ing.IsFixedIngredient)
             {
                 yield return(ing.filter.AllowedThingDefs.First <ThingDef>());
             }
             else
             {
                 ThingDef def = (from x in ing.filter.AllowedThingDefs
                                 orderby x.BaseMarketValue
                                 select x).FirstOrDefault((ThingDef x) => this.$this.fixedIngredientFilter.Allows(x));
                 if (def != null)
                 {
                     yield return(def);
                 }
             }
         }
     }
 }
 public override string BillRequirementsDescription(RecipeDef r, IngredientCount ing)
 {
     return("BillRequiresNutrition".Translate(new object[]
     {
         ing.GetBaseCount()
     }) + " (" + ing.filter.Summary + ")");
 }
Пример #3
0
        public IEnumerable <ThingDef> PotentiallyMissingIngredients(Pawn billDoer, Map map)
        {
            for (int i = 0; i < ingredients.Count; i++)
            {
                IngredientCount ingredientCount = ingredients[i];
                bool            flag            = false;
                List <Thing>    list            = map.listerThings.ThingsInGroup(ThingRequestGroup.HaulableEver);
                for (int j = 0; j < list.Count; j++)
                {
                    Thing thing = list[j];
                    if ((billDoer == null || !thing.IsForbidden(billDoer)) && !thing.Position.Fogged(map) && (ingredientCount.IsFixedIngredient || fixedIngredientFilter.Allows(thing)) && ingredientCount.filter.Allows(thing))
                    {
                        flag = true;
                        break;
                    }
                }
                if (flag)
                {
                    continue;
                }
                if (ingredientCount.IsFixedIngredient)
                {
                    yield return(ingredientCount.filter.AllowedThingDefs.First());

                    continue;
                }
                ThingDef thingDef = ingredientCount.filter.AllowedThingDefs.OrderBy((ThingDef x) => x.BaseMarketValue).FirstOrDefault((ThingDef x) => fixedIngredientFilter.Allows(x));
                if (thingDef != null)
                {
                    yield return(thingDef);
                }
            }
        }
 public override string BillRequirementsDescription(RecipeDef r, IngredientCount ing)
 {
     if (ing.filter.AllowedThingDefs.Any((ThingDef td) => td.smallVolume) && !ing.filter.AllowedThingDefs.Any((ThingDef td) => td.smallVolume && !r.GetPremultipliedSmallIngredients().Contains(td)))
     {
         return("BillRequires".Translate((float)(ing.GetBaseCount() * 10.0), ing.filter.Summary));
     }
     return("BillRequires".Translate(ing.GetBaseCount(), ing.filter.Summary));
 }
Пример #5
0
        public IEnumerable <ThingDef> PotentiallyMissingIngredients(Pawn billDoer, Map map)
        {
            int      i = 0;
            ThingDef def;

            while (true)
            {
                if (i < this.ingredients.Count)
                {
                    IngredientCount ing       = this.ingredients[i];
                    bool            foundIng  = false;
                    List <Thing>    thingList = map.listerThings.ThingsInGroup(ThingRequestGroup.HaulableEver);
                    for (int j = 0; j < thingList.Count; j++)
                    {
                        Thing thing = thingList[j];
                        if ((billDoer == null || !thing.IsForbidden(billDoer)) && !thing.Position.Fogged(map) && (ing.IsFixedIngredient || this.fixedIngredientFilter.Allows(thing)) && ing.filter.Allows(thing))
                        {
                            foundIng = true;
                            break;
                        }
                    }
                    if (!foundIng)
                    {
                        if (ing.IsFixedIngredient)
                        {
                            yield return(ing.filter.AllowedThingDefs.First());

                            /*Error: Unable to find new state assignment for yield return*/;
                        }
                        def = (from x in ing.filter.AllowedThingDefs
                               orderby x.BaseMarketValue
                               select x).FirstOrDefault((ThingDef x) => ((_003CPotentiallyMissingIngredients_003Ec__Iterator1) /*Error near IL_0190: stateMachine*/)._0024this.fixedIngredientFilter.Allows(x));
                        if (def != null)
                        {
                            break;
                        }
                    }
                    i++;
                    continue;
                }
                yield break;
            }
            yield return(def);

            /*Error: Unable to find new state assignment for yield return*/;
        }
Пример #6
0
        private static IEnumerable <Pair <ThingDef, float> > CheapestIngredients(RecipeDef d)
        {
            using (List <IngredientCount> .Enumerator enumerator = d.ingredients.GetEnumerator())
            {
                if (enumerator.MoveNext())
                {
                    IngredientCount ing   = enumerator.Current;
                    ThingDef        thing = (from td in ing.filter.AllowedThingDefs
                                             where td != ThingDefOf.Meat_Human
                                             select td).MinBy((ThingDef td) => td.BaseMarketValue / td.VolumePerUnit);
                    yield return(new Pair <ThingDef, float>(thing, ing.GetBaseCount() / d.IngredientValueGetter.ValuePerUnitOf(thing)));

                    /*Error: Unable to find new state assignment for yield return*/;
                }
            }
            yield break;
IL_0135:
            /*Error near IL_0136: Unexpected return in MoveNext()*/;
        }
Пример #7
0
        public override string BillRequirementsDescription(RecipeDef r, IngredientCount ing)
        {
            string result;

            if (!ing.filter.AllowedThingDefs.Any((ThingDef td) => td.smallVolume) || ing.filter.AllowedThingDefs.Any((ThingDef td) => td.smallVolume && !r.GetPremultipliedSmallIngredients().Contains(td)))
            {
                result = "BillRequires".Translate(new object[]
                {
                    ing.GetBaseCount(),
                    ing.filter.Summary
                });
            }
            else
            {
                result = "BillRequires".Translate(new object[]
                {
                    ing.GetBaseCount() * 10f,
                    ing.filter.Summary
                });
            }
            return(result);
        }
Пример #8
0
 public abstract string BillRequirementsDescription(RecipeDef r, IngredientCount ing);
Пример #9
0
 private static IEnumerable <ThingDef> < GetPremultipliedSmallIngredients > m__1(IngredientCount ingredient)
 {
     return(ingredient.filter.AllowedThingDefs);
 }