Ejemplo 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);
        }
Ejemplo 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);
        }
Ejemplo n.º 3
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);
        }
Ejemplo n.º 4
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));
        }
Ejemplo n.º 5
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);
        }
Ejemplo n.º 6
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);
        }