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); }