public static void GetExplanationUnfinalized_Postfix2(ref string __result, StatWorker __instance, StatRequest req, ToStringNumberSense numberSense, StatDef ___stat) { if (req.Thing != null) { Pawn pawn = req.Thing as Pawn; if (pawn?.story?.traits != null && ___stat != null && pawn.story.traits.HasTrait(SyrTraitDefOf.SlowLearner) && ___stat == StatDefOf.GlobalLearningFactor) { if (pawn.skills != null && pawn.def.statBases != null) { float num = 0f; foreach (SkillRecord skillRecord in pawn.skills.skills) { num += skillRecord.levelInt; } float val = 0.02f * Mathf.Clamp(num, 40, 140); StringBuilder stringBuilder = new StringBuilder(); stringBuilder.AppendLine("SyrTraitsSlowLearnerLabel".Translate()); stringBuilder.AppendLine(string.Concat(new object[] { " " + "SyrTraitsSlowLearner".Translate() + " (", num, "): ", val.ToStringSign(), __instance.ValueToString(val, false, ToStringNumberSense.Absolute) })); __result += stringBuilder.ToString(); } } } }
public static void GetExplanationUnfinalized_Postfix(ref string __result, StatWorker __instance, StatRequest req, ToStringNumberSense numberSense, StatDef ___stat) { if (req.Thing != null) { Pawn pawn = req.Thing as Pawn; if (pawn?.story?.traits != null && ___stat != null && pawn.story.traits.HasTrait(SyrTraitDefOf.SYR_CreativeThinker) && ___stat == StatDefOf.ResearchSpeed) { if (pawn.skills != null && pawn.def.statBases != null) { float statBase = 1f; if (pawn.def.statBases.Find((StatModifier x) => x?.stat != null && x.stat == ___stat) != null) { statBase = pawn.def.statBases.Find((StatModifier x) => x?.stat != null && x.stat == ___stat).value; } float val = 0.115f * pawn.skills.GetSkill(SkillDefOf.Artistic).Level *statBase; StringBuilder stringBuilder = new StringBuilder(); stringBuilder.AppendLine("SyrTraitsDaVinciGene".Translate()); stringBuilder.AppendLine(string.Concat(new object[] { " " + SkillDefOf.Artistic.LabelCap + " (", pawn.skills.GetSkill(SkillDefOf.Artistic).Level, "): ", val.ToStringSign(), __instance.ValueToString(val, false, ToStringNumberSense.Absolute) })); __result += stringBuilder.ToString(); } } } }