예제 #1
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);
        }
        protected override void RunInt()
        {
            Slate slate = QuestGen.slate;
            int   value = duration.GetValue(slate);

            _ = QuestGen.quest;
            int         value2        = startOffsetTicks.GetValue(slate);
            IncidentDef value3        = incidentDef.GetValue(slate);
            Map         map           = slate.Get <Map>("map");
            float       value4        = points.GetValue(slate);
            Faction     value5        = faction.GetValue(slate);
            string      delayInSignal = slate.Get <string>("inSignal");
            string      disableSignal = QuestGenUtility.HardcodedSignalWithQuestID(inSignalDisable.GetValue(slate));
            int?        value6        = randomIncidents.GetValue(slate);

            if (value6.HasValue)
            {
                for (int i = 0; i < value6; i++)
                {
                    CreateDelayedIncident(Rand.Range(value2, value), delayInSignal, disableSignal, value3, map, value4, value5);
                }
            }
            int?value7 = intervalTicks.GetValue(slate);

            if (value7.HasValue)
            {
                int num = Mathf.FloorToInt((float)value / (float)value7.Value);
                for (int j = 0; j < num; j++)
                {
                    int delayTicks = Mathf.Max(j * value7.Value, value2);
                    CreateDelayedIncident(delayTicks, delayInSignal, disableSignal, value3, map, value4, value5);
                }
            }
        }
예제 #3
0
        protected override void RunInt()
        {
            Slate slate = QuestGen.slate;
            QuestPart_ShuttleLeaveDelay questPart_ShuttleLeaveDelay = new QuestPart_ShuttleLeaveDelay();

            questPart_ShuttleLeaveDelay.inSignalEnable    = (QuestGenUtility.HardcodedSignalWithQuestID(inSignalEnable.GetValue(slate)) ?? QuestGen.slate.Get <string>("inSignal"));
            questPart_ShuttleLeaveDelay.delayTicks        = delayTicks.GetValue(slate);
            questPart_ShuttleLeaveDelay.shuttle           = shuttle.GetValue(slate);
            questPart_ShuttleLeaveDelay.expiryInfoPart    = "ShuttleDepartsIn".Translate();
            questPart_ShuttleLeaveDelay.expiryInfoPartTip = "ShuttleDepartsOn".Translate();
            if (inSignalsDisable.GetValue(slate) != null)
            {
                foreach (string item in inSignalsDisable.GetValue(slate))
                {
                    questPart_ShuttleLeaveDelay.inSignalsDisable.Add(QuestGenUtility.HardcodedSignalWithQuestID(item));
                }
            }
            if (node != null)
            {
                QuestGenUtility.RunInnerNode(node, questPart_ShuttleLeaveDelay);
            }
            if (!outSignalComplete.GetValue(slate).NullOrEmpty())
            {
                questPart_ShuttleLeaveDelay.outSignalsCompleted.Add(QuestGenUtility.HardcodedSignalWithQuestID(outSignalComplete.GetValue(slate)));
            }
            QuestGen.quest.AddPart(questPart_ShuttleLeaveDelay);
        }
예제 #4
0
        protected override void RunInt()
        {
            Slate slate = QuestGen.slate;

            if (targets.GetValue(slate) != null)
            {
                string questTagToAdd = QuestGenUtility.HardcodedTargetQuestTagWithQuestID(tag.GetValue(slate));
                foreach (object item in targets.GetValue(slate))
                {
                    Thing thing = item as Thing;
                    if (thing != null)
                    {
                        QuestUtility.AddQuestTag(ref thing.questTags, questTagToAdd);
                    }
                    else
                    {
                        WorldObject worldObject = item as WorldObject;
                        if (worldObject != null)
                        {
                            QuestUtility.AddQuestTag(ref worldObject.questTags, questTagToAdd);
                        }
                    }
                }
            }
        }
예제 #5
0
        public static QuestPart_BetrayalOffer BetrayalOffer(this Quest quest, IEnumerable <Pawn> pawns, ExtraFaction extraFaction, Pawn asker, Action success = null, Action failure = null, Action enabled = null, IEnumerable <string> inSignals = null, string inSignalEnable = null, QuestPart.SignalListenMode signalListenMode = QuestPart.SignalListenMode.OngoingOnly)
        {
            QuestPart_BetrayalOffer questPart_BetrayalOffer = new QuestPart_BetrayalOffer();

            questPart_BetrayalOffer.pawns.AddRange(pawns);
            questPart_BetrayalOffer.asker            = asker;
            questPart_BetrayalOffer.extraFaction     = extraFaction;
            questPart_BetrayalOffer.inSignalEnable   = inSignalEnable ?? QuestGen.slate.Get <string>("inSignal");
            questPart_BetrayalOffer.signalListenMode = signalListenMode;
            if (inSignals != null)
            {
                questPart_BetrayalOffer.inSignals.AddRange(inSignals);
            }
            if (success != null)
            {
                string text = QuestGen.GenerateNewSignal("BetrayalOfferSuccess");
                QuestGenUtility.RunInner(success, text);
                questPart_BetrayalOffer.outSignalSuccess = text;
            }
            if (failure != null)
            {
                string text2 = QuestGen.GenerateNewSignal("BetrayalOfferFailure");
                QuestGenUtility.RunInner(failure, text2);
                questPart_BetrayalOffer.outSignalFailure = text2;
            }
            if (enabled != null)
            {
                string text3 = QuestGen.GenerateNewSignal("BetrayalOfferEnabled");
                QuestGenUtility.RunInner(enabled, text3);
                questPart_BetrayalOffer.outSignalEnabled = text3;
            }
            quest.AddPart(questPart_BetrayalOffer);
            return(questPart_BetrayalOffer);
        }
        public static QuestPart_ShuttleLeaveDelay ShuttleLeaveDelay(this Quest quest, Thing shuttle, int delayTicks, string inSignalEnable = null, IEnumerable <string> inSignalsDisable = null, string outSignalComplete = null, Action complete = null)
        {
            QuestPart_ShuttleLeaveDelay questPart_ShuttleLeaveDelay = new QuestPart_ShuttleLeaveDelay();

            questPart_ShuttleLeaveDelay.inSignalEnable    = inSignalEnable ?? QuestGen.slate.Get <string>("inSignal");
            questPart_ShuttleLeaveDelay.delayTicks        = delayTicks;
            questPart_ShuttleLeaveDelay.shuttle           = shuttle;
            questPart_ShuttleLeaveDelay.expiryInfoPart    = "ShuttleDepartsIn".Translate();
            questPart_ShuttleLeaveDelay.expiryInfoPartTip = "ShuttleDepartsOn".Translate();
            if (inSignalsDisable != null)
            {
                foreach (string item in inSignalsDisable)
                {
                    questPart_ShuttleLeaveDelay.inSignalsDisable.Add(item);
                }
            }
            if (!outSignalComplete.NullOrEmpty())
            {
                questPart_ShuttleLeaveDelay.outSignalsCompleted.Add(outSignalComplete);
            }
            if (complete != null)
            {
                string text = QuestGen.GenerateNewSignal("ShuttleLeaveDelay");
                QuestGenUtility.RunInner(complete, text);
                questPart_ShuttleLeaveDelay.outSignalsCompleted.Add(text);
            }
            quest.AddPart(questPart_ShuttleLeaveDelay);
            return(questPart_ShuttleLeaveDelay);
        }
예제 #7
0
        protected override void RunInt()
        {
            Slate slate = QuestGen.slate;

            if (((outSignals.GetValue(slate) != null) ? outSignals.GetValue(slate).Count() : 0) + ((node != null) ? 1 : 0) == 0)
            {
                return;
            }
            QuestPart_PassActivable questPart_PassActivable = new QuestPart_PassActivable();

            QuestGen.quest.AddPart(questPart_PassActivable);
            questPart_PassActivable.inSignalEnable  = QuestGenUtility.HardcodedSignalWithQuestID(inSignalEnable.GetValue(slate)) ?? slate.Get <string>("inSignal");
            questPart_PassActivable.inSignalDisable = QuestGenUtility.HardcodedSignalWithQuestID(inSignalDisable.GetValue(slate));
            questPart_PassActivable.inSignal        = QuestGenUtility.HardcodedSignalWithQuestID(inSignal.GetValue(slate));
            if (node != null)
            {
                QuestGenUtility.RunInnerNode(node, questPart_PassActivable.OutSignalCompleted);
            }
            IEnumerable <string> value = outSignals.GetValue(slate);

            if (value != null)
            {
                foreach (string item in value)
                {
                    questPart_PassActivable.outSignalsCompleted.Add(QuestGenUtility.HardcodedSignalWithQuestID(item));
                }
            }
            questPart_PassActivable.signalListenMode = signalListenMode.GetValue(slate) ?? QuestPart.SignalListenMode.OngoingOnly;
        }
        public static void Resolve()
        {
            List <QuestTextRequest> textRequestsReadOnly = QuestGen.TextRequestsReadOnly;

            for (int i = 0; i < textRequestsReadOnly.Count; i++)
            {
                try
                {
                    List <Rule> list = new List <Rule>();
                    list.AddRange(QuestGen.QuestDescriptionRulesReadOnly);
                    list.AddRange(QuestGen.QuestContentRulesReadOnly);
                    if (textRequestsReadOnly[i].extraRules != null)
                    {
                        list.AddRange(textRequestsReadOnly[i].extraRules);
                    }
                    string obj = QuestGenUtility.ResolveAbsoluteText(list, QuestGen.QuestDescriptionConstantsReadOnly, textRequestsReadOnly[i].keyword);
                    textRequestsReadOnly[i].setter(obj);
                }
                catch (Exception arg)
                {
                    Log.Error("Error while resolving text request: " + arg);
                }
            }
            textRequestsReadOnly.Clear();
        }
예제 #9
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);
        }
예제 #10
0
        public static QuestPart_PassActivable SignalPassActivable(this Quest quest, Action action = null, string inSignalEnable = null, string inSignal = null, string outSignalCompleted = null, IEnumerable <string> outSignalsCompleted = null, string inSignalDisable = null, bool reactivatable = false)
        {
            QuestPart_PassActivable questPart_PassActivable = new QuestPart_PassActivable();

            questPart_PassActivable.inSignalEnable  = inSignalEnable ?? QuestGen.slate.Get <string>("inSignal");
            questPart_PassActivable.inSignalDisable = inSignalDisable;
            questPart_PassActivable.inSignal        = inSignal;
            questPart_PassActivable.reactivatable   = reactivatable;
            if (action != null)
            {
                string text = QuestGen.GenerateNewSignal("OuterNodeCompleted");
                QuestGenUtility.RunInner(action, text);
                questPart_PassActivable.outSignalsCompleted.Add(text);
            }
            if (outSignalsCompleted != null)
            {
                questPart_PassActivable.outSignalsCompleted.AddRange(outSignalsCompleted);
            }
            if (!outSignalCompleted.NullOrEmpty())
            {
                questPart_PassActivable.outSignalsCompleted.Add(outSignalCompleted);
            }
            quest.AddPart(questPart_PassActivable);
            return(questPart_PassActivable);
        }
예제 #11
0
        protected override void RunInt()
        {
            Slate slate = QuestGen.slate;
            PawnGenerationRequest request = new PawnGenerationRequest(kindDef.GetValue(slate), faction.GetValue(slate), PawnGenerationContext.NonPlayer, -1, forceGenerateNewPawn: false, newborn: false, allowDead: false, allowDowned: false, canGeneratePawnRelations: true, allowAddictions: allowAddictions.GetValue(slate) ?? true, forcedTraits: forcedTraits.GetValue(slate), biocodeWeaponChance: biocodeWeaponChance.GetValue(slate), mustBeCapableOfViolence: mustBeCapableOfViolence.GetValue(slate), colonistRelationChanceFactor: 1f, forceAddFreeWarmLayerIfNeeded: false, allowGay: true, allowFood: true, inhabitant: false, certainlyBeenInCryptosleep: false, forceRedressWorldPawnIfFormerColonist: false, worldPawnFactionDoesntMatter: false, extraPawnForExtraRelationChance: extraPawnForExtraRelationChance.GetValue(slate), relationWithExtraPawnChanceFactor: relationWithExtraPawnChanceFactor.GetValue(slate));

            request.BiocodeApparelChance = biocodeApparelChance.GetValue(slate);
            Pawn pawn = PawnGenerator.GeneratePawn(request);

            if (ensureNonNumericName.GetValue(slate) && (pawn.Name == null || pawn.Name.Numerical))
            {
                pawn.Name = PawnBioAndNameGenerator.GeneratePawnName(pawn);
            }
            if (storeAs.GetValue(slate) != null)
            {
                QuestGen.slate.Set(storeAs.GetValue(slate), pawn);
            }
            if (addToList.GetValue(slate) != null)
            {
                QuestGenUtility.AddToOrMakeList(QuestGen.slate, addToList.GetValue(slate), pawn);
            }
            if (addToLists.GetValue(slate) != null)
            {
                foreach (string item in addToLists.GetValue(slate))
                {
                    QuestGenUtility.AddToOrMakeList(QuestGen.slate, item, pawn);
                }
            }
            QuestGen.AddToGeneratedPawns(pawn);
            if (!pawn.IsWorldPawn())
            {
                Find.WorldPawns.PassToWorld(pawn);
            }
        }
예제 #12
0
        protected override void RunInt()
        {
            Slate  slate = QuestGen.slate;
            string var   = QuestGenUtility.ResolveLocalTextWithDescriptionRules(rules.GetValue(slate), root.GetValue(slate));

            slate.Set(storeAs.GetValue(slate), var);
        }
예제 #13
0
        private static string GenerateName()
        {
            GrammarRequest req = default(GrammarRequest);

            req.Rules.AddRange(QuestGen.QuestNameRulesReadOnly);
            foreach (KeyValuePair <string, string> item in QuestGen.QuestNameConstantsReadOnly)
            {
                req.Constants.Add(item.Key, item.Value);
            }
            QuestGenUtility.AddSlateVars(ref req);
            Predicate <string> predicate = (string x) => !Find.QuestManager.QuestsListForReading.Any((Quest y) => y.name == x);

            if (QuestGen.Root.nameMustBeUnique)
            {
                return(NameGenerator.GenerateName(req, predicate, appendNumberIfNameUsed: false, "questName"));
            }
            string text = null;
            int    i;

            for (i = 0; i < 20; i++)
            {
                text = NameGenerator.GenerateName(req, null, appendNumberIfNameUsed: false, "questName");
                if (predicate(text))
                {
                    break;
                }
            }
            if (i == 20)
            {
                Log.Warning("Generated duplicate quest name. QuestScriptDef: " + QuestGen.Root + ". Quest name: " + text);
            }
            return(text);
        }
        protected override void RunInt()
        {
            Slate slate = QuestGen.slate;
            QuestPart_GiveRoyalFavor questPart_GiveRoyalFavor = new QuestPart_GiveRoyalFavor();

            questPart_GiveRoyalFavor.giveTo         = giveTo.GetValue(slate);
            questPart_GiveRoyalFavor.giveToAccepter = giveToAccepter.GetValue(slate);
            questPart_GiveRoyalFavor.faction        = faction.GetValue(slate) ?? factionOf.GetValue(slate).Faction;
            questPart_GiveRoyalFavor.amount         = amount.GetValue(slate);
            questPart_GiveRoyalFavor.inSignal       = QuestGenUtility.HardcodedSignalWithQuestID(inSignal.GetValue(slate)) ?? QuestGen.slate.Get <string>("inSignal");
            QuestGen.quest.AddPart(questPart_GiveRoyalFavor);
            if (isSingleReward.GetValue(slate))
            {
                QuestPart_Choice questPart_Choice = new QuestPart_Choice();
                questPart_Choice.inSignalChoiceUsed = questPart_GiveRoyalFavor.inSignal;
                QuestPart_Choice.Choice choice = new QuestPart_Choice.Choice();
                choice.questParts.Add(questPart_GiveRoyalFavor);
                choice.rewards.Add(new Reward_RoyalFavor
                {
                    faction = questPart_GiveRoyalFavor.faction,
                    amount  = questPart_GiveRoyalFavor.amount
                });
                questPart_Choice.choices.Add(choice);
                QuestGen.quest.AddPart(questPart_Choice);
            }
        }
예제 #15
0
        protected override void RunInt()
        {
            Slate                 slate  = QuestGen.slate;
            MapParent             parent = slate.Get <Map>("map").Parent;
            string                text   = QuestGen.GenerateNewSignal("PawnOfRaceKilled");
            QuestPart_PawnsKilled questPart_PawnsKilled = new QuestPart_PawnsKilled();

            questPart_PawnsKilled.inSignalEnable            = (QuestGenUtility.HardcodedSignalWithQuestID(inSignalEnable.GetValue(slate)) ?? QuestGen.slate.Get <string>("inSignal"));
            questPart_PawnsKilled.race                      = race.GetValue(slate);
            questPart_PawnsKilled.requiredInstigatorFaction = Faction.OfPlayer;
            questPart_PawnsKilled.count                     = count.GetValue(slate);
            questPart_PawnsKilled.mapParent                 = parent;
            questPart_PawnsKilled.outSignalPawnKilled       = text;
            if (node != null)
            {
                QuestGenUtility.RunInnerNode(node, questPart_PawnsKilled);
            }
            if (!outSignalComplete.GetValue(slate).NullOrEmpty())
            {
                questPart_PawnsKilled.outSignalsCompleted.Add(QuestGenUtility.HardcodedSignalWithQuestID(outSignalComplete.GetValue(slate)));
            }
            QuestGen.quest.AddPart(questPart_PawnsKilled);
            QuestPart_PawnsAvailable questPart_PawnsAvailable = new QuestPart_PawnsAvailable();

            questPart_PawnsAvailable.inSignalEnable = (QuestGenUtility.HardcodedSignalWithQuestID(inSignalEnable.GetValue(slate)) ?? QuestGen.slate.Get <string>("inSignal"));
            if (!outSignalPawnsNotAvailable.GetValue(slate).NullOrEmpty())
            {
                questPart_PawnsAvailable.outSignalPawnsNotAvailable = QuestGenUtility.HardcodedSignalWithQuestID(outSignalPawnsNotAvailable.GetValue(slate));
            }
            questPart_PawnsAvailable.race              = race.GetValue(slate);
            questPart_PawnsAvailable.requiredCount     = count.GetValue(slate);
            questPart_PawnsAvailable.mapParent         = parent;
            questPart_PawnsAvailable.inSignalDecrement = text;
            QuestGen.quest.AddPart(questPart_PawnsAvailable);
        }
예제 #16
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);
            }
        }
예제 #17
0
        protected override void RunInt()
        {
            Slate                   slate                   = QuestGen.slate;
            float                   points                  = QuestGen.slate.Get("points", 0f);
            GameCondition           gameCondition           = GameConditionMaker.MakeCondition(this.gameCondition.GetValue(slate), duration.GetValue(slate));
            QuestPart_GameCondition questPart_GameCondition = new QuestPart_GameCondition();

            questPart_GameCondition.gameCondition = gameCondition;
            List <Rule> list = new List <Rule>();
            Dictionary <string, string> dictionary = new Dictionary <string, string>();

            if (targetWorld.GetValue(slate))
            {
                questPart_GameCondition.targetWorld = true;
                gameCondition.RandomizeSettings(points, null, list, dictionary);
            }
            else
            {
                Map map = GetMap(QuestGen.slate);
                questPart_GameCondition.mapParent = map.Parent;
                gameCondition.RandomizeSettings(points, map, list, dictionary);
            }
            questPart_GameCondition.inSignal = (QuestGenUtility.HardcodedSignalWithQuestID(inSignal.GetValue(slate)) ?? QuestGen.slate.Get <string>("inSignal"));
            QuestGen.quest.AddPart(questPart_GameCondition);
            if (!storeGameConditionDescriptionFutureAs.GetValue(slate).NullOrEmpty())
            {
                slate.Set(storeGameConditionDescriptionFutureAs.GetValue(slate), gameCondition.def.descriptionFuture);
            }
            QuestGen.AddQuestNameRules(list);
            QuestGen.AddQuestDescriptionRules(list);
            QuestGen.AddQuestDescriptionConstants(dictionary);
        }
예제 #18
0
        protected override void RunInt()
        {
            Slate slate = QuestGen.slate;
            Map   map   = slate.Get <Map>("map");
            QuestPart_ThreatsGenerator questPart_ThreatsGenerator = new QuestPart_ThreatsGenerator();

            questPart_ThreatsGenerator.threatStartTicks = threatStartTicks.GetValue(slate);
            questPart_ThreatsGenerator.inSignalEnable   = (QuestGenUtility.HardcodedSignalWithQuestID(inSignalEnable.GetValue(slate)) ?? slate.Get <string>("inSignal"));
            questPart_ThreatsGenerator.inSignalDisable  = QuestGenUtility.HardcodedSignalWithQuestID(inSignalDisable.GetValue(slate));
            ThreatsGeneratorParams value = parms.GetValue(slate);

            value.faction = (faction.GetValue(slate) ?? value.faction);
            questPart_ThreatsGenerator.parms     = value;
            questPart_ThreatsGenerator.mapParent = map.Parent;
            QuestGen.quest.AddPart(questPart_ThreatsGenerator);
            if (!storeThreatExampleAs.GetValue(slate).NullOrEmpty())
            {
                PawnGroupMakerParms pawnGroupMakerParms = new PawnGroupMakerParms();
                pawnGroupMakerParms.groupKind    = PawnGroupKindDefOf.Combat;
                pawnGroupMakerParms.raidStrategy = RaidStrategyDefOf.ImmediateAttack;
                pawnGroupMakerParms.faction      = (value.faction ?? (from x in Find.FactionManager.GetFactions(allowHidden: false, allowDefeated: false, allowNonHumanlike: true, TechLevel.Industrial)
                                                                      where x.HostileTo(Faction.OfPlayer)
                                                                      select x).RandomElement());
                float num = value.threatPoints ?? (StorytellerUtility.DefaultThreatPointsNow(map) * value.currentThreatPointsFactor);
                if (value.minThreatPoints.HasValue)
                {
                    num = Mathf.Max(num, value.minThreatPoints.Value);
                }
                pawnGroupMakerParms.points = IncidentWorker_Raid.AdjustedRaidPoints(num, PawnsArrivalModeDefOf.EdgeWalkIn, RaidStrategyDefOf.ImmediateAttack, pawnGroupMakerParms.faction, PawnGroupKindDefOf.Combat);
                IEnumerable <PawnKindDef> pawnKinds = PawnGroupMakerUtility.GeneratePawnKindsExample(pawnGroupMakerParms);
                slate.Set(storeThreatExampleAs.GetValue(slate), PawnUtility.PawnKindsToLineList(pawnKinds, "  - "));
            }
        }
        protected override void RunInt()
        {
            Slate slate = QuestGen.slate;
            QuestPart_DestroyWorldObject questPart_DestroyWorldObject = new QuestPart_DestroyWorldObject();

            questPart_DestroyWorldObject.worldObject = worldObject.GetValue(slate);
            questPart_DestroyWorldObject.inSignal    = (QuestGenUtility.HardcodedSignalWithQuestID(inSignal.GetValue(slate)) ?? QuestGen.slate.Get <string>("inSignal"));
            QuestGen.quest.AddPart(questPart_DestroyWorldObject);
        }
예제 #20
0
 public static void Resolve()
 {
     if (!QuestGen.slate.TryGet <string>("resolvedQuestDescription", out var var))
     {
         var = QuestGenUtility.ResolveAbsoluteText(QuestGen.QuestDescriptionRulesReadOnly, QuestGen.QuestDescriptionConstantsReadOnly, "questDescription");
         QuestGen.slate.Set("resolvedQuestDescription", var);
     }
     QuestGen.quest.description = var;
 }
예제 #21
0
        protected override void RunInt()
        {
            Slate         slate         = QuestGen.slate;
            QuestPart_Log questPart_Log = new QuestPart_Log();

            questPart_Log.inSignal = (QuestGenUtility.HardcodedSignalWithQuestID(inSignal.GetValue(slate)) ?? QuestGen.slate.Get <string>("inSignal"));
            questPart_Log.message  = message.GetValue(slate);
            QuestGen.quest.AddPart(questPart_Log);
        }
예제 #22
0
        protected override bool TestRunInt(Slate slate)
        {
            List <object> list = value.GetValue(slate);

            if (list != null)
            {
                QuestGenUtility.AddRangeToOrMakeList(slate, name.GetValue(slate), list);
            }
            return(true);
        }
        protected override void RunInt()
        {
            Slate slate = QuestGen.slate;
            QuestPart_FactionGoodwillChange questPart_FactionGoodwillChange = new QuestPart_FactionGoodwillChange();

            questPart_FactionGoodwillChange.change   = change.GetValue(slate);
            questPart_FactionGoodwillChange.faction  = (faction.GetValue(slate) ?? factionOf.GetValue(slate).Faction);
            questPart_FactionGoodwillChange.inSignal = (QuestGenUtility.HardcodedSignalWithQuestID(inSignal.GetValue(slate)) ?? QuestGen.slate.Get <string>("inSignal"));
            QuestGen.quest.AddPart(questPart_FactionGoodwillChange);
        }
예제 #24
0
        protected override void RunInt()
        {
            Slate         slate = QuestGen.slate;
            List <object> list  = value.GetValue(slate);

            if (list != null)
            {
                QuestGenUtility.AddRangeToOrMakeList(slate, name.GetValue(slate), list);
            }
        }
예제 #25
0
        public static QuestPart_FeedPawns FeedPawns(this Quest quest, IEnumerable <Pawn> pawns = null, Thing pawnsInTransporter = null, string inSignal = null)
        {
            QuestPart_FeedPawns questPart_FeedPawns = new QuestPart_FeedPawns();

            questPart_FeedPawns.pawnsInTransporter = pawnsInTransporter;
            questPart_FeedPawns.pawns    = pawns?.ToList();
            questPart_FeedPawns.inSignal = QuestGenUtility.HardcodedSignalWithQuestID(inSignal) ?? QuestGen.slate.Get <string>("inSignal");
            quest.AddPart(questPart_FeedPawns);
            return(questPart_FeedPawns);
        }
        protected override void RunInt()
        {
            Slate slate = QuestGen.slate;
            QuestPart_DropMonumentMarkerCopy questPart_DropMonumentMarkerCopy = new QuestPart_DropMonumentMarkerCopy();

            questPart_DropMonumentMarkerCopy.mapParent       = slate.Get <Map>("map").Parent;
            questPart_DropMonumentMarkerCopy.inSignal        = (QuestGenUtility.HardcodedSignalWithQuestID(inSignal.GetValue(slate)) ?? slate.Get <string>("inSignal"));
            questPart_DropMonumentMarkerCopy.outSignalResult = QuestGenUtility.HardcodedSignalWithQuestID(outSignalResult.GetValue(slate));
            QuestGen.quest.AddPart(questPart_DropMonumentMarkerCopy);
        }
예제 #27
0
        public static QuestPart_SpawnWorldObject SpawnWorldObject(this Quest quest, WorldObject worldObject, List <ThingDef> defsToExcludeFromHyperlinks = null, string inSignal = null)
        {
            QuestPart_SpawnWorldObject questPart_SpawnWorldObject = new QuestPart_SpawnWorldObject();

            questPart_SpawnWorldObject.inSignal = QuestGenUtility.HardcodedSignalWithQuestID(inSignal) ?? QuestGen.slate.Get <string>("inSignal");
            questPart_SpawnWorldObject.defsToExcludeFromHyperlinks = defsToExcludeFromHyperlinks;
            questPart_SpawnWorldObject.worldObject = worldObject;
            quest.AddPart(questPart_SpawnWorldObject);
            return(questPart_SpawnWorldObject);
        }
예제 #28
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))
            });
        }
예제 #29
0
 public static void AddQuestContentRules(List <Rule> rules)
 {
     if (!working)
     {
         Log.Error("Tried to add quest content rules while not resolving any quest.");
     }
     else
     {
         questContentRules.AddRange(QuestGenUtility.AppendCurrentPrefix(rules));
     }
 }
        public static QuestPart_SetFactionRelations SetFactionRelations(this Quest quest, Faction faction, FactionRelationKind relationKind, string inSignal = null, bool?canSendLetter = null)
        {
            QuestPart_SetFactionRelations questPart_SetFactionRelations = new QuestPart_SetFactionRelations();

            questPart_SetFactionRelations.inSignal      = QuestGenUtility.HardcodedSignalWithQuestID(inSignal) ?? QuestGen.slate.Get <string>("inSignal");
            questPart_SetFactionRelations.faction       = faction;
            questPart_SetFactionRelations.relationKind  = relationKind;
            questPart_SetFactionRelations.canSendLetter = canSendLetter ?? true;
            quest.AddPart(questPart_SetFactionRelations);
            return(questPart_SetFactionRelations);
        }