public void ParsePacket(ref StackDataReader p)
        {
            byte code = p.ReadUInt8();

            bool add = false;

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

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

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

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

                        BaseHealthBarGump gump = UIManager.GetGump <BaseHealthBarGump>(Members[i].Serial);


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

                            gump.RequestUpdateContents();
                        }
                    }

                    Clear();

                    UIManager.GetGump <PartyGump>()?.RequestUpdateContents();

                    break;
                }

                Clear();

                uint to_remove = 0xFFFF_FFFF;

                if (!add)
                {
                    to_remove = p.ReadUInt32BE();

                    UIManager.GetGump <BaseHealthBarGump>(to_remove)?.RequestUpdateContents();
                }

                bool remove_all = !add && to_remove == World.Player;
                int  done       = 0;

                for (int i = 0; i < count; i++)
                {
                    uint serial = p.ReadUInt32BE();
                    bool remove = !add && serial == to_remove;

                    if (remove && serial == to_remove && i == 0)
                    {
                        remove_all = true;
                    }

                    if (!remove && !remove_all)
                    {
                        if (!Contains(serial))
                        {
                            Members[i] = new PartyMember(serial);
                        }

                        done++;
                    }

                    if (i == 0 && !remove && !remove_all)
                    {
                        Leader = serial;
                    }

                    BaseHealthBarGump gump = UIManager.GetGump <BaseHealthBarGump>(serial);

                    if (gump != null)
                    {
                        gump.RequestUpdateContents();
                    }
                    else
                    {
                        if (serial == World.Player)
                        {
                        }
                    }
                }

                if (done <= 1 && !add)
                {
                    for (int i = 0; i < PARTY_SIZE; i++)
                    {
                        if (Members[i] != null && SerialHelper.IsValid(Members[i].Serial))
                        {
                            uint serial = Members[i].Serial;

                            Members[i] = null;

                            UIManager.GetGump <BaseHealthBarGump>(serial)?.RequestUpdateContents();
                        }
                    }

                    Clear();
                }


                UIManager.GetGump <PartyGump>()?.RequestUpdateContents();

                break;

            case 3:
            case 4:
                uint   ser  = p.ReadUInt32BE();
                string name = p.ReadUnicodeBE();

                for (int i = 0; i < PARTY_SIZE; i++)
                {
                    if (Members[i] != null && Members[i].Serial == ser)
                    {
                        MessageManager.HandleMessage
                        (
                            null,
                            name,
                            Members[i].Name,
                            ProfileManager.CurrentProfile.PartyMessageHue,
                            MessageType.Party,
                            3,
                            TextType.GUILD_ALLY
                        );

                        break;
                    }
                }

                break;

            case 7:
                Inviter = p.ReadUInt32BE();

                if (ProfileManager.CurrentProfile.PartyInviteGump)
                {
                    UIManager.Add(new PartyInviteGump(Inviter));
                }

                break;
            }
        }
        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;
                        }

                        BaseHealthBarGump gump = UIManager.GetGump <BaseHealthBarGump>(Members[i].Serial);


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

                            gump.Update();
                        }
                    }

                    Clear();
                    UIManager.GetGump <PartyGump>()?.Update();

                    break;
                }

                Clear();

                if (!add)
                {
                    UIManager.GetGump <BaseHealthBarGump>(p.ReadUInt())?.Update();
                }

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

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

                    BaseHealthBarGump gump = UIManager.GetGump <BaseHealthBarGump>(serial);

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

                UIManager.GetGump <PartyGump>()?.Update();

                break;

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

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

                        break;
                    }
                }

                break;

            case 7:
                Inviter = p.ReadUInt();

                if (ProfileManager.Current.PartyInviteGump)
                {
                    UIManager.Add(new PartyInviteGump(Inviter));
                }
                break;
            }
        }