Exemplo n.º 1
0
        public static int MobileNotoriety(Mobile a, Mobile b, out bool handled)
        {
            handled = false;

            if (!AutoPvP.CMOptions.ModuleEnabled)
            {
                return(Bubble);
            }

            PlayerMobile x, y;

            if (NotoUtility.Resolve(a, b, out x, out y))
            {
                var battle = AutoPvP.FindBattle(y);

                if (battle != null && !battle.Deleted)
                {
                    var result = battle.NotorietyHandler(a, b, out handled);

                    if (handled)
                    {
                        return(result);
                    }
                }
            }

            return(Bubble);
        }
Exemplo n.º 2
0
        public static bool AllowHarmful(Mobile a, Mobile b, out bool handled)
        {
            handled = false;

            if (!AutoPvP.CMOptions.ModuleEnabled)
            {
                return(false);
            }

            PlayerMobile x, y;

            if (NotoUtility.Resolve(a, b, out x, out y))
            {
                var battle = AutoPvP.FindBattle(y);

                if (battle != null && !battle.Deleted)
                {
                    var allow = battle.AllowHarmful(a, b, out handled);

                    if (handled)
                    {
                        return(allow);
                    }
                }
            }

            return(false);
        }
Exemplo n.º 3
0
        private static void CSConfig()
        {
            NotoUtility.RegisterNameHandler(HandleNotoriety);

            EventSink.PlayerDeath   += HandlePlayerDeath;
            EventSink.CreatureDeath += HandleCreatureDeath;

            EventSink.WorldLoad += FixPlayerMaps;

            IndexFile.Deserialize(LoadIndex);
        }
Exemplo n.º 4
0
        private static void CSDispose()
        {
            if (Mobile.CreateCorpseHandler == HandleCreateCorpse)
            {
                Mobile.CreateCorpseHandler = _CreateCorpseSuccessor;
            }

            NotoUtility.UnregisterNameHandler(HandleNotoriety);

            EventSink.PlayerDeath   -= HandlePlayerDeath;
            EventSink.CreatureDeath -= HandleCreatureDeath;

            DefragmentTimer.Dispose();
            DefragmentTimer = null;
        }
Exemplo n.º 5
0
        public virtual int NotorietyHandler(Mobile source, Mobile target, out bool handled)
        {
            handled = false;

            if (IsInternal || Hidden)
            {
                return(BattleNotoriety.Bubble);
            }

            if (source == null || source.Deleted || target == null || target.Deleted)
            {
                return(BattleNotoriety.Bubble);
            }

            handled = true;

            PlayerMobile x, y;

            if (NotoUtility.Resolve(source, target, out x, out y))
            {
                var noto = NotorietyHandler(x, y, out handled);

                if (handled || noto != BattleNotoriety.Bubble)
                {
                    return(noto);
                }
            }

            var xrs = source.InRegion(SpectateRegion);
            var xrb = source.InRegion(BattleRegion);

            var yrs = target.InRegion(SpectateRegion);
            var yrb = target.InRegion(BattleRegion);

            if (xrs || xrb || yrs || yrb)
            {
                return(Notoriety.Invulnerable);
            }

            handled = false;

            return(BattleNotoriety.Bubble);
        }
Exemplo n.º 6
0
        public override bool AllowHarmful(Mobile from, Mobile target)
        {
            if (Battle != null)
            {
                PlayerMobile x, y;

                if (NotoUtility.Resolve(from, target, out x, out y))
                {
                    bool handled;

                    var result = Battle.AllowHarmful(x, y, out handled);

                    if (handled)
                    {
                        return(result);
                    }
                }
            }

            return(base.AllowHarmful(from, target));
        }
Exemplo n.º 7
0
        public virtual bool CheckAllowHarmful(Mobile m, Mobile target, out bool handled)
        {
            handled = false;

            if (m == null || m.Deleted || target == null || target.Deleted)
            {
                return(false);
            }

            if (Deleted || State == PvPBattleState.Internal || Hidden)
            {
                return(false);
            }

            handled = true;

            PlayerMobile x, y;

            if (NotoUtility.Resolve(m, target, out x, out y))
            {
                PvPTeam teamA, teamB;

                if (IsParticipant(x, out teamA) && IsParticipant(y, out teamB))
                {
                    if (!Options.Rules.AllowHarmful)
                    {
                        return(false);
                    }

                    if (State != PvPBattleState.Running)
                    {
                        return(false);
                    }

                    if (teamA == teamB)
                    {
                        if (!CanDamageOwnTeam(x, y))
                        {
                            return(false);
                        }
                    }
                    else if (!CanDamageEnemyTeam(x, y))
                    {
                        return(false);
                    }
                }
            }

            var xrs = m.InRegion(SpectateRegion);
            var xrb = m.InRegion(BattleRegion);

            var yrs = target.InRegion(SpectateRegion);
            var yrb = target.InRegion(BattleRegion);

            if (xrs || xrb || yrs || yrb)
            {
                if (xrs && yrs)
                {
                    return(true);
                }

                if (xrb && yrb)
                {
                    return(true);
                }

                return(false);
            }

            handled = false;

            return(false);
        }
Exemplo n.º 8
0
        public virtual int NotorietyHandler(Mobile source, Mobile target, out bool handled)
        {
            handled = false;

            if (source == null || source.Deleted || target == null || target.Deleted)
            {
                return(BattleNotoriety.Bubble);
            }

            if (State == PvPBattleState.Internal || Hidden)
            {
                return(BattleNotoriety.Bubble);
            }

            handled = true;

            PlayerMobile x, y;

            if (NotoUtility.Resolve(source, target, out x, out y))
            {
                PvPTeam teamA, teamB;

                if (IsParticipant(x, out teamA) && IsParticipant(y, out teamB))
                {
                    if (State != PvPBattleState.Running)
                    {
                        return(Notoriety.Invulnerable);
                    }

                    if (teamA == teamB)
                    {
                        if (CanDamageOwnTeam(x, y))
                        {
                            return(Notoriety.Enemy);
                        }

                        return(Notoriety.Ally);
                    }

                    if (CanDamageEnemyTeam(x, y))
                    {
                        return(Notoriety.Enemy);
                    }

                    return(Notoriety.Invulnerable);
                }
            }

            var xrs = source.InRegion(SpectateRegion);
            var xrb = source.InRegion(BattleRegion);

            var yrs = target.InRegion(SpectateRegion);
            var yrb = target.InRegion(BattleRegion);

            if (xrs || xrb || yrs || yrb)
            {
                return(Notoriety.Invulnerable);
            }

            handled = false;

            return(BattleNotoriety.Bubble);
        }
Exemplo n.º 9
0
 public static void Disable()
 {
     NotoUtility.UnregisterNameHandler(MobileNotoriety);
     NotoUtility.UnregisterBeneficialHandler(AllowBeneficial);
     NotoUtility.UnregisterHarmfulHandler(AllowHarmful);
 }
Exemplo n.º 10
0
 public static void Enable()
 {
     NotoUtility.RegisterNameHandler(MobileNotoriety, Int32.MaxValue - 100);
     NotoUtility.RegisterBeneficialHandler(AllowBeneficial, Int32.MaxValue - 100);
     NotoUtility.RegisterHarmfulHandler(AllowHarmful, Int32.MaxValue - 100);
 }