private IEnumerable <Dialog_InfoCard.Hyperlink> GetHyperlinks() { if (defs != null) { for (int j = 0; j < defs.Count; j++) { yield return(new Dialog_InfoCard.Hyperlink(defs[j])); } } if (things == null) { yield break; } for (int j = 0; j < things.Count; j++) { if (things[j] is Pawn pawn && pawn.royalty != null && pawn.royalty.AllTitlesForReading.Any()) { RoyalTitle mostSeniorTitle = pawn.royalty.MostSeniorTitle; if (mostSeniorTitle != null) { yield return(new Dialog_InfoCard.Hyperlink(mostSeniorTitle.def, mostSeniorTitle.faction)); } } } }
private static void PawnKindApparelCheck() { List <DebugMenuOption> list = new List <DebugMenuOption>(); foreach (PawnKindDef item in from kd in DefDatabase <PawnKindDef> .AllDefs where kd.race == ThingDefOf.Human orderby kd.defName select kd) { PawnKindDef localKindDef = item; list.Add(new DebugMenuOption(localKindDef.defName, DebugMenuOptionMode.Action, delegate { Faction faction = FactionUtility.DefaultFactionFrom(localKindDef.defaultFactionType); bool flag = false; for (int k = 0; k < 100; k++) { Pawn pawn2 = PawnGenerator.GeneratePawn(localKindDef, faction); if (pawn2.royalty != null) { RoyalTitle mostSeniorTitle2 = pawn2.royalty.MostSeniorTitle; if (mostSeniorTitle2 != null && !mostSeniorTitle2.def.requiredApparel.NullOrEmpty()) { for (int l = 0; l < mostSeniorTitle2.def.requiredApparel.Count; l++) { if (!mostSeniorTitle2.def.requiredApparel[l].IsMet(pawn2)) { Log.Error(string.Concat(localKindDef, " (", mostSeniorTitle2.def.label, ") does not have its title requirements met. index=", l, logApparel(pawn2))); flag = true; } } } } List <Apparel> wornApparel2 = pawn2.apparel.WornApparel; for (int m = 0; m < wornApparel2.Count; m++) { string text = apparelOkayToWear(pawn2, wornApparel2[m]); if (text != "OK") { Log.Error(text + " - " + wornApparel2[m].Label + logApparel(pawn2)); flag = true; } } Find.WorldPawns.PassToWorld(pawn2, PawnDiscardDecideMode.Discard); } if (!flag) { Log.Message("No errors for " + localKindDef.defName); } })); } Find.WindowStack.Add(new Dialog_DebugOptionListLister(list));
static string apparelOkayToWear(Pawn pawn, Apparel apparel) { ApparelProperties app = apparel.def.apparel; if (!pawn.kindDef.apparelRequired.NullOrEmpty() && pawn.kindDef.apparelRequired.Contains(apparel.def)) { return("OK"); } if (!app.CorrectGenderForWearing(pawn.gender)) { return("Wrong gender."); } List <SpecificApparelRequirement> specificApparelRequirements = pawn.kindDef.specificApparelRequirements; if (specificApparelRequirements != null) { for (int i = 0; i < specificApparelRequirements.Count; i++) { if (PawnApparelGenerator.ApparelRequirementHandlesThing(specificApparelRequirements[i], apparel.def) && PawnApparelGenerator.ApparelRequirementTagsMatch(specificApparelRequirements[i], apparel.def)) { return("OK"); } } } if (!pawn.kindDef.apparelTags.NullOrEmpty()) { if (!app.tags.Any((string tag) => pawn.kindDef.apparelTags.Contains(tag))) { return("Required tag missing."); } if ((pawn.royalty == null || pawn.royalty.MostSeniorTitle == null) && app.tags.Contains("Royal") && !pawn.kindDef.apparelTags.Any((string tag) => app.tags.Contains(tag))) { return("Royal apparel on non-royal pawn."); } } if (!pawn.kindDef.apparelDisallowTags.NullOrEmpty() && pawn.kindDef.apparelDisallowTags.Any((string t) => app.tags.Contains(t))) { return("Has a disallowed tag."); } if (pawn.royalty != null && pawn.royalty.AllTitlesInEffectForReading.Any()) { RoyalTitle mostSeniorTitle = pawn.royalty.MostSeniorTitle; if (apparel.TryGetQuality(out var qc) && (int)qc < (int)mostSeniorTitle.def.requiredMinimumApparelQuality) { return("Quality too low."); } } return("OK"); }
private static string GetTitleTipString(Pawn pawn, Faction faction, RoyalTitle title, int favor) { RoyalTitleDef def = title.def; TaggedString t = "RoyalTitleTooltipHasTitle".Translate(pawn.Named("PAWN"), faction.Named("FACTION"), def.GetLabelCapFor(pawn).Named("TITLE")); t += "\n\n" + faction.def.royalFavorLabel.CapitalizeFirst() + ": " + favor; RoyalTitleDef nextTitle = def.GetNextTitle(faction); if (nextTitle != null) { t += "\n" + "RoyalTitleTooltipNextTitle".Translate() + ": " + nextTitle.GetLabelCapFor(pawn) + " (" + "RoyalTitleTooltipNextTitleFavorCost".Translate(nextTitle.favorCost.ToString(), faction.Named("FACTION")) + ")"; } else { t += "\n" + "RoyalTitleTooltipFinalTitle".Translate(); } if (title.def.canBeInherited) { Pawn heir = pawn.royalty.GetHeir(faction); if (heir != null) { t += "\n\n" + "RoyalTitleTooltipInheritance".Translate(pawn.Named("PAWN"), heir.Named("HEIR")); if (heir.Faction == null) { t += " " + "RoyalTitleTooltipHeirNoFaction".Translate(heir.Named("HEIR")); } else if (heir.Faction != faction) { t += " " + "RoyalTitleTooltipHeirDifferentFaction".Translate(heir.Named("HEIR"), heir.Faction.Named("FACTION")); } } else { t += "\n\n" + "RoyalTitleTooltipNoHeir".Translate(pawn.Named("PAWN")); } } else { t += "\n\n" + "LetterRoyalTitleCantBeInherited".Translate(title.def.Named("TITLE")).CapitalizeFirst() + " " + "LetterRoyalTitleNoHeir".Translate(pawn.Named("PAWN")); } t += "\n\n" + (title.conceited ? "RoyalTitleTooltipConceited" : "RoyalTitleTooltipNonConceited").Translate(pawn.Named("PAWN")); t += "\n\n" + RoyalTitleUtility.GetTitleProgressionInfo(faction, pawn); return((t + ("\n\n" + "ClickToLearnMore".Translate())).Resolve()); }
private static bool IsGoodPawn(Pawn pawn, GetPawnParms parms) { if (parms.mustBeFactionLeader) { Faction faction = pawn.Faction; if (faction == null || faction.leader != pawn || !faction.def.humanlikeFaction || faction.defeated || faction.Hidden || faction.IsPlayer || pawn.IsPrisoner) { return(false); } } if (parms.mustBeOfFaction != null && pawn.Faction != parms.mustBeOfFaction) { return(false); } if (pawn.Faction != null && parms.excludeFactionDefs != null && parms.excludeFactionDefs.Contains(pawn.Faction.def)) { return(false); } if (pawn.Faction != null && (int)pawn.Faction.def.techLevel < (int)parms.minTechLevel) { return(false); } if (parms.mustBeOfKind != null && pawn.kindDef != parms.mustBeOfKind) { return(false); } if (parms.mustHaveRoyalTitleInCurrentFaction && (pawn.Faction == null || pawn.royalty == null || !pawn.royalty.HasAnyTitleIn(pawn.Faction))) { return(false); } if (parms.seniorityRange != default(FloatRange) && (pawn.royalty == null || pawn.royalty.MostSeniorTitle == null || !parms.seniorityRange.IncludesEpsilon(pawn.royalty.MostSeniorTitle.def.seniority))) { return(false); } if (parms.mustBeWorldPawn && !pawn.IsWorldPawn()) { return(false); } if (parms.ifWorldPawnThenMustBeFree && pawn.IsWorldPawn() && Find.WorldPawns.GetSituation(pawn) != WorldPawnSituation.Free) { return(false); } if (parms.ifWorldPawnThenMustBeFreeOrLeader && pawn.IsWorldPawn() && Find.WorldPawns.GetSituation(pawn) != WorldPawnSituation.Free && Find.WorldPawns.GetSituation(pawn) != WorldPawnSituation.FactionLeader) { return(false); } if (pawn.IsWorldPawn() && Find.WorldPawns.GetSituation(pawn) == WorldPawnSituation.ReservedByQuest) { return(false); } if (parms.mustHaveNoFaction && pawn.Faction != null) { return(false); } if (parms.mustBeFreeColonist && !pawn.IsFreeColonist) { return(false); } if (parms.mustBePlayerPrisoner && !pawn.IsPrisonerOfColony) { return(false); } if (parms.mustBeNotSuspended && pawn.Suspended) { return(false); } if (parms.mustBeNonHostileToPlayer && (pawn.HostileTo(Faction.OfPlayer) || (pawn.Faction != null && pawn.Faction != Faction.OfPlayer && pawn.Faction.HostileTo(Faction.OfPlayer)))) { return(false); } if (!(parms.allowPermanentEnemyFaction ?? true) && pawn.Faction != null && pawn.Faction.def.permanentEnemy) { return(false); } if (parms.requireResearchedBedroomFurnitureIfRoyal) { RoyalTitle royalTitle = pawn.royalty.HighestTitleWithBedroomRequirements(); if (royalTitle != null && !PlayerHasResearchedBedroomRequirementsFor(royalTitle.def)) { return(false); } } return(true); }
private static void PawnKindAbilityCheck() { List <DebugMenuOption> list = new List <DebugMenuOption>(); StringBuilder sb = new StringBuilder(); foreach (PawnKindDef item in from kd in DefDatabase <PawnKindDef> .AllDefs where kd.titleRequired != null || !kd.titleSelectOne.NullOrEmpty() orderby kd.defName select kd) { PawnKindDef localKindDef = item; list.Add(new DebugMenuOption(localKindDef.defName, DebugMenuOptionMode.Action, delegate { Faction faction = FactionUtility.DefaultFactionFrom(localKindDef.defaultFactionType); for (int i = 0; i < 100; i++) { RoyalTitleDef fixedTitle = null; if (localKindDef.titleRequired != null) { fixedTitle = localKindDef.titleRequired; } else if (!localKindDef.titleSelectOne.NullOrEmpty() && Rand.Chance(localKindDef.royalTitleChance)) { fixedTitle = localKindDef.titleSelectOne.RandomElementByWeight((RoyalTitleDef t) => t.commonality); } Pawn pawn = PawnGenerator.GeneratePawn(new PawnGenerationRequest(localKindDef, faction, PawnGenerationContext.NonPlayer, -1, forceGenerateNewPawn: false, newborn: false, allowDead: false, allowDowned: false, canGeneratePawnRelations: true, mustBeCapableOfViolence: false, 1f, forceAddFreeWarmLayerIfNeeded: false, allowGay: true, allowFood: true, allowAddictions: true, inhabitant: false, certainlyBeenInCryptosleep: false, forceRedressWorldPawnIfFormerColonist: false, worldPawnFactionDoesntMatter: false, 0f, null, 1f, null, null, null, null, null, null, null, null, null, null, null, fixedTitle)); RoyalTitle mostSeniorTitle = pawn.royalty.MostSeniorTitle; if (mostSeniorTitle != null) { Hediff_Psylink mainPsylinkSource = pawn.GetMainPsylinkSource(); if (mainPsylinkSource == null) { if (mostSeniorTitle.def.MaxAllowedPsylinkLevel(faction.def) > 0) { string text = mostSeniorTitle.def.LabelCap + " - No psylink."; if (pawn.abilities.abilities.Any((Ability x) => x.def.level > 0)) { text += " Has psycasts without psylink."; } sb.AppendLine(text); } } else if (mainPsylinkSource.level < mostSeniorTitle.def.MaxAllowedPsylinkLevel(faction.def)) { sb.AppendLine("Psylink at level " + mainPsylinkSource.level + ", but requires " + mostSeniorTitle.def.MaxAllowedPsylinkLevel(faction.def)); } else if (mainPsylinkSource.level > mostSeniorTitle.def.MaxAllowedPsylinkLevel(faction.def)) { sb.AppendLine("Psylink at level " + mainPsylinkSource.level + ". Max is " + mostSeniorTitle.def.MaxAllowedPsylinkLevel(faction.def)); } } Find.WorldPawns.PassToWorld(pawn, PawnDiscardDecideMode.Discard); } if (sb.Length == 0) { Log.Message("No errors for " + localKindDef.defName); } else { Log.Error("Errors:\n" + sb.ToString()); } })); } Find.WindowStack.Add(new Dialog_DebugOptionListLister(list)); }
private static void PawnKindApparelCheck() { List <DebugMenuOption> list = new List <DebugMenuOption>(); foreach (PawnKindDef item in from kd in DefDatabase <PawnKindDef> .AllDefs where kd.race == ThingDefOf.Human orderby kd.defName select kd) { PawnKindDef localKindDef = item; list.Add(new DebugMenuOption(localKindDef.defName, DebugMenuOptionMode.Action, delegate { Faction faction = FactionUtility.DefaultFactionFrom(localKindDef.defaultFactionType); bool flag = false; for (int k = 0; k < 100; k++) { Pawn pawn2 = PawnGenerator.GeneratePawn(localKindDef, faction); if (pawn2.royalty != null) { RoyalTitle mostSeniorTitle2 = pawn2.royalty.MostSeniorTitle; if (mostSeniorTitle2 != null && !mostSeniorTitle2.def.requiredApparel.NullOrEmpty()) { for (int l = 0; l < mostSeniorTitle2.def.requiredApparel.Count; l++) { if (!mostSeniorTitle2.def.requiredApparel[l].IsMet(pawn2)) { Log.Error(localKindDef + " (" + mostSeniorTitle2.def.label + ") does not have its title requirements met. index=" + l + logApparel(pawn2)); flag = true; } } } } List <Apparel> wornApparel2 = pawn2.apparel.WornApparel; for (int m = 0; m < wornApparel2.Count; m++) { string text = apparelOkayToWear(pawn2, wornApparel2[m]); if (text != "OK") { Log.Error(text + " - " + wornApparel2[m].Label + logApparel(pawn2)); flag = true; } } Find.WorldPawns.PassToWorld(pawn2, PawnDiscardDecideMode.Discard); } if (!flag) { Log.Message("No errors for " + localKindDef.defName); } })); } Find.WindowStack.Add(new Dialog_DebugOptionListLister(list)); string apparelOkayToWear(Pawn pawn, Apparel apparel) { ApparelProperties app = apparel.def.apparel; if (!pawn.kindDef.apparelRequired.NullOrEmpty() && pawn.kindDef.apparelRequired.Contains(apparel.def)) { return("OK"); } if (!app.CorrectGenderForWearing(pawn.gender)) { return("Wrong gender."); } List <SpecificApparelRequirement> specificApparelRequirements = pawn.kindDef.specificApparelRequirements; if (specificApparelRequirements != null) { for (int i = 0; i < specificApparelRequirements.Count; i++) { if (PawnApparelGenerator.ApparelRequirementHandlesThing(specificApparelRequirements[i], apparel.def) && PawnApparelGenerator.ApparelRequirementTagsMatch(specificApparelRequirements[i], apparel.def)) { return("OK"); } } } if (!pawn.kindDef.apparelTags.NullOrEmpty()) { if (!app.tags.Any((string tag) => pawn.kindDef.apparelTags.Contains(tag))) { return("Required tag missing."); } if ((pawn.royalty == null || pawn.royalty.MostSeniorTitle == null) && app.tags.Contains("Royal") && !pawn.kindDef.apparelTags.Any((string tag) => app.tags.Contains(tag))) { return("Royal apparel on non-royal pawn."); } } if (!pawn.kindDef.apparelDisallowTags.NullOrEmpty() && pawn.kindDef.apparelDisallowTags.Any((string t) => app.tags.Contains(t))) { return("Has a disallowed tag."); } if (pawn.royalty != null && pawn.royalty.AllTitlesInEffectForReading.Any()) { RoyalTitle mostSeniorTitle = pawn.royalty.MostSeniorTitle; if (apparel.TryGetQuality(out QualityCategory qc) && (int)qc < (int)mostSeniorTitle.def.requiredMinimumApparelQuality) { return("Quality too low."); } } return("OK"); } string logApparel(Pawn p) { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.AppendLine(); stringBuilder.AppendLine($"Apparel of {p.LabelShort}:"); List <Apparel> wornApparel = p.apparel.WornApparel; for (int j = 0; j < wornApparel.Count; j++) { stringBuilder.AppendLine(" - " + wornApparel[j].Label); } return(stringBuilder.ToString()); } }
int GetExtendedSeniority(RoyalTitle title) => title.def.seniority * GenDate.TicksPerYear - title.receivedTick;
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(); } }
private static bool TryResolveSymbol(object obj, string subSymbol, string symbolArgs, out TaggedString resolvedStr, string fullStringForReference) { Pawn pawn = obj as Pawn; if (pawn != null) { switch (subSymbol) { case "": resolvedStr = ((pawn.Name != null) ? Find.ActiveLanguageWorker.WithIndefiniteArticle(pawn.Name.ToStringShort, pawn.gender, plural: false, name: true).ApplyTag(TagType.Name) : ((TaggedString)pawn.KindLabelIndefinite())); EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference); return(true); case "nameFull": resolvedStr = ((pawn.Name != null) ? Find.ActiveLanguageWorker.WithIndefiniteArticle(pawn.Name.ToStringFull, pawn.gender, plural: false, name: true).ApplyTag(TagType.Name) : ((TaggedString)pawn.KindLabelIndefinite())); EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference); return(true); case "nameFullDef": resolvedStr = ((pawn.Name != null) ? Find.ActiveLanguageWorker.WithDefiniteArticle(pawn.Name.ToStringFull, pawn.gender, plural: false, name: true).ApplyTag(TagType.Name) : ((TaggedString)pawn.KindLabelDefinite())); EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference); return(true); case "label": resolvedStr = pawn.LabelNoCountColored; EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference); return(true); case "labelShort": resolvedStr = ((pawn.Name != null) ? pawn.Name.ToStringShort.ApplyTag(TagType.Name) : ((TaggedString)pawn.KindLabel)); EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference); return(true); case "definite": resolvedStr = ((pawn.Name != null) ? Find.ActiveLanguageWorker.WithDefiniteArticle(pawn.Name.ToStringShort, pawn.gender, plural: false, name: true).ApplyTag(TagType.Name) : ((TaggedString)pawn.KindLabelDefinite())); EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference); return(true); case "nameDef": resolvedStr = ((pawn.Name != null) ? Find.ActiveLanguageWorker.WithDefiniteArticle(pawn.Name.ToStringShort, pawn.gender, plural: false, name: true).ApplyTag(TagType.Name) : ((TaggedString)pawn.KindLabelDefinite())); EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference); return(true); case "indefinite": resolvedStr = ((pawn.Name != null) ? Find.ActiveLanguageWorker.WithIndefiniteArticle(pawn.Name.ToStringShort, pawn.gender, plural: false, name: true).ApplyTag(TagType.Name) : ((TaggedString)pawn.KindLabelIndefinite())); EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference); return(true); case "nameIndef": resolvedStr = ((pawn.Name != null) ? Find.ActiveLanguageWorker.WithIndefiniteArticle(pawn.Name.ToStringShort, pawn.gender, plural: false, name: true).ApplyTag(TagType.Name) : ((TaggedString)pawn.KindLabelIndefinite())); EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference); return(true); case "pronoun": resolvedStr = pawn.gender.GetPronoun(); EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference); return(true); case "possessive": resolvedStr = pawn.gender.GetPossessive(); EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference); return(true); case "objective": resolvedStr = pawn.gender.GetObjective(); EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference); return(true); case "factionName": resolvedStr = ((pawn.Faction != null) ? pawn.Faction.Name.ApplyTag(pawn.Faction) : ((TaggedString)"")); EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference); return(true); case "factionPawnSingular": resolvedStr = ((pawn.Faction != null) ? pawn.Faction.def.pawnSingular : ""); EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference); return(true); case "factionPawnSingularDef": resolvedStr = ((pawn.Faction != null) ? Find.ActiveLanguageWorker.WithDefiniteArticle(pawn.Faction.def.pawnSingular) : ""); EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference); return(true); case "factionPawnSingularIndef": resolvedStr = ((pawn.Faction != null) ? Find.ActiveLanguageWorker.WithIndefiniteArticle(pawn.Faction.def.pawnSingular) : ""); EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference); return(true); case "factionPawnsPlural": resolvedStr = ((pawn.Faction != null) ? pawn.Faction.def.pawnsPlural : ""); EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference); return(true); case "factionPawnsPluralDef": resolvedStr = ((pawn.Faction != null) ? Find.ActiveLanguageWorker.WithDefiniteArticle(pawn.Faction.def.pawnsPlural, LanguageDatabase.activeLanguage.ResolveGender(pawn.Faction.def.pawnsPlural, pawn.Faction.def.pawnSingular), plural: true) : ""); EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference); return(true); case "factionPawnsPluralIndef": resolvedStr = ((pawn.Faction != null) ? Find.ActiveLanguageWorker.WithIndefiniteArticle(pawn.Faction.def.pawnsPlural, LanguageDatabase.activeLanguage.ResolveGender(pawn.Faction.def.pawnsPlural, pawn.Faction.def.pawnSingular), plural: true) : ""); EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference); return(true); case "factionRoyalFavorLabel": resolvedStr = ((pawn.Faction != null) ? pawn.Faction.def.royalFavorLabel : ""); EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference); return(true); case "kind": resolvedStr = pawn.KindLabel; EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference); return(true); case "kindDef": resolvedStr = pawn.KindLabelDefinite(); EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference); return(true); case "kindIndef": resolvedStr = pawn.KindLabelIndefinite(); EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference); return(true); case "kindPlural": resolvedStr = pawn.GetKindLabelPlural(); EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference); return(true); case "kindPluralDef": resolvedStr = Find.ActiveLanguageWorker.WithDefiniteArticle(pawn.GetKindLabelPlural(), pawn.gender, plural: true); EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference); return(true); case "kindPluralIndef": resolvedStr = Find.ActiveLanguageWorker.WithIndefiniteArticle(pawn.GetKindLabelPlural(), pawn.gender, plural: true); EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference); return(true); case "kindBase": resolvedStr = pawn.kindDef.label; EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference); return(true); case "kindBaseDef": resolvedStr = Find.ActiveLanguageWorker.WithDefiniteArticle(pawn.kindDef.label); EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference); return(true); case "kindBaseIndef": resolvedStr = Find.ActiveLanguageWorker.WithIndefiniteArticle(pawn.kindDef.label); EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference); return(true); case "kindBasePlural": resolvedStr = pawn.kindDef.GetLabelPlural(); EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference); return(true); case "kindBasePluralDef": resolvedStr = Find.ActiveLanguageWorker.WithDefiniteArticle(pawn.kindDef.GetLabelPlural(), LanguageDatabase.activeLanguage.ResolveGender(pawn.kindDef.GetLabelPlural(), pawn.kindDef.label), plural: true); EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference); return(true); case "kindBasePluralIndef": resolvedStr = Find.ActiveLanguageWorker.WithIndefiniteArticle(pawn.kindDef.GetLabelPlural(), LanguageDatabase.activeLanguage.ResolveGender(pawn.kindDef.GetLabelPlural(), pawn.kindDef.label), plural: true); EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference); return(true); case "race": resolvedStr = pawn.def.label; EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference); return(true); case "raceDef": resolvedStr = Find.ActiveLanguageWorker.WithDefiniteArticle(pawn.def.label); EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference); return(true); case "raceIndef": resolvedStr = Find.ActiveLanguageWorker.WithIndefiniteArticle(pawn.def.label); EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference); return(true); case "lifeStage": resolvedStr = pawn.ageTracker.CurLifeStage.label; EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference); return(true); case "lifeStageDef": resolvedStr = Find.ActiveLanguageWorker.WithDefiniteArticle(pawn.ageTracker.CurLifeStage.label, pawn.gender); EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference); return(true); case "lifeStageIndef": resolvedStr = Find.ActiveLanguageWorker.WithIndefiniteArticle(pawn.ageTracker.CurLifeStage.label, pawn.gender); EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference); return(true); case "lifeStageAdjective": resolvedStr = pawn.ageTracker.CurLifeStage.Adjective; EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference); return(true); case "title": resolvedStr = ((pawn.story != null) ? pawn.story.Title : ""); EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference); return(true); case "titleDef": resolvedStr = ((pawn.story != null) ? Find.ActiveLanguageWorker.WithDefiniteArticle(pawn.story.Title, pawn.gender) : ""); EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference); return(true); case "titleIndef": resolvedStr = ((pawn.story != null) ? Find.ActiveLanguageWorker.WithIndefiniteArticle(pawn.story.Title, pawn.gender) : ""); EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference); return(true); case "bestRoyalTitle": resolvedStr = PawnResolveBestRoyalTitle(pawn); EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference); return(true); case "bestRoyalTitleIndef": resolvedStr = Find.ActiveLanguageWorker.WithIndefiniteArticle(PawnResolveBestRoyalTitle(pawn)); EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference); return(true); case "bestRoyalTitleDef": resolvedStr = Find.ActiveLanguageWorker.WithDefiniteArticle(PawnResolveBestRoyalTitle(pawn)); EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference); return(true); case "royalTitleInCurrentFaction": resolvedStr = PawnResolveRoyalTitleInCurrentFaction(pawn); EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference); return(true); case "royalTitleInCurrentFactionIndef": resolvedStr = Find.ActiveLanguageWorker.WithIndefiniteArticle(PawnResolveRoyalTitleInCurrentFaction(pawn)); EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference); return(true); case "royalTitleInCurrentFactionDef": resolvedStr = Find.ActiveLanguageWorker.WithDefiniteArticle(PawnResolveRoyalTitleInCurrentFaction(pawn)); EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference); return(true); case "age": resolvedStr = pawn.ageTracker.AgeBiologicalYears.ToString(); EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference); return(true); case "chronologicalAge": resolvedStr = pawn.ageTracker.AgeChronologicalYears.ToString(); EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference); return(true); case "ageFull": resolvedStr = pawn.ageTracker.AgeNumberString; EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference); return(true); case "relationInfo": { resolvedStr = ""; TaggedString text = resolvedStr; PawnRelationUtility.TryAppendRelationsWithColonistsInfo(ref text, pawn); resolvedStr = text.RawText; return(true); } case "relationInfoInParentheses": resolvedStr = ""; PawnRelationUtility.TryAppendRelationsWithColonistsInfo(ref resolvedStr, pawn); if (!resolvedStr.NullOrEmpty()) { resolvedStr = "(" + resolvedStr + ")"; } return(true); case "gender": resolvedStr = ResolveGenderSymbol(pawn.gender, pawn.RaceProps.Animal, symbolArgs, fullStringForReference); return(true); case "humanlike": resolvedStr = ResolveHumanlikeSymbol(pawn.RaceProps.Humanlike, symbolArgs, fullStringForReference); return(true); default: resolvedStr = ""; return(false); } } Thing thing = obj as Thing; if (thing != null) { switch (subSymbol) { case "": resolvedStr = Find.ActiveLanguageWorker.WithIndefiniteArticle(thing.Label); EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference); return(true); case "label": resolvedStr = thing.Label; EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference); return(true); case "labelPlural": resolvedStr = Find.ActiveLanguageWorker.Pluralize(thing.LabelNoCount); EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference); return(true); case "labelPluralDef": resolvedStr = Find.ActiveLanguageWorker.WithDefiniteArticle(Find.ActiveLanguageWorker.Pluralize(thing.LabelNoCount), LanguageDatabase.activeLanguage.ResolveGender(Find.ActiveLanguageWorker.Pluralize(thing.LabelNoCount), thing.LabelNoCount), plural: true); EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference); return(true); case "labelPluralIndef": resolvedStr = Find.ActiveLanguageWorker.WithIndefiniteArticle(Find.ActiveLanguageWorker.Pluralize(thing.LabelNoCount), LanguageDatabase.activeLanguage.ResolveGender(Find.ActiveLanguageWorker.Pluralize(thing.LabelNoCount), thing.LabelNoCount), plural: true); EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference); return(true); case "labelShort": resolvedStr = thing.LabelShort; EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference); return(true); case "definite": resolvedStr = Find.ActiveLanguageWorker.WithDefiniteArticle(thing.Label); EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference); return(true); case "indefinite": resolvedStr = Find.ActiveLanguageWorker.WithIndefiniteArticle(thing.Label); EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference); return(true); case "pronoun": resolvedStr = LanguageDatabase.activeLanguage.ResolveGender(thing.LabelNoCount).GetPronoun(); EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference); return(true); case "possessive": resolvedStr = LanguageDatabase.activeLanguage.ResolveGender(thing.LabelNoCount).GetPossessive(); EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference); return(true); case "objective": resolvedStr = LanguageDatabase.activeLanguage.ResolveGender(thing.LabelNoCount).GetObjective(); EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference); return(true); case "factionName": resolvedStr = ((thing.Faction != null) ? thing.Faction.Name : ""); EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference); return(true); case "gender": resolvedStr = ResolveGenderSymbol(LanguageDatabase.activeLanguage.ResolveGender(thing.LabelNoCount), animal: false, symbolArgs, fullStringForReference); return(true); default: resolvedStr = ""; return(false); } } Hediff hediff = obj as Hediff; if (hediff != null) { if (subSymbol == "label") { resolvedStr = hediff.Label; EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference); return(true); } if (subSymbol == "labelNoun") { resolvedStr = ((!hediff.def.labelNoun.NullOrEmpty()) ? hediff.def.labelNoun : hediff.Label); EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference); return(true); } } WorldObject worldObject = obj as WorldObject; if (worldObject != null) { switch (subSymbol) { case "": resolvedStr = Find.ActiveLanguageWorker.WithIndefiniteArticle(worldObject.Label, plural: false, worldObject.HasName); EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference); return(true); case "label": resolvedStr = worldObject.Label; EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference); return(true); case "labelPlural": resolvedStr = Find.ActiveLanguageWorker.Pluralize(worldObject.Label); EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference); return(true); case "labelPluralDef": resolvedStr = Find.ActiveLanguageWorker.WithDefiniteArticle(Find.ActiveLanguageWorker.Pluralize(worldObject.Label), LanguageDatabase.activeLanguage.ResolveGender(Find.ActiveLanguageWorker.Pluralize(worldObject.Label), worldObject.Label), plural: true, worldObject.HasName); EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference); return(true); case "labelPluralIndef": resolvedStr = Find.ActiveLanguageWorker.WithIndefiniteArticle(Find.ActiveLanguageWorker.Pluralize(worldObject.Label), LanguageDatabase.activeLanguage.ResolveGender(Find.ActiveLanguageWorker.Pluralize(worldObject.Label), worldObject.Label), plural: true, worldObject.HasName); EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference); return(true); case "definite": resolvedStr = Find.ActiveLanguageWorker.WithDefiniteArticle(worldObject.Label, plural: false, worldObject.HasName); EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference); return(true); case "indefinite": resolvedStr = Find.ActiveLanguageWorker.WithIndefiniteArticle(worldObject.Label, plural: false, worldObject.HasName); EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference); return(true); case "pronoun": resolvedStr = LanguageDatabase.activeLanguage.ResolveGender(worldObject.Label).GetPronoun(); EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference); return(true); case "possessive": resolvedStr = LanguageDatabase.activeLanguage.ResolveGender(worldObject.Label).GetPossessive(); EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference); return(true); case "objective": resolvedStr = LanguageDatabase.activeLanguage.ResolveGender(worldObject.Label).GetObjective(); EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference); return(true); case "factionName": resolvedStr = ((worldObject.Faction != null) ? worldObject.Faction.Name.ApplyTag(worldObject.Faction) : ((TaggedString)"")); EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference); return(true); case "gender": resolvedStr = ResolveGenderSymbol(LanguageDatabase.activeLanguage.ResolveGender(worldObject.Label), animal: false, symbolArgs, fullStringForReference); return(true); default: resolvedStr = ""; return(false); } } Faction faction = obj as Faction; if (faction != null) { switch (subSymbol) { case "": resolvedStr = faction.Name.ApplyTag(faction); EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference); return(true); case "name": resolvedStr = faction.Name.ApplyTag(faction); EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference); return(true); case "pawnSingular": resolvedStr = faction.def.pawnSingular; EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference); return(true); case "pawnSingularDef": resolvedStr = Find.ActiveLanguageWorker.WithDefiniteArticle(faction.def.pawnSingular); EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference); return(true); case "pawnSingularIndef": resolvedStr = Find.ActiveLanguageWorker.WithIndefiniteArticle(faction.def.pawnSingular); EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference); return(true); case "pawnsPlural": resolvedStr = faction.def.pawnsPlural; EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference); return(true); case "pawnsPluralDef": resolvedStr = Find.ActiveLanguageWorker.WithDefiniteArticle(faction.def.pawnsPlural, LanguageDatabase.activeLanguage.ResolveGender(faction.def.pawnsPlural, faction.def.pawnSingular), plural: true); EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference); return(true); case "pawnsPluralIndef": resolvedStr = Find.ActiveLanguageWorker.WithIndefiniteArticle(faction.def.pawnsPlural, LanguageDatabase.activeLanguage.ResolveGender(faction.def.pawnsPlural, faction.def.pawnSingular), plural: true); EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference); return(true); case "royalFavorLabel": resolvedStr = faction.def.royalFavorLabel; EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference); return(true); case "leaderNameDef": resolvedStr = ((faction.leader != null && faction.leader.Name != null) ? Find.ActiveLanguageWorker.WithDefiniteArticle(faction.leader.Name.ToStringShort, faction.leader.gender, plural: false, name: true).ApplyTag(TagType.Name) : ((TaggedString)"")); EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference); return(true); case "leaderPossessive": resolvedStr = ((faction.leader != null) ? faction.leader.gender.GetPossessive() : ""); EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference); return(true); case "leaderObjective": resolvedStr = ((faction.leader != null) ? faction.leader.gender.GetObjective() : ""); EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference); return(true); case "leaderPronoun": resolvedStr = ((faction.leader != null) ? faction.leader.gender.GetPronoun() : ""); EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference); return(true); default: resolvedStr = ""; return(false); } } Def def = obj as Def; if (def != null) { PawnKindDef pawnKindDef = def as PawnKindDef; if (pawnKindDef != null) { switch (subSymbol) { case "labelPlural": resolvedStr = pawnKindDef.GetLabelPlural(); EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference); return(true); case "labelPluralDef": resolvedStr = Find.ActiveLanguageWorker.WithDefiniteArticle(pawnKindDef.GetLabelPlural(), LanguageDatabase.activeLanguage.ResolveGender(pawnKindDef.GetLabelPlural(), pawnKindDef.label), plural: true); EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference); return(true); case "labelPluralIndef": resolvedStr = Find.ActiveLanguageWorker.WithIndefiniteArticle(pawnKindDef.GetLabelPlural(), LanguageDatabase.activeLanguage.ResolveGender(pawnKindDef.GetLabelPlural(), pawnKindDef.label), plural: true); EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference); return(true); } } switch (subSymbol) { case "": resolvedStr = Find.ActiveLanguageWorker.WithIndefiniteArticle(def.label); EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference); return(true); case "label": resolvedStr = def.label; EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference); return(true); case "labelPlural": resolvedStr = Find.ActiveLanguageWorker.Pluralize(def.label); EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference); return(true); case "labelPluralDef": resolvedStr = Find.ActiveLanguageWorker.WithDefiniteArticle(Find.ActiveLanguageWorker.Pluralize(def.label), LanguageDatabase.activeLanguage.ResolveGender(Find.ActiveLanguageWorker.Pluralize(def.label), def.label), plural: true); EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference); return(true); case "labelPluralIndef": resolvedStr = Find.ActiveLanguageWorker.WithIndefiniteArticle(Find.ActiveLanguageWorker.Pluralize(def.label), LanguageDatabase.activeLanguage.ResolveGender(Find.ActiveLanguageWorker.Pluralize(def.label), def.label), plural: true); EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference); return(true); case "definite": resolvedStr = Find.ActiveLanguageWorker.WithDefiniteArticle(def.label); EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference); return(true); case "indefinite": resolvedStr = Find.ActiveLanguageWorker.WithIndefiniteArticle(def.label); EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference); return(true); case "pronoun": resolvedStr = LanguageDatabase.activeLanguage.ResolveGender(def.label).GetPronoun(); EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference); return(true); case "possessive": resolvedStr = LanguageDatabase.activeLanguage.ResolveGender(def.label).GetPossessive(); EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference); return(true); case "objective": resolvedStr = LanguageDatabase.activeLanguage.ResolveGender(def.label).GetObjective(); EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference); return(true); case "gender": resolvedStr = ResolveGenderSymbol(LanguageDatabase.activeLanguage.ResolveGender(def.label), animal: false, symbolArgs, fullStringForReference); return(true); default: resolvedStr = ""; return(false); } } RoyalTitle royalTitle = obj as RoyalTitle; if (royalTitle != null) { if (subSymbol == null || subSymbol.Length != 0) { if (!(subSymbol == "label")) { if (subSymbol == "indefinite") { resolvedStr = Find.ActiveLanguageWorker.WithIndefiniteArticlePostProcessed(royalTitle.Label); EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference); return(true); } resolvedStr = ""; return(false); } resolvedStr = royalTitle.Label; EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference); return(true); } resolvedStr = royalTitle.Label; EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference); return(true); } string text2 = obj as string; if (text2 != null) { switch (subSymbol) { case "": resolvedStr = text2; EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference); return(true); case "plural": resolvedStr = Find.ActiveLanguageWorker.Pluralize(text2); EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference); return(true); case "pluralDef": resolvedStr = Find.ActiveLanguageWorker.WithDefiniteArticle(Find.ActiveLanguageWorker.Pluralize(text2), LanguageDatabase.activeLanguage.ResolveGender(Find.ActiveLanguageWorker.Pluralize(text2), text2), plural: true); EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference); return(true); case "pluralIndef": resolvedStr = Find.ActiveLanguageWorker.WithIndefiniteArticle(Find.ActiveLanguageWorker.Pluralize(text2), LanguageDatabase.activeLanguage.ResolveGender(Find.ActiveLanguageWorker.Pluralize(text2), text2), plural: true); EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference); return(true); case "definite": resolvedStr = Find.ActiveLanguageWorker.WithDefiniteArticle(text2); EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference); return(true); case "indefinite": resolvedStr = Find.ActiveLanguageWorker.WithIndefiniteArticle(text2); EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference); return(true); case "pronoun": resolvedStr = LanguageDatabase.activeLanguage.ResolveGender(text2).GetPronoun(); EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference); return(true); case "possessive": resolvedStr = LanguageDatabase.activeLanguage.ResolveGender(text2).GetPossessive(); EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference); return(true); case "objective": resolvedStr = LanguageDatabase.activeLanguage.ResolveGender(text2).GetObjective(); EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference); return(true); case "gender": resolvedStr = ResolveGenderSymbol(LanguageDatabase.activeLanguage.ResolveGender(text2), animal: false, symbolArgs, fullStringForReference); return(true); default: resolvedStr = ""; return(false); } } if (obj is int || obj is long) { int num = (int)((obj is int) ? ((int)obj) : ((long)obj)); if (subSymbol == null || subSymbol.Length != 0) { if (!(subSymbol == "ordinal")) { if (subSymbol == "multiple") { resolvedStr = ResolveMultipleSymbol(num, symbolArgs, fullStringForReference); return(true); } resolvedStr = ""; return(false); } resolvedStr = Find.ActiveLanguageWorker.OrdinalNumber(num).ToString(); EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference); return(true); } resolvedStr = num.ToString(); EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference); return(true); } if (obj is TaggedString) { EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference); resolvedStr = ((TaggedString)obj).RawText; } if (subSymbol.NullOrEmpty()) { EnsureNoArgs(subSymbol, symbolArgs, fullStringForReference); if (obj == null) { resolvedStr = ""; } else { resolvedStr = obj.ToString(); } return(true); } resolvedStr = ""; return(false); }
public static void DrawCharacterCard(Rect rect, Pawn pawn, Action randomizeCallback = null, Rect creationRect = default(Rect)) { bool creationMode = randomizeCallback != null; GUI.BeginGroup(creationMode ? creationRect : rect); Rect rect2 = new Rect(0f, 0f, 300f, 30f); NameTriple nameTriple = pawn.Name as NameTriple; if (creationMode && nameTriple != null) { Rect rect3 = new Rect(rect2); rect3.width *= 0.333f; Rect rect4 = new Rect(rect2); rect4.width *= 0.333f; rect4.x += rect4.width; Rect rect5 = new Rect(rect2); rect5.width *= 0.333f; rect5.x += rect4.width * 2f; string name = nameTriple.First; string name2 = nameTriple.Nick; string name3 = nameTriple.Last; DoNameInputRect(rect3, ref name, 12); if (nameTriple.Nick == nameTriple.First || nameTriple.Nick == nameTriple.Last) { GUI.color = new Color(1f, 1f, 1f, 0.5f); } DoNameInputRect(rect4, ref name2, 16); GUI.color = Color.white; DoNameInputRect(rect5, ref name3, 12); if (nameTriple.First != name || nameTriple.Nick != name2 || nameTriple.Last != name3) { pawn.Name = new NameTriple(name, string.IsNullOrEmpty(name2) ? name : name2, name3); } TooltipHandler.TipRegionByKey(rect3, "FirstNameDesc"); TooltipHandler.TipRegionByKey(rect4, "ShortIdentifierDesc"); TooltipHandler.TipRegionByKey(rect5, "LastNameDesc"); } else { rect2.width = 999f; Text.Font = GameFont.Medium; Widgets.Label(rect2, pawn.Name.ToStringFull); Text.Font = GameFont.Small; } if (!pawn.health.Dead) { float num = rect.x + 50f; if (pawn.IsFreeColonist && pawn.Spawned && !pawn.IsQuestLodger()) { Rect rect7 = new Rect(num, 0f, 30f, 30f); if (Mouse.IsOver(rect7)) { TooltipHandler.TipRegion(rect7, PawnBanishUtility.GetBanishButtonTip(pawn)); } if (Widgets.ButtonImage(rect7, Banish)) { if (pawn.Downed) { Messages.Message("MessageCantBanishDownedPawn".Translate(pawn.LabelShort, pawn).AdjustedFor(pawn), pawn, MessageTypeDefOf.RejectInput, historical: false); } else { PawnBanishUtility.ShowBanishPawnConfirmationDialog(pawn); } } num -= 35f; } if (pawn.IsColonist) { Rect rect8 = new Rect(num, 0f, 30f, 30f); TooltipHandler.TipRegionByKey(rect8, "RenameColonist"); if (Widgets.ButtonImage(rect8, Rename)) { Find.WindowStack.Add(new Dialog_NamePawn(pawn)); } num -= 35f; } //if (pawn.IsFreeColonist && !pawn.IsQuestLodger() && pawn.royalty != null && pawn.royalty.AllTitlesForReading.Count > 0) //{ // Rect rect9 = new Rect(num, 0f, 30f, 30f); // TooltipHandler.TipRegionByKey(rect9, "RenounceTitle"); // if (Widgets.ButtonImage(rect9, RenounceTitle)) // { // FloatMenuUtility.MakeMenu(pawn.royalty.AllTitlesForReading, (RoyalTitle title) => "RenounceTitle".Translate() + ": " + "TitleOfFaction".Translate(title.def.GetLabelCapFor(pawn), title.faction.GetCallLabel()), delegate (RoyalTitle title) // { // return delegate // { // RoyalTitleUtility.FindLostAndGainedPermits(title.def, null, out List<RoyalTitlePermitDef> _, out List<RoyalTitlePermitDef> lostPermits); // StringBuilder stringBuilder = new StringBuilder(); // if (lostPermits.Count > 0) // { // stringBuilder.AppendLine("RenounceTitleWillLoosePermits".Translate(pawn.Named("PAWN")) + ":"); // foreach (RoyalTitlePermitDef item2 in lostPermits) // { // stringBuilder.AppendLine("- " + item2.LabelCap + " (" + FirstTitleWithPermit(item2).GetLabelFor(pawn) + ")"); // } // stringBuilder.AppendLine(); // } // if (!title.faction.def.renounceTitleMessage.NullOrEmpty()) // { // stringBuilder.AppendLine(title.faction.def.renounceTitleMessage); // } // Find.WindowStack.Add(Dialog_MessageBox.CreateConfirmation("RenounceTitleDescription".Translate(pawn.Named("PAWN"), "TitleOfFaction".Translate(title.def.GetLabelCapFor(pawn), title.faction.GetCallLabel()).Named("TITLE"), stringBuilder.ToString().TrimEndNewlines().Named("EFFECTS")), delegate // { // pawn.royalty.SetTitle(title.faction, null, grantRewards: false); // pawn.royalty.ResetPermitsAndPoints(title.faction, title.def); // }, destructive: true)); // }; // RoyalTitleDef FirstTitleWithPermit(RoyalTitlePermitDef permitDef) // { // return title.faction.def.RoyalTitlesAwardableInSeniorityOrderForReading.First((RoyalTitleDef t) => t.permits != null && t.permits.Contains(permitDef)); // } // }); // } // num -= 40f; //} } List <GenUI.AnonymousStackElement> stackElements = new List <GenUI.AnonymousStackElement>(); Text.Font = GameFont.Small; string text = pawn.MainDesc(writeFaction: false); Vector2 vector = Text.CalcSize(text); Rect rect10 = new Rect(0f, 30f, vector.x + 5f, 24f); Widgets.Label(rect10, text); float height = Text.CalcHeight(text, rect10.width); Rect rect11 = new Rect(rect10.x, rect10.y, rect10.width, height); if (Mouse.IsOver(rect11)) { TooltipHandler.TipRegion(rect11, () => pawn.ageTracker.AgeTooltipString, 6873641); } GenUI.DrawElementStack(new Rect(vector.x + 10f, 45f, 999f, 24f), 22f, stackElements, delegate(Rect r, GenUI.AnonymousStackElement obj) { obj.drawer(r); }, (GenUI.AnonymousStackElement obj) => obj.width, 4f, 5f, allowOrderOptimization: false); stackElements.Clear(); float curY = 30f; if (pawn.royalty != null && pawn.royalty.AllTitlesForReading.Count > 0) { foreach (RoyalTitle title2 in pawn.royalty.AllTitlesForReading) { RoyalTitle localTitle = title2; string titleLabel = localTitle.def.GetLabelCapFor(pawn) + " (" + pawn.royalty.GetFavor(localTitle.faction) + ")"; stackElements.Add(new GenUI.AnonymousStackElement { drawer = delegate(Rect r) { r.x += 100f; Color color5 = GUI.color; Rect rect18 = new Rect(r.x, r.y, r.width + 22f, r.height); GUI.color = StackElementBackground; GUI.DrawTexture(rect18, BaseContent.WhiteTex); GUI.color = color5; int favor = pawn.royalty.GetFavor(localTitle.faction); if (Mouse.IsOver(rect18)) { Widgets.DrawHighlight(rect18); } Rect rect19 = new Rect(r.x, r.y, r.width + 22f, r.height); Rect position2 = new Rect(r.x + 1f, r.y + 1f, 20f, 20f); GUI.color = title2.faction.Color; GUI.DrawTexture(position2, localTitle.faction.def.FactionIcon); GUI.color = color5; Widgets.Label(new Rect(rect19.x + rect19.height + 5f, rect19.y, rect19.width - 10f, rect19.height), titleLabel); if (Widgets.ButtonInvisible(rect18)) { Find.WindowStack.Add(new Dialog_InfoCard(localTitle.def, localTitle.faction)); } if (Mouse.IsOver(rect18)) { TipSignal tip4 = new TipSignal(() => GetTitleTipString(pawn, localTitle.faction, localTitle, favor), (int)curY * 37); TooltipHandler.TipRegion(rect18, tip4); } }, width = Text.CalcSize(titleLabel).x + 15f }); } } QuestUtility.AppendInspectStringsFromQuestParts(delegate(string str, Quest quest) { stackElements.Add(new GenUI.AnonymousStackElement { drawer = delegate(Rect r) { Color color4 = GUI.color; GUI.color = StackElementBackground; GUI.DrawTexture(r, BaseContent.WhiteTex); GUI.color = color4; DoQuestLine(r, str, quest); }, width = GetQuestLineSize(str, quest).x }); }, pawn, out int _); curY += GenUI.DrawElementStack(new Rect(0f, curY, rect.width - 5f, 50f), 22f, stackElements, delegate(Rect r, GenUI.AnonymousStackElement obj) { obj.drawer(r); }, (GenUI.AnonymousStackElement obj) => obj.width).height; //if (stackElements.Any()) //{ // curY += 10f; //} Rect leftRect = new Rect(0f, curY, 250f, 355f); Rect position = new Rect(leftRect.xMax, curY, 258f, 355f); GUI.BeginGroup(leftRect); curY = 0f; Pawn pawnLocal = pawn; List <Ability> abilities = (from a in pawn.abilities.abilities orderby a.def.level, a.def.EntropyGain select a).ToList(); int numSections = abilities.Any() ? 5 : 4; float num6 = (float)Enum.GetValues(typeof(BackstorySlot)).Length * 22f; if (pawn.story != null && pawn.story.title != null) { num6 += 22f; } List <LeftRectSection> list = new List <LeftRectSection>(); LeftRectSection item = new LeftRectSection { rect = new Rect(0f, 0f, leftRect.width, num6), drawer = delegate(Rect sectionRect) { float num12 = sectionRect.y; Text.Font = GameFont.Small; foreach (BackstorySlot value6 in Enum.GetValues(typeof(BackstorySlot))) { Backstory backstory = pawn.story.GetBackstory(value6); if (backstory != null) { Rect rect14 = new Rect(sectionRect.x, num12, leftRect.width, 22f); if (Mouse.IsOver(rect14)) { Widgets.DrawHighlight(rect14); } if (Mouse.IsOver(rect14)) { TooltipHandler.TipRegion(rect14, backstory.FullDescriptionFor(pawn).Resolve()); } Text.Anchor = TextAnchor.MiddleLeft; string str2 = (value6 == BackstorySlot.Adulthood) ? "Adulthood".Translate() : "Childhood".Translate(); Widgets.Label(rect14, str2 + ":"); Text.Anchor = TextAnchor.UpperLeft; Rect rect15 = new Rect(rect14); rect15.x += 90f; rect15.width -= 90f; string str3 = backstory.TitleCapFor(pawn.gender); Widgets.Label(rect15, str3.Truncate(rect15.width)); num12 += rect14.height; } } if (pawn.story != null && pawn.story.title != null) { Rect rect16 = new Rect(sectionRect.x, num12, leftRect.width, 22f); Text.Anchor = TextAnchor.MiddleLeft; Widgets.Label(rect16, "Current".Translate() + ":"); Text.Anchor = TextAnchor.UpperLeft; Rect rect17 = new Rect(rect16); rect17.x += 90f; rect17.width -= 90f; Widgets.Label(rect17, pawn.story.title); num12 += rect16.height; } } }; list.Add(item); num6 = 30f; List <Trait> traits = pawn.story.traits.allTraits; num6 = ((traits != null && traits.Count != 0) ? (num6 + GenUI.DrawElementStack(new Rect(0f, 0f, leftRect.width - 5f, leftRect.height), 22f, pawn.story.traits.allTraits, delegate { }, (Trait trait) => Text.CalcSize(trait.LabelCap).x + 10f).height) : (num6 + 22f)); num6 -= 5f; item = new LeftRectSection { rect = new Rect(0f, 0f, leftRect.width, num6), drawer = delegate(Rect sectionRect) { Text.Font = GameFont.Medium; float currentY2 = sectionRect.y; Widgets.Label(new Rect(sectionRect.x, currentY2 - 7f, 200f, 26f), "Traits".Translate()); currentY2 += 21f; Text.Font = GameFont.Small; if (traits == null || traits.Count == 0) { Color color = GUI.color; GUI.color = Color.gray; Rect rect12 = new Rect(sectionRect.x, currentY2, leftRect.width, 24f); if (Mouse.IsOver(rect12)) { Widgets.DrawHighlight(rect12); } Widgets.Label(rect12, "None".Translate()); currentY2 += rect12.height + 2f; TooltipHandler.TipRegionByKey(rect12, "None"); GUI.color = color; } else { GenUI.DrawElementStack(new Rect(sectionRect.x, currentY2, leftRect.width - 5f, leftRect.height / (float)numSections), 22f, pawn.story.traits.allTraits, delegate(Rect r, Trait trait) { Color color2 = GUI.color; GUI.color = StackElementBackground; GUI.DrawTexture(r, BaseContent.WhiteTex); GUI.color = color2; if (Mouse.IsOver(r)) { Widgets.DrawHighlight(r); } Widgets.Label(new Rect(r.x + 5f, r.y, r.width - 10f, r.height), trait.LabelCap); if (Mouse.IsOver(r)) { TooltipHandler.TipRegion(tip: new TipSignal(() => trait.TipString(pawn), (int)currentY2 * 37), rect: r); } }, (Trait trait) => Text.CalcSize(trait.LabelCap).x + 10f); } } }; list.Add(item); num6 = 30f; WorkTags disabledTags = pawn.CombinedDisabledWorkTags; List <WorkTags> disabledTagsList = WorkTagsFrom(disabledTags).ToList(); bool allowWorkTagVerticalLayout = false; GenUI.StackElementWidthGetter <WorkTags> workTagWidthGetter = (WorkTags tag) => Text.CalcSize(tag.LabelTranslated().CapitalizeFirst()).x + 10f; if (disabledTags == WorkTags.None) { num6 += 22f; } else { disabledTagsList.Sort(delegate(WorkTags a, WorkTags b) { int num11 = GetWorkTypeDisableCauses(pawn, a).Any((object c) => c is RoyalTitleDef) ? 1 : (-1); int value5 = GetWorkTypeDisableCauses(pawn, b).Any((object c) => c is RoyalTitleDef) ? 1 : (-1); return(num11.CompareTo(value5)); }); num6 += GenUI.DrawElementStack(new Rect(0f, 0f, leftRect.width - 5f, leftRect.height), 22f, disabledTagsList, delegate { }, workTagWidthGetter, 4f, 5f, allowOrderOptimization: false).height; num6 += 12f; allowWorkTagVerticalLayout = (GenUI.DrawElementStackVertical(new Rect(0f, 0f, rect.width, leftRect.height / (float)numSections), 22f, disabledTagsList, delegate { }, workTagWidthGetter).width <= leftRect.width); } item = new LeftRectSection { rect = new Rect(0f, 0f, leftRect.width, num6), drawer = delegate(Rect sectionRect) { Text.Font = GameFont.Medium; float currentY3 = sectionRect.y; Widgets.Label(new Rect(sectionRect.x, currentY3 - 7f, 200f, 26f), "IncapableOf".Translate(pawn)); currentY3 += 21f; Text.Font = GameFont.Small; if (disabledTags == WorkTags.None) { GUI.color = Color.gray; Rect rect13 = new Rect(sectionRect.x, currentY3, leftRect.width, 24f); if (Mouse.IsOver(rect13)) { Widgets.DrawHighlight(rect13); } Widgets.Label(rect13, "None".Translate()); TooltipHandler.TipRegionByKey(rect13, "None"); } else { GenUI.StackElementDrawer <WorkTags> drawer = delegate(Rect r, WorkTags tag) { Color color3 = GUI.color; GUI.color = StackElementBackground; GUI.DrawTexture(r, BaseContent.WhiteTex); GUI.color = color3; GUI.color = GetDisabledWorkTagLabelColor(pawn, tag); if (Mouse.IsOver(r)) { Widgets.DrawHighlight(r); } Widgets.Label(new Rect(r.x + 5f, r.y, r.width - 10f, r.height), tag.LabelTranslated().CapitalizeFirst()); if (Mouse.IsOver(r)) { TooltipHandler.TipRegion(tip: new TipSignal(() => GetWorkTypeDisabledCausedBy(pawnLocal, tag) + "\n" + GetWorkTypesDisabledByWorkTag(tag), (int)currentY3 * 32), rect: r); } }; if (allowWorkTagVerticalLayout) { GenUI.DrawElementStackVertical(new Rect(sectionRect.x, currentY3, leftRect.width - 5f, leftRect.height / (float)numSections), 22f, disabledTagsList, drawer, workTagWidthGetter); } else { GenUI.DrawElementStack(new Rect(sectionRect.x, currentY3, leftRect.width - 5f, leftRect.height / (float)numSections), 22f, disabledTagsList, drawer, workTagWidthGetter, 5f); } } GUI.color = Color.white; } }; list.Add(item); //if (abilities.Any()) //{ // num6 = 30f; // num6 += GenUI.DrawElementStack(new Rect(0f, 0f, leftRect.width - 5f, leftRect.height), 32f, abilities, delegate // { // }, (Ability abil) => 32f).height; // item = new LeftRectSection // { // rect = new Rect(0f, 0f, leftRect.width, num6), // drawer = delegate (Rect sectionRect) // { // Text.Font = GameFont.Medium; // float currentY = sectionRect.y; // Widgets.Label(new Rect(sectionRect.x, currentY, 200f, 30f), "Abilities".Translate(pawn)); // currentY += 30f; // Text.Font = GameFont.Small; // GenUI.DrawElementStack(new Rect(sectionRect.x, currentY, leftRect.width - 5f, leftRect.height), 32f, abilities, delegate (Rect r, Ability abil) // { // GUI.DrawTexture(r, BaseContent.ClearTex); // if (Mouse.IsOver(r)) // { // Widgets.DrawHighlight(r); // } // if (Widgets.ButtonImage(r, abil.def.uiIcon, doMouseoverSound: false)) // { // Find.WindowStack.Add(new Dialog_InfoCard(abil.def)); // } // if (Mouse.IsOver(r)) // { // TipSignal tip = new TipSignal(() => abil.def.GetTooltip() + "\n\n" + "ClickToLearnMore".Translate(), (int)currentY * 37); // TooltipHandler.TipRegion(r, tip); // } // }, (Ability abil) => 32f); // GUI.color = Color.white; // } // }; // list.Add(item); //} float num7 = 1f; // leftRect.height / (float)list.Count; float num8 = 0f; for (int i = 0; i < list.Count; i++) { LeftRectSection value = list[i]; if (value.rect.height > num7) { num8 += value.rect.height - num7; value.calculatedSize = value.rect.height; } else { value.calculatedSize = num7; } list[i] = value; } bool flag2 = false; float num9 = 0f; if (num8 > 0f) { LeftRectSection value2 = list[0]; float num10 = value2.rect.height + 2f; num8 -= value2.calculatedSize - num10; value2.calculatedSize = num10; list[0] = value2; } while (num8 > 0f) { bool flag3 = true; for (int j = 0; j < list.Count; j++) { LeftRectSection value3 = list[j]; if (value3.calculatedSize - value3.rect.height > 0f) { value3.calculatedSize -= 1f; num8 -= 1f; flag3 = false; } list[j] = value3; } if (!flag3) { continue; } for (int k = 0; k < list.Count; k++) { LeftRectSection value4 = list[k]; if (k > 0) { value4.calculatedSize = Mathf.Max(value4.rect.height, num7); } else { value4.calculatedSize = value4.rect.height + 2f; } num9 += value4.calculatedSize; list[k] = value4; } flag2 = true; break; } if (flag2) { Widgets.BeginScrollView(new Rect(0f, 0f, leftRect.width, leftRect.height), ref leftRectScrollPos, new Rect(0f, 0f, leftRect.width - 16f, num9)); } curY = 0f; for (int l = 0; l < list.Count; l++) { LeftRectSection leftRectSection = list[l]; leftRectSection.drawer(new Rect(0f, curY, leftRect.width, leftRectSection.rect.height)); curY += leftRectSection.calculatedSize; } if (flag2) { Widgets.EndScrollView(); } GUI.EndGroup(); GUI.EndGroup(); }
/// <summary> /// Returns pawn's most senior title's seniority, with no titles at all being -100 /// </summary> /// <param name="pawn"></param> /// <returns></returns> public static int GetTitleSeniority(this Pawn pawn) { RoyalTitle royalTitle = pawn.royalty.MostSeniorTitle; return royalTitle != null ? royalTitle.def.seniority : -100; }
private static int GetRoyalExpectations(Building_GuestBed bed, Pawn guest, Room room, out RoyalTitle title) { var royalExpectations = 0; title = guest.royalty?.HighestTitleWithBedroomRequirements(); if (title != null) { if (room == null) { royalExpectations -= 75; } else { foreach (Building_Bed roomBeds in room.ContainedBeds) { if (roomBeds != bed && BedClaimedByStranger(roomBeds, guest)) { royalExpectations -= 100; } } } if (RoyalTitleUtility.BedroomSatisfiesRequirements(room, title)) { royalExpectations += 100; } } return(royalExpectations); }