// For EF (see also https://github.com/dotnet/efcore/issues/12078) #pragma warning disable 8618 private Product(Guid id, ProductName name, ProductCategory category, SpecialProductType productType) { Id = id; Name = name; Category = category; ProductType = productType; }
protected decimal GetTradeRate(SpecialProductType productType, Data.DataMapping.CompanyParameter parameter) { switch (productType) { case SpecialProductType.Singleness: return(parameter.SinglenessRate); case SpecialProductType.Disperse: return(parameter.DisperseRate); case SpecialProductType.CostFree: return(parameter.CostFreeRate); case SpecialProductType.Bloc: return(parameter.BlocRate); case SpecialProductType.Business: return(parameter.BusinessRate); case SpecialProductType.OtherSpecial: return(parameter.OtherSpecialRate); case SpecialProductType.LowToHigh: return(parameter.LowToHighRate); default: throw new ArgumentOutOfRangeException(); } }
public static IEnumerable <Thing> MakeRecipeProductsInt(RecipeDef recipeDef, IRecipeProductWorker worker, List <Thing> ingredients, Thing dominantIngredient, IBillGiver billGiver) { float efficiency; if (recipeDef.efficiencyStat == null) { efficiency = 1f; } else { efficiency = worker.GetStatValue(recipeDef.efficiencyStat, true); } if (recipeDef.workTableEfficiencyStat != null) { Building_WorkTable building_WorkTable = billGiver as Building_WorkTable; if (building_WorkTable != null) { efficiency *= building_WorkTable.GetStatValue(recipeDef.workTableEfficiencyStat, true); } } if (recipeDef.products != null) { for (int i = 0; i < recipeDef.products.Count; i++) { ThingDefCountClass prod = recipeDef.products[i]; ThingDef stuffDef; if (prod.thingDef.MadeFromStuff) { stuffDef = dominantIngredient.def; } else { stuffDef = null; } Thing product = ThingMaker.MakeThing(prod.thingDef, stuffDef); product.stackCount = Mathf.CeilToInt((float)prod.count * efficiency); if (dominantIngredient != null) { product.SetColor(dominantIngredient.DrawColor, false); } CompIngredients ingredientsComp = product.TryGetComp <CompIngredients>(); if (ingredientsComp != null) { for (int l = 0; l < ingredients.Count; l++) { ingredientsComp.RegisterIngredient(ingredients[l].def); } } CompFoodPoisonable foodPoisonable = product.TryGetComp <CompFoodPoisonable>(); if (foodPoisonable != null) { Room room = worker.GetRoom(RegionType.Set_Passable); float chance = (room == null) ? RoomStatDefOf.FoodPoisonChance.roomlessScore : room.GetStat(RoomStatDefOf.FoodPoisonChance); if (Rand.Chance(chance)) { foodPoisonable.SetPoisoned(FoodPoisonCause.FilthyKitchen); } else { float statValue = worker.GetStatValue(StatDefOf.FoodPoisonChance, true); if (Rand.Chance(statValue)) { foodPoisonable.SetPoisoned(FoodPoisonCause.IncompetentCook); } } } yield return(GenRecipe2.PostProcessProduct(product, recipeDef, worker)); } } if (recipeDef.specialProducts != null) { for (int j = 0; j < recipeDef.specialProducts.Count; j++) { for (int k = 0; k < ingredients.Count; k++) { Thing ing = ingredients[k]; SpecialProductType specialProductType = recipeDef.specialProducts[j]; if (specialProductType != SpecialProductType.Butchery) { if (specialProductType == SpecialProductType.Smelted) { foreach (Thing product2 in ing.SmeltProducts(efficiency)) { yield return(GenRecipe2.PostProcessProduct(product2, recipeDef, worker)); } } } else { foreach (Thing product3 in ButcherProducts(ing, efficiency, worker)) { yield return(GenRecipe2.PostProcessProduct(product3, recipeDef, worker)); } } } } } }
public static SpecialProductView Query(SpecialProductType specialProductType) { return(SpecialProducts.Instance[specialProductType]); }
public static IEnumerable <Thing> MakeRecipeProducts(RecipeDef recipeDef, Pawn worker, List <Thing> ingredients, Thing dominantIngredient) { float efficiency; if (recipeDef.efficiencyStat == null) { efficiency = 1f; } else { efficiency = worker.GetStatValue(recipeDef.efficiencyStat, true); } if (recipeDef.products != null) { for (int i = 0; i < recipeDef.products.Count; i++) { ThingCountClass prod = recipeDef.products[i]; ThingDef stuffDef; if (prod.thingDef.MadeFromStuff) { stuffDef = dominantIngredient.def; } else { stuffDef = null; } Thing product = ThingMaker.MakeThing(prod.thingDef, stuffDef); product.stackCount = Mathf.CeilToInt((float)prod.count * efficiency); if (dominantIngredient != null) { product.SetColor(dominantIngredient.DrawColor, false); } CompIngredients ingredientsComp = product.TryGetComp <CompIngredients>(); if (ingredientsComp != null) { for (int l = 0; l < ingredients.Count; l++) { ingredientsComp.RegisterIngredient(ingredients[l].def); } } CompFoodPoisonable foodPoisonable = product.TryGetComp <CompFoodPoisonable>(); if (foodPoisonable != null) { float num = worker.GetStatValue(StatDefOf.FoodPoisonChance, true); Room room = worker.GetRoom(RegionType.Set_Passable); if (room != null) { num *= room.GetStat(RoomStatDefOf.FoodPoisonChanceFactor); } if (Rand.Value < num) { foodPoisonable.PoisonPercent = 1f; } } yield return(GenRecipe.PostProcessProduct(product, recipeDef, worker)); } } if (recipeDef.specialProducts != null) { for (int j = 0; j < recipeDef.specialProducts.Count; j++) { for (int k = 0; k < ingredients.Count; k++) { Thing ing = ingredients[k]; SpecialProductType specialProductType = recipeDef.specialProducts[j]; if (specialProductType != SpecialProductType.Butchery) { if (specialProductType == SpecialProductType.Smelted) { foreach (Thing product2 in ing.SmeltProducts(efficiency)) { yield return(GenRecipe.PostProcessProduct(product2, recipeDef, worker)); } } } else { foreach (Thing product3 in ing.ButcherProducts(worker, efficiency)) { yield return(GenRecipe.PostProcessProduct(product3, recipeDef, worker)); } } } } } }
#pragma warning restore 8618 public Product(Guid id, ProductName name, ProductCategory category, SpecialProductType productType, Boundary boundary) : this(id, name, category, productType) { Boundary = boundary; }
public IActionResult RoundTrip(SpecialProductType specialProductType) { return(RoundTrip <SpecialProductType, string>(specialProductType)); }
public SpecialProductView this[SpecialProductType paramType] { get { return(_repositoryCache[paramType]); } }
public SpecialProductView(SpecialProductType id) { this.SpecialProductType = id; }
// Token: 0x06000017 RID: 23 RVA: 0x00003205 File Offset: 0x00001405 public static IEnumerable <Thing> MakeRecipeProducts(RecipeDef recipeDef, Pawn worker, List <Thing> ingredients, Thing dominantIngredient) { Log.Message(string.Concat(new string[] { "init WPGenRecipe: recipeDef ", (recipeDef != null) ? recipeDef.ToString() : null, " worker ", (worker != null) ? worker.ToString() : null, " ingredients ", (ingredients != null) ? ingredients.ToString() : null, " dominantIngredient ", (dominantIngredient != null) ? dominantIngredient.ToString() : null }), false); bool flag = recipeDef.efficiencyStat == null; float efficiency; if (flag) { efficiency = 1f; } else { efficiency = worker.GetStatValue(recipeDef.efficiencyStat, true); } bool flag2 = recipeDef.products != null; if (flag2) { int num2; for (int i = 0; i < recipeDef.products.Count; i = num2 + 1) { ThingDefCountClass prod = recipeDef.products[i]; bool madeFromStuff = prod.thingDef.MadeFromStuff; ThingDef stuffDef; if (madeFromStuff) { stuffDef = dominantIngredient.def; } else { stuffDef = null; } Thing product = ThingMaker.MakeThing(prod.thingDef, stuffDef); product.stackCount = Mathf.CeilToInt((float)prod.count * efficiency); bool flag3 = dominantIngredient != null; if (flag3) { product.SetColor(dominantIngredient.DrawColor, false); } CompIngredients ingredientsComp = product.TryGetComp <CompIngredients>(); bool flag4 = ingredientsComp != null; if (flag4) { for (int j = 0; j < ingredients.Count; j = num2 + 1) { ingredientsComp.RegisterIngredient(ingredients[j].def); num2 = j; } } CompFoodPoisonable foodPoisonable = product.TryGetComp <CompFoodPoisonable>(); bool flag5 = foodPoisonable != null; if (flag5) { float num = worker.GetStatValue(StatDefOf.FoodPoisonChance, true); Room room = worker.GetRoom(RegionType.Set_Passable); float chance = (room == null) ? RoomStatDefOf.FoodPoisonChance.roomlessScore : room.GetStat(RoomStatDefOf.FoodPoisonChance); bool flag6 = Rand.Chance(chance); if (flag6) { foodPoisonable.SetPoisoned(FoodPoisonCause.FilthyKitchen); } else { float statValue = worker.GetStatValue(StatDefOf.FoodPoisonChance, true); bool flag7 = Rand.Chance(statValue); if (flag7) { foodPoisonable.SetPoisoned(FoodPoisonCause.IncompetentCook); } } room = null; } yield return(WPGenRecipe.PostProcessProduct(product, recipeDef, worker)); prod = null; stuffDef = null; product = null; ingredientsComp = null; foodPoisonable = null; num2 = i; } } bool flag8 = recipeDef.specialProducts != null; if (flag8) { string str = "special recipedef not null"; List <SpecialProductType> specialProducts = recipeDef.specialProducts; Log.Message(str + ((specialProducts != null) ? specialProducts.ToString() : null), false); Log.Message("recipeDef.specialProducts.Count " + recipeDef.specialProducts.Count.ToString(), false); int num2; for (int k = 0; k < recipeDef.specialProducts.Count; k = num2 + 1) { Log.Message("recipeDef.specialProducts[j] " + recipeDef.specialProducts[k].ToString(), false); Log.Message("ingredients.Count " + ingredients.Count.ToString(), false); string str2 = "recipeDef.ingredients "; List <IngredientCount> ingredients2 = recipeDef.ingredients; Log.Message(str2 + ((ingredients2 != null) ? ingredients2.ToString() : null), false); for (int l = 0; l < ingredients.Count; l = num2 + 1) { Thing ing = ingredients[l]; string str3 = "ingredients[k] "; Thing thing = ingredients[l]; Log.Message(str3 + ((thing != null) ? thing.ToString() : null), false); string str4 = "ing "; Thing thing2 = ing; Log.Message(str4 + ((thing2 != null) ? thing2.ToString() : null), false); SpecialProductType specialProductType = recipeDef.specialProducts[k]; bool flag9 = specialProductType > SpecialProductType.Butchery; if (flag9) { Log.Message("not butchery", false); bool flag10 = specialProductType == SpecialProductType.Smelted; if (flag10) { foreach (Thing product2 in ing.SmeltProducts(efficiency)) { yield return(WPGenRecipe.PostProcessProduct(product2, recipeDef, worker)); } } } else { Log.Message("butchery", false); foreach (Thing product3 in ing.ButcherProducts(worker, efficiency)) { string[] array = new string[8]; array[0] = "recipeDef.specialProducts[k] "; array[1] = recipeDef.specialProducts[l].ToString(); array[2] = "product3 "; int num3 = 3; Thing thing3 = product3; array[num3] = ((thing3 != null) ? thing3.ToString() : null); array[4] = " recipeDef "; array[5] = ((recipeDef != null) ? recipeDef.ToString() : null); array[6] = " worker "; array[7] = ((worker != null) ? worker.ToString() : null); Log.Message(string.Concat(array), false); yield return(WPGenRecipe.PostProcessProduct(product3, recipeDef, worker)); } } ing = null; num2 = l; } num2 = k; } } Log.Message("yield break", false); yield break; }
/// <summary> /// 特殊政策发布和修改获取舱位查询 /// </summary> /// <returns></returns> public object QuerySpecialBunksPolicy(string airline, DateTime startTime, DateTime endTime, DateTime startETDZDate, SpecialProductType specialProductType) { var bunkslist = FoundationService.Bunks; var result = new List <string>(); if (specialProductType == SpecialProductType.CostFree) { var list = (from item in bunkslist where item.Valid && item.AirlineCode.Value == airline && item is FreeBunk && item.FlightBeginDate.Date <= startTime.Date && (!item.FlightEndDate.HasValue || item.FlightEndDate.Value.Date >= endTime.Date) && item.ETDZDate.Date <= startETDZDate.Date && ((item.VoyageType & VoyageTypeValue.OneWay) == VoyageTypeValue.OneWay) && ((item.TravelType & TravelTypeValue.Individual) == TravelTypeValue.Individual) && ((item.PassengerType & PassengerTypeValue.Adult) == PassengerTypeValue.Adult) select item); foreach (var item in list) { if (!result.Contains(item.Code.Value)) { result.Add(item.Code.Value); } } return(result); } if (specialProductType == SpecialProductType.Bloc) { var query = bunkslist; var list = (from item in query where item.Valid && item.AirlineCode.Value == airline && item.FlightBeginDate.Date <= startTime.Date && (!item.FlightEndDate.HasValue || item.FlightEndDate.Value.Date >= endTime.Date) && item.ETDZDate.Date <= startETDZDate.Date && item is GeneralBunk && ((item.VoyageType & VoyageTypeValue.OneWay) == VoyageTypeValue.OneWay) && ((item.TravelType & TravelTypeValue.Individual) == TravelTypeValue.Individual) && ((item.PassengerType & PassengerTypeValue.Adult) == PassengerTypeValue.Adult) select item); foreach (var item in list) { if (!result.Contains(item.Code.Value)) { result.Add(item.Code.Value); } } list = (from item in query where item.Valid && item.AirlineCode.Value == airline && item.FlightBeginDate.Date <= startTime.Date && (!item.FlightEndDate.HasValue || item.FlightEndDate.Value.Date >= endTime.Date) && item.ETDZDate.Date <= startETDZDate.Date && item is PromotionBunk && ((item.VoyageType & VoyageTypeValue.OneWay) == VoyageTypeValue.OneWay) && ((item.TravelType & TravelTypeValue.Individual) == TravelTypeValue.Individual) && ((item.PassengerType & PassengerTypeValue.Adult) == PassengerTypeValue.Adult) select item); foreach (var item in list) { if (!result.Contains(item.Code.Value)) { result.Add(item.Code.Value); } } return(result); } return(result); }