Esempio n. 1
0
        protected override bool TryExecuteWorker(IncidentParms parms)
        {
            Map map = (Map)parms.target;

            if (!base.TryResolveParms(parms))
            {
                return(false);
            }
            List <Pawn> list = base.SpawnPawns(parms);

            if (list.Count == 0)
            {
                return(false);
            }
            IntVec3 chillSpot = default(IntVec3);

            RCellFinder.TryFindRandomSpotJustOutsideColony(list[0], out chillSpot);
            LordJob_VisitColony lordJob = new LordJob_VisitColony(parms.faction, chillSpot);

            LordMaker.MakeNewLord(parms.faction, lordJob, map, list);
            bool flag = false;

            if (Rand.Value < 0.75)
            {
                flag = this.TryConvertOnePawnToSmallTrader(list, parms.faction, map);
            }
            Pawn   pawn = list.Find((Pawn x) => parms.faction.leader == x);
            string label;
            string text3;

            if (list.Count == 1)
            {
                string text  = (!flag) ? string.Empty : "SingleVisitorArrivesTraderInfo".Translate();
                string text2 = (pawn == null) ? string.Empty : "SingleVisitorArrivesLeaderInfo".Translate();
                label = "LetterLabelSingleVisitorArrives".Translate();
                text3 = "SingleVisitorArrives".Translate(list[0].story.Title.ToLower(), parms.faction.Name, list[0].Name, text, text2);
                text3 = text3.AdjustedFor(list[0]);
            }
            else
            {
                string text4 = (!flag) ? string.Empty : "GroupVisitorsArriveTraderInfo".Translate();
                string text5 = (pawn == null) ? string.Empty : "GroupVisitorsArriveLeaderInfo".Translate(pawn.LabelShort);
                label = "LetterLabelGroupVisitorsArrive".Translate();
                text3 = "GroupVisitorsArrive".Translate(parms.faction.Name, text4, text5);
            }
            PawnRelationUtility.Notify_PawnsSeenByPlayer_Letter(list, ref label, ref text3, "LetterRelatedPawnsNeutralGroup".Translate(), true, true);
            Find.LetterStack.ReceiveLetter(label, text3, LetterDefOf.NeutralEvent, list[0], null);
            return(true);
        }
        protected override bool TryExecuteWorker(IncidentParms parms)
        {
            Map map = (Map)parms.target;

            if (!TryResolveParms(parms))
            {
                return(false);
            }
            List <Pawn> list = SpawnPawns(parms);

            if (list.Count == 0)
            {
                return(false);
            }
            RCellFinder.TryFindRandomSpotJustOutsideColony(list[0], out IntVec3 result);
            LordJob_VisitColony lordJob = new LordJob_VisitColony(parms.faction, result);

            LordMaker.MakeNewLord(parms.faction, lordJob, map, list);
            bool flag = false;

            if (Rand.Value < 0.75f)
            {
                flag = TryConvertOnePawnToSmallTrader(list, parms.faction, map);
            }
            Pawn   pawn = list.Find((Pawn x) => parms.faction.leader == x);
            string letterLabel;
            string letterText;

            if (list.Count == 1)
            {
                string value  = (!flag) ? string.Empty : ("\n\n" + "SingleVisitorArrivesTraderInfo".Translate(list[0].Named("PAWN")).AdjustedFor(list[0]));
                string value2 = (pawn == null) ? string.Empty : ("\n\n" + "SingleVisitorArrivesLeaderInfo".Translate(list[0].Named("PAWN")).AdjustedFor(list[0]));
                letterLabel = "LetterLabelSingleVisitorArrives".Translate();
                letterText  = "SingleVisitorArrives".Translate(list[0].story.Title, parms.faction.Name, list[0].Name.ToStringFull, value, value2, list[0].Named("PAWN")).AdjustedFor(list[0]);
            }
            else
            {
                string value3 = (!flag) ? string.Empty : ("\n\n" + "GroupVisitorsArriveTraderInfo".Translate());
                string value4 = (pawn == null) ? string.Empty : ("\n\n" + "GroupVisitorsArriveLeaderInfo".Translate(pawn.LabelShort, pawn));
                letterLabel = "LetterLabelGroupVisitorsArrive".Translate();
                letterText  = "GroupVisitorsArrive".Translate(parms.faction.Name, value3, value4);
            }
            PawnRelationUtility.Notify_PawnsSeenByPlayer_Letter(list, ref letterLabel, ref letterText, "LetterRelatedPawnsNeutralGroup".Translate(Faction.OfPlayer.def.pawnsPlural), informEvenIfSeenBefore: true);
            Find.LetterStack.ReceiveLetter(letterLabel, letterText, LetterDefOf.NeutralEvent, list[0], parms.faction);
            return(true);
        }