Пример #1
0
 public static string PawnKindsToCommaList(IEnumerable <PawnKindDef> pawnKinds, bool useAnd = false)
 {
     PawnUtility.tmpPawnKinds.Clear();
     PawnUtility.tmpPawnKinds.AddRange(pawnKinds);
     if (PawnUtility.tmpPawnKinds.Count >= 2)
     {
         PawnUtility.tmpPawnKinds.SortBy((PawnKindDef x) => !x.RaceProps.Humanlike, (PawnKindDef x) => GenLabel.BestKindLabel(x, Gender.None, true, -1));
     }
     PawnUtility.tmpAddedPawnKinds.Clear();
     PawnUtility.tmpPawnKindsStr.Clear();
     for (int i = 0; i < PawnUtility.tmpPawnKinds.Count; i++)
     {
         if (!PawnUtility.tmpAddedPawnKinds.Contains(PawnUtility.tmpPawnKinds[i]))
         {
             PawnUtility.tmpAddedPawnKinds.Add(PawnUtility.tmpPawnKinds[i]);
             int num = 0;
             for (int j = 0; j < PawnUtility.tmpPawnKinds.Count; j++)
             {
                 if (PawnUtility.tmpPawnKinds[j] == PawnUtility.tmpPawnKinds[i])
                 {
                     num++;
                 }
             }
             if (num == 1)
             {
                 PawnUtility.tmpPawnKindsStr.Add("1 " + GenLabel.BestKindLabel(PawnUtility.tmpPawnKinds[i], Gender.None, false, -1));
             }
             else
             {
                 PawnUtility.tmpPawnKindsStr.Add(num + " " + GenLabel.BestKindLabel(PawnUtility.tmpPawnKinds[i], Gender.None, true, num));
             }
         }
     }
     return(PawnUtility.tmpPawnKindsStr.ToCommaList(useAnd));
 }
Пример #2
0
        public override void Notify_GeneratedByQuestGen(SitePart part, Slate slate, List <Rule> outExtraDescriptionRules, Dictionary <string, string> outExtraDescriptionConstants)
        {
            base.Notify_GeneratedByQuestGen(part, slate, outExtraDescriptionRules, outExtraDescriptionConstants);
            int    animalsCount = GetAnimalsCount(part.parms);
            string output       = GenLabel.BestKindLabel(part.parms.animalKind, Gender.None, plural: true, animalsCount);

            outExtraDescriptionRules.Add(new Rule_String("count", animalsCount.ToString()));
            outExtraDescriptionRules.Add(new Rule_String("kindLabel", output));
            outExtraDescriptionConstants.Add("count", animalsCount.ToString());
        }
Пример #3
0
        public override string GetPostProcessedThreatLabel(Site site, SiteCoreOrPartBase siteCoreOrPart)
        {
            int animalsCount = this.GetAnimalsCount(siteCoreOrPart.parms);

            return(string.Concat(new object[]
            {
                base.GetPostProcessedThreatLabel(site, siteCoreOrPart),
                " (",
                animalsCount,
                " ",
                GenLabel.BestKindLabel(siteCoreOrPart.parms.animalKind, Gender.None, true, animalsCount),
                ")"
            }));
        }
Пример #4
0
 public static List <string> PawnKindsToList(IEnumerable <PawnKindDef> pawnKinds)
 {
     tmpPawnKinds.Clear();
     tmpPawnKinds.AddRange(pawnKinds);
     if (tmpPawnKinds.Count >= 2)
     {
         tmpPawnKinds.SortBy((PawnKindDef x) => !x.RaceProps.Humanlike, (PawnKindDef x) => GenLabel.BestKindLabel(x, Gender.None, plural: true));
     }
     tmpAddedPawnKinds.Clear();
     tmpPawnKindsStr.Clear();
     for (int i = 0; i < tmpPawnKinds.Count; i++)
     {
         if (tmpAddedPawnKinds.Contains(tmpPawnKinds[i]))
         {
             continue;
         }
         tmpAddedPawnKinds.Add(tmpPawnKinds[i]);
         int num = 0;
         for (int j = 0; j < tmpPawnKinds.Count; j++)
         {
             if (tmpPawnKinds[j] == tmpPawnKinds[i])
             {
                 num++;
             }
         }
         if (num == 1)
         {
             tmpPawnKindsStr.Add("1 " + GenLabel.BestKindLabel(tmpPawnKinds[i], Gender.None));
         }
         else
         {
             tmpPawnKindsStr.Add(num + " " + GenLabel.BestKindLabel(tmpPawnKinds[i], Gender.None, plural: true, num));
         }
     }
     return(tmpPawnKindsStr);
 }
Пример #5
0
        public override string GetPostProcessedDescriptionDialogue(Site site, SiteCoreOrPartBase siteCoreOrPart)
        {
            int animalsCount = this.GetAnimalsCount(siteCoreOrPart.parms);

            return(string.Format(base.GetPostProcessedDescriptionDialogue(site, siteCoreOrPart), animalsCount, GenLabel.BestKindLabel(siteCoreOrPart.parms.animalKind, Gender.None, true, animalsCount)));
        }
Пример #6
0
        public override string GetPostProcessedThreatLabel(Site site, SiteCoreOrPartBase siteCoreOrPart)
        {
            int animalsCount = GetAnimalsCount(siteCoreOrPart.parms);

            return(base.GetPostProcessedThreatLabel(site, siteCoreOrPart) + " (" + animalsCount + " " + GenLabel.BestKindLabel(siteCoreOrPart.parms.animalKind, Gender.None, plural: true, animalsCount) + ")");
        }
Пример #7
0
 private static string <PawnKindsToCommaList> m__4(PawnKindDef x)
 {
     return(GenLabel.BestKindLabel(x, Gender.None, true, -1));
 }
Пример #8
0
        public static string BestKindLabel(PawnKindDef kindDef, Gender gender, bool plural = false, int pluralCount = -1)
        {
            bool flag;

            return(GenLabel.BestKindLabel(kindDef, gender, out flag, plural, pluralCount));
        }
Пример #9
0
        public static string BestKindLabel(Pawn pawn, bool mustNoteGender = false, bool mustNoteLifeStage = false, bool plural = false, int pluralCount = -1)
        {
            if (plural && pluralCount == 1)
            {
                plural = false;
            }
            bool   flag   = false;
            bool   flag2  = false;
            string text   = null;
            Gender gender = pawn.gender;

            if (gender != Gender.None)
            {
                if (gender != Gender.Male)
                {
                    if (gender == Gender.Female)
                    {
                        if (plural && !pawn.RaceProps.Humanlike && pawn.ageTracker.CurKindLifeStage.labelFemalePlural != null)
                        {
                            text  = pawn.ageTracker.CurKindLifeStage.labelFemalePlural;
                            flag2 = true;
                            flag  = true;
                        }
                        else if (!pawn.RaceProps.Humanlike && pawn.ageTracker.CurKindLifeStage.labelFemale != null)
                        {
                            text  = pawn.ageTracker.CurKindLifeStage.labelFemale;
                            flag2 = true;
                            flag  = true;
                            if (plural)
                            {
                                text = Find.ActiveLanguageWorker.Pluralize(text, pluralCount);
                            }
                        }
                        else if (plural && !pawn.RaceProps.Humanlike && pawn.ageTracker.CurKindLifeStage.labelPlural != null)
                        {
                            text  = pawn.ageTracker.CurKindLifeStage.labelPlural;
                            flag2 = true;
                        }
                        else if (!pawn.RaceProps.Humanlike && pawn.ageTracker.CurKindLifeStage.label != null)
                        {
                            text  = pawn.ageTracker.CurKindLifeStage.label;
                            flag2 = true;
                            if (plural)
                            {
                                text = Find.ActiveLanguageWorker.Pluralize(text, pluralCount);
                            }
                        }
                        else
                        {
                            text = GenLabel.BestKindLabel(pawn.kindDef, Gender.Female, out flag, plural, pluralCount);
                        }
                    }
                }
                else if (plural && !pawn.RaceProps.Humanlike && pawn.ageTracker.CurKindLifeStage.labelMalePlural != null)
                {
                    text  = pawn.ageTracker.CurKindLifeStage.labelMalePlural;
                    flag2 = true;
                    flag  = true;
                }
                else if (!pawn.RaceProps.Humanlike && pawn.ageTracker.CurKindLifeStage.labelMale != null)
                {
                    text  = pawn.ageTracker.CurKindLifeStage.labelMale;
                    flag2 = true;
                    flag  = true;
                    if (plural)
                    {
                        text = Find.ActiveLanguageWorker.Pluralize(text, pluralCount);
                    }
                }
                else if (plural && !pawn.RaceProps.Humanlike && pawn.ageTracker.CurKindLifeStage.labelPlural != null)
                {
                    text  = pawn.ageTracker.CurKindLifeStage.labelPlural;
                    flag2 = true;
                }
                else if (!pawn.RaceProps.Humanlike && pawn.ageTracker.CurKindLifeStage.label != null)
                {
                    text  = pawn.ageTracker.CurKindLifeStage.label;
                    flag2 = true;
                    if (plural)
                    {
                        text = Find.ActiveLanguageWorker.Pluralize(text, pluralCount);
                    }
                }
                else
                {
                    text = GenLabel.BestKindLabel(pawn.kindDef, Gender.Male, out flag, plural, pluralCount);
                }
            }
            else if (plural && !pawn.RaceProps.Humanlike && pawn.ageTracker.CurKindLifeStage.labelPlural != null)
            {
                text  = pawn.ageTracker.CurKindLifeStage.labelPlural;
                flag2 = true;
            }
            else if (!pawn.RaceProps.Humanlike && pawn.ageTracker.CurKindLifeStage.label != null)
            {
                text  = pawn.ageTracker.CurKindLifeStage.label;
                flag2 = true;
                if (plural)
                {
                    text = Find.ActiveLanguageWorker.Pluralize(text, pluralCount);
                }
            }
            else
            {
                text = GenLabel.BestKindLabel(pawn.kindDef, Gender.None, out flag, plural, pluralCount);
            }
            if (mustNoteGender && !flag && pawn.gender != Gender.None)
            {
                text = "PawnMainDescGendered".Translate(new object[]
                {
                    pawn.GetGenderLabel(),
                    text
                });
            }
            if (mustNoteLifeStage && !flag2 && pawn.ageTracker != null && pawn.ageTracker.CurLifeStage.visible)
            {
                text = "PawnMainDescLifestageWrap".Translate(new object[]
                {
                    text,
                    pawn.ageTracker.CurLifeStage.Adjective
                });
            }
            return(text);
        }
Пример #10
0
        public override string GetPostProcessedThreatLabel(Site site, SitePart sitePart)
        {
            int animalsCount = GetAnimalsCount(sitePart.parms);

            return(base.GetPostProcessedThreatLabel(site, sitePart) + ": " + "KnownSiteThreatEnemyCountAppend".Translate(animalsCount.ToString(), GenLabel.BestKindLabel(sitePart.parms.animalKind, Gender.None, plural: true, animalsCount)));
        }