protected override bool TryExecuteWorker(IncidentParms parms)
        {
            Faction faction = default(Faction);

            if (!this.TryFindFaction(out faction))
            {
                return(false);
            }
            int tile = default(int);

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

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

            Find.LetterStack.ReceiveLetter(base.def.letterLabel, text, base.def.letterDef, peaceTalks, null);
            return(true);
        }
        protected override bool TryExecuteWorker(IncidentParms parms)
        {
            Faction faction;

            if (!this.TryFindFaction(out faction))
            {
                return(false);
            }
            int tile;

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

            peaceTalks.Tile = tile;
            peaceTalks.SetFaction(faction);
            int randomInRange = SiteTuning.QuestSiteTimeoutDaysRange.RandomInRange;

            peaceTalks.GetComponent <TimeoutComp>().StartTimeout(randomInRange * 60000);
            Find.WorldObjects.Add(peaceTalks);
            string text = this.def.letterText.Formatted(faction.def.leaderTitle, faction.Name, randomInRange, faction.leader.Named("PAWN")).AdjustedFor(faction.leader, "PAWN").CapitalizeFirst();

            Find.LetterStack.ReceiveLetter(this.def.letterLabel, text, this.def.letterDef, peaceTalks, faction, null);
            return(true);
        }
示例#3
0
        public static void DebugDrawSettlement(int from, int to)
        {
            PeaceTalks o = (PeaceTalks)WorldObjectMaker.MakeWorldObject(WorldObjectDefOfVehicles.DebugSettlement);

            o.Tile = from;
            o.SetFaction(Faction.OfMechanoids);
            Find.WorldObjects.Add(o);
            if (VehicleHarmony.drawPaths)
            {
                VehicleHarmony.debugLines.Add(Find.WorldPathFinder.FindPath(from, to, null, null));
            }
        }
        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);
        }