public static void DecreeSelectionWeightsNow() { IIncidentTarget target = Find.CurrentMap; string label = "selection weight now\ntarget: " + target.ToString(); DebugTables.MakeTablesDialog(DefDatabase <QuestScriptDef> .AllDefsListForReading.Where((QuestScriptDef x) => x.IsRootDecree), new TableDataGetter <QuestScriptDef>("defName", (QuestScriptDef x) => x.defName), new TableDataGetter <QuestScriptDef>(label, (QuestScriptDef x) => NaturalRandomQuestChooser.GetNaturalDecreeSelectionWeight(x, target.StoryState).ToString("F3"))); }
public static void QuestSelectionWeightsNow() { List <DebugMenuOption> list = new List <DebugMenuOption>(); foreach (float item in DebugActionsUtility.PointsOptions(extended: true)) { float localPoints = item; list.Add(new DebugMenuOption(localPoints + " points", DebugMenuOptionMode.Action, delegate { IIncidentTarget target = Find.CurrentMap; string label = "selection weight now\ntarget: " + target.ToString() + "\npoints: " + localPoints.ToString("F0") + "\npopIntentQuest: " + StorytellerUtilityPopulation.PopulationIntentForQuest; DebugTables.MakeTablesDialog(DefDatabase <QuestScriptDef> .AllDefsListForReading.Where((QuestScriptDef x) => x.IsRootRandomSelected), new TableDataGetter <QuestScriptDef>("defName", (QuestScriptDef x) => x.defName), new TableDataGetter <QuestScriptDef>(label, (QuestScriptDef x) => NaturalRandomQuestChooser.GetNaturalRandomSelectionWeight(x, localPoints, target.StoryState).ToString("F3")), new TableDataGetter <QuestScriptDef>("increases\npopulation", (QuestScriptDef x) => x.rootIncreasesPopulation.ToStringCheckBlank()), new TableDataGetter <QuestScriptDef>("recency\nindex", (QuestScriptDef x) => (!target.StoryState.RecentRandomQuests.Contains(x)) ? "" : target.StoryState.RecentRandomQuests.IndexOf(x).ToString()), new TableDataGetter <QuestScriptDef>("total\nselection\nchance\nnow", (QuestScriptDef x) => NaturalRandomQuestChooser.DebugTotalNaturalRandomSelectionWeight(x, localPoints, target).ToString("F3"))); })); } Find.WindowStack.Add(new Dialog_DebugOptionListLister(list.OrderBy((DebugMenuOption op) => op.label))); }
private static string GetIncidentTargetLabel(IIncidentTarget target) { if (target == null) { return("null target"); } if (target is Map) { return("Map"); } if (target is World) { return("World"); } if (target is Caravan) { return(((Caravan)target).LabelCap); } return(target.ToString()); }