Exemple #1
0
        public static void Spawn(Mobile caller, Mobile target, int amount, bool onlyAdditional)
        {
            if (target == null || target.Deleted || target.GuardImmune)
                return;

            IPooledEnumerable eable = target.GetMobilesInRange(15);

            foreach (Mobile m in eable)
            {
                if (m is BaseGuard)
                {
                    BaseGuard g = (BaseGuard)m;

                    if (g.Focus == null) // idling
                    {
                        g.Focus = target;

                        --amount;
                    }
                    else if (g.Focus == target && !onlyAdditional)
                    {
                        --amount;
                    }
                }
            }

            eable.Free();

            while (amount-- > 0)
                caller.Region.MakeGuard(target);
        }
Exemple #2
0
        public static void Spawn(Mobile caller, Mobile target, int amount, bool onlyAdditional)
        {
            if (target == null || target.Deleted)
            {
                return;
            }

            foreach (Mobile m in target.GetMobilesInRange(15))
            {
                if (m is BaseGuard)
                {
                    BaseGuard g = (BaseGuard)m;

                    if (g.Focus == null)                       // idling
                    {
                        g.Focus = target;

                        --amount;
                    }
                    else if (g.Focus == target && !onlyAdditional)
                    {
                        --amount;
                    }
                }
            }

            while (amount-- > 0)
            {
                caller.Region.MakeGuard(target);
            }
        }
Exemple #3
0
        public static void Spawn(Mobile caller, Mobile target, int amount, bool onlyAdditional)
        {
            if (target == null || target.Deleted)
            {
                return;
            }

            IPooledEnumerable eable = null;

            //Pix: 7/10/04 - putting this safety try-catch in after shard crash
            //Adam: 7/8/08 - converting IPooledEnumerable so we can free it. (We caught an exception here)
            try
            {
                eable = target.GetMobilesInRange(15);
                foreach (Mobile m in  eable)
                {
                    if (m is BaseGuard)
                    {
                        BaseGuard g = (BaseGuard)m;

                        if (g.Focus == null)                           // idling
                        {
                            g.Focus = target;

                            --amount;
                        }
                        else if (g.Focus == target && !onlyAdditional)
                        {
                            --amount;
                        }
                    }
                }
            }
            catch (Exception ex) { EventSink.InvokeLogException(new LogExceptionEventArgs(ex)); }
            finally
            {
                if (eable != null)
                {
                    eable.Free();
                }
            }
            while (amount-- > 0)
            {
                caller.Region.MakeGuard(target);
            }
        }
Exemple #4
0
 protected override void OnTick()
 {
     BaseGuard.Spawn(m_Focus, m_Focus, 1, true);
 }
Exemple #5
0
 public IdleTimer(BaseGuard owner)
     : base(TimeSpan.FromSeconds(2.0), TimeSpan.FromSeconds(2.5))
 {
     m_Owner = owner;
 }
Exemple #6
0
 public AttackTimer(BaseGuard owner)
     : base(TimeSpan.Zero, TimeSpan.FromSeconds(0.1))
 {
     m_Owner = owner;
 }
 public IdleTimer(BaseGuard owner)
     : base(TimeSpan.FromSeconds(2.0), TimeSpan.FromSeconds(2.5))
 {
     m_Owner = owner;
 }
 public AttackTimer(BaseGuard owner)
     : base(TimeSpan.Zero, TimeSpan.FromSeconds(0.1))
 {
     m_Owner = owner;
 }