static bool DrawOverviewTab(ref Rect leftRect, ref Pawn pawn, ref float curY) { if (pawn is Droid) { curY += 4f; Pawn p = pawn; Text.Font = GameFont.Small; if (!pawn.Dead) { IEnumerable <PawnCapacityDef> source = pawn.def.race.Humanlike ? (from x in DefDatabase <PawnCapacityDef> .AllDefs where x.showOnHumanlikes select x) : ((!pawn.def.race.Animal) ? DefDatabase <PawnCapacityDef> .AllDefs.Where((PawnCapacityDef x) => x.showOnMechanoids) : DefDatabase <PawnCapacityDef> .AllDefs.Where((PawnCapacityDef x) => x.showOnAnimals)); foreach (PawnCapacityDef item in from act in source orderby act.listOrder select act) { if (PawnCapacityUtility.BodyCanEverDoCapacity(pawn.RaceProps.body, item)) { PawnCapacityDef activityLocal = item; Pair <string, Color> efficiencyLabel = HealthCardUtility.GetEfficiencyLabel(pawn, item); Func <string> textGetter = () => (!p.Dead) ? HealthCardUtility.GetPawnCapacityTip(p, activityLocal) : ""; curY = (float)(typeof(HealthCardUtility).GetMethod("DrawLeftRow", BindingFlags.NonPublic | BindingFlags.Static).Invoke(new object(), new object[] { leftRect, curY, item.GetLabelFor(pawn.RaceProps.IsFlesh, pawn.RaceProps.Humanlike).CapitalizeFirst(), efficiencyLabel.First, efficiencyLabel.Second, new TipSignal(textGetter, pawn.thingIDNumber ^ item.index) })); } } } return(false); } else { return(true); } }
private static string GetCapacityReport(Pawn subject, PawnCapacityDef capacity) { var payload = $"{capacity.GetLabelFor(subject).CapitalizeFirst()}: "; if (!PawnCapacityUtility.BodyCanEverDoCapacity(subject.RaceProps.body, capacity)) { payload += $"{Find.ActiveLanguageWorker.Pluralize(subject.kindDef.race.defName)} "; payload += $" are incapable of {capacity.GetLabelFor(subject)}"; return(payload); } var impactors = new List <PawnCapacityUtility.CapacityImpactor>(); payload += PawnCapacityUtility.CalculateCapacityLevel(subject.health.hediffSet, capacity, impactors) .ToStringPercent(); payload += " | "; if (!impactors.Any()) { return($"{payload}No health conditions"); } var segments = new List <string>(); foreach (var i in impactors) { if (i is PawnCapacityUtility.CapacityImpactorHediff) { segments.Add(i.Readable(subject)); } } foreach (var i in impactors) { if (i is PawnCapacityUtility.CapacityImpactorBodyPartHealth) { segments.Add(i.Readable(subject)); } } foreach (var i in impactors) { if (i is PawnCapacityUtility.CapacityImpactorCapacity) { segments.Add(i.Readable(subject)); } } foreach (var i in impactors) { if (i is PawnCapacityUtility.CapacityImpactorPain) { segments.Add(i.Readable(subject)); } } return($"{payload} | {string.Join(", ", segments.ToArray())}"); }
private static string GetHealthReport(Pawn subject) { var health = subject.health; var payload = health.summaryHealth.SummaryHealthPercent.ToStringPercent() + " "; payload += health.State != PawnHealthState.Mobile ? GetHealthStateFriendly(health.State) : GetMoodFriendly(subject); if (health.hediffSet.BleedRateTotal > 0.01f) { var ticks = HealthUtility.TicksUntilDeathDueToBloodLoss(subject); payload += " | "; payload += ticks >= 60000 ? "⌛" : $"⏳ {ticks.ToStringTicksToPeriod(shortForm: true)}"; payload += " | "; } var source = DefDatabase <PawnCapacityDef> .AllDefsListForReading; if (subject.def.race.Humanlike) { source = source.Where(c => c.showOnHumanlikes).ToList(); } else if (subject.def.race.Animal) { source = source.Where(c => c.showOnAnimals).ToList(); } else if (subject.def.race.IsMechanoid) { source = source.Where(c => c.showOnMechanoids).ToList(); } else { source.Clear(); payload += "Unsupported race"; } if (!source.Any()) { return(payload); } var container = ""; foreach (var capacity in source.OrderBy(c => c.listOrder)) { if (!PawnCapacityUtility.BodyCanEverDoCapacity(subject.RaceProps.body, capacity)) { continue; } container += $"{capacity.GetLabelFor(subject).CapitalizeFirst()}: "; container += HealthCardUtility.GetEfficiencyLabel(subject, capacity).First; container += ", "; } return(payload + container.Substring(0, container.Length - 2)); }
private void DoRow(Rect rect, Pawn p) { GUI.BeginGroup(rect); var rect2 = rect.AtZero(); //CaravanPeopleAndItemsTabUtility.DoAbandonButton(rect2, p, base.SelCaravan); rect2.width -= 24f; Widgets.InfoCardButton(rect2.width - 24f, (rect.height - 24f) / 2f, p); rect2.width -= 24f; //CaravanPeopleAndItemsTabUtility.DoOpenSpecificTabButton(rect2, p, ref this.specificHealthTabForPawn); rect2.width -= 24f; if (Mouse.IsOver(rect2)) { Widgets.DrawHighlight(rect2); } var rect3 = new Rect(4f, (rect.height - 27f) / 2f, 27f, 27f); Widgets.ThingIcon(rect3, p, 1f); var bgRect = new Rect(rect3.xMax + 4f, 16f, 100f, 18f); GenMapUI.DrawPawnLabel(p, bgRect, 1f, 100f, null, GameFont.Small, false, false); if (!compactMode) { var num = bgRect.xMax; if (p.RaceProps.IsFlesh) { var rect4 = new Rect(num, 0f, 100f, 50f); DoPain(rect4, p); } var list = CapacitiesToDisplay; for (var i = 0; i < list.Count; i++) { num += 100f; var rect5 = new Rect(num, 0f, 100f, 50f); if (!p.RaceProps.Humanlike || list[i].showOnHumanlikes) { if (!p.RaceProps.Animal || list[i].showOnAnimals) { if (!p.RaceProps.IsMechanoid || list[i].showOnMechanoids) { if (PawnCapacityUtility.BodyCanEverDoCapacity(p.RaceProps.body, list[i])) { DoCapacity(rect5, p, list[i]); } } } } } } if (p.Downed) { GUI.color = new Color(1f, 0f, 0f, 0.5f); Widgets.DrawLineHorizontal(0f, rect.height / 2f, rect.width); GUI.color = Color.white; } GUI.EndGroup(); }
private static string MyPawnHealthCapacity(Viewer viewer, Pawn pawn, PawnCapacityDef capacityDef) { if (PawnCapacityUtility.BodyCanEverDoCapacity(pawn.RaceProps.body, capacityDef)) { Pair <string, Color> efficiencyLabel = HealthCardUtility.GetEfficiencyLabel(pawn, capacityDef); List <PawnCapacityUtility.CapacityImpactor> impactorList = new List <PawnCapacityUtility.CapacityImpactor>(); float fLevel = PawnCapacityUtility.CalculateCapacityLevel(pawn.health.hediffSet, capacityDef, impactorList); string sLevel = (fLevel * 100.0f).ToString("F0") + "%"; string output = $"@{viewer.username} {pawn.Name.ToStringShort.CapitalizeFirst()}'s {capacityDef.LabelCap}: {efficiencyLabel.First} ({sLevel})"; output += " - " + "AffectedBy".Translate() + " "; if (impactorList.Count > 0) { for (int i = 0; i < impactorList.Count; i++) { if (impactorList[i] is PawnCapacityUtility.CapacityImpactorHediff) { output += impactorList[i].Readable(pawn) + ", "; } } for (int i = 0; i < impactorList.Count; i++) { if (impactorList[i] is PawnCapacityUtility.CapacityImpactorBodyPartHealth) { output += impactorList[i].Readable(pawn) + ", "; } } for (int i = 0; i < impactorList.Count; i++) { if (impactorList[i] is PawnCapacityUtility.CapacityImpactorCapacity) { output += impactorList[i].Readable(pawn) + ", "; } } for (int i = 0; i < impactorList.Count; i++) { if (impactorList[i] is PawnCapacityUtility.CapacityImpactorPain) { output += impactorList[i].Readable(pawn) + ", "; } } output = output.Substring(0, output.Length - 2); } else { output += $"nothing "; } return(output); } else { return($"@{viewer.username} {pawn.Name.ToStringShort.CapitalizeFirst()} Can not have {capacityDef.LabelCap}."); } }
private static string HealthCapacityReport([NotNull] Pawn pawn, [NotNull] PawnCapacityDef capacity) { if (!PawnCapacityUtility.BodyCanEverDoCapacity(pawn.RaceProps.body, capacity)) { return("TKUtils.PawnHealth.IncapableOfCapacity".LocalizeKeyed(capacity.GetLabelFor(pawn))); } var impactors = new List <PawnCapacityUtility.CapacityImpactor>(); var segments = new List <string> { ResponseHelper.JoinPair( RichTextHelper.StripTags(capacity.LabelCap), PawnCapacityUtility.CalculateCapacityLevel(pawn.health.hediffSet, capacity, impactors).ToStringPercent() ), impactors.Any() ? ResponseHelper.JoinPair("TKUtils.PawnHealth.AffectedBy".Localize(), GetImpactorsForPawn(pawn, impactors).SectionJoin()) : "NoHealthConditions".Localize().CapitalizeFirst() }; return(segments.GroupedJoin()); }
private static string HealthReport([NotNull] Pawn pawn) { var segments = new List <string> { ResponseHelper.JoinPair("TKUtils.PawnHealth.OverallHealth".Localize(), pawn.health.summaryHealth.SummaryHealthPercent.ToStringPercent()) }; if (pawn.health.State != PawnHealthState.Mobile) { segments[0] += $" {GetHealthStateFriendly(pawn.health.State)}"; } else { segments[0] += $" {GetMoodFriendly(pawn)}"; } if (pawn.health.hediffSet.BleedRateTotal > 0.01f) { int ticks = HealthUtility.TicksUntilDeathDueToBloodLoss(pawn); segments.Add( ticks >= 60000 ? ResponseHelper.BleedingSafeGlyphs.AltText("WontBleedOutSoon".Localize().CapitalizeFirst()) : $"{ResponseHelper.BleedingBadGlyphs.AltText("BleedingRate".Localize())} ({ticks.ToStringTicksToPeriod(shortForm: true)})" ); } List <PawnCapacityDef> source = GetCapacitiesForPawn(pawn).ToList(); if (source.Count > 0) { source = source.OrderBy(d => d.listOrder).ToList(); string[] capacities = source.Where(capacity => PawnCapacityUtility.BodyCanEverDoCapacity(pawn.RaceProps.body, capacity)) .Select( capacity => ResponseHelper.JoinPair( RichTextHelper.StripTags(capacity.GetLabelFor(pawn)).CapitalizeFirst(), HealthCardUtility.GetEfficiencyLabel(pawn, capacity).First ) ) .ToArray(); segments.Add(capacities.SectionJoin()); } else { segments.Add("TKUtils.Responses.UnsupportedRace".LocalizeKeyed(pawn.kindDef.race.defName)); } if (!TkSettings.ShowSurgeries) { return(segments.GroupedJoin()); } BillStack surgeries = pawn.health.surgeryBills; if (surgeries?.Count <= 0) { return(segments.GroupedJoin()); } string[] queued = surgeries !.Bills.Select(item => RichTextHelper.StripTags(item.LabelCap)).ToArray(); segments.Add(ResponseHelper.JoinPair("TKUtils.PawnHealth.QueuedSurgeries".Localize(), queued.SectionJoin())); return(segments.GroupedJoin()); }
private static float DrawOverviewTab(Rect leftRect, Pawn pawn, float curY) { curY += 4f; Text.Font = GameFont.Tiny; Text.Anchor = TextAnchor.UpperLeft; GUI.color = new Color(0.9f, 0.9f, 0.9f); string str = ((pawn.gender == Gender.None) ? ((string)"PawnSummary".Translate(pawn.Named("PAWN"))) : ((string)"PawnSummaryWithGender".Translate(pawn.Named("PAWN")))); Rect rect = new Rect(0f, curY, leftRect.width, 34f); Widgets.Label(rect, str.CapitalizeFirst()); if (Mouse.IsOver(rect)) { TooltipHandler.TipRegion(rect, () => pawn.ageTracker.AgeTooltipString, 73412); Widgets.DrawHighlight(rect); } GUI.color = Color.white; curY += 34f; bool flag = pawn.RaceProps.IsFlesh && (pawn.Faction == Faction.OfPlayer || pawn.HostFaction == Faction.OfPlayer || (pawn.NonHumanlikeOrWildMan() && pawn.InBed() && pawn.CurrentBed().Faction == Faction.OfPlayer)); if (pawn.foodRestriction != null && pawn.foodRestriction.Configurable) { Rect rect2 = new Rect(0f, curY, leftRect.width * 0.42f, 23f); Text.Anchor = TextAnchor.MiddleLeft; Widgets.Label(rect2, "FoodRestriction".Translate()); GenUI.ResetLabelAlign(); if (Widgets.ButtonText(new Rect(rect2.width, curY, leftRect.width - rect2.width, 23f), pawn.foodRestriction.CurrentFoodRestriction.label)) { List <FloatMenuOption> list = new List <FloatMenuOption>(); List <FoodRestriction> allFoodRestrictions = Current.Game.foodRestrictionDatabase.AllFoodRestrictions; for (int i = 0; i < allFoodRestrictions.Count; i++) { FoodRestriction localRestriction = allFoodRestrictions[i]; list.Add(new FloatMenuOption(localRestriction.label, delegate { pawn.foodRestriction.CurrentFoodRestriction = localRestriction; })); } list.Add(new FloatMenuOption("ManageFoodRestrictions".Translate(), delegate { Find.WindowStack.Add(new Dialog_ManageFoodRestrictions(null)); })); Find.WindowStack.Add(new FloatMenu(list)); } curY += 23f; } if (pawn.IsColonist && !pawn.Dead) { bool selfTend = pawn.playerSettings.selfTend; Rect rect3 = new Rect(0f, curY, leftRect.width, 24f); Widgets.CheckboxLabeled(rect3, "SelfTend".Translate(), ref pawn.playerSettings.selfTend); if (pawn.playerSettings.selfTend && !selfTend) { if (pawn.WorkTypeIsDisabled(WorkTypeDefOf.Doctor)) { pawn.playerSettings.selfTend = false; Messages.Message("MessageCannotSelfTendEver".Translate(pawn.LabelShort, pawn), MessageTypeDefOf.RejectInput, historical: false); } else if (pawn.workSettings.GetPriority(WorkTypeDefOf.Doctor) == 0) { Messages.Message("MessageSelfTendUnsatisfied".Translate(pawn.LabelShort, pawn), MessageTypeDefOf.CautionInput, historical: false); } } if (Mouse.IsOver(rect3)) { TooltipHandler.TipRegion(rect3, "SelfTendTip".Translate(Faction.OfPlayer.def.pawnsPlural, 0.7f.ToStringPercent()).CapitalizeFirst()); } curY += 28f; } if (flag && pawn.playerSettings != null && !pawn.Dead && Current.ProgramState == ProgramState.Playing) { MedicalCareUtility.MedicalCareSetter(new Rect(0f, curY, 140f, 28f), ref pawn.playerSettings.medCare); if (Widgets.ButtonText(new Rect(leftRect.width - 70f, curY, 70f, 28f), "MedGroupDefaults".Translate())) { Find.WindowStack.Add(new Dialog_MedicalDefaults()); } curY += 32f; } Text.Font = GameFont.Small; if (pawn.def.race.IsFlesh) { Pair <string, Color> painLabel = GetPainLabel(pawn); string painTip = GetPainTip(pawn); curY = DrawLeftRow(leftRect, curY, "PainLevel".Translate(), painLabel.First, painLabel.Second, painTip); } if (!pawn.Dead) { IEnumerable <PawnCapacityDef> source = (pawn.def.race.Humanlike ? DefDatabase <PawnCapacityDef> .AllDefs.Where((PawnCapacityDef x) => x.showOnHumanlikes) : ((!pawn.def.race.Animal) ? DefDatabase <PawnCapacityDef> .AllDefs.Where((PawnCapacityDef x) => x.showOnMechanoids) : DefDatabase <PawnCapacityDef> .AllDefs.Where((PawnCapacityDef x) => x.showOnAnimals))); { foreach (PawnCapacityDef item in source.OrderBy((PawnCapacityDef act) => act.listOrder)) { if (PawnCapacityUtility.BodyCanEverDoCapacity(pawn.RaceProps.body, item)) { PawnCapacityDef activityLocal = item; Pair <string, Color> efficiencyLabel = GetEfficiencyLabel(pawn, item); Func <string> textGetter = () => (!pawn.Dead) ? GetPawnCapacityTip(pawn, activityLocal) : ""; curY = DrawLeftRow(leftRect, curY, item.GetLabelFor(pawn.RaceProps.IsFlesh, pawn.RaceProps.Humanlike).CapitalizeFirst(), efficiencyLabel.First, efficiencyLabel.Second, new TipSignal(textGetter, pawn.thingIDNumber ^ item.index)); } } return(curY); } } return(curY); }
private static float DrawOverviewTab(Rect leftRect, Pawn pawn, float curY) { curY = (float)(curY + 4.0); Text.Font = GameFont.Tiny; Text.Anchor = TextAnchor.UpperLeft; GUI.color = new Color(0.9f, 0.9f, 0.9f); string str = string.Empty; if (pawn.gender != 0) { str = pawn.gender.GetLabel() + " "; } str = str + pawn.def.label + ", " + "AgeIndicator".Translate(pawn.ageTracker.AgeNumberString); Rect rect = new Rect(0f, curY, leftRect.width, 34f); Widgets.Label(rect, str.CapitalizeFirst()); TooltipHandler.TipRegion(rect, () => pawn.ageTracker.AgeTooltipString, 73412); if (Mouse.IsOver(rect)) { Widgets.DrawHighlight(rect); } GUI.color = Color.white; curY = (float)(curY + 34.0); GUI.color = Color.white; if (pawn.IsColonist && !pawn.Dead) { bool selfTend = pawn.playerSettings.selfTend; Rect rect2 = new Rect(0f, curY, leftRect.width, 24f); Widgets.CheckboxLabeled(rect2, "SelfTend".Translate(), ref pawn.playerSettings.selfTend, false); if (pawn.playerSettings.selfTend && !selfTend) { if (pawn.story.WorkTypeIsDisabled(WorkTypeDefOf.Doctor)) { pawn.playerSettings.selfTend = false; Messages.Message("MessageCannotSelfTendEver".Translate(pawn.LabelShort), MessageTypeDefOf.RejectInput); } else if (pawn.workSettings.GetPriority(WorkTypeDefOf.Doctor) == 0) { Messages.Message("MessageSelfTendUnsatisfied".Translate(pawn.LabelShort), MessageTypeDefOf.CautionInput); } } TooltipHandler.TipRegion(rect2, "SelfTendTip".Translate(Faction.OfPlayer.def.pawnsPlural, 0.7f.ToStringPercent()).CapitalizeFirst()); curY = (float)(curY + 28.0); } if (pawn.playerSettings != null && !pawn.Dead && Current.ProgramState == ProgramState.Playing) { Rect rect3 = new Rect(0f, curY, 140f, 28f); MedicalCareUtility.MedicalCareSetter(rect3, ref pawn.playerSettings.medCare); if (Widgets.ButtonText(new Rect((float)(leftRect.width - 70.0), curY, 70f, 28f), "MedGroupDefaults".Translate(), true, false, true)) { Find.WindowStack.Add(new Dialog_MedicalDefaults()); } curY = (float)(curY + 32.0); } Text.Font = GameFont.Small; if (pawn.def.race.IsFlesh) { Pair <string, Color> painLabel = HealthCardUtility.GetPainLabel(pawn); string painTip = HealthCardUtility.GetPainTip(pawn); curY = HealthCardUtility.DrawLeftRow(leftRect, curY, "PainLevel".Translate(), painLabel.First, painLabel.Second, painTip); } if (!pawn.Dead) { IEnumerable <PawnCapacityDef> source = (!pawn.def.race.Humanlike) ? ((!pawn.def.race.Animal) ? (from x in DefDatabase <PawnCapacityDef> .AllDefs where x.showOnMechanoids select x) : DefDatabase <PawnCapacityDef> .AllDefs.Where((PawnCapacityDef x) => x.showOnAnimals)) : (from x in DefDatabase <PawnCapacityDef> .AllDefs where x.showOnHumanlikes select x); { foreach (PawnCapacityDef item in from act in source orderby act.listOrder select act) { if (PawnCapacityUtility.BodyCanEverDoCapacity(pawn.RaceProps.body, item)) { PawnCapacityDef activityLocal = item; Pair <string, Color> efficiencyLabel = HealthCardUtility.GetEfficiencyLabel(pawn, item); Func <string> textGetter = () => (!pawn.Dead) ? HealthCardUtility.GetPawnCapacityTip(pawn, activityLocal) : string.Empty; curY = HealthCardUtility.DrawLeftRow(leftRect, curY, item.GetLabelFor(pawn.RaceProps.IsFlesh, pawn.RaceProps.Humanlike).CapitalizeFirst(), efficiencyLabel.First, efficiencyLabel.Second, new TipSignal(textGetter, pawn.thingIDNumber ^ item.index)); } } return(curY); } } return(curY); }
private void DoRow(Rect rect, Pawn p) { GUI.BeginGroup(rect); Rect rect2 = rect.AtZero(); CaravanThingsTabUtility.DoAbandonButton(rect2, p, base.SelCaravan); rect2.width -= 24f; Widgets.InfoCardButton(rect2.width - 24f, (rect.height - 24f) / 2f, p); rect2.width -= 24f; CaravanThingsTabUtility.DoOpenSpecificTabButton(rect2, p, ref specificHealthTabForPawn); rect2.width -= 24f; if (Mouse.IsOver(rect2)) { Widgets.DrawHighlight(rect2); } Rect rect3 = new Rect(4f, (rect.height - 27f) / 2f, 27f, 27f); Widgets.ThingIcon(rect3, p); Rect bgRect = new Rect(rect3.xMax + 4f, 16f, 100f, 18f); GenMapUI.DrawPawnLabel(p, bgRect, 1f, 100f, null, GameFont.Small, alwaysDrawBg: false, alignCenter: false); float num = bgRect.xMax; if (!compactMode) { if (p.RaceProps.IsFlesh) { Rect rect4 = new Rect(num, 0f, 100f, 50f); DoPain(rect4, p); } num += 100f; List <PawnCapacityDef> list = CapacitiesToDisplay; for (int i = 0; i < list.Count; i++) { Rect rect5 = new Rect(num, 0f, 100f, 50f); if ((p.RaceProps.Humanlike && !list[i].showOnHumanlikes) || (p.RaceProps.Animal && !list[i].showOnAnimals) || (p.RaceProps.IsMechanoid && !list[i].showOnMechanoids) || !PawnCapacityUtility.BodyCanEverDoCapacity(p.RaceProps.body, list[i])) { num += 100f; } else { DoCapacity(rect5, p, list[i]); num += 100f; } } } if (!compactMode) { Vector2 vector = new Vector2(num + 8f, 13f); Widgets.Checkbox(vector, ref p.health.beCarriedByCaravanIfSick, 24f, disabled: false, paintable: true); TooltipHandler.TipRegion(new Rect(vector, new Vector2(24f, 24f)), "BeCarriedIfSickTip".Translate()); num += 40f; } if (p.Downed) { GUI.color = new Color(1f, 0f, 0f, 0.5f); Widgets.DrawLineHorizontal(0f, rect.height / 2f, rect.width); GUI.color = Color.white; } GUI.EndGroup(); }
private static string MyPawnHealthSummary(Viewer viewer, Pawn pawn) { string healthPercent = (pawn.health.summaryHealth.SummaryHealthPercent * 100.0f).ToString("n1") + "%"; string output = $"@{viewer.username} {pawn.Name.ToStringShort.CapitalizeFirst()}'s health: {healthPercent} "; if (pawn.health.State != PawnHealthState.Mobile) { output += $"({HealthStateForPawn(pawn)}) "; } if (pawn.health.hediffSet.BleedRateTotal > 0.01f) { int ticksUntilDeath = HealthUtility.TicksUntilDeathDueToBloodLoss(pawn); if (ticksUntilDeath < 60000) { output += "- " + "TimeToDeath".Translate(ticksUntilDeath.ToStringTicksToPeriod()) + " "; } else { output += "- " + "WontBleedOutSoon".Translate() + " "; } } output += " | "; IEnumerable <PawnCapacityDef> capacityDefs; if (pawn.def.race.Humanlike) { capacityDefs = from x in DefDatabase <PawnCapacityDef> .AllDefs where x.showOnHumanlikes select x; } else if (pawn.def.race.Animal) { capacityDefs = from x in DefDatabase <PawnCapacityDef> .AllDefs where x.showOnAnimals select x; } else if (pawn.def.race.IsMechanoid) { capacityDefs = from x in DefDatabase <PawnCapacityDef> .AllDefs where x.showOnMechanoids select x; } else { capacityDefs = new List <PawnCapacityDef>(); output += "(can't show capacities for this race) "; } foreach (PawnCapacityDef pawnCapacityDef in from def in capacityDefs orderby def.listOrder select def) { if (PawnCapacityUtility.BodyCanEverDoCapacity(pawn.RaceProps.body, pawnCapacityDef)) { Pair <string, Color> efficiencyLabel = HealthCardUtility.GetEfficiencyLabel(pawn, pawnCapacityDef); output += $"{pawnCapacityDef}: {efficiencyLabel.First} | "; } } if (capacityDefs.Count() > 0) { output = output.Substring(0, output.Length - 2); } if (ModSettings.Singleton.MyPawnHealthShowSurgeries) { output += " | Queued Surgeries - "; if (pawn.health.surgeryBills?.Count > 0) { foreach (var surgeryBill in pawn.health.surgeryBills) { output += $"{surgeryBill.LabelCap}, "; } output = output.Substring(0, output.Length - 2); } else { output += $"none"; } } return(output); }