Get() public static method

public static Get ( Server.Mobile m ) : Party
m Server.Mobile
return Party
        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);
                }
            }
        }
Example #2
0
        public static void ListenToParty_OnTarget(Mobile from, object obj)
        {
            if (obj is Mobile)
            {
                Party p = Party.Get((Mobile)obj);

                if (p == null)
                {
                    from.SendMessage("They are not in a party.");
                }
                else if (p.m_Listeners.Contains(from))
                {
                    p.m_Listeners.Remove(from);
                    from.SendMessage("You are no longer listening to that party.");
                }
                else
                {
                    p.m_Listeners.Add(from);
                    from.SendMessage("You are now listening to that party.");
                }
            }
        }
Example #3
0
        public static void EventSink_PlayerDeath(Mobile from, Mobile killer, Container cont)
        {
            Party p = Party.Get(from);

            if (p != null)
            {
                Mobile m = killer;

                if (m == from)
                {
                    p.SendPublicMessage(from, "I killed myself !!");
                }
                else if (m == null)
                {
                    p.SendPublicMessage(from, "I was killed !!");
                }
                else
                {
                    p.SendPublicMessage(from, string.Format("I was killed by {0} !!", m.Name));
                }
            }
        }
Example #4
0
        public static void EventSink_PlayerDeath(PlayerDeathEventArgs e)
        {
            Mobile from = e.Mobile;
            Party  p    = Party.Get(from);

            if (p != null)
            {
                Mobile m = from.LastKiller;

                if (m == from)
                {
                    p.SendPublicMessage(from, "I killed myself !!");
                }
                else if (m == null)
                {
                    p.SendPublicMessage(from, "I was killed !!");
                }
                else
                {
                    p.SendPublicMessage(from, String.Format("I was killed by {0} !!", m.Name));
                }
            }
        }
Example #5
0
        public override void OnAccept(Mobile from, Mobile sentLeader)
        {
            Mobile leader = from.Party as Mobile;

            from.Party = null;

            var pm = from as PlayerMobile;

            Party p = Party.Get(leader);

            if (leader == null || p == null || !p.Candidates.Contains(from))
            {
                from.SendLocalizedMessage(3000222);                   // No one has invited you to be in a party.
            }
            else if (pm != null && pm.PokerGame != null)
            {
                pm.SendMessage(61, "You may not join a party while participating in a poker game.");
            }
            else if ((p.Members.Count + p.Candidates.Count) <= Party.Capacity)
            {
                p.OnAccept(from);
            }
        }
Example #6
0
            protected override void OnTick()
            {
                Party p = Party.Get(m_Mobile);

                if (p == null)
                {
                    return;
                }

                m_Mobile.SendLocalizedMessage(1005437); // You have rejoined the party.
                m_Mobile.Send(new PartyMemberList(p));

                Packet message = Packet.Acquire(new MessageLocalizedAffix(Serial.MinusOne, -1, MessageType.Label, 0x3B2, 3, 1008087, "", AffixType.Prepend | AffixType.System, m_Mobile.Name, ""));
                Packet attrs   = Packet.Acquire(new MobileAttributesN(m_Mobile));

                foreach (PartyMemberInfo mi in p.Members)
                {
                    Mobile m = mi.Mobile;

                    if (m != m_Mobile)
                    {
                        m.Send(message);
                        m.Send(new MobileStatusCompact(m_Mobile.CanBeRenamedBy(m), m_Mobile));
                        m.Send(attrs);
                        m_Mobile.Send(new MobileStatusCompact(m.CanBeRenamedBy(m_Mobile), m));
                        m_Mobile.Send(new MobileAttributesN(m));

                        if (m_Mobile.NetState != null && m_Mobile.NetState.IsEnhancedClient)
                        {
                            Waypoints.Create(m_Mobile, m, WaypointType.PartyMember);
                        }
                    }
                }

                Packet.Release(message);
                Packet.Release(attrs);
            }
Example #7
0
        public static void Invite(Mobile from, Mobile target)
        {
            Party p = Party.Get(from);

            if (p == null)
            {
                from.Party = p = new Party(from);
            }

            if (!p.Candidates.Contains(target))
            {
                p.Candidates.Add(target);
            }

            //  : You are invited to join the party. Type /accept to join or /decline to decline the offer.
            target.Send(new MessageLocalizedAffix(Serial.MinusOne, -1, MessageType.Label, 0x3B2, 3, 1008089, "", AffixType.Prepend | AffixType.System, from.Name, ""));

            from.SendLocalizedMessage(1008090);               // You have invited them to join the party.

            target.Send(new PartyInvitation(from));
            target.Party = from;

            DeclineTimer.Start(target, from);
        }
Example #8
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 (from.InRange(data.Mobile, 15))
                    {
                        continue;
                    }

                    if (data.GlobalW && !p.Contains(data.Mobile))
                    {
                        data.Mobile.SendMessage(data.GlobalWC, "(Global) <World->Party> {0}: {1}", from.Name, text);
                    }
                }

                if (Data.LogChat)
                {
                    Logging.LogChat(String.Format(DateTime.Now + " <Party> {0}: {1}", from.Name, text));
                }
            }
            else
            {
                from.SendLocalizedMessage(3000211); // You are not in a party.
            }
        }