Exemple #1
0
        private static void TryOpenComms(Pawn actor)
        {
            var curJobCommTarget = actor.jobs.curJob.commTarget;

            if (curJobCommTarget is Faction f)
            {
                var dialog_Negotiation = new Dialog_Negotiation(actor, f,
                                                                JecsToolsFactionDialogMaker.FactionDialogFor(actor, f), true);
                dialog_Negotiation.soundAmbient = SoundDefOf.RadioComms_Ambience;
                Find.WindowStack.Add(dialog_Negotiation);
                return;
            }
            if (!(curJobCommTarget is TradeShip ts))
            {
                return;
            }
            if (!ts.CanTradeNow)
            {
                return;
            }
            Find.WindowStack.Add(new Dialog_Trade(actor, ts));
            LessonAutoActivator.TeachOpportunity(ConceptDefOf.BuildOrbitalTradeBeacon, OpportunityType.Critical);
            var empty  = string.Empty;
            var empty2 = string.Empty;

            PawnRelationUtility.Notify_PawnsSeenByPlayer_Letter(
                ts.Goods.OfType <Pawn>(), ref empty, ref empty2, "LetterRelatedPawnsTradeShip".Translate());
            if (!empty2.NullOrEmpty())
            {
                Find.LetterStack.ReceiveLetter(empty, empty2, LetterDefOf.PositiveEvent, null);
            }
            TutorUtility.DoModalDialogIfNotKnown(ConceptDefOf.TradeGoodsMustBeNearBeacon);
        }
        private static bool TryStartPeaceTalks(Faction faction)
        {
            int tile;

            if (!JecsToolsFactionDialogMaker.TryFindTile(out tile))
            {
                return(false);
            }
            PeaceTalks peaceTalks = (PeaceTalks)WorldObjectMaker.MakeWorldObject(WorldObjectDefOf.PeaceTalks);

            peaceTalks.Tile = tile;
            peaceTalks.SetFaction(faction);
            peaceTalks.GetComponent <TimeoutComp>().StartTimeout(900000);
            Find.WorldObjects.Add(peaceTalks);
            var    def  = IncidentDef.Named("QuestPeaceTalks");
            string text = string.Format(def.letterText.AdjustedFor(faction.leader), faction.def.leaderTitle, faction.Name, 15).CapitalizeFirst();

            Find.LetterStack.ReceiveLetter(def.letterLabel, text, def.letterDef, peaceTalks, null);
            return(true);
        }