// Token: 0x06000018 RID: 24 RVA: 0x0000322C File Offset: 0x0000142C private static Thing PostProcessProduct(Thing product, RecipeDef recipeDef, Pawn worker) { string[] array = new string[6]; array[0] = "post processing: product "; int num = 1; Thing thing = product; array[num] = ((thing != null) ? thing.ToString() : null); array[2] = " recipeDef "; array[3] = ((recipeDef != null) ? recipeDef.ToString() : null); array[4] = " worker "; array[5] = ((worker != null) ? worker.ToString() : null); Log.Message(string.Concat(array), false); CompQuality compQuality = product.TryGetComp <CompQuality>(); bool flag = compQuality != null; if (flag) { bool flag2 = recipeDef.workSkill == null; if (flag2) { Log.Error(((recipeDef != null) ? recipeDef.ToString() : null) + " needs workSkill because it creates a product with a quality.", false); } int relevantSkillLevel = 1; QualityCategory q = QualityUtility.GenerateQualityCreatedByPawn(relevantSkillLevel, false); bool flag3 = worker.InspirationDef == InspirationDefOf.Inspired_Creativity && (product.def.IsArt || (product.def.minifiedDef != null && product.def.minifiedDef.IsArt)); if (flag3) { int relevantSkillLevel2 = 4; q = QualityUtility.GenerateQualityCreatedByPawn(relevantSkillLevel2, false); } compQuality.SetQuality(q, ArtGenerationContext.Colony); } CompArt compArt = product.TryGetComp <CompArt>(); bool flag4 = compArt != null; if (flag4) { compArt.JustCreatedBy(worker); } bool minifiable = product.def.Minifiable; if (minifiable) { product = product.MakeMinified(); } string[] array2 = new string[6]; array2[0] = "end post processing:product "; int num2 = 1; Thing thing2 = product; array2[num2] = ((thing2 != null) ? thing2.ToString() : null); array2[2] = " recipeDef "; array2[3] = ((recipeDef != null) ? recipeDef.ToString() : null); array2[4] = " worker "; array2[5] = ((worker != null) ? worker.ToString() : null); Log.Message(string.Concat(array2), false); return(product); }
public override string ToString() { return(string.Concat("(def=", defInt, ", amount= ", amountInt, ", instigator=", (instigatorInt != null) ? instigatorInt.ToString() : categoryInt.ToString(), ", angle=", angleInt.ToString("F1"), ")")); }
private string CurrentDebugString() { StringBuilder stringBuilder = new StringBuilder(); if (DebugViewSettings.writeGame) { stringBuilder.AppendLine("---"); stringBuilder.AppendLine((Current.Game != null) ? Current.Game.DebugString() : "Current.Game = null"); } if (DebugViewSettings.writeMusicManagerPlay) { stringBuilder.AppendLine("---"); stringBuilder.AppendLine(Find.MusicManagerPlay.DebugString()); } if (DebugViewSettings.writePlayingSounds) { stringBuilder.AppendLine("---"); stringBuilder.AppendLine("Sustainers:"); foreach (Sustainer sustainer in Find.SoundRoot.sustainerManager.AllSustainers) { stringBuilder.AppendLine(sustainer.DebugString()); } stringBuilder.AppendLine(); stringBuilder.AppendLine("OneShots:"); foreach (SampleOneShot sampleOneShot in Find.SoundRoot.oneShotManager.PlayingOneShots) { stringBuilder.AppendLine(sampleOneShot.ToString()); } } if (DebugViewSettings.writeSoundEventsRecord) { stringBuilder.AppendLine("---"); stringBuilder.AppendLine("Recent sound events:\n ..."); stringBuilder.AppendLine(DebugSoundEventsLog.EventsListingDebugString); } if (DebugViewSettings.writeSteamItems) { stringBuilder.AppendLine("---"); stringBuilder.AppendLine(WorkshopItems.DebugOutput()); } if (DebugViewSettings.writeConcepts) { stringBuilder.AppendLine("---"); stringBuilder.AppendLine(LessonAutoActivator.DebugString()); } if (DebugViewSettings.writeMemoryUsage) { stringBuilder.AppendLine("---"); stringBuilder.AppendLine("Total allocated: " + Profiler.GetTotalAllocatedMemoryLong().ToStringBytes("F2")); stringBuilder.AppendLine("Total reserved: " + Profiler.GetTotalReservedMemoryLong().ToStringBytes("F2")); stringBuilder.AppendLine("Total reserved unused: " + Profiler.GetTotalUnusedReservedMemoryLong().ToStringBytes("F2")); stringBuilder.AppendLine("Mono heap size: " + Profiler.GetMonoHeapSizeLong().ToStringBytes("F2")); stringBuilder.AppendLine("Mono used size: " + Profiler.GetMonoUsedSizeLong().ToStringBytes("F2")); } if (Current.ProgramState == ProgramState.Playing) { stringBuilder.AppendLine("Tick " + Find.TickManager.TicksGame); if (DebugViewSettings.writeStoryteller) { stringBuilder.AppendLine("---"); stringBuilder.AppendLine(Find.Storyteller.DebugString()); } } if (Current.ProgramState == ProgramState.Playing && Find.CurrentMap != null) { if (DebugViewSettings.writeMapGameConditions) { stringBuilder.AppendLine("---"); stringBuilder.AppendLine(Find.CurrentMap.gameConditionManager.DebugString()); } if (DebugViewSettings.drawPawnDebug) { stringBuilder.AppendLine("---"); stringBuilder.AppendLine(Find.CurrentMap.reservationManager.DebugString()); } if (DebugViewSettings.writeMoteSaturation) { stringBuilder.AppendLine("---"); stringBuilder.AppendLine("Mote count: " + Find.CurrentMap.moteCounter.MoteCount); stringBuilder.AppendLine("Mote saturation: " + Find.CurrentMap.moteCounter.Saturation); } if (DebugViewSettings.writeEcosystem) { stringBuilder.AppendLine("---"); stringBuilder.AppendLine(Find.CurrentMap.wildAnimalSpawner.DebugString()); } if (DebugViewSettings.writeTotalSnowDepth) { stringBuilder.AppendLine("---"); stringBuilder.AppendLine("Total snow depth: " + Find.CurrentMap.snowGrid.TotalDepth); } if (DebugViewSettings.writeWind) { stringBuilder.AppendLine("---"); stringBuilder.AppendLine(Find.CurrentMap.windManager.DebugString()); } if (DebugViewSettings.writeRecentStrikes) { stringBuilder.AppendLine("---"); stringBuilder.AppendLine(Find.CurrentMap.mineStrikeManager.DebugStrikeRecords()); } if (DebugViewSettings.writeListRepairableBldgs) { stringBuilder.AppendLine("---"); stringBuilder.AppendLine(Find.CurrentMap.listerBuildingsRepairable.DebugString()); } if (DebugViewSettings.writeListFilthInHomeArea) { stringBuilder.AppendLine("---"); stringBuilder.AppendLine(Find.CurrentMap.listerFilthInHomeArea.DebugString()); } if (DebugViewSettings.writeListHaulables) { stringBuilder.AppendLine("---"); stringBuilder.AppendLine(Find.CurrentMap.listerHaulables.DebugString()); } if (DebugViewSettings.writeListMergeables) { stringBuilder.AppendLine("---"); stringBuilder.AppendLine(Find.CurrentMap.listerMergeables.DebugString()); } if (DebugViewSettings.drawLords) { foreach (Lord lord in Find.CurrentMap.lordManager.lords) { stringBuilder.AppendLine("---"); stringBuilder.AppendLine(lord.DebugString()); } } IntVec3 intVec = UI.MouseCell(); if (intVec.InBounds(Find.CurrentMap)) { stringBuilder.AppendLine("Inspecting " + intVec.ToString()); if (DebugViewSettings.writeTerrain) { stringBuilder.AppendLine("---"); stringBuilder.AppendLine(Find.CurrentMap.terrainGrid.DebugStringAt(intVec)); } if (DebugViewSettings.writeAttackTargets) { foreach (Pawn pawn in Find.CurrentMap.thingGrid.ThingsAt(UI.MouseCell()).OfType <Pawn>()) { stringBuilder.AppendLine("---"); stringBuilder.AppendLine("Potential attack targets for " + pawn.LabelShort + ":"); List <IAttackTarget> potentialTargetsFor = Find.CurrentMap.attackTargetsCache.GetPotentialTargetsFor(pawn); for (int i = 0; i < potentialTargetsFor.Count; i++) { Thing thing = (Thing)potentialTargetsFor[i]; stringBuilder.AppendLine(string.Concat(new object[] { thing.LabelShort, ", ", thing.Faction, (!potentialTargetsFor[i].ThreatDisabled(null)) ? "" : " (threat disabled)" })); } } } if (DebugViewSettings.writeSnowDepth) { stringBuilder.AppendLine("---"); stringBuilder.AppendLine("Snow depth: " + Find.CurrentMap.snowGrid.GetDepth(intVec)); } if (DebugViewSettings.drawDeepResources) { stringBuilder.AppendLine("---"); stringBuilder.AppendLine("Deep resource def: " + Find.CurrentMap.deepResourceGrid.ThingDefAt(intVec)); stringBuilder.AppendLine("Deep resource count: " + Find.CurrentMap.deepResourceGrid.CountAt(intVec)); } if (DebugViewSettings.writeCanReachColony) { stringBuilder.AppendLine("---"); stringBuilder.AppendLine("CanReachColony: " + Find.CurrentMap.reachability.CanReachColony(UI.MouseCell())); } if (DebugViewSettings.writeMentalStateCalcs) { stringBuilder.AppendLine("---"); foreach (Pawn pawn2 in (from t in Find.CurrentMap.thingGrid.ThingsAt(UI.MouseCell()) where t is Pawn select t).Cast <Pawn>()) { stringBuilder.AppendLine(pawn2.mindState.mentalBreaker.DebugString()); } } if (DebugViewSettings.writeWorkSettings) { foreach (Pawn pawn3 in (from t in Find.CurrentMap.thingGrid.ThingsAt(UI.MouseCell()) where t is Pawn select t).Cast <Pawn>()) { if (pawn3.workSettings != null) { stringBuilder.AppendLine("---"); stringBuilder.AppendLine(pawn3.workSettings.DebugString()); } } } if (DebugViewSettings.writeApparelScore) { stringBuilder.AppendLine("---"); if (intVec.InBounds(Find.CurrentMap)) { foreach (Thing thing2 in intVec.GetThingList(Find.CurrentMap)) { Apparel apparel = thing2 as Apparel; if (apparel != null) { stringBuilder.AppendLine(apparel.Label + ": " + JobGiver_OptimizeApparel.ApparelScoreRaw(null, apparel).ToString("F2")); } } } } if (DebugViewSettings.writeCellContents || this.fullMode) { stringBuilder.AppendLine("---"); if (intVec.InBounds(Find.CurrentMap)) { foreach (Designation designation in Find.CurrentMap.designationManager.AllDesignationsAt(intVec)) { stringBuilder.AppendLine(designation.ToString()); } foreach (Thing thing3 in Find.CurrentMap.thingGrid.ThingsAt(intVec)) { if (!this.fullMode) { stringBuilder.AppendLine(thing3.LabelCap + " - " + thing3.ToString()); } else { stringBuilder.AppendLine(Scribe.saver.DebugOutputFor(thing3)); stringBuilder.AppendLine(); } } } } if (DebugViewSettings.debugApparelOptimize) { stringBuilder.AppendLine("---"); foreach (Thing thing4 in Find.CurrentMap.thingGrid.ThingsAt(intVec)) { Apparel apparel2 = thing4 as Apparel; if (apparel2 != null) { stringBuilder.AppendLine(apparel2.LabelCap); stringBuilder.AppendLine(" raw: " + JobGiver_OptimizeApparel.ApparelScoreRaw(null, apparel2).ToString("F2")); Pawn pawn4 = Find.Selector.SingleSelectedThing as Pawn; if (pawn4 != null) { stringBuilder.AppendLine(" Pawn: " + pawn4); stringBuilder.AppendLine(" gain: " + JobGiver_OptimizeApparel.ApparelScoreGain(pawn4, apparel2).ToString("F2")); } } } } if (DebugViewSettings.drawRegions) { stringBuilder.AppendLine("---"); Region regionAt_NoRebuild_InvalidAllowed = Find.CurrentMap.regionGrid.GetRegionAt_NoRebuild_InvalidAllowed(intVec); stringBuilder.AppendLine("Region:\n" + ((regionAt_NoRebuild_InvalidAllowed == null) ? "null" : regionAt_NoRebuild_InvalidAllowed.DebugString)); } if (DebugViewSettings.drawRooms) { stringBuilder.AppendLine("---"); Room room = intVec.GetRoom(Find.CurrentMap, RegionType.Set_All); if (room != null) { stringBuilder.AppendLine(room.DebugString()); } else { stringBuilder.AppendLine("(no room)"); } } if (DebugViewSettings.drawRoomGroups) { stringBuilder.AppendLine("---"); RoomGroup roomGroup = intVec.GetRoomGroup(Find.CurrentMap); if (roomGroup != null) { stringBuilder.AppendLine(roomGroup.DebugString()); } else { stringBuilder.AppendLine("(no room group)"); } } if (DebugViewSettings.drawGlow) { stringBuilder.AppendLine("---"); stringBuilder.AppendLine("Game glow: " + Find.CurrentMap.glowGrid.GameGlowAt(intVec, false)); stringBuilder.AppendLine("Psych glow: " + Find.CurrentMap.glowGrid.PsychGlowAt(intVec)); stringBuilder.AppendLine("Visual Glow: " + Find.CurrentMap.glowGrid.VisualGlowAt(intVec)); stringBuilder.AppendLine("GlowReport:\n" + ((SectionLayer_LightingOverlay)Find.CurrentMap.mapDrawer.SectionAt(intVec).GetLayer(typeof(SectionLayer_LightingOverlay))).GlowReportAt(intVec)); stringBuilder.AppendLine("SkyManager.CurSkyGlow: " + Find.CurrentMap.skyManager.CurSkyGlow); } if (DebugViewSettings.writePathCosts) { stringBuilder.AppendLine("---"); stringBuilder.AppendLine("Perceived path cost: " + Find.CurrentMap.pathGrid.PerceivedPathCostAt(intVec)); stringBuilder.AppendLine("Real path cost: " + Find.CurrentMap.pathGrid.CalculatedCostAt(intVec, false, IntVec3.Invalid)); } if (DebugViewSettings.writeFertility) { stringBuilder.AppendLine("---"); stringBuilder.AppendLine("\nFertility: " + Find.CurrentMap.fertilityGrid.FertilityAt(intVec).ToString("##0.00")); } if (DebugViewSettings.writeLinkFlags) { stringBuilder.AppendLine("---"); stringBuilder.AppendLine("\nLinkFlags: "); IEnumerator enumerator11 = Enum.GetValues(typeof(LinkFlags)).GetEnumerator(); try { while (enumerator11.MoveNext()) { object obj = enumerator11.Current; if ((Find.CurrentMap.linkGrid.LinkFlagsAt(intVec) & (LinkFlags)obj) != LinkFlags.None) { stringBuilder.Append(" " + obj); } } } finally { IDisposable disposable; if ((disposable = (enumerator11 as IDisposable)) != null) { disposable.Dispose(); } } } if (DebugViewSettings.writeSkyManager) { stringBuilder.AppendLine("---"); stringBuilder.AppendLine(Find.CurrentMap.skyManager.DebugString()); } if (DebugViewSettings.writeCover) { stringBuilder.AppendLine("---"); stringBuilder.Append("Cover: "); Thing thing5 = Find.CurrentMap.coverGrid[intVec]; if (thing5 == null) { stringBuilder.AppendLine("null"); } else { stringBuilder.AppendLine(thing5.ToString()); } } if (DebugViewSettings.drawPower) { stringBuilder.AppendLine("---"); foreach (Thing thing6 in Find.CurrentMap.thingGrid.ThingsAt(intVec)) { ThingWithComps thingWithComps = thing6 as ThingWithComps; if (thingWithComps != null && thingWithComps.GetComp <CompPowerTrader>() != null) { stringBuilder.AppendLine(" " + thingWithComps.GetComp <CompPowerTrader>().DebugString); } } PowerNet powerNet = Find.CurrentMap.powerNetGrid.TransmittedPowerNetAt(intVec); if (powerNet != null) { stringBuilder.AppendLine("" + powerNet.DebugString()); } else { stringBuilder.AppendLine("(no PowerNet here)"); } } if (DebugViewSettings.drawPreyInfo) { Pawn pawn5 = Find.Selector.SingleSelectedThing as Pawn; if (pawn5 != null) { List <Thing> thingList = intVec.GetThingList(Find.CurrentMap); for (int j = 0; j < thingList.Count; j++) { Pawn pawn6 = thingList[j] as Pawn; if (pawn6 != null) { stringBuilder.AppendLine("---"); if (FoodUtility.IsAcceptablePreyFor(pawn5, pawn6)) { stringBuilder.AppendLine("Prey score: " + FoodUtility.GetPreyScoreFor(pawn5, pawn6)); } else { stringBuilder.AppendLine("Prey score: None"); } break; } } } } } } return(stringBuilder.ToString()); }
public override string ToString() { return("(def=" + defInt + ", amount= " + amountInt + ", instigator=" + ((instigatorInt != null) ? instigatorInt.ToString() : categoryInt.ToString()) + ", angle=" + angleInt.ToString("F1") + ")"); }
// 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; }