public static QuestPart_Filter_FactionHostileToOtherFaction FactionHostileToOtherFaction(this Quest quest, Faction faction, Faction other, Action action = null, Action elseAction = null, string inSignal = null, string outSignal = null, string outSignalElse = null, QuestPart.SignalListenMode signalListenMode = QuestPart.SignalListenMode.OngoingOnly) { QuestPart_Filter_FactionHostileToOtherFaction questPart_Filter_FactionHostileToOtherFaction = new QuestPart_Filter_FactionHostileToOtherFaction(); questPart_Filter_FactionHostileToOtherFaction.inSignal = QuestGenUtility.HardcodedSignalWithQuestID(inSignal) ?? QuestGen.slate.Get <string>("inSignal"); questPart_Filter_FactionHostileToOtherFaction.signalListenMode = signalListenMode; questPart_Filter_FactionHostileToOtherFaction.faction = faction; questPart_Filter_FactionHostileToOtherFaction.other = other; if (action != null) { QuestGenUtility.RunInner(action, questPart_Filter_FactionHostileToOtherFaction.outSignal = QuestGen.GenerateNewSignal("OuterNodeCompleted")); } if (elseAction != null) { QuestGenUtility.RunInner(elseAction, questPart_Filter_FactionHostileToOtherFaction.outSignalElse = QuestGen.GenerateNewSignal("OuterNodeCompleted")); } quest.AddPart(questPart_Filter_FactionHostileToOtherFaction); return(questPart_Filter_FactionHostileToOtherFaction); }
public static QuestPart_Filter_AnyPawnPlayerControlled AnyPawnPlayerControlled(this Quest quest, IEnumerable <Pawn> pawns, Action action = null, Action elseAction = null, string inSignal = null, string outSignal = null, string outSignalElse = null, string inSignalRemovePawn = null, QuestPart.SignalListenMode signalListenMode = QuestPart.SignalListenMode.OngoingOnly) { QuestPart_Filter_AnyPawnPlayerControlled questPart_Filter_AnyPawnPlayerControlled = new QuestPart_Filter_AnyPawnPlayerControlled(); questPart_Filter_AnyPawnPlayerControlled.inSignal = QuestGenUtility.HardcodedSignalWithQuestID(inSignal) ?? QuestGen.slate.Get <string>("inSignal"); questPart_Filter_AnyPawnPlayerControlled.signalListenMode = signalListenMode; questPart_Filter_AnyPawnPlayerControlled.pawns = pawns.ToList(); questPart_Filter_AnyPawnPlayerControlled.inSignalRemovePawn = inSignalRemovePawn; if (action != null) { QuestGenUtility.RunInner(action, questPart_Filter_AnyPawnPlayerControlled.outSignal = QuestGen.GenerateNewSignal("OuterNodeCompleted")); } if (elseAction != null) { QuestGenUtility.RunInner(elseAction, questPart_Filter_AnyPawnPlayerControlled.outSignalElse = QuestGen.GenerateNewSignal("OuterNodeCompleted")); } quest.AddPart(questPart_Filter_AnyPawnPlayerControlled); return(questPart_Filter_AnyPawnPlayerControlled); }
public static QuestPart_Filter_FactionNonPlayer FactionNonPlayer(this Quest quest, Action action = null, Action elseAction = null, string inSignal = null, string outSignal = null, string outSignalElse = null, QuestPart.SignalListenMode signalListenMode = QuestPart.SignalListenMode.OngoingOnly) { QuestPart_Filter_FactionNonPlayer questPart_Filter_FactionNonPlayer = new QuestPart_Filter_FactionNonPlayer(); questPart_Filter_FactionNonPlayer.inSignal = QuestGenUtility.HardcodedSignalWithQuestID(inSignal) ?? QuestGen.slate.Get <string>("inSignal"); questPart_Filter_FactionNonPlayer.signalListenMode = signalListenMode; if (action != null) { QuestGenUtility.RunInner(action, questPart_Filter_FactionNonPlayer.outSignal = QuestGen.GenerateNewSignal("OuterNodeCompleted")); } if (elseAction != null) { QuestGenUtility.RunInner(elseAction, questPart_Filter_FactionNonPlayer.outSignalElse = QuestGen.GenerateNewSignal("OuterNodeCompleted")); } quest.AddPart(questPart_Filter_FactionNonPlayer); return(questPart_Filter_FactionNonPlayer); }
public static QuestPart_Filter_AnyOnTransporter AnyOnTransporter(this Quest quest, IEnumerable <Pawn> pawns, Thing shuttle, Action action = null, Action elseAction = null, string inSignal = null, string outSignal = null, string outSignalElse = null, string inSignalRemovePawn = null, QuestPart.SignalListenMode signalListenMode = QuestPart.SignalListenMode.OngoingOnly) { QuestPart_Filter_AnyOnTransporter questPart_Filter_AnyOnTransporter = new QuestPart_Filter_AnyOnTransporter(); questPart_Filter_AnyOnTransporter.inSignal = QuestGenUtility.HardcodedSignalWithQuestID(inSignal) ?? QuestGen.slate.Get <string>("inSignal"); questPart_Filter_AnyOnTransporter.signalListenMode = signalListenMode; questPart_Filter_AnyOnTransporter.pawns = pawns.ToList(); questPart_Filter_AnyOnTransporter.outSignal = outSignal; questPart_Filter_AnyOnTransporter.outSignalElse = outSignalElse; questPart_Filter_AnyOnTransporter.transporter = shuttle; if (action != null) { QuestGenUtility.RunInner(action, questPart_Filter_AnyOnTransporter.outSignal = QuestGen.GenerateNewSignal("OuterNodeCompleted")); } if (elseAction != null) { QuestGenUtility.RunInner(elseAction, questPart_Filter_AnyOnTransporter.outSignalElse = QuestGen.GenerateNewSignal("OuterNodeCompleted")); } quest.AddPart(questPart_Filter_AnyOnTransporter); return(questPart_Filter_AnyOnTransporter); }
public static void SignalRandom(this Quest quest, IEnumerable <Action> actions, string inSignal = null, QuestPart.SignalListenMode signalListenMode = QuestPart.SignalListenMode.OngoingOnly) { QuestPart_PassOutRandom questPart_PassOutRandom = new QuestPart_PassOutRandom(); questPart_PassOutRandom.inSignal = QuestGenUtility.HardcodedSignalWithQuestID(inSignal) ?? QuestGen.slate.Get <string>("inSignal"); questPart_PassOutRandom.signalListenMode = signalListenMode; quest.AddPart(questPart_PassOutRandom); foreach (Action action in actions) { string text = QuestGen.GenerateNewSignal("OuterNodeCompleted"); questPart_PassOutRandom.outSignals.Add(text); QuestGenUtility.RunInner(action, text); } }
public static void Signal(this Quest quest, string inSignal = null, Action action = null, IEnumerable <string> outSignals = null, QuestPart.SignalListenMode signalListenMode = QuestPart.SignalListenMode.OngoingOnly) { _ = QuestGen.slate; switch ((outSignals?.Count() ?? 0) + ((action != null) ? 1 : 0)) { case 0: return; case 1: { QuestPart_Pass questPart_Pass = new QuestPart_Pass(); questPart_Pass.inSignal = QuestGenUtility.HardcodedSignalWithQuestID(inSignal); if (action != null) { questPart_Pass.outSignal = QuestGen.GenerateNewSignal("OuterNodeCompleted"); QuestGenUtility.RunInner(action, questPart_Pass.outSignal); } else { questPart_Pass.outSignal = QuestGenUtility.HardcodedSignalWithQuestID(outSignals.First()); } questPart_Pass.signalListenMode = signalListenMode; quest.AddPart(questPart_Pass); return; } } QuestPart_PassOutMany questPart_PassOutMany = new QuestPart_PassOutMany(); questPart_PassOutMany.inSignal = QuestGenUtility.HardcodedSignalWithQuestID(inSignal); if (action != null) { string text = QuestGen.GenerateNewSignal("OuterNodeCompleted"); questPart_PassOutMany.outSignals.Add(text); QuestGenUtility.RunInner(action, text); } foreach (string outSignal in outSignals) { questPart_PassOutMany.outSignals.Add(QuestGenUtility.HardcodedSignalWithQuestID(outSignal)); } questPart_PassOutMany.signalListenMode = signalListenMode; quest.AddPart(questPart_PassOutMany); }
public static QuestPart_Delay Delay(this Quest quest, int delayTicks, Action inner, string inSignalEnable = null, string inSignalDisable = null, string outSignalComplete = null, bool reactivatable = false, IEnumerable <ISelectable> inspectStringTargets = null, string inspectString = null, bool isQuestTimeout = false, string expiryInfoPart = null, string expiryInfoPartTip = null, string debugLabel = null, bool tickHistorically = false, QuestPart.SignalListenMode signalListenMode = QuestPart.SignalListenMode.OngoingOnly) { QuestPart_Delay questPart_Delay = new QuestPart_Delay(); questPart_Delay.delayTicks = delayTicks; questPart_Delay.inSignalEnable = QuestGenUtility.HardcodedSignalWithQuestID(inSignalEnable) ?? QuestGen.slate.Get <string>("inSignal"); questPart_Delay.inSignalDisable = QuestGenUtility.HardcodedSignalWithQuestID(inSignalDisable); questPart_Delay.reactivatable = reactivatable; questPart_Delay.signalListenMode = signalListenMode; if (!inspectStringTargets.EnumerableNullOrEmpty()) { questPart_Delay.inspectString = inspectString; questPart_Delay.inspectStringTargets = new List <ISelectable>(); questPart_Delay.inspectStringTargets.AddRange(inspectStringTargets); } if (isQuestTimeout) { questPart_Delay.isBad = true; questPart_Delay.expiryInfoPart = "QuestExpiresIn".Translate(); questPart_Delay.expiryInfoPartTip = "QuestExpiresOn".Translate(); } else { questPart_Delay.expiryInfoPart = expiryInfoPart; questPart_Delay.expiryInfoPartTip = expiryInfoPartTip; } if (inner != null) { QuestGenUtility.RunInner(inner, questPart_Delay); } if (!outSignalComplete.NullOrEmpty()) { questPart_Delay.outSignalsCompleted.Add(QuestGenUtility.HardcodedSignalWithQuestID(outSignalComplete)); } if (!debugLabel.NullOrEmpty()) { questPart_Delay.debugLabel = debugLabel; } quest.AddPart(questPart_Delay); return(questPart_Delay); }
public static QuestPart_FactionGoodwillChange FactionGoodwillChange(this Quest quest, Faction faction, int change = 0, string inSignal = null, bool canSendMessage = true, bool canSendHostilityLetter = true, string reason = null, bool getLookTargetFromSignal = true, QuestPart.SignalListenMode signalListenMode = QuestPart.SignalListenMode.OngoingOnly) { QuestPart_FactionGoodwillChange questPart_FactionGoodwillChange = new QuestPart_FactionGoodwillChange(); questPart_FactionGoodwillChange.faction = faction; questPart_FactionGoodwillChange.change = change; questPart_FactionGoodwillChange.inSignal = inSignal ?? QuestGen.slate.Get <string>("inSignal"); questPart_FactionGoodwillChange.canSendMessage = canSendMessage; questPart_FactionGoodwillChange.canSendHostilityLetter = canSendHostilityLetter; questPart_FactionGoodwillChange.reason = reason; questPart_FactionGoodwillChange.getLookTargetFromSignal = getLookTargetFromSignal; questPart_FactionGoodwillChange.signalListenMode = signalListenMode; quest.AddPart(questPart_FactionGoodwillChange); return(questPart_FactionGoodwillChange); }
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); }
public static QuestPart_QuestEnd End(this Quest quest, QuestEndOutcome outcome, int goodwillChangeAmount = 0, Faction goodwillChangeFactionOf = null, string inSignal = null, QuestPart.SignalListenMode signalListenMode = QuestPart.SignalListenMode.OngoingOnly, bool sendStandardLetter = false) { Slate slate = QuestGen.slate; if (goodwillChangeAmount != 0 && goodwillChangeFactionOf != null && goodwillChangeFactionOf != null) { QuestPart_FactionGoodwillChange questPart_FactionGoodwillChange = new QuestPart_FactionGoodwillChange(); questPart_FactionGoodwillChange.inSignal = QuestGenUtility.HardcodedSignalWithQuestID(inSignal) ?? QuestGen.slate.Get <string>("inSignal"); questPart_FactionGoodwillChange.faction = goodwillChangeFactionOf; questPart_FactionGoodwillChange.change = goodwillChangeAmount; slate.Set("goodwillPenalty", Mathf.Abs(goodwillChangeAmount).ToString()); QuestGen.quest.AddPart(questPart_FactionGoodwillChange); } QuestPart_QuestEnd questPart_QuestEnd = new QuestPart_QuestEnd(); questPart_QuestEnd.inSignal = QuestGenUtility.HardcodedSignalWithQuestID(inSignal) ?? QuestGen.slate.Get <string>("inSignal"); questPart_QuestEnd.outcome = outcome; questPart_QuestEnd.signalListenMode = signalListenMode; questPart_QuestEnd.sendLetter = sendStandardLetter; QuestGen.quest.AddPart(questPart_QuestEnd); return(questPart_QuestEnd); }
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); }
public static QuestPart_DestroyThingsOrPassToWorld DestroyThingsOrPassToWorld(this Quest quest, IEnumerable <Thing> things, string inSignal = null, bool questLookTargets = true, QuestPart.SignalListenMode signalListenMode = QuestPart.SignalListenMode.OngoingOnly) { QuestPart_DestroyThingsOrPassToWorld questPart_DestroyThingsOrPassToWorld = new QuestPart_DestroyThingsOrPassToWorld(); questPart_DestroyThingsOrPassToWorld.things.AddRange(things); questPart_DestroyThingsOrPassToWorld.inSignal = inSignal ?? QuestGen.slate.Get <string>("inSignal"); questPart_DestroyThingsOrPassToWorld.questLookTargets = true; questPart_DestroyThingsOrPassToWorld.signalListenMode = signalListenMode; return(questPart_DestroyThingsOrPassToWorld); }
public static QuestPart_FactionGoodwillChange_ShuttleSentThings GoodwillChangeShuttleSentThings(this Quest quest, Faction faction, IEnumerable <Pawn> pawns, int changeNotOnShuttle, string inSignalEnable = null, IEnumerable <string> inSignalsShuttleSent = null, string inSignalShuttleDestroyed = null, string reason = null, bool canSendMessage = true, bool canSendHostilityLetter = false, QuestPart.SignalListenMode signalListenMode = QuestPart.SignalListenMode.OngoingOnly) { QuestPart_FactionGoodwillChange_ShuttleSentThings questPart_FactionGoodwillChange_ShuttleSentThings = new QuestPart_FactionGoodwillChange_ShuttleSentThings(); questPart_FactionGoodwillChange_ShuttleSentThings.inSignalEnable = inSignalEnable ?? QuestGen.slate.Get <string>("inSignal"); questPart_FactionGoodwillChange_ShuttleSentThings.inSignalsShuttleSent.AddRange(inSignalsShuttleSent); questPart_FactionGoodwillChange_ShuttleSentThings.inSignalShuttleDestroyed = inSignalShuttleDestroyed; questPart_FactionGoodwillChange_ShuttleSentThings.changeNotOnShuttle = changeNotOnShuttle; questPart_FactionGoodwillChange_ShuttleSentThings.things.AddRange(pawns); questPart_FactionGoodwillChange_ShuttleSentThings.faction = faction; questPart_FactionGoodwillChange_ShuttleSentThings.reason = reason; questPart_FactionGoodwillChange_ShuttleSentThings.canSendMessage = canSendMessage; questPart_FactionGoodwillChange_ShuttleSentThings.canSendHostilityLetter = canSendHostilityLetter; questPart_FactionGoodwillChange_ShuttleSentThings.signalListenMode = signalListenMode; quest.AddPart(questPart_FactionGoodwillChange_ShuttleSentThings); return(questPart_FactionGoodwillChange_ShuttleSentThings); }
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_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); }