Beispiel #1
0
        private void GetLetterText(Pawn prisoner, Site site, SitePart sitePart, int days, out string letter, out string label)
        {
            letter = this.def.letterText.Formatted(site.Faction.Name, prisoner.ageTracker.AgeBiologicalYears, prisoner.story.Title, SitePartUtility.GetDescriptionDialogue(site, sitePart), prisoner.Named("PAWN")).AdjustedFor(prisoner, "PAWN").CapitalizeFirst();
            if (PawnUtility.EverBeenColonistOrTameAnimal(prisoner))
            {
                letter = letter + "\n\n" + "PawnWasFormerlyColonist".Translate(prisoner.LabelShort, prisoner);
            }
            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(prisoner.LabelShort, prisoner),
                    "\n\n",
                    text
                });
                label = label + " " + "RelationshipAppendedLetterSuffix".Translate();
            }
            letter = letter + "\n\n" + "PrisonerRescueTimeout".Translate(days, prisoner.LabelShort, prisoner.Named("PRISONER"));
        }
Beispiel #2
0
        private string GetLetterText(Pawn prisoner, Faction siteFaction, int days)
        {
            string text = string.Format(this.def.letterText.AdjustedFor(prisoner), siteFaction.Name, prisoner.ageTracker.AgeBiologicalYears, prisoner.story.Title).CapitalizeFirst();

            if (PawnUtility.EverBeenColonistOrTameAnimal(prisoner))
            {
                text = text + "\n\n" + "PawnWasFormerlyColonist".Translate(new object[]
                {
                    prisoner.LabelShort
                });
            }
            string text2;

            PawnRelationUtility.Notify_PawnsSeenByPlayer(Gen.YieldSingle <Pawn>(prisoner), out text2, true, false);
            if (!text2.NullOrEmpty())
            {
                string text3 = text;
                text = string.Concat(new string[]
                {
                    text3,
                    "\n\n",
                    "PawnHasTheseRelationshipsWithColonists".Translate(new object[]
                    {
                        prisoner.LabelShort
                    }),
                    "\n\n",
                    text2
                });
            }
            return(text + "\n\n" + "PrisonerRescueTimeout".Translate(new object[]
            {
                days,
                prisoner.LabelShort
            }));
        }
 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"));
 }
Beispiel #4
0
        public static TaleData_Pawn GenerateFrom(Pawn pawn)
        {
            TaleData_Pawn taleData_Pawn = new TaleData_Pawn();

            taleData_Pawn.pawn                         = pawn;
            taleData_Pawn.kind                         = pawn.kindDef;
            taleData_Pawn.faction                      = pawn.Faction;
            taleData_Pawn.gender                       = (pawn.RaceProps.hasGenders ? pawn.gender : Gender.None);
            taleData_Pawn.age                          = pawn.ageTracker.AgeBiologicalYears;
            taleData_Pawn.chronologicalAge             = pawn.ageTracker.AgeChronologicalYears;
            taleData_Pawn.everBeenColonistOrTameAnimal = PawnUtility.EverBeenColonistOrTameAnimal(pawn);
            taleData_Pawn.everBeenQuestLodger          = PawnUtility.EverBeenQuestLodger(pawn);
            taleData_Pawn.isFactionLeader              = (pawn.Faction != null && pawn.Faction.leader == pawn);
            if (pawn.royalty != null)
            {
                taleData_Pawn.royalTitles = new List <RoyalTitle>();
                foreach (RoyalTitle item in pawn.royalty.AllTitlesForReading)
                {
                    taleData_Pawn.royalTitles.Add(new RoyalTitle(item));
                }
            }
            TaggedString text = "";

            PawnRelationUtility.TryAppendRelationsWithColonistsInfo(ref text, pawn);
            taleData_Pawn.relationInfo = text.Resolve();
            if (pawn.story != null)
            {
                taleData_Pawn.title = pawn.story.title;
            }
            if (pawn.RaceProps.Humanlike)
            {
                taleData_Pawn.name = pawn.Name;
                if (pawn.equipment.Primary != null)
                {
                    taleData_Pawn.primaryEquipment = pawn.equipment.Primary.def;
                }
                if (pawn.apparel.WornApparel.TryRandomElement(out Apparel result))
                {
                    taleData_Pawn.notableApparel = result.def;
                }
            }
            return(taleData_Pawn);
        }