示例#1
0
        private bool PassesModChecks(Viewer viewer, Trait target, ArgWorker worker)
        {
            if (RationalRomance.Active && RationalRomance.IsTraitDisabled(target.def))
            {
                MessageHelper.ReplyToUser(viewer.username, "TKUtils.RemoveTrait.RationalRomance".LocalizeKeyed(_buyable.Name.CapitalizeFirst()));

                return(false);
            }

            if (CompatRegistry.Alien != null && CompatRegistry.Alien.IsTraitForced(_pawn, target.def.defName, target.Degree))
            {
                MessageHelper.ReplyToUser(viewer.username, "TKUtils.RemoveTrait.Kind".LocalizeKeyed(_pawn.kindDef.race.LabelCap, _buyable.Name));

                return(false);
            }

            if ((CompatRegistry.Magic?.IsClassTrait(target.def) ?? false) && !TkSettings.ClassChanges)
            {
                MessageHelper.ReplyToUser(viewer.username, "TKUtils.RemoveTrait.Class".LocalizeKeyed(worker.GetLast()));

                return(false);
            }

            return(true);
        }
示例#2
0
        private bool PassesCharacterChecks(Viewer viewer, ArgWorker worker)
        {
            if (_buyableTrait.TraitDef.IsDisallowedByBackstory(_pawn !, _buyableTrait.Degree, out Backstory backstory))
            {
                MessageHelper.ReplyToUser(viewer.username, "TKUtils.Trait.RestrictedByBackstory".LocalizeKeyed(backstory.identifier, worker.GetLast()));

                return(false);
            }

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

                return(false);
            }

            if (!_buyableTrait.TraitDef.IsDisallowedByKind(_pawn, _buyableTrait.Degree))
            {
                return(true);
            }

            MessageHelper.ReplyToUser(viewer.username, "TKUtils.Trait.RestrictedByKind".LocalizeKeyed(_pawn.kindDef.race.LabelCap, worker.GetLast()));

            return(false);
        }