Ejemplo n.º 1
0
        public void CallGuards(Point3D p)
        {
            if (IsDisabled())
            {
                return;
            }

            IPooledEnumerable eable = Map.GetMobilesInRange(p, 14);

            foreach (Mobile m in eable)
            {
                Factions.PlayerState mobileState = Factions.PlayerState.Find(m);

                if (IsGuardCandidate(m) && ((mobileState == null && m.Kills >= 5 && m.Region.IsPartOf(this)) || m_GuardCandidates.ContainsKey(m)))
                {
                    GuardTimer timer = null;
                    m_GuardCandidates.TryGetValue(m, out timer);

                    if (timer != null)
                    {
                        timer.Stop();
                        m_GuardCandidates.Remove(m);
                    }

                    MakeGuard(m);
                    m.SendLocalizedMessage(502276);                       // Guards can no longer be called on you.
                    break;
                }
            }

            eable.Free();
        }
Ejemplo n.º 2
0
        public bool IsGuardCandidate(Mobile m)
        {
            Factions.PlayerState mobileState = Factions.PlayerState.Find(m);

            if (m is BaseGuard || !m.Alive || m.AccessLevel > AccessLevel.Player || m.Blessed || (m is BaseCreature && ((BaseCreature)m).IsInvulnerable) || IsDisabled())
            {
                return(false);
            }

            return(mobileState == null && m.Criminal);
        }