private static void GenerateQuestsSamples()
        {
            List <DebugMenuOption> list = new List <DebugMenuOption>();

            foreach (QuestScriptDef scriptDef in DefDatabase <QuestScriptDef> .AllDefs.Where((QuestScriptDef x) => x.IsRootAny))
            {
                list.Add(new DebugMenuOption(scriptDef.defName, DebugMenuOptionMode.Action, delegate
                {
                    foreach (float item in DebugActionsUtility.PointsOptions(extended: false))
                    {
                        try
                        {
                            if (!scriptDef.CanRun(item))
                            {
                                Log.Error("Cannot generate quest " + scriptDef.defName + " for " + item + " points!");
                            }
                            else
                            {
                                Quest quest = QuestUtility.GenerateQuestAndMakeAvailable(scriptDef, item);
                                quest.name  = item + ": " + quest.name;
                            }
                        }
                        catch (Exception ex)
                        {
                            Log.Error("Exception generating quest " + scriptDef.defName + " for " + item + " points!\n\n" + ex.Message + "\n-------------\n" + ex.StackTrace);
                        }
                    }
                }));
            }
            Find.WindowStack.Add(new Dialog_DebugOptionListLister(list.OrderBy((DebugMenuOption op) => op.label)));
        }
        public static void QuestExample()
        {
            List <DebugMenuOption> list = new List <DebugMenuOption>();

            foreach (QuestScriptDef allDef in DefDatabase <QuestScriptDef> .AllDefs)
            {
                QuestScriptDef localRuleDef = allDef;
                list.Add(new DebugMenuOption(localRuleDef.defName, DebugMenuOptionMode.Action, delegate
                {
                    List <DebugMenuOption> list2 = new List <DebugMenuOption>();
                    float localPoints            = default(float);
                    foreach (float item in DebugActionsUtility.PointsOptions(extended: true))
                    {
                        localPoints = item;
                        list2.Add(new DebugMenuOption(item.ToString("F0"), DebugMenuOptionMode.Action, delegate
                        {
                            Slate slate = new Slate();
                            slate.Set("points", localPoints);
                            Quest saveable = QuestGen.Generate(localRuleDef, slate);
                            Log.Message(Scribe.saver.DebugOutputFor(saveable));
                        }));
                    }
                    Find.WindowStack.Add(new Dialog_DebugOptionListLister(list2));
                }));
            }
            Find.WindowStack.Add(new Dialog_DebugOptionListLister(list));
        }
예제 #3
0
        private static void DoIncidentWithPointsAction(IIncidentTarget target)
        {
            List <DebugMenuOption> list = new List <DebugMenuOption>();

            foreach (IncidentDef item in from d in DefDatabase <IncidentDef> .AllDefs
                     where d.TargetAllowed(target) && d.pointsScaleable
                     orderby d.defName
                     select d)
            {
                IncidentDef   localDef = item;
                string        text     = localDef.defName;
                IncidentParms parms    = StorytellerUtility.DefaultParmsNow(localDef.category, target);
                if (!localDef.Worker.CanFireNow(parms))
                {
                    text += " [NO]";
                }
                float localPoints = default(float);
                list.Add(new DebugMenuOption(text, DebugMenuOptionMode.Action, delegate
                {
                    List <DebugMenuOption> list2 = new List <DebugMenuOption>();
                    foreach (float item2 in DebugActionsUtility.PointsOptions(extended: true))
                    {
                        localPoints = item2;
                        list2.Add(new DebugMenuOption(item2 + " points", DebugMenuOptionMode.Action, delegate
                        {
                            parms.points = localPoints;
                            localDef.Worker.TryExecute(parms);
                        }));
                    }
                    Find.WindowStack.Add(new Dialog_DebugOptionListLister(list2));
                }));
            }
            Find.WindowStack.Add(new Dialog_DebugOptionListLister(list));
        }
예제 #4
0
        private static void SpawnSiteWithPoints()
        {
            int tile = GenWorld.MouseTile();

            if (tile < 0 || Find.World.Impassable(tile))
            {
                Messages.Message("Impassable", MessageTypeDefOf.RejectInput, historical: false);
                return;
            }
            List <SitePartDef> parts   = new List <SitePartDef>();
            Action             addPart = null;
            float       localPoints    = default(float);
            SitePartDef localPart      = default(SitePartDef);

            addPart = delegate
            {
                List <DebugMenuOption> list = new List <DebugMenuOption>
                {
                    new DebugMenuOption("-Done (" + parts.Count + " parts)-", DebugMenuOptionMode.Action, delegate
                    {
                        List <DebugMenuOption> list2 = new List <DebugMenuOption>();
                        foreach (float item in DebugActionsUtility.PointsOptions(extended: true))
                        {
                            localPoints = item;
                            list2.Add(new DebugMenuOption(item.ToString("F0"), DebugMenuOptionMode.Action, delegate
                            {
                                Site site = SiteMaker.TryMakeSite(parts, tile, disallowNonHostileFactions: true, null, ifHostileThenMustRemainHostile: true, localPoints);
                                if (site == null)
                                {
                                    Messages.Message("Could not find any valid faction for this site.", MessageTypeDefOf.RejectInput, historical: false);
                                }
                                else
                                {
                                    Find.WorldObjects.Add(site);
                                }
                            }));
                        }
                        Find.WindowStack.Add(new Dialog_DebugOptionListLister(list2));
                    })
                };
                foreach (SitePartDef allDef in DefDatabase <SitePartDef> .AllDefs)
                {
                    localPart = allDef;
                    list.Add(new DebugMenuOption(allDef.defName, DebugMenuOptionMode.Action, delegate
                    {
                        parts.Add(localPart);
                        addPart();
                    }));
                }
                Find.WindowStack.Add(new Dialog_DebugOptionListLister(list));
            };
            addPart();
        }
        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)));
        }
예제 #6
0
        private static void ExecuteRaidWithPoints()
        {
            List <FloatMenuOption> list = new List <FloatMenuOption>();

            foreach (float item in DebugActionsUtility.PointsOptions(extended: true))
            {
                float localP = item;
                list.Add(new FloatMenuOption(localP.ToString() + " points", delegate
                {
                    IncidentParms parms = new IncidentParms
                    {
                        target = Find.CurrentMap,
                        points = localP
                    };
                    IncidentDefOf.RaidEnemy.Worker.TryExecute(parms);
                }));
            }
            Find.WindowStack.Add(new FloatMenu(list));
        }
예제 #7
0
        private static void ExecuteRaidWithFaction()
        {
            StorytellerComp        storytellerComp = Find.Storyteller.storytellerComps.First((StorytellerComp x) => x is StorytellerComp_OnOffCycle || x is StorytellerComp_RandomMain);
            IncidentParms          parms           = storytellerComp.GenerateParms(IncidentCategoryDefOf.ThreatBig, Find.CurrentMap);
            List <DebugMenuOption> list            = new List <DebugMenuOption>();

            foreach (Faction allFaction in Find.FactionManager.AllFactions)
            {
                Faction localFac = allFaction;
                list.Add(new DebugMenuOption(localFac.Name + " (" + localFac.def.defName + ")", DebugMenuOptionMode.Action, delegate
                {
                    parms.faction = localFac;
                    List <DebugMenuOption> list2 = new List <DebugMenuOption>();
                    float localPoints            = default(float);
                    foreach (float item in DebugActionsUtility.PointsOptions(extended: true))
                    {
                        localPoints = item;
                        list2.Add(new DebugMenuOption(item + " points", DebugMenuOptionMode.Action, delegate
                        {
                            parms.points = localPoints;
                            List <RaidStrategyDef> source = DefDatabase <RaidStrategyDef> .AllDefs.Where((RaidStrategyDef s) => s.Worker.CanUseWith(parms, PawnGroupKindDefOf.Combat)).ToList();
                            Log.Message("Available strategies: " + string.Join(", ", source.Select((RaidStrategyDef s) => s.defName).ToArray()));
                            parms.raidStrategy = source.RandomElement();
                            if (parms.raidStrategy != null)
                            {
                                Log.Message("Strategy: " + parms.raidStrategy.defName);
                                List <PawnsArrivalModeDef> source2 = DefDatabase <PawnsArrivalModeDef> .AllDefs.Where((PawnsArrivalModeDef a) => a.Worker.CanUseWith(parms) && parms.raidStrategy.arriveModes.Contains(a)).ToList();
                                Log.Message("Available arrival modes: " + string.Join(", ", source2.Select((PawnsArrivalModeDef s) => s.defName).ToArray()));
                                parms.raidArrivalMode = source2.RandomElement();
                                Log.Message("Arrival mode: " + parms.raidArrivalMode.defName);
                            }
                            DoRaid(parms);
                        }));
                    }
                    Find.WindowStack.Add(new Dialog_DebugOptionListLister(list2));
                }));
            }
            Find.WindowStack.Add(new Dialog_DebugOptionListLister(list));
        }
        private static void GenerateQuests(int count, bool logDescOnly)
        {
            Action <QuestScriptDef, Slate> generateQuest = delegate(QuestScriptDef script, Slate slate)
            {
                int num = 0;
                for (int i = 0; i < count; i++)
                {
                    if (script.IsRootDecree)
                    {
                        Pawn pawn = slate.Get <Pawn>("asker");
                        if (pawn.royalty.AllTitlesForReading.NullOrEmpty())
                        {
                            pawn.royalty.SetTitle(Faction.Empire, RoyalTitleDefOf.Knight, grantRewards: false);
                            Messages.Message("Dev: Gave " + RoyalTitleDefOf.Knight.label + " title to " + pawn.LabelCap, pawn, MessageTypeDefOf.NeutralEvent, historical: false);
                        }
                        Find.CurrentMap.StoryState.RecordDecreeFired(script);
                    }
                    if (count != 1 && !script.CanRun(slate))
                    {
                        num++;
                    }
                    else if (!logDescOnly)
                    {
                        Quest quest = QuestUtility.GenerateQuestAndMakeAvailable(script, slate);
                        if (!quest.hidden)
                        {
                            QuestUtility.SendLetterQuestAvailable(quest);
                        }
                    }
                    else
                    {
                        Quest  quest2 = QuestUtility.GenerateQuestAndMakeAvailable(script, slate);
                        string text2  = quest2.name;
                        if (slate.Exists("points"))
                        {
                            text2 = text2 + "(" + slate.Get("points", 0f) + " points)";
                        }
                        if (slate.Exists("population"))
                        {
                            text2 = text2 + "(" + slate.Get("population", 0) + " population)";
                        }
                        text2 += "\n--------------\n" + quest2.description + "\n--------------";
                        Log.Message(text2);
                        Find.QuestManager.Remove(quest2);
                    }
                }
                if (num != 0)
                {
                    Messages.Message("Dev: Generated only " + (count - num) + " quests.", MessageTypeDefOf.RejectInput, historical: false);
                }
            };
            Action <QuestScriptDef, Slate, Action> selectPoints = delegate(QuestScriptDef script, Slate slate, Action next)
            {
                List <DebugMenuOption> list3 = new List <DebugMenuOption>();
                float localPoints            = default(float);
                foreach (float item in DebugActionsUtility.PointsOptions(extended: false))
                {
                    localPoints = item;
                    string text = item.ToString("F0") + " points";
                    if (script != null)
                    {
                        if (script.IsRootDecree)
                        {
                            slate.Set("asker", PawnsFinder.AllMapsCaravansAndTravelingTransportPods_Alive_FreeColonists.RandomElement());
                        }
                        if (script == QuestScriptDefOf.LongRangeMineralScannerLump)
                        {
                            slate.Set("targetMineableThing", ThingDefOf.Gold);
                            slate.Set("targetMineable", ThingDefOf.MineableGold);
                            slate.Set("worker", PawnsFinder.AllMaps_FreeColonists.FirstOrDefault());
                        }
                        slate.Set("points", localPoints);
                        if (!script.CanRun(slate))
                        {
                            text += " [not now]";
                        }
                    }
                    list3.Add(new DebugMenuOption(text, DebugMenuOptionMode.Action, delegate
                    {
                        slate.Set("points", localPoints);
                        next();
                    }));
                }
                Find.WindowStack.Add(new Dialog_DebugOptionListLister(list3));
            };
            Action <Slate, Action> selectPopulation = delegate(Slate slate, Action next)
            {
                List <DebugMenuOption> list2 = new List <DebugMenuOption>
                {
                    new DebugMenuOption("*Don't set", DebugMenuOptionMode.Action, next)
                };
                int localPopulation = default(int);
                foreach (int item2 in DebugActionsUtility.PopulationOptions())
                {
                    localPopulation = item2;
                    list2.Add(new DebugMenuOption(item2.ToString("F0") + " colony population", DebugMenuOptionMode.Action, delegate
                    {
                        slate.Set("population", localPopulation);
                        next();
                    }));
                }
                Find.WindowStack.Add(new Dialog_DebugOptionListLister(list2));
            };
            List <DebugMenuOption> list = new List <DebugMenuOption>();

            list.Add(new DebugMenuOption("*Natural random", DebugMenuOptionMode.Action, delegate
            {
                Slate slate3 = new Slate();
                selectPoints(null, slate3, delegate
                {
                    float points           = slate3.Get("points", 0f);
                    QuestScriptDef script2 = NaturalRandomQuestChooser.ChooseNaturalRandomQuest(points, Find.CurrentMap);
                    if (script2.affectedByPopulation)
                    {
                        selectPopulation(slate3, delegate
                        {
                            generateQuest(script2, slate3);
                        });
                    }
                    else
                    {
                        generateQuest(script2, slate3);
                    }
                });
            }));
            foreach (QuestScriptDef scriptDef in DefDatabase <QuestScriptDef> .AllDefs.Where((QuestScriptDef x) => x.IsRootAny))
            {
                QuestScriptDef localScriptDef = scriptDef;
                string         defName        = localScriptDef.defName;
                list.Add(new DebugMenuOption(defName, DebugMenuOptionMode.Action, delegate
                {
                    Slate slate2 = new Slate();
                    if (localScriptDef.affectedByPoints && localScriptDef.affectedByPopulation)
                    {
                        selectPoints(localScriptDef, slate2, delegate
                        {
                            selectPopulation(slate2, delegate
                            {
                                generateQuest(localScriptDef, slate2);
                            });
                        });
                    }
                    else if (scriptDef.affectedByPoints)
                    {
                        selectPoints(localScriptDef, slate2, delegate
                        {
                            generateQuest(localScriptDef, slate2);
                        });
                    }
                    else if (localScriptDef.affectedByPopulation)
                    {
                        selectPopulation(slate2, delegate
                        {
                            generateQuest(localScriptDef, slate2);
                        });
                    }
                    else
                    {
                        generateQuest(localScriptDef, slate2);
                    }
                }));
            }
            Find.WindowStack.Add(new Dialog_DebugOptionListLister(list.OrderBy((DebugMenuOption op) => op.label)));
        }
예제 #9
0
        public static void PawnGroupGenSampled()
        {
            List <DebugMenuOption> list = new List <DebugMenuOption>();

            foreach (Faction allFaction in Find.FactionManager.AllFactions)
            {
                if (allFaction.def.pawnGroupMakers != null && allFaction.def.pawnGroupMakers.Any((PawnGroupMaker x) => x.kindDef == PawnGroupKindDefOf.Combat))
                {
                    Faction localFac    = allFaction;
                    float   localP      = default(float);
                    float   maxPawnCost = default(float);
                    list.Add(new DebugMenuOption(localFac.Name + " (" + localFac.def.defName + ")", DebugMenuOptionMode.Action, delegate
                    {
                        List <DebugMenuOption> list2 = new List <DebugMenuOption>();
                        foreach (float item in DebugActionsUtility.PointsOptions(extended: true))
                        {
                            localP         = item;
                            maxPawnCost    = PawnGroupMakerUtility.MaxPawnCost(localFac, localP, null, PawnGroupKindDefOf.Combat);
                            string defName = (from op in localFac.def.pawnGroupMakers.SelectMany((PawnGroupMaker gm) => gm.options)
                                              where op.Cost <= maxPawnCost
                                              select op).MaxBy((PawnGenOption op) => op.Cost).kind.defName;
                            string label = localP.ToString() + ", max " + maxPawnCost.ToString("F0") + " " + defName;
                            list2.Add(new DebugMenuOption(label, DebugMenuOptionMode.Action, delegate
                            {
                                Dictionary <ThingDef, int>[] weaponsCount = new Dictionary <ThingDef, int> [20];
                                string[] pawnKinds = new string[20];
                                for (int i = 0; i < 20; i++)
                                {
                                    weaponsCount[i]   = new Dictionary <ThingDef, int>();
                                    List <Pawn> list3 = PawnGroupMakerUtility.GeneratePawns(new PawnGroupMakerParms
                                    {
                                        groupKind = PawnGroupKindDefOf.Combat,
                                        tile      = Find.CurrentMap.Tile,
                                        points    = localP,
                                        faction   = localFac
                                    }, warnOnZeroResults: false).ToList();
                                    pawnKinds[i] = PawnUtility.PawnKindsToCommaList(list3, useAnd: true);
                                    foreach (Pawn item2 in list3)
                                    {
                                        if (item2.equipment.Primary != null)
                                        {
                                            if (!weaponsCount[i].ContainsKey(item2.equipment.Primary.def))
                                            {
                                                weaponsCount[i].Add(item2.equipment.Primary.def, 0);
                                            }
                                            weaponsCount[i][item2.equipment.Primary.def]++;
                                        }
                                        item2.Destroy();
                                    }
                                }
                                int totalPawns = weaponsCount.Sum((Dictionary <ThingDef, int> x) => x.Sum((KeyValuePair <ThingDef, int> y) => y.Value));
                                List <TableDataGetter <int> > list4 = new List <TableDataGetter <int> >();
                                list4.Add(new TableDataGetter <int>("", (int x) => (x != 20) ? (x + 1).ToString() : "avg"));
                                list4.Add(new TableDataGetter <int>("pawns", (int x) => " " + ((x == 20) ? ((float)totalPawns / 20f).ToString("0.#") : weaponsCount[x].Sum((KeyValuePair <ThingDef, int> y) => y.Value).ToString())));
                                list4.Add(new TableDataGetter <int>("kinds", (int x) => (x != 20) ? pawnKinds[x] : ""));
                                list4.AddRange(from x in DefDatabase <ThingDef> .AllDefs
                                               where x.IsWeapon && !x.weaponTags.NullOrEmpty() && weaponsCount.Any((Dictionary <ThingDef, int> wc) => wc.ContainsKey(x))
                                               orderby x.IsMeleeWeapon descending, x.techLevel, x.BaseMarketValue
                                               select new TableDataGetter <int>(x.label.Shorten(), delegate(int y)
                                {
                                    if (y == 20)
                                    {
                                        return(" " + ((float)weaponsCount.Sum((Dictionary <ThingDef, int> z) => z.ContainsKey(x) ? z[x] : 0) / 20f).ToString("0.#"));
                                    }
                                    return((!weaponsCount[y].ContainsKey(x)) ? "" : (" " + weaponsCount[y][x] + " (" + ((float)weaponsCount[y][x] / (float)weaponsCount[y].Sum((KeyValuePair <ThingDef, int> z) => z.Value)).ToStringPercent("F0") + ")"));
                                }));
                                DebugTables.MakeTablesDialog(Enumerable.Range(0, 21), list4.ToArray());
                            }));
                        }
                        Find.WindowStack.Add(new Dialog_DebugOptionListLister(list2));
                    }));
                }
            }
            Find.WindowStack.Add(new Dialog_DebugOptionListLister(list));
        }
예제 #10
0
        private static void GenerateQuests(int count, bool logDescOnly)
        {
            List <DebugMenuOption> list      = new List <DebugMenuOption>();
            float localPoints                = default(float);
            Slate testSlate                  = default(Slate);
            Action <QuestScriptDef> generate = delegate(QuestScriptDef script)
            {
                List <DebugMenuOption> list2 = new List <DebugMenuOption>();
                foreach (float item in DebugActionsUtility.PointsOptions(extended: false))
                {
                    localPoints = item;
                    string text = item.ToString("F0");
                    testSlate = new Slate();
                    testSlate.Set("points", localPoints);
                    if (script != null)
                    {
                        if (script.IsRootDecree)
                        {
                            testSlate.Set("asker", PawnsFinder.AllMapsCaravansAndTravelingTransportPods_Alive_FreeColonists.RandomElement());
                        }
                        if (script == QuestScriptDefOf.LongRangeMineralScannerLump)
                        {
                            testSlate.Set("targetMineable", ThingDefOf.MineableGold);
                            testSlate.Set("worker", PawnsFinder.AllMaps_FreeColonists.FirstOrDefault());
                        }
                        if (!script.CanRun(testSlate))
                        {
                            text += " [not now]";
                        }
                    }
                    list2.Add(new DebugMenuOption(text, DebugMenuOptionMode.Action, delegate
                    {
                        int num   = 0;
                        bool flag = script == null;
                        for (int i = 0; i < count; i++)
                        {
                            if (flag)
                            {
                                script = NaturalRandomQuestChooser.ChooseNaturalRandomQuest(localPoints, Find.CurrentMap);
                                Find.CurrentMap.StoryState.RecordRandomQuestFired(script);
                            }
                            if (script.IsRootDecree)
                            {
                                Pawn pawn = testSlate.Get <Pawn>("asker");
                                if (pawn.royalty.AllTitlesForReading.NullOrEmpty())
                                {
                                    pawn.royalty.SetTitle(Faction.Empire, RoyalTitleDefOf.Knight, grantRewards: false);
                                    Messages.Message("Dev: Gave " + RoyalTitleDefOf.Knight.label + " title to " + pawn.LabelCap, pawn, MessageTypeDefOf.NeutralEvent, historical: false);
                                }
                                Find.CurrentMap.StoryState.RecordDecreeFired(script);
                            }
                            if (count != 1 && !script.CanRun(testSlate))
                            {
                                num++;
                            }
                            else if (!logDescOnly)
                            {
                                QuestUtility.SendLetterQuestAvailable(QuestUtility.GenerateQuestAndMakeAvailable(script, testSlate));
                            }
                            else
                            {
                                Quest quest = QuestUtility.GenerateQuestAndMakeAvailable(script, testSlate);
                                Log.Message(quest.name + " (" + localPoints + " points)\n--------------\n" + quest.description + "\n--------------");
                                Find.QuestManager.Remove(quest);
                            }
                        }
                        if (num != 0)
                        {
                            Messages.Message("Dev: Generated only " + (count - num) + " quests.", MessageTypeDefOf.RejectInput, historical: false);
                        }
                    }));
                }
                Find.WindowStack.Add(new Dialog_DebugOptionListLister(list2));
            };

            list.Add(new DebugMenuOption("*Natural random", DebugMenuOptionMode.Action, delegate
            {
                generate(null);
            }));
            foreach (QuestScriptDef item2 in DefDatabase <QuestScriptDef> .AllDefs.Where((QuestScriptDef x) => x.IsRootAny))
            {
                QuestScriptDef localRuleDef = item2;
                string         defName      = localRuleDef.defName;
                list.Add(new DebugMenuOption(defName, DebugMenuOptionMode.Action, delegate
                {
                    generate(localRuleDef);
                }));
            }
            Find.WindowStack.Add(new Dialog_DebugOptionListLister(list.OrderBy((DebugMenuOption op) => op.label)));
        }
예제 #11
0
        private static void ExecuteRaidWithSpecifics()
        {
            StorytellerComp        storytellerComp = Find.Storyteller.storytellerComps.First((StorytellerComp x) => x is StorytellerComp_OnOffCycle || x is StorytellerComp_RandomMain);
            IncidentParms          parms           = storytellerComp.GenerateParms(IncidentCategoryDefOf.ThreatBig, Find.CurrentMap);
            List <DebugMenuOption> list            = new List <DebugMenuOption>();

            foreach (Faction allFaction in Find.FactionManager.AllFactions)
            {
                Faction             localFac     = allFaction;
                float               localPoints  = default(float);
                RaidStrategyDef     localStrat   = default(RaidStrategyDef);
                PawnsArrivalModeDef localArrival = default(PawnsArrivalModeDef);
                list.Add(new DebugMenuOption(localFac.Name + " (" + localFac.def.defName + ")", DebugMenuOptionMode.Action, delegate
                {
                    parms.faction = localFac;
                    List <DebugMenuOption> list2 = new List <DebugMenuOption>();
                    foreach (float item in DebugActionsUtility.PointsOptions(extended: true))
                    {
                        localPoints = item;
                        list2.Add(new DebugMenuOption(item + " points", DebugMenuOptionMode.Action, delegate
                        {
                            parms.points = localPoints;
                            List <DebugMenuOption> list3 = new List <DebugMenuOption>();
                            foreach (RaidStrategyDef allDef in DefDatabase <RaidStrategyDef> .AllDefs)
                            {
                                localStrat  = allDef;
                                string text = localStrat.defName;
                                if (!localStrat.Worker.CanUseWith(parms, PawnGroupKindDefOf.Combat))
                                {
                                    text += " [NO]";
                                }
                                list3.Add(new DebugMenuOption(text, DebugMenuOptionMode.Action, delegate
                                {
                                    parms.raidStrategy           = localStrat;
                                    List <DebugMenuOption> list4 = new List <DebugMenuOption>
                                    {
                                        new DebugMenuOption("-Random-", DebugMenuOptionMode.Action, delegate
                                        {
                                            DoRaid(parms);
                                        })
                                    };
                                    foreach (PawnsArrivalModeDef allDef2 in DefDatabase <PawnsArrivalModeDef> .AllDefs)
                                    {
                                        localArrival = allDef2;
                                        string text2 = localArrival.defName;
                                        if (!localArrival.Worker.CanUseWith(parms) || !localStrat.arriveModes.Contains(localArrival))
                                        {
                                            text2 += " [NO]";
                                        }
                                        list4.Add(new DebugMenuOption(text2, DebugMenuOptionMode.Action, delegate
                                        {
                                            parms.raidArrivalMode = localArrival;
                                            DoRaid(parms);
                                        }));
                                    }
                                    Find.WindowStack.Add(new Dialog_DebugOptionListLister(list4));
                                }));
                            }
                            Find.WindowStack.Add(new Dialog_DebugOptionListLister(list3));
                        }));
                    }
                    Find.WindowStack.Add(new Dialog_DebugOptionListLister(list2));
                }));
            }
            Find.WindowStack.Add(new Dialog_DebugOptionListLister(list));
        }