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