Contains() public method

public Contains ( Server.Mobile m ) : bool
m Server.Mobile
return bool
Example #1
0
        public override void OnPublicMessage(Mobile from, string text)
        {
            if (text.Length > 128 || (text = text.Trim()).Length == 0)
            {
                return;
            }

            Party p = Party.Get(from);

            if (p != null)
            {
                p.SendPublicMessage(from, text);

                foreach (Data data in Data.Datas.Values)
                {
                    if (data.GlobalW && !p.Contains(data.Mobile))
                    {
                        data.Mobile.SendMessage(data.GlobalWC, "(Global) <World->Party> {0}: {1}", from.Name, text);
                    }
                }
            }
            else
            {
                from.SendLocalizedMessage(3000211); // You are not in a party.
            }
        }
Example #2
0
        public override void OnPrivateMessage(Mobile from, Mobile target, string text)
        {
            if (text.Length > 128 || (text = text.Trim()).Length == 0)
            {
                return;
            }

            Party p = Party.Get(from);

            if (p != null && p.Contains(target))
            {
                p.SendPrivateMessage(from, target, text);
            }
            else
            {
                from.SendLocalizedMessage(3000211);                 // You are not in a party.
            }
        }
Example #3
0
        public override void OnRemove(Mobile from, Mobile target)
        {
            Party p = Party.Get(from);

            if (p == null)
            {
                from.SendLocalizedMessage(3000211);                 // You are not in a party.
                return;
            }

            if (p.Leader == from && target == null)
            {
                from.SendLocalizedMessage(1005455);                 // Who would you like to remove from your party?
                from.Target = new RemovePartyTarget();
            }
            else if ((p.Leader == from || from == target) && p.Contains(target))
            {
                p.Remove(target);
            }
        }
Example #4
0
        protected override void OnTarget(Mobile from, object o)
        {
            if (o is Mobile m)
            {
                Party p = Party.Get(from);

                if (p == null || p.Leader != from || !p.Contains(m))
                {
                    return;
                }

                if (from == m)
                {
                    from.SendLocalizedMessage(1005446);                     // You may only remove yourself from a party if you are not the leader.
                }
                else
                {
                    p.Remove(m);
                }
            }
        }