public void PlayerShowMailPopUp(GPlayer PL)
        {
            var _db = new PangyaEntities();
            PangyaBinaryWriter Reply;

            Reply = new PangyaBinaryWriter();

            var QueryList = _db.ProcGetMail((int)PL.GetUID, 1, 5, 1).ToList();

            Reply.Write(new byte[] { 0x10, 0x02 });
            Reply.Write(0);
            Reply.Write(QueryList.Count);//count
            foreach (var mail in QueryList)
            {
                var type = Convert.ToUInt32(mail.SETTYPEID > 0 ? mail.SETTYPEID : mail.TYPEID);

                Reply.WriteInt32(mail.Mail_Index);      //Mail_Index
                Reply.WriteStr(mail.Sender, 10);        //Sender
                Reply.WriteZero(123);
                Reply.Write(mail.Mail_Item_Count ?? 0); //Mail_Total COunt
                Reply.Write(uint.MaxValue);             //FF FF FF FF
                Reply.WriteUInt32(type);                //typeID
                Reply.Write((byte)0);                   //time
                Reply.WriteInt32(mail.QTY ?? 0);        //quantidade
                Reply.WriteZero(20);
                Reply.WriteUInt32(uint.MaxValue);       //FF FF FF FF
                Reply.WriteUInt32(0);
                Reply.WriteStr(IsUCCNull(mail.UCC_UNIQUE), 14);
            }
            PL.SendResponse(Reply.GetBytes());
        }
        public void PlayerGetMailList(GPlayer PL, Packet packet, bool IsDel = false)
        {
            var _db = new PangyaEntities();
            PangyaBinaryWriter Reply;


            if (!packet.ReadInt32(out int PageSelect))
            {
                return;
            }
            Reply = new PangyaBinaryWriter();


            var QueryList = _db.ProcGetMail((int)PL.GetUID, PageSelect, 20, 2).ToList();

            try
            {
                if (IsDel)
                {
                    Reply.Write(new byte[] { 0x15, 0x02 });
                }
                else
                {
                    Reply.Write(new byte[] { 0x11, 0x02 });
                }
                Reply.Write(0);
                Reply.Write(PageSelect);//count
                if (QueryList.Count > 1)
                {
                    Reply.Write(QueryList.FirstOrDefault().PAGE_TOTAL ?? 0);
                }
                else
                {
                    Reply.Write(1);
                }
                Reply.Write(QueryList.Count);
                foreach (var mail in QueryList)
                {
                    var type = Convert.ToUInt32(mail.SETTYPEID > 0 ? mail.SETTYPEID : mail.TYPEID);
                    Reply.Write(mail.Mail_Index);                   //Mail_Index
                    Reply.WriteStr(mail.Sender, 16);                //Sender
                    Reply.WriteZero(116);
                    Reply.Write((byte)mail.IsRead);                 //)
                    Reply.Write(mail.Mail_Item_Count ?? 0);         //Mail_Total COunt
                    Reply.Write(4294967295);
                    Reply.Write(type);                              //typeID
                    Reply.Write(Convert.ToByte(mail.IsTimer ?? 0)); //time
                    Reply.Write(mail.QTY ?? 0);
                    Reply.Write(Convert.ToUInt32(mail.DAY ?? 0));
                    Reply.WriteZero(16);
                    Reply.Write(4294967295);
                    Reply.Write(0);
                    Reply.WriteStr(IsUCCNull(mail.UCC_UNIQUE), 14);
                }
                PL.SendResponse(Reply.GetBytes());
            }
            catch
            {
                PL.Close();
            }
        }