protected override void GiveQuest(IncidentParms parms, QuestScriptDef questDef)
        {
            Slate slate = new Slate();

            slate.Set("points", parms.points);
            slate.Set("map", (Map)parms.target);
            QuestUtility.SendLetterQuestAvailable(QuestUtility.GenerateQuestAndMakeAvailable(questDef, slate));
        }
Esempio n. 2
0
        protected override bool TryExecuteWorker(IncidentParms parms)
        {
            Quest quest = QuestUtility.GenerateQuestAndMakeAvailable(def.questScriptDef ?? parms.questScriptDef ?? NaturalRandomQuestChooser.ChooseNaturalRandomQuest(parms.points, parms.target), parms.points);

            if (!quest.hidden)
            {
                QuestUtility.SendLetterQuestAvailable(quest);
            }
            return(true);
        }
Esempio n. 3
0
        public static void GenerateBestowingCeremonyQuest(Pawn pawn, Faction faction)
        {
            Slate slate = new Slate();

            slate.Set("titleHolder", pawn);
            slate.Set("bestowingFaction", faction);
            if (QuestScriptDefOf.BestowingCeremony.CanRun(slate))
            {
                QuestUtility.SendLetterQuestAvailable(QuestUtility.GenerateQuestAndMakeAvailable(QuestScriptDefOf.BestowingCeremony, slate));
            }
        }
Esempio n. 4
0
        private static DiaOption RequestAICoreQuest(Map map, Faction faction, Pawn negotiator)
        {
            TaggedString taggedString = "RequestAICoreInformation".Translate(ThingDefOf.AIPersonaCore.label, 1500.ToString());

            if (faction.PlayerGoodwill < 40)
            {
                DiaOption diaOption = new DiaOption(taggedString);
                diaOption.Disable("NeedGoodwill".Translate(40.ToString("F0")));
                return(diaOption);
            }
            bool  num   = PlayerItemAccessibilityUtility.ItemStashHas(ThingDefOf.AIPersonaCore);
            Slate slate = new Slate();

            slate.Set("points", StorytellerUtility.DefaultThreatPointsNow(Find.World));
            slate.Set("asker", faction.leader);
            slate.Set("itemStashSingleThing", ThingDefOf.AIPersonaCore);
            bool flag = QuestScriptDefOf.OpportunitySite_ItemStash.CanRun(slate);

            if (num || !flag)
            {
                DiaOption diaOption2 = new DiaOption(taggedString);
                diaOption2.Disable("NoKnownAICore".Translate(1500));
                return(diaOption2);
            }
            if (AmountSendableSilver(map) < 1500)
            {
                DiaOption diaOption3 = new DiaOption(taggedString);
                diaOption3.Disable("NeedSilverLaunchable".Translate(1500));
                return(diaOption3);
            }
            return(new DiaOption(taggedString)
            {
                action = delegate
                {
                    Quest quest = QuestUtility.GenerateQuestAndMakeAvailable(QuestScriptDefOf.OpportunitySite_ItemStash, slate);
                    if (!quest.hidden)
                    {
                        QuestUtility.SendLetterQuestAvailable(quest);
                    }
                    TradeUtility.LaunchThingsOfType(ThingDefOf.Silver, 1500, map, null);
                    Current.Game.GetComponent <GameComponent_OnetimeNotification>().sendAICoreRequestReminder = false;
                },
                link = new DiaNode("RequestAICoreInformationResult".Translate(faction.leader).CapitalizeFirst())
                {
                    options =
                    {
                        OKToRoot(faction, negotiator)
                    }
                }
            });
        }
Esempio n. 5
0
        public static DiaNode RoyalHeirChangeCandidates(Faction faction, Pawn factionRepresentative, Pawn negotiator)
        {
            DiaNode       diaNode = new DiaNode("ChooseHeir".Translate(negotiator.Named("HOLDER")));
            RoyalTitleDef title   = negotiator.royalty.GetCurrentTitle(faction);
            Pawn          heir2   = negotiator.royalty.GetHeir(faction);

            foreach (Pawn item in PawnsFinder.AllMaps_FreeColonistsAndPrisonersSpawned)
            {
                DiaOption diaOption = new DiaOption(item.Name.ToStringFull);
                if (item == negotiator || item == heir2)
                {
                    continue;
                }
                if (item.royalty != null)
                {
                    RoyalTitleDef currentTitle = item.royalty.GetCurrentTitle(faction);
                    if (currentTitle != null && currentTitle.seniority >= title.seniority)
                    {
                        continue;
                    }
                }
                if (item.IsQuestLodger())
                {
                    continue;
                }
                Pawn   heir         = item;
                Action confirmedAct = delegate
                {
                    QuestScriptDef changeRoyalHeir = QuestScriptDefOf.ChangeRoyalHeir;
                    Slate          slate           = new Slate();
                    slate.Set("points", title.changeHeirQuestPoints);
                    slate.Set("asker", factionRepresentative);
                    slate.Set("titleHolder", negotiator);
                    slate.Set("titleHeir", heir);
                    slate.Set("titlePreviousHeir", negotiator.royalty.GetHeir(faction));
                    Quest quest = QuestUtility.GenerateQuestAndMakeAvailable(changeRoyalHeir, slate);
                    if (!quest.hidden)
                    {
                        QuestUtility.SendLetterQuestAvailable(quest);
                    }
                };
                diaOption.link = RoyalHeirChangeConfirm(faction, negotiator, heir2, confirmedAct);
                diaNode.options.Add(diaOption);
            }
            DiaOption diaOption2 = new DiaOption("GoBack".Translate());

            diaOption2.linkLateBind = ResetToRoot(faction, negotiator);
            diaNode.options.Add(diaOption2);
            return(diaNode);
        }
Esempio n. 6
0
 protected virtual void GiveQuest(IncidentParms parms, QuestScriptDef questDef)
 {
     QuestUtility.SendLetterQuestAvailable(QuestUtility.GenerateQuestAndMakeAvailable(questDef, parms.points));
 }