public override string GetPostProcessedThreatLabel(Site site, SiteCoreOrPartBase siteCoreOrPart)
 {
     return(string.Concat(base.GetPostProcessedThreatLabel(site, siteCoreOrPart),
                          " (",
                          GenLabel.BestKindLabel(siteCoreOrPart.parms.animalKind, Gender.None, true),
                          ")"
                          ));
 }
        public override string CompInspectStringExtra()
        {
            string text = base.CompInspectStringExtra();

            if (this.innerContainer.Count < 3)
            {
                if (!text.NullOrEmpty())
                {
                    text += "\n";
                }
                text = string.Concat(new object[]
                {
                    text,
                    GenLabel.BestKindLabel(PawnKindDef.Named("AA_Dryad_Corruptor"), Gender.Male, true, -1).CapitalizeFirst(),
                    ": ",
                    this.innerContainer.Count,
                    "/",
                    3
                });
            }
            return(text);
        }
        public static IEnumerable <Rule> RulesForPawn(string pawnSymbol, Name name, string title, PawnKindDef kind, Gender gender, Faction faction, Dictionary <string, string> constants = null)
        {
            string nameFull;

            if (name != null)
            {
                nameFull = Find.ActiveLanguageWorker.WithIndefiniteArticle(name.ToStringFull, gender, false, true);
            }
            else
            {
                nameFull = Find.ActiveLanguageWorker.WithIndefiniteArticle(kind.label, gender, false, false);
            }
            yield return(new Rule_String(pawnSymbol + "_nameFull", nameFull));

            string nameShort;

            if (name != null)
            {
                nameShort = name.ToStringShort;
            }
            else
            {
                nameShort = kind.label;
            }
            yield return(new Rule_String(pawnSymbol + "_label", nameShort));

            string nameShortDef;

            if (name != null)
            {
                nameShortDef = Find.ActiveLanguageWorker.WithDefiniteArticle(name.ToStringShort, gender, false, true);
            }
            else
            {
                nameShortDef = Find.ActiveLanguageWorker.WithDefiniteArticle(kind.label, gender, false, false);
            }
            yield return(new Rule_String(pawnSymbol + "_definite", nameShortDef));

            yield return(new Rule_String(pawnSymbol + "_nameDef", nameShortDef));

            string nameShortIndef;

            if (name != null)
            {
                nameShortIndef = Find.ActiveLanguageWorker.WithIndefiniteArticle(name.ToStringShort, gender, false, true);
            }
            else
            {
                nameShortIndef = Find.ActiveLanguageWorker.WithIndefiniteArticle(kind.label, gender, false, false);
            }
            yield return(new Rule_String(pawnSymbol + "_indefinite", nameShortIndef));

            yield return(new Rule_String(pawnSymbol + "_nameIndef", nameShortIndef));

            yield return(new Rule_String(pawnSymbol + "_pronoun", gender.GetPronoun()));

            yield return(new Rule_String(pawnSymbol + "_possessive", gender.GetPossessive()));

            yield return(new Rule_String(pawnSymbol + "_objective", gender.GetObjective()));

            if (faction != null)
            {
                yield return(new Rule_String(pawnSymbol + "_factionName", faction.Name));
            }
            if (kind != null)
            {
                yield return(new Rule_String(pawnSymbol + "_kind", GenLabel.BestKindLabel(kind, gender, false, -1)));
            }
            if (title != null)
            {
                yield return(new Rule_String(pawnSymbol + "_title", title));
            }
            if (constants != null && kind != null)
            {
                constants[pawnSymbol + "_flesh"] = kind.race.race.FleshType.defName;
            }
        }
 public override string GetPostProcessedDescriptionDialogue(Site site, SiteCoreOrPartBase siteCoreOrPart)
 {
     return(string.Format(base.GetPostProcessedDescriptionDialogue(site, siteCoreOrPart), GenLabel.BestKindLabel(siteCoreOrPart.parms.animalKind, Gender.None, true)));
 }
Beispiel #5
0
        public static IEnumerable <Rule> RulesForPawn(string pawnSymbol, Name name, string title, PawnKindDef kind, Gender gender, Faction faction, int age, int chronologicalAge, string relationInfo, bool everBeenColonistOrTameAnimal, bool everBeenQuestLodger, bool isFactionLeader, List <RoyalTitle> royalTitles, Dictionary <string, string> constants = null, bool addTags = true)
        {
            string prefix = "";

            if (!pawnSymbol.NullOrEmpty())
            {
                prefix = prefix + pawnSymbol + "_";
            }
            string kindLabel;

            switch (gender)
            {
            case Gender.Female:
                kindLabel = (kind.labelFemale.NullOrEmpty() ? kind.label : kind.labelFemale);
                break;

            case Gender.Male:
                kindLabel = (kind.labelMale.NullOrEmpty() ? kind.label : kind.labelMale);
                break;

            default:
                kindLabel = kind.label;
                break;
            }
            yield return(new Rule_String(output: ((name == null) ? Find.ActiveLanguageWorker.WithIndefiniteArticle(kindLabel, gender) : Find.ActiveLanguageWorker.WithIndefiniteArticle(name.ToStringFull, gender, plural: false, name: true)).ApplyTag(TagType.Name).Resolve(), keyword: prefix + "nameFull"));

            string nameShort = (name == null) ? kindLabel : name.ToStringShort;

            yield return(new Rule_String(prefix + "label", addTags ? nameShort.ApplyTag(TagType.Name).Resolve() : nameShort));

            string nameShortDef2 = (name == null) ? Find.ActiveLanguageWorker.WithDefiniteArticle(kindLabel, gender) : Find.ActiveLanguageWorker.WithDefiniteArticle(name.ToStringShort, gender, plural: false, name: true);

            yield return(new Rule_String(prefix + "definite", addTags ? nameShortDef2.ApplyTag(TagType.Name).Resolve() : nameShortDef2));

            yield return(new Rule_String(prefix + "nameDef", addTags ? nameShortDef2.ApplyTag(TagType.Name).Resolve() : nameShortDef2));

            nameShortDef2 = ((name == null) ? Find.ActiveLanguageWorker.WithIndefiniteArticle(kindLabel, gender) : Find.ActiveLanguageWorker.WithIndefiniteArticle(name.ToStringShort, gender, plural: false, name: true));
            yield return(new Rule_String(prefix + "indefinite", addTags ? nameShortDef2.ApplyTag(TagType.Name).Resolve() : nameShortDef2));

            yield return(new Rule_String(prefix + "nameIndef", addTags ? nameShortDef2.ApplyTag(TagType.Name).Resolve() : nameShortDef2));

            yield return(new Rule_String(prefix + "pronoun", gender.GetPronoun()));

            yield return(new Rule_String(prefix + "possessive", gender.GetPossessive()));

            yield return(new Rule_String(prefix + "objective", gender.GetObjective()));

            if (faction != null)
            {
                yield return(new Rule_String(prefix + "factionName", addTags ? faction.Name.ApplyTag(faction).Resolve() : faction.Name));

                if (constants != null)
                {
                    constants[prefix + "faction"] = faction.def.defName;
                }
            }
            if (constants != null && isFactionLeader)
            {
                constants[prefix + "factionLeader"] = "True";
            }
            if (kind != null)
            {
                yield return(new Rule_String(prefix + "kind", GenLabel.BestKindLabel(kind, gender)));
            }
            if (title != null)
            {
                yield return(new Rule_String(prefix + "title", title));

                yield return(new Rule_String(prefix + "titleIndef", Find.ActiveLanguageWorker.WithIndefiniteArticle(title, gender)));

                yield return(new Rule_String(prefix + "titleDef", Find.ActiveLanguageWorker.WithDefiniteArticle(title, gender)));
            }
            if (royalTitles != null)
            {
                int        royalTitleIndex = 0;
                RoyalTitle bestTitle       = null;
                foreach (RoyalTitle royalTitle in royalTitles.OrderBy((RoyalTitle x) => x.def.index))
                {
                    yield return(new Rule_String(prefix + "royalTitle" + royalTitleIndex, royalTitle.def.GetLabelFor(gender)));

                    yield return(new Rule_String(prefix + "royalTitle" + royalTitleIndex + "Indef", Find.ActiveLanguageWorker.WithIndefiniteArticle(royalTitle.def.GetLabelFor(gender))));

                    yield return(new Rule_String(prefix + "royalTitle" + royalTitleIndex + "Def", Find.ActiveLanguageWorker.WithDefiniteArticle(royalTitle.def.GetLabelFor(gender))));

                    yield return(new Rule_String(prefix + "royalTitleFaction" + royalTitleIndex, royalTitle.faction.Name.ApplyTag(royalTitle.faction).Resolve()));

                    if (royalTitle.faction == faction)
                    {
                        yield return(new Rule_String(prefix + "royalTitleInCurrentFaction", royalTitle.def.GetLabelFor(gender)));

                        yield return(new Rule_String(prefix + "royalTitleInCurrentFactionIndef", Find.ActiveLanguageWorker.WithIndefiniteArticle(royalTitle.def.GetLabelFor(gender))));

                        yield return(new Rule_String(prefix + "royalTitleInCurrentFactionDef", Find.ActiveLanguageWorker.WithDefiniteArticle(royalTitle.def.GetLabelFor(gender))));

                        if (constants != null)
                        {
                            constants[prefix + "royalInCurrentFaction"] = "True";
                        }
                    }
                    if (bestTitle == null || royalTitle.def.favorCost > bestTitle.def.favorCost)
                    {
                        bestTitle = royalTitle;
                    }
                    royalTitleIndex++;
                }
                if (bestTitle != null)
                {
                    yield return(new Rule_String(prefix + "bestRoyalTitle", bestTitle.def.GetLabelFor(gender)));

                    yield return(new Rule_String(prefix + "bestRoyalTitleIndef", Find.ActiveLanguageWorker.WithIndefiniteArticle(bestTitle.def.GetLabelFor(gender))));

                    yield return(new Rule_String(prefix + "bestRoyalTitleDef", Find.ActiveLanguageWorker.WithDefiniteArticle(bestTitle.def.GetLabelFor(gender))));

                    yield return(new Rule_String(prefix + "bestRoyalTitleFaction", bestTitle.faction.Name));
                }
            }
            yield return(new Rule_String(prefix + "age", age.ToString()));

            yield return(new Rule_String(prefix + "chronologicalAge", chronologicalAge.ToString()));

            if (everBeenColonistOrTameAnimal)
            {
                yield return(new Rule_String("formerlyColonistInfo", "PawnWasFormerlyColonist".Translate(nameShort)));

                if (constants != null)
                {
                    constants[prefix + "formerlyColonist"] = "True";
                }
            }
            else if (everBeenQuestLodger)
            {
                yield return(new Rule_String("formerlyColonistInfo", "PawnWasFormerlyLodger".Translate(nameShort)));

                if (constants != null)
                {
                    constants[prefix + "formerlyColonist"] = "True";
                }
            }
            yield return(new Rule_String(prefix + "relationInfo", relationInfo));

            if (constants != null && kind != null)
            {
                constants[prefix + "flesh"] = kind.race.race.FleshType.defName;
            }
            if (constants != null)
            {
                constants[prefix + "gender"] = gender.ToString();
            }
        }