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