예제 #1
0
        public string TipString(Pawn pawn)
        {
            StringBuilder   stringBuilder = new StringBuilder();
            TraitDegreeData currentData   = CurrentData;

            stringBuilder.Append(currentData.description.Formatted(pawn.Named("PAWN")).AdjustedFor(pawn).Resolve());
            bool num   = CurrentData.skillGains.Count > 0;
            bool flag  = GetPermaThoughts().Any();
            bool flag2 = currentData.statOffsets != null;
            bool flag3 = currentData.statFactors != null;

            if (num || flag || flag2 || flag3)
            {
                stringBuilder.AppendLine();
                stringBuilder.AppendLine();
            }
            if (num)
            {
                foreach (KeyValuePair <SkillDef, int> skillGain in CurrentData.skillGains)
                {
                    if (skillGain.Value != 0)
                    {
                        string value = "    " + skillGain.Key.skillLabel.CapitalizeFirst() + ":   " + skillGain.Value.ToString("+##;-##");
                        stringBuilder.AppendLine(value);
                    }
                }
            }
            if (flag)
            {
                foreach (ThoughtDef permaThought in GetPermaThoughts())
                {
                    stringBuilder.AppendLine("    " + "PermanentMoodEffect".Translate() + " " + permaThought.stages[0].baseMoodEffect.ToStringByStyle(ToStringStyle.Integer, ToStringNumberSense.Offset));
                }
            }
            if (flag2)
            {
                for (int i = 0; i < currentData.statOffsets.Count; i++)
                {
                    StatModifier statModifier          = currentData.statOffsets[i];
                    string       valueToStringAsOffset = statModifier.ValueToStringAsOffset;
                    string       value2 = "    " + statModifier.stat.LabelCap + " " + valueToStringAsOffset;
                    stringBuilder.AppendLine(value2);
                }
            }
            if (flag3)
            {
                for (int j = 0; j < currentData.statFactors.Count; j++)
                {
                    StatModifier statModifier2    = currentData.statFactors[j];
                    string       toStringAsFactor = statModifier2.ToStringAsFactor;
                    string       value3           = "    " + statModifier2.stat.LabelCap + " " + toStringAsFactor;
                    stringBuilder.AppendLine(value3);
                }
            }
            if (currentData.hungerRateFactor != 1f)
            {
                string t      = currentData.hungerRateFactor.ToStringByStyle(ToStringStyle.PercentOne, ToStringNumberSense.Factor);
                string value4 = "    " + "HungerRate".Translate() + " " + t;
                stringBuilder.AppendLine(value4);
            }
            if (ModsConfig.RoyaltyActive)
            {
                List <MeditationFocusDef> allowedMeditationFocusTypes = CurrentData.allowedMeditationFocusTypes;
                if (!allowedMeditationFocusTypes.NullOrEmpty())
                {
                    stringBuilder.AppendLine();
                    stringBuilder.AppendLine();
                    stringBuilder.AppendLine("EnablesMeditationFocusType".Translate() + ":\n" + allowedMeditationFocusTypes.Select((MeditationFocusDef f) => f.LabelCap.RawText).ToLineList("  - "));
                }
            }
            if (stringBuilder.Length > 0 && stringBuilder[stringBuilder.Length - 1] == '\n')
            {
                if (stringBuilder.Length > 1 && stringBuilder[stringBuilder.Length - 2] == '\r')
                {
                    stringBuilder.Remove(stringBuilder.Length - 2, 2);
                }
                else
                {
                    stringBuilder.Remove(stringBuilder.Length - 1, 1);
                }
            }
            return(stringBuilder.ToString());
        }
예제 #2
0
        public string TipString(Pawn pawn)
        {
            StringBuilder   stringBuilder = new StringBuilder();
            TraitDegreeData currentData   = this.CurrentData;

            stringBuilder.Append(currentData.description.AdjustedFor(pawn));
            int count = this.CurrentData.skillGains.Count;

            if (count > 0)
            {
                stringBuilder.AppendLine();
                stringBuilder.AppendLine();
            }
            int num = 0;

            foreach (KeyValuePair <SkillDef, int> current in this.CurrentData.skillGains)
            {
                if (current.Value != 0)
                {
                    string value = "    " + current.Key.skillLabel.CapitalizeFirst() + ":   " + current.Value.ToString("+##;-##");
                    if (num < count - 1)
                    {
                        stringBuilder.AppendLine(value);
                    }
                    else
                    {
                        stringBuilder.Append(value);
                    }
                    num++;
                }
            }
            if (this.GetPermaThoughts().Any <ThoughtDef>())
            {
                stringBuilder.AppendLine();
                foreach (ThoughtDef current2 in this.GetPermaThoughts())
                {
                    stringBuilder.AppendLine();
                    stringBuilder.Append("    " + "PermanentMoodEffect".Translate() + " " + current2.stages[0].baseMoodEffect.ToStringByStyle(ToStringStyle.Integer, ToStringNumberSense.Offset));
                }
            }
            if (currentData.statOffsets != null)
            {
                stringBuilder.AppendLine();
                stringBuilder.AppendLine();
                for (int i = 0; i < currentData.statOffsets.Count; i++)
                {
                    StatModifier statModifier          = currentData.statOffsets[i];
                    string       valueToStringAsOffset = statModifier.ValueToStringAsOffset;
                    string       value2 = "    " + statModifier.stat.LabelCap + " " + valueToStringAsOffset;
                    if (i < currentData.statOffsets.Count - 1)
                    {
                        stringBuilder.AppendLine(value2);
                    }
                    else
                    {
                        stringBuilder.Append(value2);
                    }
                }
            }
            if (currentData.statFactors != null)
            {
                stringBuilder.AppendLine();
                stringBuilder.AppendLine();
                for (int j = 0; j < currentData.statFactors.Count; j++)
                {
                    StatModifier statModifier2    = currentData.statFactors[j];
                    string       toStringAsFactor = statModifier2.ToStringAsFactor;
                    string       value3           = "    " + statModifier2.stat.LabelCap + " " + toStringAsFactor;
                    if (j < currentData.statFactors.Count - 1)
                    {
                        stringBuilder.AppendLine(value3);
                    }
                    else
                    {
                        stringBuilder.Append(value3);
                    }
                }
            }
            return(stringBuilder.ToString());
        }