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

MobileNotoriety() public static méthode

public static MobileNotoriety ( Server.Mobile source, Server.Mobile target ) : int
source Server.Mobile
target Server.Mobile
Résultat int
        public static int MobileNotoriety( Mobile source, Mobile target )
        {
            if( Core.AOS && (target.Blessed || (target is BaseVendor && ((BaseVendor)target).IsInvulnerable) || target is PlayerVendor || target is TownCrier) )
                return Notoriety.Invulnerable;

            if( target.AccessLevel > AccessLevel.Player )
                return Notoriety.CanBeAttacked;

            if( source.Player && !target.Player && source is PlayerMobile && target is BaseCreature )
            {
                BaseCreature bc = (BaseCreature)target;

                Mobile master = bc.GetMaster();

                if ( master != null && master.AccessLevel > AccessLevel.Player )
                    return Notoriety.CanBeAttacked;

                master = bc.ControlMaster;

                if ( Core.ML && master != null )
                {
                    if ( ( source == master && CheckAggressor( target.Aggressors, source ) ) || ( CheckAggressor( source.Aggressors, bc ) ) )
                        return Notoriety.CanBeAttacked;
                    else
                        return MobileNotoriety( source, master );
                }

                if( !bc.Summoned && !bc.Controlled && ((PlayerMobile)source).EnemyOfOneType == target.GetType() )
                    return Notoriety.Enemy;
            }

            if ( target.Kills >= 5 || ( target.Body.IsMonster && IsSummoned( target as BaseCreature ) && !( target is BaseFamiliar ) && !( target is ArcaneFey ) && !( target is Golem ) ) || ( target is BaseCreature && ( ( (BaseCreature)target ).AlwaysMurderer || ( (BaseCreature)target ).IsAnimatedDead ) ) )
                return Notoriety.Murderer;

            if( target.Criminal )
                return Notoriety.Criminal;

            Guild sourceGuild = GetGuildFor( source.Guild as Guild, source );
            Guild targetGuild = GetGuildFor( target.Guild as Guild, target );

            if( sourceGuild != null && targetGuild != null )
            {
                if( sourceGuild == targetGuild || sourceGuild.IsAlly( targetGuild ) )
                    return Notoriety.Ally;
                else if( sourceGuild.IsEnemy( targetGuild ) )
                    return Notoriety.Enemy;
            }

            Faction srcFaction = Faction.Find( source, true, true );
            Faction trgFaction = Faction.Find( target, true, true );

            if( srcFaction != null && trgFaction != null && srcFaction != trgFaction && source.Map == Faction.Facet )
                return Notoriety.Enemy;

            if( SkillHandlers.Stealing.ClassicMode && target is PlayerMobile && ((PlayerMobile)target).PermaFlags.Contains( source ) )
                return Notoriety.CanBeAttacked;

            if( target is BaseCreature && ((BaseCreature)target).AlwaysAttackable )
                return Notoriety.CanBeAttacked;

            if( CheckHouseFlag( source, target, target.Location, target.Map ) )
                return Notoriety.CanBeAttacked;

            if( !(target is BaseCreature && ((BaseCreature)target).InitialInnocent) )   //If Target is NOT A baseCreature, OR it's a BC and the BC is initial innocent...
            {
                if( !target.Body.IsHuman && !target.Body.IsGhost && !IsPet( target as BaseCreature ) && !(target is PlayerMobile) || !Core.ML && !target.CanBeginAction( typeof( Server.Spells.Seventh.PolymorphSpell ) ) )
                    return Notoriety.CanBeAttacked;
            }

            if( CheckAggressor( source.Aggressors, target ) )
                return Notoriety.CanBeAttacked;

            if( CheckAggressed( source.Aggressed, target ) )
                return Notoriety.CanBeAttacked;

            if( target is BaseCreature )
            {
                BaseCreature bc = (BaseCreature)target;

                if( bc.Controlled && bc.ControlOrder == OrderType.Guard && bc.ControlTarget == source )
                    return Notoriety.CanBeAttacked;
            }

            if( source is BaseCreature )
            {
                BaseCreature bc = (BaseCreature)source;
                Mobile master = bc.GetMaster();

                if( master != null )
                    if( CheckAggressor( master.Aggressors, target ) || MobileNotoriety( master, target ) == Notoriety.CanBeAttacked || target is BaseCreature )
                        return Notoriety.CanBeAttacked;
            }

            return Notoriety.Innocent;
        }