Пример #1
0
        public void ParsePacket(Packet p)
        {
            byte code = p.ReadByte();

            switch (code)
            {
            case 1:
            case 2:
                byte count = p.ReadByte();

                if (count <= 1)
                {
                    Leader  = 0;
                    Inviter = 0;

                    for (int i = 0; i < Members.Length; i++)
                    {
                        if (Members[i] == null || Members[i].Serial == 0)
                        {
                            break;
                        }

                        HealthBarGump gump = Engine.UI.GetControl <HealthBarGump>(Members[i].Serial);


                        if (gump != null)
                        {
                            if (code == 2)
                            {
                                Members[i].Serial = 0;
                            }

                            gump.Update();
                        }
                    }

                    Clear();
                    Engine.UI.GetControl <PartyGumpAdvanced>()?.Update();

                    break;
                }

                Clear();

                for (int i = 0; i < count; i++)
                {
                    Serial serial = p.ReadUInt();
                    Members[i] = new PartyMember(serial);

                    if (i == 0)
                    {
                        Leader = serial;
                    }


                    HealthBarGump gump = Engine.UI.GetControl <HealthBarGump>(serial);

                    if (gump != null)
                    {
                        GameActions.RequestMobileStatus(serial);
                        gump.Update();
                    }
                    else
                    {
                        if (serial == World.Player)
                        {
                        }
                    }
                }

                Engine.UI.GetControl <PartyGumpAdvanced>()?.Update();

                break;

            case 3:
            case 4:
                Serial ser  = p.ReadUInt();
                string name = p.ReadUnicode();

                for (int i = 0; i < Members.Length; i++)
                {
                    if (Members[i] == null)
                    {
                        break;
                    }

                    if (Members[i].Serial == ser)
                    {
                        Mobile m = Members[i].Mobile;

                        if (m != null)
                        {
                            Chat.HandleMessage(null, name, m.Name, Engine.Profile.Current.PartyMessageHue, MessageType.Party, 3);
                        }

                        break;
                    }
                }

                break;

            case 7:
                Inviter = p.ReadUInt();

                break;
            }
        }
Пример #2
0
        public void ParsePacket(Packet p)
        {
            byte code = p.ReadByte();

            bool add = false;

            switch (code)
            {
            case 1:
                add = true;
                goto case 2;

            case 2:
                byte count = p.ReadByte();

                if (count <= 1)
                {
                    Leader  = 0;
                    Inviter = 0;

                    for (int i = 0; i < PARTY_SIZE; i++)
                    {
                        if (Members[i] == null || Members[i].Serial == 0)
                        {
                            break;
                        }

                        HealthBarGump gump = Engine.UI.GetGump <HealthBarGump>(Members[i].Serial);


                        if (gump != null)
                        {
                            if (code == 2)
                            {
                                Members[i].Serial = 0;
                            }

                            gump.Update();
                        }
                    }

                    Clear();
                    Engine.UI.GetGump <PartyGumpAdvanced>()?.Update();

                    break;
                }

                Clear();

                if (!add)
                {
                    Engine.UI.GetGump <HealthBarGump>(p.ReadUInt())?.Update();
                }

                for (int i = 0; i < count; i++)
                {
                    Serial serial = p.ReadUInt();
                    Members[i] = new PartyMember(serial);

                    if (i == 0)
                    {
                        Leader = serial;
                    }

                    HealthBarGump gump = Engine.UI.GetGump <HealthBarGump>(serial);

                    if (gump != null)
                    {
                        GameActions.RequestMobileStatus(serial);
                        gump.Update();
                    }
                    else
                    {
                        if (serial == World.Player)
                        {
                        }
                    }
                }

                Engine.UI.GetGump <PartyGumpAdvanced>()?.Update();

                break;

            case 3:
            case 4:
                Serial ser  = p.ReadUInt();
                string name = p.ReadUnicode();

                for (int i = 0; i < PARTY_SIZE; i++)
                {
                    if (Members[i] != null && Members[i].Serial == ser)
                    {
                        Chat.HandleMessage(null, name, Members[i].Name, Engine.Profile.Current.PartyMessageHue, MessageType.Party, 3);

                        break;
                    }
                }

                break;

            case 7:
                Inviter = p.ReadUInt();

                if (Engine.Profile.Current.PartyInviteGump)
                {
                    Engine.UI.Add(new PartyInviteGump(Inviter));
                }
                break;
            }
        }