private static DiaOption OKToRoot(Faction faction, Pawn negotiator) { return(new DiaOption("OK".Translate()) { linkLateBind = FactionDialogMaker.ResetToRoot(faction, negotiator) }); }
private static DiaOption OKToRoot() { return(new DiaOption("OK".Translate()) { linkLateBind = FactionDialogMaker.ResetToRoot() }); }
private static DiaOption OKToRoot() { DiaOption diaOption = new DiaOption("OK".Translate()); diaOption.linkLateBind = FactionDialogMaker.ResetToRoot(); return(diaOption); }
private static DiaNode FightersSent() { DiaNode diaNode = new DiaNode("MilitaryAidSent".Translate(FactionDialogMaker.faction.leader.LabelIndefinite()).CapitalizeFirst()); diaNode.options.Add(FactionDialogMaker.OKToRoot()); return(diaNode); }
private static DiaNode FightersSent(Faction faction, Pawn negotiator) { return(new DiaNode("MilitaryAidSent".Translate(faction.leader).CapitalizeFirst()) { options = { FactionDialogMaker.OKToRoot(faction, negotiator) } }); }
private static DiaNode CantMakeItInTime(Faction faction, Pawn negotiator) { return(new DiaNode("CantSendMilitaryAidInTime".Translate(faction.leader).CapitalizeFirst()) { options = { FactionDialogMaker.OKToRoot(faction, negotiator) } }); }
private static DiaOption RequestTraderOption(Map map, int silverCost) { string text = "RequestTrader".Translate(silverCost.ToString()); if (FactionDialogMaker.AmountSendableSilver(map) < silverCost) { DiaOption diaOption = new DiaOption(text); diaOption.Disable("NeedSilverLaunchable".Translate(silverCost)); return(diaOption); } if (!FactionDialogMaker.faction.def.allowedArrivalTemperatureRange.ExpandedBy(-4f).Includes(map.mapTemperature.SeasonalTemp)) { DiaOption diaOption2 = new DiaOption(text); diaOption2.Disable("BadTemperature".Translate()); return(diaOption2); } int num = FactionDialogMaker.faction.lastTraderRequestTick + 240000 - Find.TickManager.TicksGame; if (num > 0) { DiaOption diaOption3 = new DiaOption(text); diaOption3.Disable("WaitTime".Translate(num.ToStringTicksToPeriod(true, false, true))); return(diaOption3); } DiaOption diaOption4 = new DiaOption(text); DiaNode diaNode = new DiaNode("TraderSent".Translate(FactionDialogMaker.faction.leader.LabelIndefinite()).CapitalizeFirst()); diaNode.options.Add(FactionDialogMaker.OKToRoot()); DiaNode diaNode2 = new DiaNode("ChooseTraderKind".Translate(FactionDialogMaker.faction.leader.LabelIndefinite())); foreach (TraderKindDef caravanTraderKind in FactionDialogMaker.faction.def.caravanTraderKinds) { TraderKindDef localTk = caravanTraderKind; DiaOption diaOption5 = new DiaOption(localTk.LabelCap); diaOption5.action = delegate { IncidentParms incidentParms = new IncidentParms(); incidentParms.target = map; incidentParms.faction = FactionDialogMaker.faction; incidentParms.traderKind = localTk; incidentParms.forced = true; Find.Storyteller.incidentQueue.Add(IncidentDefOf.TraderCaravanArrival, Find.TickManager.TicksGame + 120000, incidentParms); FactionDialogMaker.faction.lastTraderRequestTick = Find.TickManager.TicksGame; TradeUtility.LaunchThingsOfType(ThingDefOf.Silver, silverCost, map, null); }; diaOption5.link = diaNode; diaNode2.options.Add(diaOption5); } DiaOption diaOption6 = new DiaOption("GoBack".Translate()); diaOption6.linkLateBind = FactionDialogMaker.ResetToRoot(); diaNode2.options.Add(diaOption6); diaOption4.link = diaNode2; return(diaOption4); }
public static DiaNode FactionDialogFor(Pawn negotiator, Faction faction) { Map map = negotiator.Map; FactionDialogMaker.negotiator = negotiator; FactionDialogMaker.faction = faction; string text = (faction.leader != null) ? faction.leader.Name.ToStringFull : faction.Name; if (faction.PlayerGoodwill < -70.0) { FactionDialogMaker.root = new DiaNode("FactionGreetingHostile".Translate(text)); } else if (faction.PlayerGoodwill < 40.0) { string text2 = "FactionGreetingWary".Translate(text, negotiator.LabelShort); text2 = text2.AdjustedFor(negotiator); FactionDialogMaker.root = new DiaNode(text2); if (!SettlementUtility.IsPlayerAttackingAnySettlementOf(faction)) { FactionDialogMaker.root.options.Add(FactionDialogMaker.OfferGiftOption(negotiator.Map)); } if (!faction.HostileTo(Faction.OfPlayer) && negotiator.Spawned && negotiator.Map.IsPlayerHome) { FactionDialogMaker.root.options.Add(FactionDialogMaker.RequestTraderOption(map, 1100)); } } else { FactionDialogMaker.root = new DiaNode("FactionGreetingWarm".Translate(text, negotiator.LabelShort)); if (!SettlementUtility.IsPlayerAttackingAnySettlementOf(faction)) { FactionDialogMaker.root.options.Add(FactionDialogMaker.OfferGiftOption(negotiator.Map)); } if (!faction.HostileTo(Faction.OfPlayer) && negotiator.Spawned && negotiator.Map.IsPlayerHome) { FactionDialogMaker.root.options.Add(FactionDialogMaker.RequestTraderOption(map, 700)); FactionDialogMaker.root.options.Add(FactionDialogMaker.RequestMilitaryAidOption(map)); } } if (Prefs.DevMode) { foreach (DiaOption item in FactionDialogMaker.DebugOptions()) { FactionDialogMaker.root.options.Add(item); } } DiaOption diaOption = new DiaOption("(" + "Disconnect".Translate() + ")"); diaOption.resolveTree = true; FactionDialogMaker.root.options.Add(diaOption); return(FactionDialogMaker.root); }
private static IEnumerable <DiaOption> DebugOptions() { yield return(new DiaOption("(Debug) Goodwill +10") { action = delegate { FactionDialogMaker.faction.AffectGoodwillWith(Faction.OfPlayer, 10f); }, linkLateBind = (() => FactionDialogMaker.FactionDialogFor(FactionDialogMaker.negotiator, FactionDialogMaker.faction)) }); /*Error: Unable to find new state assignment for yield return*/; }
private static DiaNode FightersSent() { return(new DiaNode("MilitaryAidSent".Translate(new object[] { FactionDialogMaker.faction.leader.LabelIndefinite() }).CapitalizeFirst()) { options = { FactionDialogMaker.OKToRoot() } }); }
private static DiaOption RequestAICoreQuest(Map map, Faction faction, Pawn negotiator) { string text = "RequestAICoreInformation".Translate(ThingDefOf.AIPersonaCore.label, 1500.ToString()); if (faction.PlayerGoodwill < 40) { DiaOption diaOption = new DiaOption(text); diaOption.Disable("NeedGoodwill".Translate(40.ToString("F0"))); return(diaOption); } IncidentDef def = IncidentDefOf.Quest_ItemStashAICore; bool flag = PlayerItemAccessibilityUtility.ItemStashHas(ThingDefOf.AIPersonaCore); IncidentParms coreIncidentParms = StorytellerUtility.DefaultParmsNow(IncidentCategoryDefOf.Misc, Find.World); coreIncidentParms.faction = faction; bool flag2 = def.Worker.CanFireNow(coreIncidentParms, false); if (flag || !flag2) { DiaOption diaOption2 = new DiaOption(text); diaOption2.Disable("NoKnownAICore".Translate(1500)); return(diaOption2); } if (FactionDialogMaker.AmountSendableSilver(map) < 1500) { DiaOption diaOption3 = new DiaOption(text); diaOption3.Disable("NeedSilverLaunchable".Translate(1500)); return(diaOption3); } DiaOption diaOption4 = new DiaOption(text); diaOption4.action = delegate { if (def.Worker.TryExecute(coreIncidentParms)) { TradeUtility.LaunchThingsOfType(ThingDefOf.Silver, 1500, map, null); } Current.Game.GetComponent <GameComponent_OnetimeNotification>().sendAICoreRequestReminder = false; }; string text2 = "RequestAICoreInformationResult".Translate(faction.leader).CapitalizeFirst(); diaOption4.link = new DiaNode(text2) { options = { FactionDialogMaker.OKToRoot(faction, negotiator) } }; return(diaOption4); }
private static DiaOption RequestMilitaryAidOption(Map map) { string text = "RequestMilitaryAid".Translate(new object[] { -25f }); if (!FactionDialogMaker.faction.def.allowedArrivalTemperatureRange.ExpandedBy(-4f).Includes(map.mapTemperature.SeasonalTemp)) { DiaOption diaOption = new DiaOption(text); diaOption.Disable("BadTemperature".Translate()); return(diaOption); } DiaOption diaOption2 = new DiaOption(text); if (map.attackTargetsCache.TargetsHostileToColony.Any(new Func <IAttackTarget, bool>(GenHostility.IsActiveThreatToPlayer))) { if (!map.attackTargetsCache.TargetsHostileToColony.Any((IAttackTarget p) => ((Thing)p).Faction != null && ((Thing)p).Faction.HostileTo(FactionDialogMaker.faction))) { IEnumerable <Faction> source = (from pa in map.attackTargetsCache.TargetsHostileToColony.Where(new Func <IAttackTarget, bool>(GenHostility.IsActiveThreatToPlayer)) select((Thing)pa).Faction into fa where fa != null && !fa.HostileTo(FactionDialogMaker.faction) select fa).Distinct <Faction>(); string arg_1B2_0 = "MilitaryAidConfirmMutualEnemy"; object[] expr_178 = new object[2]; expr_178[0] = FactionDialogMaker.faction.Name; expr_178[1] = GenText.ToCommaList(from fa in source select fa.Name, true); DiaNode diaNode = new DiaNode(arg_1B2_0.Translate(expr_178)); DiaOption diaOption3 = new DiaOption("CallConfirm".Translate()); diaOption3.action = delegate { FactionDialogMaker.CallForAid(map); }; diaOption3.link = FactionDialogMaker.FightersSent(); DiaOption diaOption4 = new DiaOption("CallCancel".Translate()); diaOption4.linkLateBind = FactionDialogMaker.ResetToRoot(); diaNode.options.Add(diaOption3); diaNode.options.Add(diaOption4); diaOption2.link = diaNode; return(diaOption2); } } diaOption2.action = delegate { FactionDialogMaker.CallForAid(map); }; diaOption2.link = FactionDialogMaker.FightersSent(); return(diaOption2); }
private static DiaOption OfferGiftOption(Map map) { // TODO: Compare with vanilla method int cost = GetCost(Hospitality_MapComponent.Instance(map).GetBribeCount(faction)); //Log.Message(faction.name + ": " + Hospitality_MapComponent.Instance.GetBribeCount(faction) + " = " + cost); int silver = TradeUtility.AllLaunchableThings(map).Where(t => t.def == ThingDefOf.Silver).Sum(t => t.stackCount); if (silver < cost) { var diaOption = new DiaOption("OfferGift".Translate() + " (" + "NeedSilverLaunchable".Translate(new object[] { cost }) + ")"); diaOption.Disable("NotEnoughSilver".Translate()); return(diaOption); } float goodwillDelta = 12f * negotiator.GetStatValue(StatDefOf.GiftImpact); var diaOption2 = new DiaOption("OfferGift".Translate() + " (" + "SilverForGoodwill".Translate(new object[] { cost, goodwillDelta.ToString("#####0") }) + ")"); diaOption2.action = delegate { TradeUtility.LaunchThingsOfType(ThingDefOf.Silver, cost, map, null); faction.AffectGoodwillWith(Faction.OfPlayer, goodwillDelta); Hospitality_MapComponent.Instance(map).Bribe(faction); }; string text = "SilverGiftSent".Translate(new object[] { faction.Name, Mathf.RoundToInt(goodwillDelta) }); diaOption2.link = new DiaNode(text) { options = { new DiaOption("OK".Translate()) { linkLateBind = () => Source.FactionDialogFor(negotiator, faction) } } }; return(diaOption2); }
private static IEnumerable <DiaOption> DebugOptions(Faction faction, Pawn negotiator) { yield return(new DiaOption("(Debug) Goodwill +10") { action = delegate { faction.TryAffectGoodwillWith(Faction.OfPlayer, 10, false, true, null, null); }, linkLateBind = (() => FactionDialogMaker.FactionDialogFor(negotiator, faction)) }); yield return(new DiaOption("(Debug) Goodwill -10") { action = delegate { faction.TryAffectGoodwillWith(Faction.OfPlayer, -10, false, true, null, null); }, linkLateBind = (() => FactionDialogMaker.FactionDialogFor(negotiator, faction)) }); }
private static IEnumerable <DiaOption> DebugOptions() { DiaOption opt = new DiaOption("(Debug) Goodwill +10"); opt.action = delegate { FactionDialogMaker.faction.AffectGoodwillWith(Faction.OfPlayer, 10f); }; opt.linkLateBind = (() => FactionDialogMaker.FactionDialogFor(FactionDialogMaker.negotiator, FactionDialogMaker.faction)); yield return(opt); DiaOption opt2 = new DiaOption("(Debug) Goodwill -10"); opt2.action = delegate { FactionDialogMaker.faction.AffectGoodwillWith(Faction.OfPlayer, -10f); }; opt2.linkLateBind = (() => FactionDialogMaker.FactionDialogFor(FactionDialogMaker.negotiator, FactionDialogMaker.faction)); yield return(opt2); }
public bool MoveNext() { uint num = (uint)this.$PC; this.$PC = -1; switch (num) { case 0u: { DiaOption opt = new DiaOption("(Debug) Goodwill +10"); opt.action = delegate() { faction.TryAffectGoodwillWith(Faction.OfPlayer, 10, false, true, null, null); }; opt.linkLateBind = (() => FactionDialogMaker.FactionDialogFor(negotiator, faction)); this.$current = opt; if (!this.$disposing) { this.$PC = 1; } return(true); } case 1u: { DiaOption opt2 = new DiaOption("(Debug) Goodwill -10"); opt2.action = delegate() { < DebugOptions > c__AnonStorey.faction.TryAffectGoodwillWith(Faction.OfPlayer, -10, false, true, null, null); }; opt2.linkLateBind = (() => FactionDialogMaker.FactionDialogFor(< DebugOptions > c__AnonStorey.negotiator, <DebugOptions> c__AnonStorey.faction)); this.$current = opt2; if (!this.$disposing) { this.$PC = 2; } return(true); }
private static DiaOption OfferGiftOption(Map map) { if (FactionDialogMaker.AmountSendableSilver(map) < 300) { DiaOption diaOption = new DiaOption("OfferGift".Translate()); diaOption.Disable("NeedSilverLaunchable".Translate(new object[] { 300 })); return(diaOption); } float goodwillDelta = 12f * FactionDialogMaker.negotiator.GetStatValue(StatDefOf.DiplomacyPower, true); DiaOption diaOption2 = new DiaOption("OfferGift".Translate() + " (" + "SilverForGoodwill".Translate(new object[] { 300, goodwillDelta.ToString("#####0") }) + ")"); diaOption2.action = delegate { TradeUtility.LaunchThingsOfType(ThingDefOf.Silver, 300, map, null); FactionDialogMaker.faction.AffectGoodwillWith(Faction.OfPlayer, goodwillDelta); }; string text = "SilverGiftSent".Translate(new object[] { FactionDialogMaker.faction.leader.LabelIndefinite(), Mathf.RoundToInt(goodwillDelta) }).CapitalizeFirst(); diaOption2.link = new DiaNode(text) { options = { FactionDialogMaker.OKToRoot() } }; return(diaOption2); }
private static Func <DiaNode> ResetToRoot(Faction faction, Pawn negotiator) { return(() => FactionDialogMaker.FactionDialogFor(negotiator, faction)); }
private static DiaOption RequestMilitaryAidOption(Map map, Faction faction, Pawn negotiator) { string text = "RequestMilitaryAid".Translate(new object[] { 25 }); if (faction.PlayerRelationKind != FactionRelationKind.Ally) { DiaOption diaOption = new DiaOption(text); diaOption.Disable("MustBeAlly".Translate()); return(diaOption); } if (!faction.def.allowedArrivalTemperatureRange.ExpandedBy(-4f).Includes(map.mapTemperature.SeasonalTemp)) { DiaOption diaOption2 = new DiaOption(text); diaOption2.Disable("BadTemperature".Translate()); return(diaOption2); } int num = faction.lastMilitaryAidRequestTick + 60000 - Find.TickManager.TicksGame; if (num > 0) { DiaOption diaOption3 = new DiaOption(text); diaOption3.Disable("WaitTime".Translate(new object[] { num.ToStringTicksToPeriod() })); return(diaOption3); } if (NeutralGroupIncidentUtility.AnyBlockingHostileLord(map, faction)) { DiaOption diaOption4 = new DiaOption(text); diaOption4.Disable("HostileVisitorsPresent".Translate()); return(diaOption4); } DiaOption diaOption5 = new DiaOption(text); if (faction.def.techLevel < TechLevel.Industrial) { diaOption5.link = FactionDialogMaker.CantMakeItInTime(faction, negotiator); } else { IEnumerable <Faction> source = (from x in map.attackTargetsCache.TargetsHostileToColony.Where(new Func <IAttackTarget, bool>(GenHostility.IsActiveThreatToPlayer)) select((Thing)x).Faction into x where x != null && !x.HostileTo(faction) select x).Distinct <Faction>(); if (source.Any <Faction>()) { string arg_224_0 = "MilitaryAidConfirmMutualEnemy"; object[] expr_1E9 = new object[2]; expr_1E9[0] = faction.Name; expr_1E9[1] = (from fa in source select fa.Name).ToCommaList(true); DiaNode diaNode = new DiaNode(arg_224_0.Translate(expr_1E9)); DiaOption diaOption6 = new DiaOption("CallConfirm".Translate()); diaOption6.action = delegate { FactionDialogMaker.CallForAid(map, faction); }; diaOption6.link = FactionDialogMaker.FightersSent(faction, negotiator); DiaOption diaOption7 = new DiaOption("CallCancel".Translate()); diaOption7.linkLateBind = FactionDialogMaker.ResetToRoot(faction, negotiator); diaNode.options.Add(diaOption6); diaNode.options.Add(diaOption7); diaOption5.link = diaNode; } else { diaOption5.action = delegate { FactionDialogMaker.CallForAid(map, faction); }; diaOption5.link = FactionDialogMaker.FightersSent(faction, negotiator); } } return(diaOption5); }
private static DiaOption RequestTraderOption(Map map, Faction faction, Pawn negotiator) { string text = "RequestTrader".Translate(new object[] { 15 }); if (faction.PlayerRelationKind != FactionRelationKind.Ally) { DiaOption diaOption = new DiaOption(text); diaOption.Disable("MustBeAlly".Translate()); return(diaOption); } if (!faction.def.allowedArrivalTemperatureRange.ExpandedBy(-4f).Includes(map.mapTemperature.SeasonalTemp)) { DiaOption diaOption2 = new DiaOption(text); diaOption2.Disable("BadTemperature".Translate()); return(diaOption2); } int num = faction.lastTraderRequestTick + 240000 - Find.TickManager.TicksGame; if (num > 0) { DiaOption diaOption3 = new DiaOption(text); diaOption3.Disable("WaitTime".Translate(new object[] { num.ToStringTicksToPeriod() })); return(diaOption3); } DiaOption diaOption4 = new DiaOption(text); DiaNode diaNode = new DiaNode("TraderSent".Translate(new object[] { faction.leader.LabelIndefinite() }).CapitalizeFirst()); diaNode.options.Add(FactionDialogMaker.OKToRoot(faction, negotiator)); DiaNode diaNode2 = new DiaNode("ChooseTraderKind".Translate(new object[] { faction.leader.LabelIndefinite() })); foreach (TraderKindDef current in from x in faction.def.caravanTraderKinds where x.requestable select x) { TraderKindDef localTk = current; DiaOption diaOption5 = new DiaOption(localTk.LabelCap); diaOption5.action = delegate { IncidentParms incidentParms = new IncidentParms(); incidentParms.target = map; incidentParms.faction = faction; incidentParms.traderKind = localTk; incidentParms.forced = true; Find.Storyteller.incidentQueue.Add(IncidentDefOf.TraderCaravanArrival, Find.TickManager.TicksGame + 120000, incidentParms, 240000); faction.lastTraderRequestTick = Find.TickManager.TicksGame; Faction arg_B2_0 = faction; Faction ofPlayer = Faction.OfPlayer; int goodwillChange = -15; bool canSendMessage = false; string reason = "GoodwillChangedReason_RequestedTrader".Translate(); arg_B2_0.TryAffectGoodwillWith(ofPlayer, goodwillChange, canSendMessage, true, reason, null); }; diaOption5.link = diaNode; diaNode2.options.Add(diaOption5); } DiaOption diaOption6 = new DiaOption("GoBack".Translate()); diaOption6.linkLateBind = FactionDialogMaker.ResetToRoot(faction, negotiator); diaNode2.options.Add(diaOption6); diaOption4.link = diaNode2; return(diaOption4); }
public static DiaNode FactionDialogFor(Pawn negotiator, Faction faction) { Map map = negotiator.Map; Pawn p; string text; if (faction.leader != null) { p = faction.leader; text = faction.leader.Name.ToStringFull; } else { Log.Error("Faction " + faction + " has no leader.", false); p = negotiator; text = faction.Name; } DiaNode diaNode; if (faction.PlayerRelationKind == FactionRelationKind.Hostile) { string key; if (!faction.def.permanentEnemy && "FactionGreetingHostileAppreciative".CanTranslate()) { key = "FactionGreetingHostileAppreciative"; } else { key = "FactionGreetingHostile"; } diaNode = new DiaNode(key.Translate(new object[] { text }).AdjustedFor(p, "PAWN")); } else if (faction.PlayerRelationKind == FactionRelationKind.Neutral) { diaNode = new DiaNode("FactionGreetingWary".Translate(new object[] { text, negotiator.LabelShort }).AdjustedFor(p, "PAWN")); } else { diaNode = new DiaNode("FactionGreetingWarm".Translate(new object[] { text, negotiator.LabelShort }).AdjustedFor(p, "PAWN")); } if (map != null && map.IsPlayerHome) { diaNode.options.Add(FactionDialogMaker.RequestTraderOption(map, faction, negotiator)); diaNode.options.Add(FactionDialogMaker.RequestMilitaryAidOption(map, faction, negotiator)); if (DefDatabase <ResearchProjectDef> .AllDefsListForReading.Any((ResearchProjectDef rp) => rp.HasTag(ResearchProjectTagDefOf.ShipRelated) && rp.IsFinished)) { diaNode.options.Add(FactionDialogMaker.RequestAICoreQuest(map, faction, negotiator)); } } if (Prefs.DevMode) { foreach (DiaOption current in FactionDialogMaker.DebugOptions(faction, negotiator)) { diaNode.options.Add(current); } } DiaOption diaOption = new DiaOption("(" + "Disconnect".Translate() + ")"); diaOption.resolveTree = true; diaNode.options.Add(diaOption); return(diaNode); }
public void TryOpenComms(Pawn negotiator) { Dialog_Negotiation dialog_Negotiation = new Dialog_Negotiation(negotiator, this, FactionDialogMaker.FactionDialogFor(negotiator, this), true); dialog_Negotiation.soundAmbient = SoundDefOf.RadioComms_Ambience; Find.WindowStack.Add(dialog_Negotiation); }
private static Func <DiaNode> ResetToRoot() { return(() => FactionDialogMaker.FactionDialogFor(FactionDialogMaker.negotiator, FactionDialogMaker.faction)); }
private static DiaOption RequestMilitaryAidOption(Map map, Faction faction, Pawn negotiator) { string text = "RequestMilitaryAid".Translate(new object[] { 20 }); DiaOption result; if (faction.PlayerRelationKind != FactionRelationKind.Ally) { DiaOption diaOption = new DiaOption(text); diaOption.Disable("MustBeAlly".Translate()); result = diaOption; } else if (!faction.def.allowedArrivalTemperatureRange.ExpandedBy(-4f).Includes(map.mapTemperature.SeasonalTemp)) { DiaOption diaOption2 = new DiaOption(text); diaOption2.Disable("BadTemperature".Translate()); result = diaOption2; } else { DiaOption diaOption3 = new DiaOption(text); if (faction.def.techLevel < TechLevel.Industrial) { diaOption3.link = FactionDialogMaker.CantMakeItInTime(faction, negotiator); } else { IEnumerable <Faction> source = (from x in map.attackTargetsCache.TargetsHostileToColony where GenHostility.IsActiveThreatToPlayer(x) select((Thing)x).Faction into x where x != null && !x.HostileTo(faction) select x).Distinct <Faction>(); if (source.Any <Faction>()) { string key = "MilitaryAidConfirmMutualEnemy"; object[] array = new object[2]; array[0] = faction.Name; array[1] = (from fa in source select fa.Name).ToCommaList(true); DiaNode diaNode = new DiaNode(key.Translate(array)); DiaOption diaOption4 = new DiaOption("CallConfirm".Translate()); diaOption4.action = delegate() { FactionDialogMaker.CallForAid(map, faction); }; diaOption4.link = FactionDialogMaker.FightersSent(faction, negotiator); DiaOption diaOption5 = new DiaOption("CallCancel".Translate()); diaOption5.linkLateBind = FactionDialogMaker.ResetToRoot(faction, negotiator); diaNode.options.Add(diaOption4); diaNode.options.Add(diaOption5); diaOption3.link = diaNode; } else { diaOption3.action = delegate() { FactionDialogMaker.CallForAid(map, faction); }; diaOption3.link = FactionDialogMaker.FightersSent(faction, negotiator); } } result = diaOption3; } return(result); }