Beispiel #1
0
        public static bool AllowHarmful(Mobile a, Mobile b)
        {
            if (_HarmfulParent == null)
            {
                return(NotorietyHandlers.Mobile_AllowHarmful(a, b));
            }

            if (a == null || a.Deleted || b == null || b.Deleted || a == b)
            {
                return(_HarmfulParent(a, b));
            }

            if (a is PlayerMobile && b is PlayerMobile)
            {
                PlayerMobile x = (PlayerMobile)a, y = (PlayerMobile)b;
                PvPBattle    battleA = AutoPvP.FindBattle(x), battleB = AutoPvP.FindBattle(y);

                if (battleA == null || battleA.Deleted || battleB == null || battleB.Deleted || battleA != battleB || x == y)
                {
                    return(_HarmfulParent(x, y));
                }

                var battle = battleA;

                if (_HarmfulHandlers.ContainsKey(battle) && _HarmfulHandlers[battle] != null)
                {
                    return(_HarmfulHandlers[battle](x, y));
                }
            }

            return(_HarmfulParent(a, b));
        }
Beispiel #2
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);
        }
Beispiel #3
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);
        }
Beispiel #4
0
        public virtual bool InOtherBattle(PlayerMobile pm)
        {
            if (pm == null)
            {
                return(false);
            }

            var battle = AutoPvP.FindBattle(pm);

            return(battle != null && battle != this && battle.IsParticipant(pm));
        }
Beispiel #5
0
        private static void OnCheckEquipItem(CheckEquipItemEventArgs e)
        {
            if (e.Block || !(e.Mobile is PlayerMobile))
            {
                return;
            }

            var m = (PlayerMobile)e.Mobile;
            var b = AutoPvP.FindBattle(m);

            if (b != null && b.IsParticipant(m) && !b.CanUseItem(m, e.Item, e.Message))
            {
                e.Block = true;
            }
        }
Beispiel #6
0
        public static int MobileNotoriety(Mobile a, Mobile b)
        {
            if (_NotorietyParent == null)
            {
                return(NotorietyHandlers.MobileNotoriety(a, b));
            }

            if (a == null || a.Deleted || b == null || b.Deleted || a == b)
            {
                return(_NotorietyParent(a, b));
            }

            if (a is PlayerMobile && b is PlayerMobile)
            {
                PlayerMobile x = (PlayerMobile)a, y = (PlayerMobile)b;
                PvPBattle    battleA = AutoPvP.FindBattle(x), battleB = AutoPvP.FindBattle(y);

                if (battleA == null || battleA.Deleted || battleB == null || battleB.Deleted || battleA != battleB || x == y)
                {
                    return(_NotorietyParent(x, y));
                }

                var battle = battleA;

                if (_NameHandlers.ContainsKey(battle) && _NameHandlers[battle] != null)
                {
                    var val = _NameHandlers[battle](x, y);

                    if (val == Bubble)
                    {
                        val = _NotorietyParent(x, y);
                    }

                    return(val);
                }
            }

            return(_NotorietyParent(a, b));
        }
Beispiel #7
0
        public virtual bool InOtherBattle(PlayerMobile pm)
        {
            PvPBattle battle = AutoPvP.FindBattle(pm);

            return(battle != null && battle != this && battle.IsParticipant(pm));
        }