Beispiel #1
0
        protected override void RunInt()
        {
            var slate = QuestGen.slate;
            var pawn  = target.GetValue(slate);
            var range = sapienceRange.GetValue(slate);

            if (pawn == null)
            {
                throw new QuestException($"required quest parameter {nameof(target)} is not set in node {nameof(TransformPawn)}");
            }
            var tfTarget = GetTransformations(slate).RandomElement();

            if (tfTarget == null)
            {
                Log.Error($"{nameof(TransformPawn)} Could not get valid transformation target!");
                return;
            }

            var sig    = (QuestGenUtility.HardcodedSignalWithQuestID(inSignal.GetValue(slate)) ?? slate.Get <string>("inSignal"));
            var quest  = QuestGen.quest;
            var tfPart = new Part_TransformPawn()
            {
                target      = pawn,
                inSignal    = sig,
                pawnKind    = tfTarget,
                debugLabel  = "TransformPawn",
                maxSapience = range.max,
                minSapience = range.min,
            };

            quest.AddPart(tfPart);
        }
        protected override void RunInt()
        {
            Slate slate = QuestGen.slate;
            PawnsArrivalModeDef pawnsArrivalModeDef = this.arrivalMode.GetValue(slate) ?? PawnsArrivalModeDefOf.EdgeWalkIn;

            // this line is the only thing changed (we are using custom QuestPart)
            var pawnsArrive = new Kyrun.Reunion.QuestPart_PawnsArrive();

            pawnsArrive.inSignal = (QuestGenUtility.HardcodedSignalWithQuestID(this.inSignal.GetValue(slate)) ?? QuestGen.slate.Get <string>("inSignal", null, false));
            pawnsArrive.pawns.AddRange(this.pawns.GetValue(slate));
            pawnsArrive.arrivalMode = pawnsArrivalModeDef;
            pawnsArrive.joinPlayer  = this.joinPlayer.GetValue(slate);
            pawnsArrive.mapParent   = QuestGen.slate.Get <Map>("map", null, false).Parent;
            if (pawnsArrivalModeDef.walkIn)
            {
                pawnsArrive.spawnNear = (this.walkInSpot.GetValue(slate) ?? (QuestGen.slate.Get <IntVec3?>("walkInSpot", null, false) ?? IntVec3.Invalid));
            }
            if (!this.customLetterLabel.GetValue(slate).NullOrEmpty() || this.customLetterLabelRules.GetValue(slate) != null)
            {
                QuestGen.AddTextRequest("root", delegate(string x)
                {
                    pawnsArrive.customLetterLabel = x;
                }, QuestGenUtility.MergeRules(this.customLetterLabelRules.GetValue(slate), this.customLetterLabel.GetValue(slate), "root"));
            }
            if (!this.customLetterText.GetValue(slate).NullOrEmpty() || this.customLetterTextRules.GetValue(slate) != null)
            {
                QuestGen.AddTextRequest("root", delegate(string x)
                {
                    pawnsArrive.customLetterText = x;
                }, QuestGenUtility.MergeRules(this.customLetterTextRules.GetValue(slate), this.customLetterText.GetValue(slate), "root"));
            }
            QuestGen.quest.AddPart(pawnsArrive);
        }
        protected override void RunInt()
        {
            var slate        = QuestGen.slate;
            var numMutations = addRange.GetValue(slate).RandomInRange;

            if (numMutations == 0)
            {
                return;
            }

            var mPawn = pawn.GetValue(slate);

            if (mPawn == null)
            {
                throw new QuestException($"required pawn ${nameof(pawn)}/\"{((ISlateRef) pawn).SlateRef}\" is missing!");
            }
            var sig = (QuestGenUtility.HardcodedSignalWithQuestID(inSignal.GetValue(slate)) ?? slate.Get <string>("inSignal"));


            var allMutations = GetAllAvailableMutations(slate).Distinct().ToList();
            var part         = new Part_MutatePawn()
            {
                target     = mPawn,
                countToAdd = numMutations,
                debugLabel = "Mutate Pawn",
                mutations  = allMutations,
                inSignal   = sig
            };

            QuestGen.quest.AddPart(part);
        }
Beispiel #4
0
        protected override void RunInt()
        {
            GameComponentCentaurStory.trishotTraceEnabled = true;
            Find.ResearchManager.AddTechprints(CentaurStoryProjectStep1Def, 1);
            Find.ResearchManager.FinishProject(CentaurStoryProjectStep1Def, false, null);

            Slate            slate            = QuestGen.slate;
            QuestPart_Choice questPart_Choice = new QuestPart_Choice
            {
                inSignalChoiceUsed = QuestGenUtility.HardcodedSignalWithQuestID(inSignalChoiceUsed.GetValue(slate))
            };

            QuestPart_Choice.Choice choice = new QuestPart_Choice.Choice();

            choice.rewards.Add(new Reward_FisteverTrishot_Trishot());
            choice.rewards.Add(new Reward_CentaurStoryProgress_Start());

            questPart_Choice.choices.Add(choice);

            QuestPart_HyperLinks questPart_HyperLinks = new QuestPart_HyperLinks()
            {
                DefDatabase <ThingDef> .GetNamed("FabricationBench"),
                DefDatabase <RecipeDef> .GetNamed("Repair_Trishot_1Stage"),
            };

            QuestGen.quest.AddPart(questPart_Choice);
            QuestGen.quest.AddPart(questPart_HyperLinks);
        }
        protected override void RunInt()
        {
            Slate slate = QuestGen.slate;
            QuestPart_ReplaceLostLeaderReferences questPart_ReplaceLostLeaderReferences = new QuestPart_ReplaceLostLeaderReferences();

            questPart_ReplaceLostLeaderReferences.inSignal         = QuestGenUtility.HardcodedSignalWithQuestID(inSignal.GetValue(slate));
            questPart_ReplaceLostLeaderReferences.signalListenMode = signalListenMode.GetValue(slate) ?? QuestPart.SignalListenMode.OngoingOnly;
            QuestGen.quest.AddPart(questPart_ReplaceLostLeaderReferences);
        }
Beispiel #6
0
        public static void Log(this Quest quest, string message, string inSignal = null, QuestPart.SignalListenMode signalListenMode = QuestPart.SignalListenMode.OngoingOnly)
        {
            QuestPart_Log questPart_Log = new QuestPart_Log();

            questPart_Log.inSignal         = QuestGenUtility.HardcodedSignalWithQuestID(inSignal) ?? QuestGen.slate.Get <string>("inSignal");
            questPart_Log.signalListenMode = signalListenMode;
            questPart_Log.message          = message;
            quest.AddPart(questPart_Log);
        }
 protected override void AddSpawnPawnQuestParts(Quest quest, Map map, Pawn pawn)
 {
     this.signalAccept = QuestGenUtility.HardcodedSignalWithQuestID("Accept");
     this.signalReject = QuestGenUtility.HardcodedSignalWithQuestID("Reject");
     quest.Signal(this.signalAccept, delegate
     {
         quest.SetFaction(Gen.YieldSingle <Pawn>(pawn), Faction.OfPlayer, null);
         quest.PawnsArrive(Gen.YieldSingle <Pawn>(pawn), null, map.Parent, null, false, null, null, null, null, null, false, false, true);
         quest.End(QuestEndOutcome.Success, 0, null, null, QuestPart.SignalListenMode.OngoingOnly, false);
     }, null, QuestPart.SignalListenMode.OngoingOnly);
     quest.Signal(this.signalReject, delegate
     {
         quest.GiveDiedOrDownedThoughts(pawn, PawnDiedOrDownedThoughtsKind.DeniedJoining, null);
         quest.End(QuestEndOutcome.Fail, 0, null, null, QuestPart.SignalListenMode.OngoingOnly, false);
     }, null, QuestPart.SignalListenMode.OngoingOnly);
 }
Beispiel #8
0
        public override IEnumerable <QuestPart> GenerateQuestParts(int index, RewardsGeneratorParams parms, string customLetterLabel, string customLetterText, RulePack customLetterLabelRules, RulePack customLetterTextRules)
        {
            Slate slate = RimWorld.QuestGen.QuestGen.slate;
            QuestPart_GiveRoyalFavor questPart_GiveRoyalFavor = new QuestPart_GiveRoyalFavor();

            questPart_GiveRoyalFavor.faction = faction;
            questPart_GiveRoyalFavor.amount  = amount;
            if (!parms.chosenPawnSignal.NullOrEmpty())
            {
                questPart_GiveRoyalFavor.inSignal         = QuestGenUtility.HardcodedSignalWithQuestID(parms.chosenPawnSignal);
                questPart_GiveRoyalFavor.signalListenMode = QuestPart.SignalListenMode.Always;
            }
            else
            {
                questPart_GiveRoyalFavor.inSignal       = slate.Get <string>("inSignal");
                questPart_GiveRoyalFavor.giveToAccepter = true;
            }
            yield return(questPart_GiveRoyalFavor);

            slate.Set("royalFavorReward_amount", amount);
        }