private string GetLetterText(Faction alliedFaction, List <Thing> items, int days, Site site, SitePart sitePart)
        {
            string text = string.Format(this.def.letterText, new object[]
            {
                alliedFaction.leader.LabelShort,
                alliedFaction.def.leaderTitle,
                alliedFaction.Name,
                GenLabel.ThingsLabel(items).TrimEndNewlines(),
                days.ToString(),
                SitePartUtility.GetDescriptionDialogue(site, sitePart)
            }).CapitalizeFirst();

            if (items.Count == 1 || (items.Count >= 2 && items.All((Thing x) => x.def == items[0].def)))
            {
                string text2 = text;
                text = string.Concat(new string[]
                {
                    text2,
                    "\n\n---\n\n",
                    items[0].LabelCapNoCount,
                    ": ",
                    items[0].DescriptionFlavor
                });
            }
            return(text);
        }
Example #2
0
        private void FoundMinerals(Pawn worker)
        {
            this.daysWorkingSinceLastMinerals = 0f;
            IntRange preciousLumpSiteDistanceRange = SiteTuning.PreciousLumpSiteDistanceRange;
            int      min  = preciousLumpSiteDistanceRange.min;
            int      max  = preciousLumpSiteDistanceRange.max;
            int      tile = this.parent.Tile;
            int      tile2;

            if (!TileFinder.TryFindNewSiteTile(out tile2, min, max, false, true, tile))
            {
                return;
            }
            Site site = SiteMaker.TryMakeSite_SingleSitePart(SiteCoreDefOf.PreciousLump, (!Rand.Chance(0.6f)) ? "MineralScannerPreciousLumpThreat" : null, tile2, null, true, null, true, null);

            if (site != null)
            {
                site.sitePartsKnown = true;
                site.core.parms.preciousLumpResources = this.targetMineable;
                int randomInRange = SiteTuning.MineralScannerPreciousLumpTimeoutDaysRange.RandomInRange;
                site.GetComponent <TimeoutComp>().StartTimeout(randomInRange * 60000);
                Find.WorldObjects.Add(site);
                Find.LetterStack.ReceiveLetter("LetterLabelFoundPreciousLump".Translate(), "LetterFoundPreciousLump".Translate(new object[]
                {
                    this.targetMineable.label,
                    randomInRange,
                    SitePartUtility.GetDescriptionDialogue(site, site.parts.FirstOrDefault <SitePart>()).CapitalizeFirst(),
                    worker.LabelShort
                }), LetterDefOf.PositiveEvent, site, null, null);
            }
        }
Example #3
0
        protected override bool TryExecuteWorker(IncidentParms parms)
        {
            int tile;

            if (!this.TryFindTile(out tile))
            {
                return(false);
            }
            Site site = SiteMaker.TryMakeSite_SingleSitePart(SiteCoreDefOf.DownedRefugee, (!Rand.Chance(0.3f)) ? "DownedRefugeeQuestThreat" : null, tile, null, true, null, true, null);

            if (site == null)
            {
                return(false);
            }
            site.sitePartsKnown = true;
            Pawn pawn = DownedRefugeeQuestUtility.GenerateRefugee(tile);

            site.GetComponent <DownedRefugeeComp>().pawn.TryAdd(pawn, true);
            int randomInRange = SiteTuning.QuestSiteRefugeeTimeoutDaysRange.RandomInRange;

            site.GetComponent <TimeoutComp>().StartTimeout(randomInRange * 60000);
            Find.WorldObjects.Add(site);
            string text  = this.def.letterLabel;
            string text2 = string.Format(this.def.letterText.AdjustedFor(pawn, "PAWN"), new object[]
            {
                randomInRange,
                pawn.ageTracker.AgeBiologicalYears,
                pawn.story.Title,
                SitePartUtility.GetDescriptionDialogue(site, site.parts.FirstOrDefault <SitePart>())
            }).CapitalizeFirst();
            Pawn mostImportantColonyRelative = PawnRelationUtility.GetMostImportantColonyRelative(pawn);

            if (mostImportantColonyRelative != null)
            {
                PawnRelationDef mostImportantRelation = mostImportantColonyRelative.GetMostImportantRelation(pawn);
                if (mostImportantRelation != null && mostImportantRelation.opinionOffset > 0)
                {
                    pawn.relations.relativeInvolvedInRescueQuest = mostImportantColonyRelative;
                    text2 = text2 + "\n\n" + "RelatedPawnInvolvedInQuest".Translate(new object[]
                    {
                        mostImportantColonyRelative.LabelShort,
                        mostImportantRelation.GetGenderSpecificLabel(pawn)
                    }).AdjustedFor(pawn, "PAWN");
                }
                else
                {
                    PawnRelationUtility.TryAppendRelationsWithColonistsInfo(ref text2, pawn);
                }
                text = text + " " + "RelationshipAppendedLetterSuffix".Translate();
            }
            if (pawn.relations != null)
            {
                pawn.relations.everSeenByPlayer = true;
            }
            Find.LetterStack.ReceiveLetter(text, text2, this.def.letterDef, site, null, null);
            return(true);
        }
        private string GetLetterText(Faction alliedFaction, List <Thing> items, int days, Site site, SitePart sitePart)
        {
            string result = string.Format(this.def.letterText, new object[]
            {
                alliedFaction.leader.LabelShort,
                alliedFaction.def.leaderTitle,
                alliedFaction.Name,
                GenLabel.ThingsLabel(items, "  - "),
                days.ToString(),
                SitePartUtility.GetDescriptionDialogue(site, sitePart),
                GenThing.GetMarketValue(items).ToStringMoney(null)
            }).CapitalizeFirst();

            GenThing.TryAppendSingleRewardInfo(ref result, items);
            return(result);
        }
Example #5
0
        private void GetLetterText(Pawn prisoner, Site site, SitePart sitePart, int days, out string letter, out string label)
        {
            letter = string.Format(this.def.letterText.AdjustedFor(prisoner, "PAWN"), new object[]
            {
                site.Faction.Name,
                prisoner.ageTracker.AgeBiologicalYears,
                prisoner.story.Title,
                SitePartUtility.GetDescriptionDialogue(site, sitePart)
            }).CapitalizeFirst();
            if (PawnUtility.EverBeenColonistOrTameAnimal(prisoner))
            {
                letter = letter + "\n\n" + "PawnWasFormerlyColonist".Translate(new object[]
                {
                    prisoner.LabelShort
                });
            }
            string text;

            PawnRelationUtility.Notify_PawnsSeenByPlayer(Gen.YieldSingle <Pawn>(prisoner), out text, true, false);
            label = this.def.letterLabel;
            if (!text.NullOrEmpty())
            {
                string text2 = letter;
                letter = string.Concat(new string[]
                {
                    text2,
                    "\n\n",
                    "PawnHasTheseRelationshipsWithColonists".Translate(new object[]
                    {
                        prisoner.LabelShort
                    }),
                    "\n\n",
                    text
                });
                label = label + " " + "RelationshipAppendedLetterSuffix".Translate();
            }
            letter = letter + "\n\n" + "PrisonerRescueTimeout".Translate(new object[]
            {
                days,
                prisoner.LabelShort
            });
        }
Example #6
0
        protected override bool TryExecuteWorker(IncidentParms parms)
        {
            Faction faction;
            Faction faction2;

            if (!this.TryFindFactions(out faction, out faction2))
            {
                return(false);
            }
            int tile;

            if (!this.TryFindTile(out tile))
            {
                return(false);
            }
            Site site = SiteMaker.MakeSite(SiteCoreDefOf.Nothing, SitePartDefOf.Outpost, tile, faction2, true, null);

            site.sitePartsKnown = true;
            List <Thing> list = this.GenerateRewards(faction, site.desiredThreatPoints);

            site.GetComponent <DefeatAllEnemiesQuestComp>().StartQuest(faction, 18, list);
            int randomInRange = SiteTuning.QuestSiteTimeoutDaysRange.RandomInRange;

            site.GetComponent <TimeoutComp>().StartTimeout(randomInRange * 60000);
            Find.WorldObjects.Add(site);
            string text = string.Format(this.def.letterText, new object[]
            {
                faction.leader.LabelShort,
                faction.def.leaderTitle,
                faction.Name,
                GenLabel.ThingsLabel(list, string.Empty),
                randomInRange.ToString(),
                SitePartUtility.GetDescriptionDialogue(site, site.parts.FirstOrDefault <SitePart>()),
                GenThing.GetMarketValue(list).ToStringMoney(null)
            }).CapitalizeFirst();

            GenThing.TryAppendSingleRewardInfo(ref text, list);
            Find.LetterStack.ReceiveLetter(this.def.letterLabel, text, this.def.letterDef, site, faction, null);
            return(true);
        }
Example #7
0
        private string GetLetterText(Faction alliedFaction, List <Thing> items, int days, Site site, SitePart sitePart)
        {
            string text = def.letterText.Formatted(alliedFaction.leader.LabelShort, alliedFaction.def.leaderTitle, alliedFaction.Name, GenLabel.ThingsLabel(items), days.ToString(), SitePartUtility.GetDescriptionDialogue(site, sitePart), GenThing.GetMarketValue(items).ToStringMoney()).CapitalizeFirst();

            GenThing.TryAppendSingleRewardInfo(ref text, items);
            return(text);
        }
 private void GetLetterText(Pawn prisoner, Site site, SitePart sitePart, int days, out string letter, out string label)
 {
     letter = def.letterText.Formatted(site.Faction.Name, prisoner.ageTracker.AgeBiologicalYears, prisoner.story.Title, SitePartUtility.GetDescriptionDialogue(site, sitePart), prisoner.Named("PAWN")).AdjustedFor(prisoner).CapitalizeFirst();
     if (PawnUtility.EverBeenColonistOrTameAnimal(prisoner))
     {
         letter = letter + "\n\n" + "PawnWasFormerlyColonist".Translate(prisoner.LabelShort, prisoner);
     }
     PawnRelationUtility.Notify_PawnsSeenByPlayer(Gen.YieldSingle(prisoner), out string pawnRelationsInfo, informEvenIfSeenBefore: true, writeSeenPawnsNames: false);
     label = def.letterLabel;
     if (!pawnRelationsInfo.NullOrEmpty())
     {
         string text = letter;
         letter = text + "\n\n" + "PawnHasTheseRelationshipsWithColonists".Translate(prisoner.LabelShort, prisoner) + "\n\n" + pawnRelationsInfo;
         label  = label + " " + "RelationshipAppendedLetterSuffix".Translate();
     }
     letter = letter + "\n\n" + "PrisonerRescueTimeout".Translate(days, prisoner.LabelShort, prisoner.Named("PRISONER"));
 }