// Token: 0x0600005D RID: 93 RVA: 0x00005B98 File Offset: 0x00003D98 public static void DoMSTranscendence(Pawn p, ThingDef t) { List <SkillDef> skills = MSSkillChanger.GetSkillList(MSSkillChanger.GetTranscendenceQuality(t)); List <SkillDef> candidates = new List <SkillDef>(); if (skills.Count > 0) { for (int i = 0; i < skills.Count; i++) { if (p != null) { Pawn_SkillTracker skills2 = p.skills; int?num; if (skills2 == null) { num = null; } else { SkillRecord skill2 = skills2.GetSkill(skills[i]); num = ((skill2 != null) ? new int?(skill2.Level) : null); } int?num2 = num; int num3 = 20; if ((num2.GetValueOrDefault() < num3 & num2 != null) && p != null) { Pawn_SkillTracker skills3 = p.skills; num2 = ((skills3 != null) ? new int?(skills3.GetSkill(skills[i]).Level) : null); num3 = 0; if (num2.GetValueOrDefault() > num3 & num2 != null) { candidates.Add(skills[i]); } } } } } if (candidates.Count > 0) { SkillDef skill = candidates.RandomElement(); int before = p.skills.GetSkill(skill).Level; float Rnd = Rand.Range(1f, 3f); p.skills.Learn(skill, 32000f * Rnd, true); int after = p.skills.GetSkill(skill).Level; Messages.Message("MSExotic.TSkillBoost".Translate(p.LabelShort, skill.label.CapitalizeFirst(), before.ToString(), after.ToString()), p, MessageTypeDefOf.PositiveEvent, true); } }
// Token: 0x06000072 RID: 114 RVA: 0x00006354 File Offset: 0x00004554 public static void CheckSkills(Pawn p, ThingDef t, out string reason, out bool passed) { reason = ""; passed = true; List <SkillDef> chkskills = MSSkillChanger.GetSkillList(MSSkillChanger.GetTranscendenceQuality(t)); if (chkskills.Count > 0) { int numCants = 0; for (int i = 0; i < chkskills.Count; i++) { if (p != null) { Pawn_SkillTracker skills = p.skills; int?num; if (skills == null) { num = null; } else { SkillRecord skill = skills.GetSkill(chkskills[i]); num = ((skill != null) ? new int?(skill.Level) : null); } int?num2 = num; int num3 = 20; if (num2.GetValueOrDefault() >= num3 & num2 != null) { numCants++; } } } if (numCants == chkskills.Count) { reason = "MSExotic.WontLearnUsing".Translate(p.LabelShort, t.label.CapitalizeFirst()); passed = false; return; } } else { reason = "MSExotic.NoTSkillList".Translate(p.LabelShort, t.defName); passed = false; } }
// Token: 0x0600005D RID: 93 RVA: 0x00005B98 File Offset: 0x00003D98 public static void DoMSTranscendence(Pawn p, ThingDef t) { var skills = MSSkillChanger.GetSkillList(MSSkillChanger.GetTranscendenceQuality(t)); var candidates = new List <SkillDef>(); if (skills.Count > 0) { foreach (var skillDef in skills) { if (p == null) { continue; } var skills2 = p.skills; int?num; if (skills2 == null) { num = null; } else { var skill2 = skills2.GetSkill(skillDef); num = skill2 != null ? new int?(skill2.Level) : null; } var num2 = num; var num3 = 20; if (!((num2.GetValueOrDefault() < num3) & (num2 != null))) { continue; } var skills3 = p.skills; num2 = skills3 != null ? new int?(skills3.GetSkill(skillDef).Level) : null; num3 = 0; if ((num2.GetValueOrDefault() > num3) & (num2 != null)) { candidates.Add(skillDef); } } } if (candidates.Count <= 0) { return; } var skill = candidates.RandomElement(); if (p == null) { return; } var before = p.skills.GetSkill(skill).Level; var Rnd = Rand.Range(1f, 3f); p.skills.Learn(skill, 32000f * Rnd, true); var after = p.skills.GetSkill(skill).Level; Messages.Message( "MSExotic.TSkillBoost".Translate(p.LabelShort, skill.label.CapitalizeFirst(), before.ToString(), after.ToString()), p, MessageTypeDefOf.PositiveEvent); }