Example #1
0
        private bool PassesCharacterCheck(Viewer viewer)
        {
            if (_thatShop !.TraitDef.IsDisallowedByBackstory(_pawn, _thatShop.Degree, out Backstory backstory))
            {
                MessageHelper.ReplyToUser(viewer.username, "TKUtils.Trait.RestrictedByBackstory".LocalizeKeyed(backstory.identifier, _thisShop !.Name));

                return(false);
            }

            if (_pawn.kindDef.disallowedTraits?.Any(t => t.defName.Equals(_thatShop.TraitDef !.defName)) == true)
            {
                MessageHelper.ReplyToUser(viewer.username, "TKUtils.Trait.RestrictedByKind".LocalizeKeyed(_pawn.kindDef.race.LabelCap, _thatShop.Name));

                return(false);
            }

            if (_thatShop.TraitDef.IsDisallowedByKind(_pawn, _thatShop.Degree))
            {
                MessageHelper.ReplyToUser(viewer.username, "TKUtils.Trait.RestrictedByKind".LocalizeKeyed(_pawn.kindDef.race.LabelCap, _thatShop.Name));

                return(false);
            }

            return(true);
        }