Example #1
0
        private TextModel GetRelationKindAndFaction()
        {
            var faction      = (Base.Faction == null) || !Base.Faction.HasName ? null : Lang.Get("Model.OfFaction", Base.Faction.Name);
            var relationKind = Lang.AdjectiveNoun(GetFactionRelation(), GetKind());

            return(TextModel.Create(Lang.Get("Model.RelationKindAndFaction", relationKind, faction).Trim().CapitalizeFirst(), GetBioTooltip(), FactionRelationColor, InspectPanePlus.ToggleBioTab));
        }
Example #2
0
        private TextModel GetGenderAndAge()
        {
            var gender = GetGender();
            var race   = gender == null ? Base.kindDef.race.LabelCap : Base.kindDef.race.label;

            Base.ageTracker.AgeBiologicalTicks.TicksToPeriod(out var years, out var quadrums, out var days, out _);
            var ageDays = (quadrums * GenDate.DaysPerQuadrum) + days;

            var age = years.ToString().Bold();

            if ((ageDays == 0) || (ageDays == GenDate.DaysPerYear))
            {
                age += Lang.Get("Model.Age.Birthday");
            }
            else if (ageDays == 1)
            {
                age += Lang.Get("Model.Age.Day");
            }
            else
            {
                age += Lang.Get("Model.Age.Days", ageDays);
            }

            return(TextModel.Create(Lang.Get("Model.GenderAndAge", gender, race, age), GetBioTooltip(), FactionRelationColor));
        }
Example #3
0
        private TextModel GetBleedWarning()
        {
            var bloodLossTicksRemaining = HealthUtility.TicksUntilDeathDueToBloodLoss(Model.Base);
            var text = bloodLossTicksRemaining < GenDate.TicksPerDay ? Lang.Get("Model.Health.Bleed", bloodLossTicksRemaining.ToStringTicksToPeriod()) : null;

            return(TextModel.Create(text, GetHealthTooltip(), Theme.CriticalColor.Value, OnClick));
        }
Example #4
0
        private TextModel GetGenderAndAge()
        {
            var gender     = GetGender();
            var genderKind = Lang.AdjectiveNoun(gender, Base.kindDef?.race?.label);

            if (Base.ageTracker == null)
            {
                return(TextModel.Create(genderKind.CapitalizeFirst(), GetBioTooltip(), FactionRelationColor, InspectPanePlus.ToggleBioTab));
            }

            Base.ageTracker.AgeBiologicalTicks.TicksToPeriod(out var years, out var quadrums, out var days, out _);
            var ageDays = (quadrums * GenDate.DaysPerQuadrum) + days;

            var age = years.ToString().Bold();

            if ((ageDays == 0) || (ageDays == GenDate.DaysPerYear))
            {
                age = Lang.CombineWords(age, Lang.Get("Model.Age.Birthday"));
            }
            else if (ageDays == 1)
            {
                age = Lang.CombineWords(age, Lang.Get("Model.Age.Day"));
            }
            else
            {
                age = Lang.CombineWords(age, Lang.Get("Model.Age.Days", ageDays));
            }

            return(TextModel.Create(Lang.Get("Model.GenderAndAge", genderKind, age).CapitalizeFirst(), GetBioTooltip(), FactionRelationColor, InspectPanePlus.ToggleBioTab));
        }
Example #5
0
        private TextModel GetRelationKindAndFaction()
        {
            var faction  = (Base.Faction == null) || !Base.Faction.HasName ? null : Lang.Get("Model.OfFaction", Base.Faction.Name);
            var relation = GetFactionRelation();
            var kind     = GetKind();

            return(TextModel.Create(Lang.Get("Model.RelationKindAndFaction", relation, relation == null ? kind.CapitalizeFirst() : kind, faction), GetBioTooltip(), FactionRelationColor));
        }
Example #6
0
        private TextModel GetInspiration()
        {
            if (!Model.Base.Inspired)
            {
                return(null);
            }

            var inspiration = Model.Base.Inspiration.InspectLine;

            return(TextModel.Create(inspiration, GetTooltip(), Theme.ExcellentColor.Value, OnClick));
        }
Example #7
0
        private TextModel GetHealthCondition()
        {
            if (Model.Base.health?.hediffSet?.hediffs == null)
            {
                return(null);
            }
            if (Model.Base.Dead)
            {
                return(TextModel.Create(Lang.Get("Model.Health.Dead"), GetHealthTooltip(), Theme.InfoColor.Value, OnClick));
            }

            return(GetBleedWarning() ?? GetTendWarning() ?? GetLifeThreateningWarning() ?? GetAffectedWarning() ?? GetIncapacitatedWarning() ?? TextModel.Create(Lang.Get("Model.Health.Stable"), GetHealthTooltip(), Theme.GoodColor.Value, OnClick));
        }
Example #8
0
        private TextModel GetMaster()
        {
            var master = Base.playerSettings?.Master;

            if (master == null)
            {
                return(null);
            }

            var masterName = master.LabelShort;
            var relation   = Base.GetMostImportantRelation(master)?.LabelCap;

            return(TextModel.Create(Lang.Get("Model.Bio.Master", masterName), GetAnimalTooltip(), relation == null ? (Color?)null : Theme.SkillMinorPassionColor.Value));
        }
Example #9
0
        private TextModel GetTendWarning()
        {
            var count = Model.Base.health.hediffSet.hediffs.Count(hediff => hediff.TendableNow());

            if (count == 0)
            {
                return(null);
            }

            var text = count == 1 ? Lang.Get("Model.Health.Tend", count) : Lang.Get("Model.Health.TendPlural", count);
            var hasLifeThreateningCondition = GetLifeThreateningWarning();

            return(TextModel.Create(text, GetHealthTooltip(), hasLifeThreateningCondition?.Color ?? Theme.WarningColor.Value, OnClick));
        }
Example #10
0
        private TextModel GetLifeThreateningWarning()
        {
            var threats = Model.Base.health.hediffSet.hediffs.Where(hediff => hediff.CurStage?.lifeThreatening ?? false).ToArray();
            var count   = threats.Count();

            if (count == 0)
            {
                return(null);
            }

            var worst = threats.MinBy(hediff => hediff.CurStage.deathMtbDays);
            var text  = count == 1 ? Lang.Get("Model.Health.Threat", worst.LabelCap) : Lang.Get("Model.Health.ThreatPlural", worst.LabelCap, count);

            return(TextModel.Create(text, GetHealthTooltip(), Theme.CriticalColor.Value, OnClick));
        }
Example #11
0
        private TextModel GetAffectedWarning()
        {
            var affected = VisibleHediffs(Model.Base, false).Where(hediff => hediff.Visible && !hediff.IsPermanent() && !hediff.FullyImmune() && hediff.def != null && ((hediff.CurStage?.lifeThreatening ?? false) || hediff.def.makesSickThought)).ToArray();
            var count    = affected.Count();

            if (count == 0)
            {
                return(null);
            }

            var worst = affected.MaxBy(hediff => hediff.PainFactor);

            var text = count == 1 ? Lang.Get("Model.Health.Affected", worst.LabelCap) : Lang.Get("Model.Health.AffectedPlural", worst.LabelCap, count - 1);

            return(TextModel.Create(text, GetHealthTooltip(), Theme.WarningColor.Value, OnClick));
        }
Example #12
0
        private TextModel GetCondition()
        {
            if (Model.Base.mindState?.mentalStateHandler == null)
            {
                return(null);
            }
            if (Model.Base.mindState.mentalStateHandler.InMentalState)
            {
                return(TextModel.Create(Model.Base.mindState.mentalStateHandler.CurState.InspectLine, GetTooltip(), Model.Base.mindState.mentalStateHandler.CurState.def.IsAggro || Model.Base.mindState.mentalStateHandler.CurState.def.IsExtreme ? Theme.CriticalColor.Value : Theme.WarningColor.Value, OnClick));
            }

            if (Model.Base.needs?.mood == null || Model.Base.mindState?.mentalBreaker == null)
            {
                return(null);
            }

            if (Model.Base.mindState.mentalBreaker.BreakExtremeIsImminent)
            {
                return(TextModel.Create(Lang.Get("Model.Mood.ExtremeBreakImminent"), GetTooltip(), Theme.CriticalColor.Value, OnClick));
            }
            if (Model.Base.mindState.mentalBreaker.BreakMajorIsImminent)
            {
                return(TextModel.Create(Lang.Get("Model.Mood.MajorBreakImminent"), GetTooltip(), Theme.WarningColor.Value, OnClick));
            }
            if (Model.Base.mindState.mentalBreaker.BreakMinorIsImminent)
            {
                return(TextModel.Create(Lang.Get("Model.Mood.MinorBreakImminent"), GetTooltip(), Theme.WarningColor.Value, OnClick));
            }

            var inspiration = GetInspiration();

            if (inspiration != null)
            {
                return(inspiration);
            }

            if (Model.Base.needs.mood.CurLevel > MoodHappyLevel)
            {
                return(TextModel.Create(Lang.Get("Model.Mood.Happy"), GetTooltip(), Theme.ExcellentColor.Value, OnClick));
            }
            return(Model.Base.needs.mood.CurLevel > MoodContentLevel?TextModel.Create(Lang.Get("Model.Mood.Content"), GetTooltip(), Theme.GoodColor.Value, OnClick) : TextModel.Create(Lang.Get("Model.Mood.Indifferent"), GetTooltip(), Theme.InfoColor.Value, OnClick));
        }
Example #13
0
        private TextModel GetIdeoligionGenderRaceAndAge()
        {
            var genderRaceAge = GetGenderRaceAndAgeText(true);

            return(TextModel.Create(!ModLister.IdeologyInstalled || Base.Ideo == null ? genderRaceAge : Lang.Get("Model.IdeoligionGenderRaceAndAge", Base.Ideo.memberName, genderRaceAge), GetBioTooltip(), FactionRelationColor, InspectPanePlus.ToggleBioTab));
        }
Example #14
0
 private TextModel GetGenderRaceAndAge() => TextModel.Create(GetGenderRaceAndAgeText(false).CapitalizeFirst(), GetBioTooltip(), FactionRelationColor, InspectPanePlus.ToggleBioTab);
Example #15
0
 private TextModel GetIncapacitatedWarning() => !Model.Base.health.Downed ? null : TextModel.Create(Lang.Get("Model.Health.Incapacitated"), GetHealthTooltip(), Theme.WarningColor.Value, OnClick);