// Token: 0x0600007C RID: 124 RVA: 0x000067F8 File Offset: 0x000049F8
        public static void RemoveTrait(Pawn pawn, Trait trait, string doer, MessageTypeDef MsgType, bool SendMsg = true)
        {
            Pawn_StoryTracker story    = pawn.story;
            Trait             remTrait = (story != null) ? (from x in story.traits.allTraits
                                                            where x.def == trait.def
                                                            select x).FirstOrDefault() : null;

            if (remTrait == null)
            {
                return;
            }
            if (pawn != null)
            {
                Pawn_StoryTracker story2 = pawn.story;
                if (story2 != null)
                {
                    story2.traits.allTraits.Remove(remTrait);
                }
            }
            MSTraitChanger.TraitsUpdated(pawn);
            if (SendMsg)
            {
                string        key    = "MSExotic.TraitRemoved";
                NamedArgument arg    = pawn?.LabelShort.CapitalizeFirst();
                Trait         trait2 = trait;
                Messages.Message(key.Translate(arg, trait2?.Label.CapitalizeFirst(), doer.CapitalizeFirst()), pawn, MsgType, true);
            }
        }
        // Token: 0x06000058 RID: 88 RVA: 0x000058E0 File Offset: 0x00003AE0
        public static void DoMSCerebrax(Pawn p, ThingDef t)
        {
            var degree  = 0;
            var MsgType = MessageTypeDefOf.PositiveEvent;
            var Psych   = DefDatabase <TraitDef> .GetNamed("PsychicSensitivity");

            if (p.story.traits.HasTrait(Psych))
            {
                degree = p.story.traits.GetTrait(Psych).Degree;
            }

            if (degree == 2)
            {
                var   story = p.story;
                Trait trait;
                if (story == null)
                {
                    trait = null;
                }
                else
                {
                    var traits = story.traits;
                    trait = traits?.GetTrait(Psych);
                }

                var ToGo = trait;
                MSTraitChanger.RemoveTrait(p, ToGo, t.label, MsgType);
                var ToAdd = new Trait(Psych, 1);
                MSTraitChanger.AddTrait(p, ToAdd, t.label, MsgType, false);
                return;
            }

            if (degree != 1)
            {
                return;
            }

            var   story2 = p.story;
            Trait trait2;

            if (story2 == null)
            {
                trait2 = null;
            }
            else
            {
                var traits2 = story2.traits;
                trait2 = traits2?.GetTrait(Psych);
            }

            var ToGo2 = trait2;

            MSTraitChanger.RemoveTrait(p, ToGo2, t.label, MsgType);
        }
        // Token: 0x06000056 RID: 86 RVA: 0x0000571C File Offset: 0x0000391C
        public static void DoMSImmunisation(Pawn p, ThingDef t)
        {
            var Sickly   = false;
            var MsgType  = MessageTypeDefOf.PositiveEvent;
            var Immunity = DefDatabase <TraitDef> .GetNamed("Immunity");

            if (p.story.traits.HasTrait(Immunity))
            {
                var story = p.story;
                int?num;
                if (story == null)
                {
                    num = null;
                }
                else
                {
                    var traits = story.traits;
                    num = traits != null ? new int?(traits.GetTrait(Immunity).Degree) : null;
                }

                var num2 = num;
                var num3 = -1;
                if ((num2.GetValueOrDefault() == num3) & (num2 != null))
                {
                    Sickly = true;
                }
            }

            if (Sickly)
            {
                var   story2 = p.story;
                Trait trait;
                if (story2 == null)
                {
                    trait = null;
                }
                else
                {
                    var traits2 = story2.traits;
                    trait = traits2?.GetTrait(Immunity);
                }

                var ToGo = trait;
                MSTraitChanger.RemoveTrait(p, ToGo, t.label, MsgType);
                return;
            }

            var ToAdd = new Trait(Immunity, 1);

            MSTraitChanger.AddTrait(p, ToAdd, t.label, MsgType);
        }
 // Token: 0x0600007D RID: 125 RVA: 0x000068C8 File Offset: 0x00004AC8
 public static void AddTrait(Pawn pawn, Trait trait, string doer, MessageTypeDef MsgType, bool SendMsg = true)
 {
     if (pawn != null)
     {
         Pawn_StoryTracker story = pawn.story;
         if (story != null)
         {
             story.traits.GainTrait(trait);
         }
     }
     MSTraitChanger.TraitsUpdated(pawn);
     if (SendMsg)
     {
         Messages.Message("MSExotic.TraitAdded".Translate(pawn?.LabelShort.CapitalizeFirst(), trait?.Label.CapitalizeFirst(), doer.CapitalizeFirst()), pawn, MsgType, true);
     }
 }
        // Token: 0x06000056 RID: 86 RVA: 0x0000571C File Offset: 0x0000391C
        public static void DoMSImmunisation(Pawn p, ThingDef t)
        {
            bool           Sickly   = false;
            MessageTypeDef MsgType  = MessageTypeDefOf.PositiveEvent;
            TraitDef       Immunity = DefDatabase <TraitDef> .GetNamed("Immunity", true);

            if (p.story.traits.HasTrait(Immunity) && p != null)
            {
                Pawn_StoryTracker story = p.story;
                int?num;
                if (story == null)
                {
                    num = null;
                }
                else
                {
                    TraitSet traits = story.traits;
                    num = ((traits != null) ? new int?(traits.GetTrait(Immunity).Degree) : null);
                }
                int?num2 = num;
                int num3 = -1;
                if (num2.GetValueOrDefault() == num3 & num2 != null)
                {
                    Sickly = true;
                }
            }
            if (Sickly)
            {
                Pawn_StoryTracker story2 = p.story;
                Trait             trait;
                if (story2 == null)
                {
                    trait = null;
                }
                else
                {
                    TraitSet traits2 = story2.traits;
                    trait = (traits2?.GetTrait(Immunity));
                }
                Trait ToGo = trait;
                MSTraitChanger.RemoveTrait(p, ToGo, t.label, MsgType, true);
                return;
            }
            Trait ToAdd = new Trait(Immunity, 1, false);

            MSTraitChanger.AddTrait(p, ToAdd, t.label, MsgType, true);
        }
        // Token: 0x06000058 RID: 88 RVA: 0x000058E0 File Offset: 0x00003AE0
        public static void DoMSCerebrax(Pawn p, ThingDef t)
        {
            int            degree  = 0;
            MessageTypeDef MsgType = MessageTypeDefOf.PositiveEvent;
            TraitDef       Psych   = DefDatabase <TraitDef> .GetNamed("PsychicSensitivity", true);

            if (p.story.traits.HasTrait(Psych))
            {
                degree = p.story.traits.GetTrait(Psych).Degree;
            }
            if (degree == 2)
            {
                Pawn_StoryTracker story = p.story;
                Trait             trait;
                if (story == null)
                {
                    trait = null;
                }
                else
                {
                    TraitSet traits = story.traits;
                    trait = (traits?.GetTrait(Psych));
                }
                Trait ToGo = trait;
                MSTraitChanger.RemoveTrait(p, ToGo, t.label, MsgType, true);
                Trait ToAdd = new Trait(Psych, 1, false);
                MSTraitChanger.AddTrait(p, ToAdd, t.label, MsgType, false);
                return;
            }
            if (degree == 1)
            {
                Pawn_StoryTracker story2 = p.story;
                Trait             trait2;
                if (story2 == null)
                {
                    trait2 = null;
                }
                else
                {
                    TraitSet traits2 = story2.traits;
                    trait2 = (traits2?.GetTrait(Psych));
                }
                Trait ToGo2 = trait2;
                MSTraitChanger.RemoveTrait(p, ToGo2, t.label, MsgType, true);
            }
        }