Example #1
0
        protected override void RunInt()
        {
            Slate slate = QuestGen.slate;
            Map   map   = QuestGen.slate.Get <Map>("map");

            if (map != null)
            {
                QuestPart_Infestation questPart = new QuestPart_Infestation();
                questPart.mapParent  = map.Parent;
                questPart.hivesCount = hivesCount.GetValue(slate);
                questPart.tag        = QuestGenUtility.HardcodedTargetQuestTagWithQuestID(tag.GetValue(slate));
                if (!customLetterLabel.GetValue(slate).NullOrEmpty() || customLetterLabelRules.GetValue(slate) != null)
                {
                    QuestGen.AddTextRequest("root", delegate(string x)
                    {
                        questPart.customLetterLabel = x;
                    }, QuestGenUtility.MergeRules(customLetterLabelRules.GetValue(slate), customLetterLabel.GetValue(slate), "root"));
                }
                if (!customLetterText.GetValue(slate).NullOrEmpty() || customLetterTextRules.GetValue(slate) != null)
                {
                    QuestGen.AddTextRequest("root", delegate(string x)
                    {
                        questPart.customLetterText = x;
                    }, QuestGenUtility.MergeRules(customLetterTextRules.GetValue(slate), customLetterText.GetValue(slate), "root"));
                }
                questPart.inSignal = (QuestGenUtility.HardcodedSignalWithQuestID(inSignal.GetValue(slate)) ?? QuestGen.slate.Get <string>("inSignal"));
                QuestGen.quest.AddPart(questPart);
            }
        }
Example #2
0
        protected override void RunInt()
        {
            Slate slate  = QuestGen.slate;
            Map   target = QuestGen.slate.Get <Map>("map");
            float points = QuestGen.slate.Get("points", 0f);
            QuestPart_Incident questPart_Incident = new QuestPart_Incident();

            questPart_Incident.incident = incidentDef.GetValue(slate);
            IncidentParms incidentParms = new IncidentParms();

            incidentParms.forced = true;
            incidentParms.target = target;
            incidentParms.points = points;
            if (!customLetterLabel.GetValue(slate).NullOrEmpty() || customLetterLabelRules.GetValue(slate) != null)
            {
                QuestGen.AddTextRequest("root", delegate(string x)
                {
                    incidentParms.customLetterLabel = x;
                }, QuestGenUtility.MergeRules(customLetterLabelRules.GetValue(slate), customLetterLabel.GetValue(slate), "root"));
            }
            if (!customLetterText.GetValue(slate).NullOrEmpty() || customLetterTextRules.GetValue(slate) != null)
            {
                QuestGen.AddTextRequest("root", delegate(string x)
                {
                    incidentParms.customLetterText = x;
                }, QuestGenUtility.MergeRules(customLetterTextRules.GetValue(slate), customLetterText.GetValue(slate), "root"));
            }
            questPart_Incident.SetIncidentParmsAndRemoveTarget(incidentParms);
            questPart_Incident.inSignal = QuestGenUtility.HardcodedSignalWithQuestID(inSignal.GetValue(slate)) ?? QuestGen.slate.Get <string>("inSignal");
            QuestGen.quest.AddPart(questPart_Incident);
        }
Example #3
0
        protected override void RunInt()
        {
            Slate            slate            = QuestGen.slate;
            QuestPart_Letter questPart_Letter = new QuestPart_Letter();

            questPart_Letter.inSignal = (QuestGenUtility.HardcodedSignalWithQuestID(inSignal.GetValue(slate)) ?? slate.Get <string>("inSignal"));
            LetterDef letterDef = this.letterDef.GetValue(slate) ?? LetterDefOf.NeutralEvent;

            if (typeof(ChoiceLetter).IsAssignableFrom(letterDef.letterClass))
            {
                ChoiceLetter choiceLetter = LetterMaker.MakeLetter("error", "error", letterDef, QuestGenUtility.ToLookTargets(lookTargets, slate), relatedFaction.GetValue(slate), QuestGen.quest);
                questPart_Letter.letter = choiceLetter;
                QuestGen.AddTextRequest("root", delegate(string x)
                {
                    choiceLetter.label = x;
                }, QuestGenUtility.MergeRules(labelRules.GetValue(slate), label.GetValue(slate), "root"));
                QuestGen.AddTextRequest("root", delegate(string x)
                {
                    choiceLetter.text = x;
                }, QuestGenUtility.MergeRules(textRules.GetValue(slate), text.GetValue(slate), "root"));
            }
            else
            {
                questPart_Letter.letter                = LetterMaker.MakeLetter(letterDef);
                questPart_Letter.letter.lookTargets    = QuestGenUtility.ToLookTargets(lookTargets, slate);
                questPart_Letter.letter.relatedFaction = relatedFaction.GetValue(slate);
            }
            questPart_Letter.chosenPawnSignal               = QuestGenUtility.HardcodedSignalWithQuestID(chosenPawnSignal.GetValue(slate));
            questPart_Letter.useColonistsOnMap              = useColonistsOnMap.GetValue(slate);
            questPart_Letter.useColonistsFromCaravanArg     = useColonistsFromCaravanArg.GetValue(slate);
            questPart_Letter.signalListenMode               = (signalListenMode.GetValue(slate) ?? QuestPart.SignalListenMode.OngoingOnly);
            questPart_Letter.filterDeadPawnsFromLookTargets = filterDeadPawnsFromLookTargets.GetValue(slate);
            QuestGen.quest.AddPart(questPart_Letter);
        }
Example #4
0
        protected override void RunInt()
        {
            Slate              slate              = QuestGen.slate;
            Map                target             = QuestGen.slate.Get <Map>("map");
            float              a                  = QuestGen.slate.Get("points", 0f);
            Faction            faction            = QuestGen.slate.Get <Faction>("enemyFaction");
            QuestPart_Incident questPart_Incident = new QuestPart_Incident();

            questPart_Incident.debugLabel = "raid";
            questPart_Incident.incident   = IncidentDefOf.RaidEnemy;
            IncidentParms incidentParms = new IncidentParms();

            incidentParms.forced             = true;
            incidentParms.target             = target;
            incidentParms.points             = Mathf.Max(a, faction.def.MinPointsToGeneratePawnGroup(PawnGroupKindDefOf.Combat));
            incidentParms.faction            = faction;
            incidentParms.pawnGroupMakerSeed = Rand.Int;
            incidentParms.inSignalEnd        = QuestGenUtility.HardcodedSignalWithQuestID(inSignalLeave.GetValue(slate));
            incidentParms.questTag           = QuestGenUtility.HardcodedTargetQuestTagWithQuestID(tag.GetValue(slate));
            if (!customLetterLabel.GetValue(slate).NullOrEmpty() || customLetterLabelRules.GetValue(slate) != null)
            {
                QuestGen.AddTextRequest("root", delegate(string x)
                {
                    incidentParms.customLetterLabel = x;
                }, QuestGenUtility.MergeRules(customLetterLabelRules.GetValue(slate), customLetterLabel.GetValue(slate), "root"));
            }
            if (!customLetterText.GetValue(slate).NullOrEmpty() || customLetterTextRules.GetValue(slate) != null)
            {
                QuestGen.AddTextRequest("root", delegate(string x)
                {
                    incidentParms.customLetterText = x;
                }, QuestGenUtility.MergeRules(customLetterTextRules.GetValue(slate), customLetterText.GetValue(slate), "root"));
            }
            IncidentWorker_Raid obj = (IncidentWorker_Raid)questPart_Incident.incident.Worker;

            obj.ResolveRaidStrategy(incidentParms, PawnGroupKindDefOf.Combat);
            obj.ResolveRaidArriveMode(incidentParms);
            if (incidentParms.raidArrivalMode.walkIn)
            {
                incidentParms.spawnCenter = walkInSpot.GetValue(slate) ?? QuestGen.slate.Get <IntVec3?>("walkInSpot") ?? IntVec3.Invalid;
            }
            PawnGroupMakerParms defaultPawnGroupMakerParms = IncidentParmsUtility.GetDefaultPawnGroupMakerParms(PawnGroupKindDefOf.Combat, incidentParms);

            defaultPawnGroupMakerParms.points = IncidentWorker_Raid.AdjustedRaidPoints(defaultPawnGroupMakerParms.points, incidentParms.raidArrivalMode, incidentParms.raidStrategy, defaultPawnGroupMakerParms.faction, PawnGroupKindDefOf.Combat);
            IEnumerable <PawnKindDef> pawnKinds = PawnGroupMakerUtility.GeneratePawnKindsExample(defaultPawnGroupMakerParms);

            questPart_Incident.SetIncidentParmsAndRemoveTarget(incidentParms);
            questPart_Incident.inSignal = QuestGenUtility.HardcodedSignalWithQuestID(inSignal.GetValue(slate)) ?? QuestGen.slate.Get <string>("inSignal");
            QuestGen.quest.AddPart(questPart_Incident);
            QuestGen.AddQuestDescriptionRules(new List <Rule>
            {
                new Rule_String("raidPawnKinds", PawnUtility.PawnKindsToLineList(pawnKinds, "  - ", ColoredText.ThreatColor)),
                new Rule_String("raidArrivalModeInfo", incidentParms.raidArrivalMode.textWillArrive.Formatted(faction))
            });
        }
Example #5
0
        public static void Raid(this Quest quest, Map map, float points, Faction faction, string inSignalLeave = null, string customLetterLabel = null, string customLetterText = null, RulePack customLetterLabelRules = null, RulePack customLetterTextRules = null, IntVec3?walkInSpot = null, string tag = null, string inSignal = null, string rootSymbol = "root", PawnsArrivalModeDef raidArrivalMode = null)
        {
            QuestPart_Incident questPart_Incident = new QuestPart_Incident();

            questPart_Incident.debugLabel = "raid";
            questPart_Incident.incident   = IncidentDefOf.RaidEnemy;
            IncidentParms incidentParms = new IncidentParms();

            incidentParms.forced             = true;
            incidentParms.target             = map;
            incidentParms.points             = Mathf.Max(points, faction.def.MinPointsToGeneratePawnGroup(PawnGroupKindDefOf.Combat));
            incidentParms.faction            = faction;
            incidentParms.pawnGroupMakerSeed = Rand.Int;
            incidentParms.inSignalEnd        = inSignalLeave;
            incidentParms.questTag           = QuestGenUtility.HardcodedTargetQuestTagWithQuestID(tag);
            incidentParms.raidArrivalMode    = raidArrivalMode;
            if (!customLetterLabel.NullOrEmpty() || customLetterLabelRules != null)
            {
                QuestGen.AddTextRequest(rootSymbol, delegate(string x)
                {
                    incidentParms.customLetterLabel = x;
                }, QuestGenUtility.MergeRules(customLetterLabelRules, customLetterLabel, rootSymbol));
            }
            if (!customLetterText.NullOrEmpty() || customLetterTextRules != null)
            {
                QuestGen.AddTextRequest(rootSymbol, delegate(string x)
                {
                    incidentParms.customLetterText = x;
                }, QuestGenUtility.MergeRules(customLetterTextRules, customLetterText, rootSymbol));
            }
            IncidentWorker_Raid obj = (IncidentWorker_Raid)questPart_Incident.incident.Worker;

            obj.ResolveRaidStrategy(incidentParms, PawnGroupKindDefOf.Combat);
            obj.ResolveRaidArriveMode(incidentParms);
            if (incidentParms.raidArrivalMode.walkIn)
            {
                incidentParms.spawnCenter = walkInSpot ?? QuestGen.slate.Get <IntVec3?>("walkInSpot") ?? IntVec3.Invalid;
            }
            PawnGroupMakerParms defaultPawnGroupMakerParms = IncidentParmsUtility.GetDefaultPawnGroupMakerParms(PawnGroupKindDefOf.Combat, incidentParms);

            defaultPawnGroupMakerParms.points = IncidentWorker_Raid.AdjustedRaidPoints(defaultPawnGroupMakerParms.points, incidentParms.raidArrivalMode, incidentParms.raidStrategy, defaultPawnGroupMakerParms.faction, PawnGroupKindDefOf.Combat);
            IEnumerable <PawnKindDef> pawnKinds = PawnGroupMakerUtility.GeneratePawnKindsExample(defaultPawnGroupMakerParms);

            questPart_Incident.SetIncidentParmsAndRemoveTarget(incidentParms);
            questPart_Incident.inSignal = inSignal ?? QuestGen.slate.Get <string>("inSignal");
            QuestGen.quest.AddPart(questPart_Incident);
            QuestGen.AddQuestDescriptionRules(new List <Rule>
            {
                new Rule_String("raidPawnKinds", PawnUtility.PawnKindsToLineList(pawnKinds, "  - ", ColoredText.ThreatColor)),
                new Rule_String("raidArrivalModeInfo", incidentParms.raidArrivalMode.textWillArrive.Formatted(faction))
            });
        }
        protected override void RunInt()
        {
            Slate slate  = QuestGen.slate;
            Map   map    = QuestGen.slate.Get <Map>("map");
            float points = QuestGen.slate.Get("points", 0f);
            QuestPart_Incident questPart_Incident = new QuestPart_Incident();

            questPart_Incident.incident = IncidentDefOf.ManhunterPack;
            IncidentParms incidentParms = new IncidentParms();

            incidentParms.forced      = true;
            incidentParms.target      = map;
            incidentParms.points      = points;
            incidentParms.questTag    = QuestGenUtility.HardcodedTargetQuestTagWithQuestID(tag.GetValue(slate));
            incidentParms.spawnCenter = walkInSpot.GetValue(slate) ?? QuestGen.slate.Get <IntVec3?>("walkInSpot") ?? IntVec3.Invalid;
            incidentParms.pawnCount   = animalCount.GetValue(slate);
            if (ManhunterPackIncidentUtility.TryFindManhunterAnimalKind(points, map.Tile, out var animalKind))
            {
                incidentParms.pawnKind = animalKind;
            }
            slate.Set("animalKindDef", animalKind);
            int num = ((incidentParms.pawnCount > 0) ? incidentParms.pawnCount : ManhunterPackIncidentUtility.GetAnimalsCount(animalKind, points));

            QuestGen.slate.Set("animalCount", num);
            if (!customLetterLabel.GetValue(slate).NullOrEmpty() || customLetterLabelRules.GetValue(slate) != null)
            {
                QuestGen.AddTextRequest("root", delegate(string x)
                {
                    incidentParms.customLetterLabel = x;
                }, QuestGenUtility.MergeRules(customLetterLabelRules.GetValue(slate), customLetterLabel.GetValue(slate), "root"));
            }
            if (!customLetterText.GetValue(slate).NullOrEmpty() || customLetterTextRules.GetValue(slate) != null)
            {
                QuestGen.AddTextRequest("root", delegate(string x)
                {
                    incidentParms.customLetterText = x;
                }, QuestGenUtility.MergeRules(customLetterTextRules.GetValue(slate), customLetterText.GetValue(slate), "root"));
            }
            questPart_Incident.SetIncidentParmsAndRemoveTarget(incidentParms);
            questPart_Incident.inSignal = QuestGenUtility.HardcodedSignalWithQuestID(inSignal.GetValue(slate)) ?? QuestGen.slate.Get <string>("inSignal");
            QuestGen.quest.AddPart(questPart_Incident);
            List <Rule> rules = new List <Rule>
            {
                new Rule_String("animalKind_label", animalKind.label),
                new Rule_String("animalKind_labelPlural", animalKind.GetLabelPlural(num))
            };

            QuestGen.AddQuestDescriptionRules(rules);
            QuestGen.AddQuestNameRules(rules);
        }
        protected override void RunInt()
        {
            Slate slate = QuestGen.slate;
            PawnsArrivalModeDef   pawnsArrivalModeDef = arrivalMode.GetValue(slate) ?? PawnsArrivalModeDefOf.EdgeWalkIn;
            QuestPart_PawnsArrive pawnsArrive         = new QuestPart_PawnsArrive();

            pawnsArrive.inSignal = QuestGenUtility.HardcodedSignalWithQuestID(inSignal.GetValue(slate)) ?? QuestGen.slate.Get <string>("inSignal");
            pawnsArrive.pawns.AddRange(pawns.GetValue(slate));
            pawnsArrive.arrivalMode = pawnsArrivalModeDef;
            pawnsArrive.joinPlayer  = joinPlayer.GetValue(slate);
            pawnsArrive.mapParent   = QuestGen.slate.Get <Map>("map").Parent;
            if (pawnsArrivalModeDef.walkIn)
            {
                pawnsArrive.spawnNear = walkInSpot.GetValue(slate) ?? QuestGen.slate.Get <IntVec3?>("walkInSpot") ?? IntVec3.Invalid;
            }
            if (!customLetterLabel.GetValue(slate).NullOrEmpty() || customLetterLabelRules.GetValue(slate) != null)
            {
                QuestGen.AddTextRequest("root", delegate(string x)
                {
                    pawnsArrive.customLetterLabel = x;
                }, QuestGenUtility.MergeRules(customLetterLabelRules.GetValue(slate), customLetterLabel.GetValue(slate), "root"));
            }
            if (!customLetterText.GetValue(slate).NullOrEmpty() || customLetterTextRules.GetValue(slate) != null)
            {
                QuestGen.AddTextRequest("root", delegate(string x)
                {
                    pawnsArrive.customLetterText = x;
                }, QuestGenUtility.MergeRules(customLetterTextRules.GetValue(slate), customLetterText.GetValue(slate), "root"));
            }
            QuestGen.quest.AddPart(pawnsArrive);
            if (!isSingleReward.GetValue(slate))
            {
                return;
            }
            QuestPart_Choice questPart_Choice = new QuestPart_Choice();

            questPart_Choice.inSignalChoiceUsed = pawnsArrive.inSignal;
            QuestPart_Choice.Choice choice = new QuestPart_Choice.Choice();
            choice.questParts.Add(pawnsArrive);
            foreach (Pawn pawn in pawnsArrive.pawns)
            {
                choice.rewards.Add(new Reward_Pawn
                {
                    pawn          = pawn,
                    detailsHidden = rewardDetailsHidden.GetValue(slate)
                });
            }
            questPart_Choice.choices.Add(choice);
            QuestGen.quest.AddPart(questPart_Choice);
        }
Example #8
0
        public static void PawnsArrive(this Quest quest, IEnumerable <Pawn> pawns, string inSignal = null, MapParent mapParent = null, PawnsArrivalModeDef arrivalMode = null, bool joinPlayer = false, IntVec3?walkInSpot = null, string customLetterLabel = null, string customLetterText = null, RulePack customLetterLabelRules = null, RulePack customLetterTextRules = null, bool isSingleReward = false, bool rewardDetailsHidden = false)
        {
            _ = QuestGen.slate;
            PawnsArrivalModeDef   pawnsArrivalModeDef = arrivalMode ?? PawnsArrivalModeDefOf.EdgeWalkIn;
            QuestPart_PawnsArrive pawnsArrive         = new QuestPart_PawnsArrive();

            pawnsArrive.inSignal = QuestGenUtility.HardcodedSignalWithQuestID(inSignal) ?? QuestGen.slate.Get <string>("inSignal");
            pawnsArrive.pawns.AddRange(pawns);
            pawnsArrive.arrivalMode = pawnsArrivalModeDef;
            pawnsArrive.joinPlayer  = joinPlayer;
            pawnsArrive.mapParent   = mapParent ?? QuestGen.slate.Get <Map>("map").Parent;
            if (pawnsArrivalModeDef.walkIn)
            {
                pawnsArrive.spawnNear = walkInSpot ?? QuestGen.slate.Get <IntVec3?>("walkInSpot") ?? IntVec3.Invalid;
            }
            if (!customLetterLabel.NullOrEmpty() || customLetterLabelRules != null)
            {
                QuestGen.AddTextRequest("root", delegate(string x)
                {
                    pawnsArrive.customLetterLabel = x;
                }, QuestGenUtility.MergeRules(customLetterLabelRules, customLetterLabel, "root"));
            }
            if (!customLetterText.NullOrEmpty() || customLetterTextRules != null)
            {
                QuestGen.AddTextRequest("root", delegate(string x)
                {
                    pawnsArrive.customLetterText = x;
                }, QuestGenUtility.MergeRules(customLetterTextRules, customLetterText, "root"));
            }
            QuestGen.quest.AddPart(pawnsArrive);
            if (!isSingleReward)
            {
                return;
            }
            QuestPart_Choice questPart_Choice = new QuestPart_Choice();

            questPart_Choice.inSignalChoiceUsed = pawnsArrive.inSignal;
            QuestPart_Choice.Choice choice = new QuestPart_Choice.Choice();
            choice.questParts.Add(pawnsArrive);
            foreach (Pawn pawn in pawnsArrive.pawns)
            {
                choice.rewards.Add(new Reward_Pawn
                {
                    pawn          = pawn,
                    detailsHidden = rewardDetailsHidden
                });
            }
            questPart_Choice.choices.Add(choice);
            QuestGen.quest.AddPart(questPart_Choice);
        }
Example #9
0
        protected override void RunInt()
        {
            Slate             slate   = QuestGen.slate;
            QuestPart_Message message = new QuestPart_Message();

            message.inSignal    = (QuestGenUtility.HardcodedSignalWithQuestID(inSignal.GetValue(slate)) ?? slate.Get <string>("inSignal"));
            message.messageType = (messageType.GetValue(slate) ?? MessageTypeDefOf.NeutralEvent);
            message.lookTargets = QuestGenUtility.ToLookTargets(lookTargets, slate);
            QuestGen.AddTextRequest("root", delegate(string x)
            {
                message.message = x;
            }, QuestGenUtility.MergeRules(rules.GetValue(slate), text.GetValue(slate), "root"));
            QuestGen.quest.AddPart(message);
        }
Example #10
0
        public static QuestPart_Message Message(this Quest quest, string message, MessageTypeDef messageType = null, bool getLookTargetsFromSignal = false, RulePack rules = null, LookTargets lookTargets = null, string inSignal = null)
        {
            QuestPart_Message questPart = new QuestPart_Message();

            questPart.inSignal    = QuestGenUtility.HardcodedSignalWithQuestID(inSignal) ?? QuestGen.slate.Get <string>("inSignal");
            questPart.messageType = messageType ?? MessageTypeDefOf.NeutralEvent;
            questPart.lookTargets = lookTargets;
            questPart.getLookTargetsFromSignal = getLookTargetsFromSignal;
            QuestGen.AddTextRequest("root", delegate(string x)
            {
                questPart.message = x;
            }, QuestGenUtility.MergeRules(rules, message, "root"));
            QuestGen.quest.AddPart(questPart);
            return(questPart);
        }
Example #11
0
        protected override void RunInt()
        {
            Slate             slate   = QuestGen.slate;
            QuestPart_EndGame endGame = new QuestPart_EndGame();

            endGame.inSignal         = (QuestGenUtility.HardcodedSignalWithQuestID(inSignal.GetValue(slate)) ?? slate.Get <string>("inSignal"));
            endGame.signalListenMode = (signalListenMode.GetValue(slate) ?? QuestPart.SignalListenMode.OngoingOnly);
            QuestGen.AddTextRequest("root", delegate(string x)
            {
                endGame.introText = x;
            }, QuestGenUtility.MergeRules(introTextRules.GetValue(slate), introText.GetValue(slate), "root"));
            QuestGen.AddTextRequest("root", delegate(string x)
            {
                endGame.endingText = x;
            }, QuestGenUtility.MergeRules(endingTextRules.GetValue(slate), endingText.GetValue(slate), "root"));
            QuestGen.quest.AddPart(endGame);
        }
Example #12
0
        protected override void RunInt()
        {
            Slate slate = QuestGen.slate;

            if (contents.GetValue(slate) == null)
            {
                return;
            }
            QuestPart_DropPods dropPods = new QuestPart_DropPods();

            dropPods.inSignal = QuestGenUtility.HardcodedSignalWithQuestID(inSignal.GetValue(slate)) ?? QuestGen.slate.Get <string>("inSignal");
            if (!customLetterLabel.GetValue(slate).NullOrEmpty() || customLetterLabelRules.GetValue(slate) != null)
            {
                QuestGen.AddTextRequest("root", delegate(string x)
                {
                    dropPods.customLetterLabel = x;
                }, QuestGenUtility.MergeRules(customLetterLabelRules.GetValue(slate), customLetterLabel.GetValue(slate), "root"));
            }
            if (!customLetterText.GetValue(slate).NullOrEmpty() || customLetterTextRules.GetValue(slate) != null)
            {
                QuestGen.AddTextRequest("root", delegate(string x)
                {
                    dropPods.customLetterText = x;
                }, QuestGenUtility.MergeRules(customLetterTextRules.GetValue(slate), customLetterText.GetValue(slate), "root"));
            }
            dropPods.sendStandardLetter = sendStandardLetter.GetValue(slate) ?? dropPods.sendStandardLetter;
            dropPods.useTradeDropSpot   = useTradeDropSpot.GetValue(slate);
            dropPods.joinPlayer         = joinPlayer.GetValue(slate);
            dropPods.makePrisoners      = makePrisoners.GetValue(slate);
            dropPods.mapParent          = QuestGen.slate.Get <Map>("map").Parent;
            dropPods.Things             = contents.GetValue(slate);
            if (thingsToExcludeFromHyperlinks.GetValue(slate) != null)
            {
                dropPods.thingsToExcludeFromHyperlinks.AddRange(from t in thingsToExcludeFromHyperlinks.GetValue(slate)
                                                                select t.GetInnerIfMinified().def);
            }
            QuestGen.quest.AddPart(dropPods);
        }
Example #13
0
        public static QuestPart_DropPods DropPods(this Quest quest, MapParent mapParent, IEnumerable <Thing> contents, string customLetterLabel = null, RulePack customLetterLabelRules = null, string customLetterText = null, RulePack customLetterTextRules = null, bool?sendStandardLetter = true, bool useTradeDropSpot = false, bool joinPlayer = false, bool makePrisoners = false, string inSignal = null, IEnumerable <Thing> thingsToExcludeFromHyperlinks = null, QuestPart.SignalListenMode signalListenMode = QuestPart.SignalListenMode.OngoingOnly, IntVec3?dropSpot = null, bool destroyItemsOnCleanup = true)
        {
            QuestPart_DropPods dropPods = new QuestPart_DropPods();

            dropPods.inSignal         = QuestGenUtility.HardcodedSignalWithQuestID(inSignal) ?? QuestGen.slate.Get <string>("inSignal");
            dropPods.signalListenMode = signalListenMode;
            if (!customLetterLabel.NullOrEmpty() || customLetterLabelRules != null)
            {
                QuestGen.AddTextRequest("root", delegate(string x)
                {
                    dropPods.customLetterLabel = x;
                }, QuestGenUtility.MergeRules(customLetterLabelRules, customLetterLabel, "root"));
            }
            if (!customLetterText.NullOrEmpty() || customLetterTextRules != null)
            {
                QuestGen.AddTextRequest("root", delegate(string x)
                {
                    dropPods.customLetterText = x;
                }, QuestGenUtility.MergeRules(customLetterTextRules, customLetterText, "root"));
            }
            dropPods.sendStandardLetter    = sendStandardLetter ?? dropPods.sendStandardLetter;
            dropPods.useTradeDropSpot      = useTradeDropSpot;
            dropPods.joinPlayer            = joinPlayer;
            dropPods.makePrisoners         = makePrisoners;
            dropPods.mapParent             = mapParent;
            dropPods.Things                = contents;
            dropPods.destroyItemsOnCleanup = destroyItemsOnCleanup;
            if (dropSpot.HasValue)
            {
                dropPods.dropSpot = dropSpot.Value;
            }
            if (thingsToExcludeFromHyperlinks != null)
            {
                dropPods.thingsToExcludeFromHyperlinks.AddRange(thingsToExcludeFromHyperlinks.Select((Thing t) => t.GetInnerIfMinified().def));
            }
            QuestGen.quest.AddPart(dropPods);
            return(dropPods);
        }
Example #14
0
        public static QuestPart_Letter Letter(this Quest quest, LetterDef letterDef, string inSignal = null, string chosenPawnSignal = null, Faction relatedFaction = null, MapParent useColonistsOnMap = null, bool useColonistsFromCaravanArg = false, QuestPart.SignalListenMode signalListenMode = QuestPart.SignalListenMode.OngoingOnly, IEnumerable <object> lookTargets = null, bool filterDeadPawnsFromLookTargets = false, string text = null, RulePack textRules = null, string label = null, RulePack labelRules = null, string getColonistsFromSignal = null)
        {
            Slate            slate            = QuestGen.slate;
            QuestPart_Letter questPart_Letter = new QuestPart_Letter();

            questPart_Letter.inSignal = QuestGenUtility.HardcodedSignalWithQuestID(inSignal) ?? slate.Get <string>("inSignal");
            LetterDef letterDef2 = letterDef ?? LetterDefOf.NeutralEvent;

            if (typeof(ChoiceLetter).IsAssignableFrom(letterDef2.letterClass))
            {
                ChoiceLetter choiceLetter = LetterMaker.MakeLetter("error", "error", letterDef2, QuestGenUtility.ToLookTargets(lookTargets), relatedFaction, QuestGen.quest);
                questPart_Letter.letter = choiceLetter;
                QuestGen.AddTextRequest("root", delegate(string x)
                {
                    choiceLetter.label = x;
                }, QuestGenUtility.MergeRules(labelRules, label, "root"));
                QuestGen.AddTextRequest("root", delegate(string x)
                {
                    choiceLetter.text = x;
                }, QuestGenUtility.MergeRules(textRules, text, "root"));
            }
            else
            {
                questPart_Letter.letter                = LetterMaker.MakeLetter(letterDef2);
                questPart_Letter.letter.lookTargets    = QuestGenUtility.ToLookTargets(lookTargets);
                questPart_Letter.letter.relatedFaction = relatedFaction;
            }
            questPart_Letter.chosenPawnSignal               = QuestGenUtility.HardcodedSignalWithQuestID(chosenPawnSignal);
            questPart_Letter.useColonistsOnMap              = useColonistsOnMap;
            questPart_Letter.useColonistsFromCaravanArg     = useColonistsFromCaravanArg;
            questPart_Letter.signalListenMode               = signalListenMode;
            questPart_Letter.filterDeadPawnsFromLookTargets = filterDeadPawnsFromLookTargets;
            questPart_Letter.getColonistsFromSignal         = getColonistsFromSignal;
            QuestGen.quest.AddPart(questPart_Letter);
            return(questPart_Letter);
        }