예제 #1
0
        public static bool RestrictSilver(Mobile a, Mobile b)
        {
            Account accountA = a.Account as Account;
            Account accountB = b.Account as Account;

            return(accountA != null && (accountA == accountB || PVPArenaSystem.IsSameIP(a, b)));
        }
예제 #2
0
        public static void Configure()
        {
            EventSink.WorldSave     += OnSave;
            EventSink.WorldLoad     += OnLoad;
            EventSink.QuestComplete += CompleteQuest;
            EventSink.OnKilledBy    += OnKilledBy;

            Systems = new List <PointsSystem>();

            QueensLoyalty       = new QueensLoyalty();
            VoidPool            = new VoidPool();
            DespiseCrystals     = new DespiseCrystals();
            ShameCrystals       = new ShameCrystals();
            CasinoData          = new CasinoData();
            Blackthorn          = new BlackthornData();
            CleanUpBritannia    = new CleanUpBritanniaData();
            ViceVsVirtue        = new ViceVsVirtueSystem();
            TreasuresOfKotlCity = new KotlCityData();

            CityLoyaltySystem.ConstructSystems();
            ArenaSystem       = new PVPArenaSystem();
            Khaldun           = new KhaldunData();
            TreasuresOfDoom   = new DoomData();
            SorcerersDungeon  = new SorcerersDungeonData();
            RisingTide        = new RisingTide();
            DoomGauntlet      = new DoomGauntlet();
            TreasuresOfTokuno = new TreasuresOfTokuno();
            VirtueArtifacts   = new VirtueArtifactsSystem();
            FellowshipData    = new FellowshipData();
        }
예제 #3
0
        public static void Configure()
        {
            EventSink.WorldSave += OnSave;
            EventSink.WorldLoad += OnLoad;

            Systems = new List <PointsSystem>();

            QueensLoyalty       = new QueensLoyalty();
            VoidPool            = new VoidPool();
            DespiseCrystals     = new DespiseCrystals();
            ShameCrystals       = new ShameCrystals();
            CasinoData          = new CasinoData();
            Blackthorn          = new BlackthornData();
            CleanUpBritannia    = new CleanUpBritanniaData();
            ViceVsVirtue        = new ViceVsVirtueSystem();
            TreasuresOfKotlCity = new KotlCityData();

            CityLoyaltySystem.ConstructSystems();
            ArenaSystem = new PVPArenaSystem();
        }
예제 #4
0
        public static int MobileNotoriety(Mobile source, IDamageable damageable)
        {
            if (damageable is PublicMoongate)
            {
                return(Notoriety.Innocent);
            }

            var target = damageable as Mobile;

            if (target == null)
            {
                return(Notoriety.CanBeAttacked);
            }

            if (Core.AOS)
            {
                if (target.Blessed)
                {
                    return(Notoriety.Invulnerable);
                }

                if (target is BaseVendor && ((BaseVendor)target).IsInvulnerable)
                {
                    return(Notoriety.Invulnerable);
                }

                if (target is PlayerVendor || target is TownCrier)
                {
                    return(Notoriety.Invulnerable);
                }
            }

            var context = EnemyOfOneSpell.GetContext(source);

            if (context != null && context.IsEnemy(target))
            {
                return(Notoriety.Enemy);
            }

            if (PVPArenaSystem.IsEnemy(source, target))
            {
                return(Notoriety.Enemy);
            }

            if (PVPArenaSystem.IsFriendly(source, target))
            {
                return(Notoriety.Ally);
            }

            if (target.IsStaff())
            {
                return(Notoriety.CanBeAttacked);
            }

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

                var master = bc.GetMaster();

                if (master != null && master.IsStaff())
                {
                    return(Notoriety.CanBeAttacked);
                }

                master = bc.ControlMaster;

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

                    if (CheckAggressor(source.Aggressors, bc))
                    {
                        return(Notoriety.CanBeAttacked);
                    }

                    return(MobileNotoriety(source, master));
                }
            }

            if (target.Murderer)
            {
                return(Notoriety.Murderer);
            }

            if (target.Body.IsMonster && IsSummoned(target as BaseCreature))
            {
                if (!(target is BaseFamiliar) && !(target is ArcaneFey) && !(target is Golem))
                {
                    return(Notoriety.Murderer);
                }
            }

            if (target is BaseCreature)
            {
                if (((BaseCreature)target).AlwaysMurderer || ((BaseCreature)target).IsAnimatedDead)
                {
                    return(Notoriety.Murderer);
                }
            }

            #region Mondain's Legacy
            if (target is Gregorio)
            {
                if (Gregorio.IsMurderer(source))
                {
                    return(Notoriety.Murderer);
                }

                return(Notoriety.Innocent);
            }

            if (source.Player && target is BaseEscort)
            {
                return(Notoriety.Innocent);
            }
            #endregion

            if (target.Criminal)
            {
                return(Notoriety.Criminal);
            }

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

            if (sourceGuild != null && targetGuild != null)
            {
                if (sourceGuild == targetGuild)
                {
                    return(Notoriety.Ally);
                }

                if (sourceGuild.IsAlly(targetGuild))
                {
                    return(Notoriety.Ally);
                }

                if (sourceGuild.IsEnemy(targetGuild))
                {
                    return(Notoriety.Enemy);
                }
            }

            if (Settings.Enabled)
            {
                var srcFaction = Faction.Find(source, true, true);
                var trgFaction = Faction.Find(target, true, true);

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

            if (ViceVsVirtueSystem.Enabled && ViceVsVirtueSystem.IsEnemy(source, damageable) && source.Map == Faction.Facet)
            {
                return(Notoriety.Enemy);
            }

            if (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 NOT A baseCreature, OR it's a BC and the BC is initial innocent...
            if (!(target is BaseCreature && ((BaseCreature)target).InitialInnocent))
            {
                if (!target.Body.IsHuman && !target.Body.IsGhost && !IsPet(target as BaseCreature) && !(target is PlayerMobile))
                {
                    return(Notoriety.CanBeAttacked);
                }

                if (!Core.ML && !target.CanBeginAction(typeof(PolymorphSpell)))
                {
                    return(Notoriety.CanBeAttacked);
                }
            }

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

            if (source is PlayerMobile && CheckPetAggressor((PlayerMobile)source, target))
            {
                return(Notoriety.CanBeAttacked);
            }

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

            if (source is PlayerMobile && CheckPetAggressed((PlayerMobile)source, target))
            {
                return(Notoriety.CanBeAttacked);
            }

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

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

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

                if (master != null)
                {
                    if (CheckAggressor(master.Aggressors, target))
                    {
                        return(Notoriety.CanBeAttacked);
                    }

                    if (MobileNotoriety(master, target) == Notoriety.CanBeAttacked)
                    {
                        return(Notoriety.CanBeAttacked);
                    }

                    if (target is BaseCreature)
                    {
                        return(Notoriety.CanBeAttacked);
                    }
                }
            }

            return(Notoriety.Innocent);
        }
예제 #5
0
        public static int MobileNotoriety(Mobile source, IDamageable damageable)
        {
            Mobile target = damageable as Mobile;

            if (target == null)
            {
                return(Notoriety.CanBeAttacked);
            }

            if (target.Blessed)
            {
                return(Notoriety.Invulnerable);
            }

            if (target is BaseVendor vendor && vendor.IsInvulnerable)
            {
                return(Notoriety.Invulnerable);
            }

            if (target is PlayerVendor || target is TownCrier)
            {
                return(Notoriety.Invulnerable);
            }

            EnemyOfOneContext context = EnemyOfOneSpell.GetContext(source);

            if (context != null && context.IsEnemy(target))
            {
                return(Notoriety.Enemy);
            }

            if (PVPArenaSystem.IsEnemy(source, target))
            {
                return(Notoriety.Enemy);
            }

            if (PVPArenaSystem.IsFriendly(source, target))
            {
                return(Notoriety.Ally);
            }

            if (target.IsStaff())
            {
                return(Notoriety.CanBeAttacked);
            }

            var bc = target as BaseCreature;

            if (source.Player && bc != null)
            {
                Mobile master = bc.GetMaster();

                if (master != null && master.IsStaff())
                {
                    return(Notoriety.CanBeAttacked);
                }

                master = bc.ControlMaster;

                if (master != null && !bc.ForceNotoriety)
                {
                    if (source == master && CheckAggressor(target.Aggressors, source))
                    {
                        return(Notoriety.CanBeAttacked);
                    }

                    if (CheckAggressor(source.Aggressors, bc))
                    {
                        return(Notoriety.CanBeAttacked);
                    }

                    return(MobileNotoriety(source, master));
                }
            }

            if (target.Murderer)
            {
                return(Notoriety.Murderer);
            }

            if (target.Body.IsMonster && IsSummoned(bc))
            {
                if (!(target is BaseFamiliar) && !(target is ArcaneFey) && !(target is Golem))
                {
                    return(Notoriety.Murderer);
                }
            }

            if (bc != null && (bc.AlwaysMurderer || bc.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)
                {
                    return(Notoriety.Ally);
                }

                if (sourceGuild.IsAlly(targetGuild))
                {
                    return(Notoriety.Ally);
                }

                if (sourceGuild.IsEnemy(targetGuild))
                {
                    return(Notoriety.Enemy);
                }
            }

            if (ViceVsVirtueSystem.Enabled && ViceVsVirtueSystem.IsEnemy(source, target) && (ViceVsVirtueSystem.EnhancedRules || source.Map == ViceVsVirtueSystem.Facet))
            {
                return(Notoriety.Enemy);
            }

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

            if (bc != null && bc.AlwaysAttackable)
            {
                return(Notoriety.CanBeAttacked);
            }

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

            //If Target is NOT A baseCreature, OR it's a BC and the BC is initial innocent...
            if (!(bc != null && ((BaseCreature)target).InitialInnocent))
            {
                if (!target.Body.IsHuman && !target.Body.IsGhost && !IsPet(target as BaseCreature) && !(target is PlayerMobile))
                {
                    return(Notoriety.CanBeAttacked);
                }
            }

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

            if (source is PlayerMobile pm && CheckPetAggressor(pm, target))
            {
                return(Notoriety.CanBeAttacked);
            }

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

            if (source is PlayerMobile playerMobile && CheckPetAggressed(playerMobile, target))
            {
                return(Notoriety.CanBeAttacked);
            }

            if (bc != null)
            {
                if (bc.AlwaysInnocent)
                {
                    return(Notoriety.Innocent);
                }

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

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

                if (master != null)
                {
                    if (CheckAggressor(master.Aggressors, target))
                    {
                        return(Notoriety.CanBeAttacked);
                    }

                    if (MobileNotoriety(master, target) == Notoriety.CanBeAttacked)
                    {
                        return(Notoriety.CanBeAttacked);
                    }

                    if (target is BaseCreature)
                    {
                        return(Notoriety.CanBeAttacked);
                    }
                }
            }

            return(Notoriety.Innocent);
        }