示例#1
0
 public string DebugString()
 {
     if (Time.frameCount % 60 == 0)
     {
         StringBuilder stringBuilder = new StringBuilder();
         stringBuilder.AppendLine("GLOBAL STORYTELLER STATS");
         stringBuilder.AppendLine("------------------------");
         stringBuilder.AppendLine("Storyteller: ".PadRight(40) + def.label);
         stringBuilder.AppendLine("Adaptation days: ".PadRight(40) + Find.StoryWatcher.watcherAdaptation.AdaptDays.ToString("F1"));
         stringBuilder.AppendLine("Adapt points factor: ".PadRight(40) + Find.StoryWatcher.watcherAdaptation.TotalThreatPointsFactor.ToString("F2"));
         stringBuilder.AppendLine("Time points factor: ".PadRight(40) + Find.Storyteller.def.pointsFactorFromDaysPassed.Evaluate(GenDate.DaysPassed).ToString("F2"));
         stringBuilder.AppendLine();
         stringBuilder.AppendLine("Ally incident fraction (neutral or ally): ".PadRight(40) + StorytellerUtility.AllyIncidentFraction(fullAlliesOnly: false).ToString("F2"));
         stringBuilder.AppendLine("Ally incident fraction (ally only): ".PadRight(40) + StorytellerUtility.AllyIncidentFraction(fullAlliesOnly: true).ToString("F2"));
         stringBuilder.AppendLine();
         stringBuilder.AppendLine(StorytellerUtilityPopulation.DebugReadout().TrimEndNewlines());
         IIncidentTarget incidentTarget = Find.WorldSelector.SingleSelectedObject as IIncidentTarget;
         if (incidentTarget == null)
         {
             incidentTarget = Find.CurrentMap;
         }
         if (incidentTarget != null)
         {
             Map map = incidentTarget as Map;
             stringBuilder.AppendLine();
             stringBuilder.AppendLine("STATS FOR INCIDENT TARGET: " + incidentTarget);
             stringBuilder.AppendLine("------------------------");
             stringBuilder.AppendLine("Progress score: ".PadRight(40) + StorytellerUtility.GetProgressScore(incidentTarget).ToString("F2"));
             stringBuilder.AppendLine("Base points: ".PadRight(40) + StorytellerUtility.DefaultThreatPointsNow(incidentTarget).ToString("F0"));
             stringBuilder.AppendLine("Points factor random range: ".PadRight(40) + incidentTarget.IncidentPointsRandomFactorRange);
             stringBuilder.AppendLine("Wealth: ".PadRight(40) + incidentTarget.PlayerWealthForStoryteller.ToString("F0"));
             if (map != null)
             {
                 stringBuilder.AppendLine("- Items: ".PadRight(40) + map.wealthWatcher.WealthItems.ToString("F0"));
                 stringBuilder.AppendLine("- Buildings: ".PadRight(40) + map.wealthWatcher.WealthBuildings.ToString("F0"));
                 stringBuilder.AppendLine("- Floors: ".PadRight(40) + map.wealthWatcher.WealthFloorsOnly.ToString("F0"));
                 stringBuilder.AppendLine("- Pawns: ".PadRight(40) + map.wealthWatcher.WealthPawns.ToString("F0"));
             }
             stringBuilder.AppendLine("Pawn count human: ".PadRight(40) + incidentTarget.PlayerPawnsForStoryteller.Where((Pawn p) => p.def.race.Humanlike).Count());
             stringBuilder.AppendLine("Pawn count animal: ".PadRight(40) + incidentTarget.PlayerPawnsForStoryteller.Where((Pawn p) => p.def.race.Animal).Count());
             if (map != null)
             {
                 stringBuilder.AppendLine("StoryDanger: ".PadRight(40) + map.dangerWatcher.DangerRating);
                 stringBuilder.AppendLine("FireDanger: ".PadRight(40) + map.fireWatcher.FireDanger.ToString("F2"));
                 stringBuilder.AppendLine("LastThreatBigTick days ago: ".PadRight(40) + (Find.TickManager.TicksGame - map.storyState.LastThreatBigTick).ToStringTicksToDays());
             }
         }
         stringBuilder.AppendLine();
         stringBuilder.AppendLine("LIST OF ALL INCIDENT TARGETS");
         stringBuilder.AppendLine("------------------------");
         for (int i = 0; i < AllIncidentTargets.Count; i++)
         {
             stringBuilder.AppendLine(i + ". " + AllIncidentTargets[i].ToString());
         }
         debugStringCached = stringBuilder.ToString();
     }
     return(debugStringCached);
 }
示例#2
0
 public string DebugString()
 {
     if (Time.frameCount % 60 == 0)
     {
         StringBuilder stringBuilder = new StringBuilder();
         stringBuilder.AppendLine("Storyteller : " + this.def.label);
         stringBuilder.AppendLine("------------- Global threats data ---------------");
         stringBuilder.AppendLine("   Adaptation days: " + Find.StoryWatcher.watcherAdaptation.AdaptDays.ToString("F1"));
         stringBuilder.AppendLine("   Adapt points factor: " + Find.StoryWatcher.watcherAdaptation.TotalThreatPointsFactor.ToString("F2"));
         stringBuilder.AppendLine("   Time points factor: " + Find.Storyteller.def.pointsFactorFromDaysPassed.Evaluate((float)GenDate.DaysPassed).ToString("F2"));
         stringBuilder.AppendLine("   Num raids enemy: " + Find.StoryWatcher.statsRecord.numRaidsEnemy);
         stringBuilder.AppendLine("   Ally incident fraction (neutral or ally): " + StorytellerUtility.AllyIncidentFraction(false).ToString("F2"));
         stringBuilder.AppendLine("   Ally incident fraction (ally only): " + StorytellerUtility.AllyIncidentFraction(true).ToString("F2"));
         stringBuilder.AppendLine();
         stringBuilder.AppendLine("-------------- Global population data --------------");
         stringBuilder.AppendLine(StorytellerUtilityPopulation.DebugReadout().TrimEndNewlines());
         stringBuilder.AppendLine("   Greatest population: " + Find.StoryWatcher.statsRecord.greatestPopulation);
         stringBuilder.AppendLine("------------- All incident targets --------------");
         for (int i = 0; i < this.AllIncidentTargets.Count; i++)
         {
             stringBuilder.AppendLine("   " + this.AllIncidentTargets[i].ToString());
         }
         IIncidentTarget incidentTarget = Find.WorldSelector.SingleSelectedObject as IIncidentTarget;
         if (incidentTarget == null)
         {
             incidentTarget = Find.CurrentMap;
         }
         if (incidentTarget != null)
         {
             Map map = incidentTarget as Map;
             stringBuilder.AppendLine();
             stringBuilder.AppendLine("---------- Selected: " + incidentTarget + " --------");
             stringBuilder.AppendLine("   Wealth: " + incidentTarget.PlayerWealthForStoryteller.ToString("F0"));
             if (map != null)
             {
                 stringBuilder.AppendLine(string.Concat(new string[]
                 {
                     "   (Items: ",
                     map.wealthWatcher.WealthItems.ToString("F0"),
                     " Buildings: ",
                     map.wealthWatcher.WealthBuildings.ToString("F0"),
                     " (Floors: ",
                     map.wealthWatcher.WealthFloorsOnly.ToString("F0"),
                     ") Pawns: ",
                     map.wealthWatcher.WealthPawns.ToString("F0"),
                     ")"
                 }));
             }
             stringBuilder.AppendLine("   IncidentPointsRandomFactorRange: " + incidentTarget.IncidentPointsRandomFactorRange);
             stringBuilder.AppendLine("   Pawns-Humanlikes: " + (from p in incidentTarget.PlayerPawnsForStoryteller
                                                                 where p.def.race.Humanlike
                                                                 select p).Count <Pawn>());
             stringBuilder.AppendLine("   Pawns-Animals: " + (from p in incidentTarget.PlayerPawnsForStoryteller
                                                              where p.def.race.Animal
                                                              select p).Count <Pawn>());
             if (map != null)
             {
                 stringBuilder.AppendLine("   StoryDanger: " + map.dangerWatcher.DangerRating);
                 stringBuilder.AppendLine("   FireDanger: " + map.fireWatcher.FireDanger.ToString("F2"));
                 stringBuilder.AppendLine("   LastThreatBigTick days ago: " + (Find.TickManager.TicksGame - map.storyState.LastThreatBigTick).ToStringTicksToDays("F1"));
             }
             stringBuilder.AppendLine("   Current points (ignoring early raid factors): " + StorytellerUtility.DefaultThreatPointsNow(incidentTarget).ToString("F0"));
             stringBuilder.AppendLine("   Current points for specific IncidentMakers:");
             for (int j = 0; j < this.storytellerComps.Count; j++)
             {
                 IncidentParms incidentParms = this.storytellerComps[j].GenerateParms(IncidentCategoryDefOf.ThreatBig, incidentTarget);
                 stringBuilder.AppendLine("      " + this.storytellerComps[j].GetType().ToString().Substring(23) + ": " + incidentParms.points.ToString("F0"));
             }
         }
         this.debugStringCached = stringBuilder.ToString();
     }
     return(this.debugStringCached);
 }
示例#3
0
        public static void PopulationIntents()
        {
            List <float> list = new List <float>();

            for (int i = 0; i < 30; i++)
            {
                list.Add((float)i);
            }
            List <float> list2 = new List <float>();

            for (int j = 0; j < 40; j += 2)
            {
                list2.Add((float)j);
            }
            DebugTables.MakeTablesDialog <float, float>(list2, (float ds) => "d-" + ds.ToString("F0"), list, (float rv) => rv.ToString("F2"), (float ds, float p) => StorytellerUtilityPopulation.CalculatePopulationIntent(StorytellerUtilityPopulation.StorytellerDef, p, (float)((int)ds)).ToString("F2"), "pop");
        }
示例#4
0
 private static string <PopulationIntents> m__2(float ds, float p)
 {
     return(StorytellerUtilityPopulation.CalculatePopulationIntent(StorytellerUtilityPopulation.StorytellerDef, p, (float)((int)ds)).ToString("F2"));
 }