Server.Misc.NotorietyHandlers.Mobile_AllowBeneficial C# (CSharp) Méthode

Mobile_AllowBeneficial() public static méthode

public static Mobile_AllowBeneficial ( Server.Mobile from, Server.Mobile target ) : bool
from Server.Mobile
target Server.Mobile
Résultat bool
        public static bool Mobile_AllowBeneficial( Mobile from, Mobile target )
        {
            if( from == null || target == null || from.AccessLevel > AccessLevel.Player || target.AccessLevel > AccessLevel.Player )
                return true;

            Map map = from.Map;

            #region Factions
            Faction targetFaction = Faction.Find( target, true );

            if( (!Core.ML || map == Faction.Facet) && targetFaction != null )
            {
                if( Faction.Find( from, true ) != targetFaction )
                    return false;
            }
            #endregion

            if( map != null && (map.Rules & MapRules.BeneficialRestrictions) == 0 )
                return true; // In felucca, anything goes

            if( !from.Player )
                return true; // NPCs have no restrictions

            if( target is BaseCreature && !((BaseCreature)target).Controlled )
                return false; // Players cannot heal uncontrolled mobiles

            if( from is PlayerMobile && ((PlayerMobile)from).Young && (!(target is PlayerMobile) || !((PlayerMobile)target).Young) )
                return false; // Young players cannot perform beneficial actions towards older players

            Guild fromGuild = from.Guild as Guild;
            Guild targetGuild = target.Guild as Guild;

            if( fromGuild != null && targetGuild != null && (targetGuild == fromGuild || fromGuild.IsAlly( targetGuild )) )
                return true; // Guild members can be beneficial

            return CheckBeneficialStatus( GetGuildStatus( from ), GetGuildStatus( target ) );
        }