コード例 #1
0
        public void userlist(User user)
        {
            PacketManager Write = new PacketManager();

            Write.OP(19);
            Write.Int(Ultilize.LobbyListaDePlayers.Count);
            for (int a = 0; a < Ultilize.LobbyListaDePlayers.Count; a++)
            {
                User temp = Ultilize.LobbyListaDePlayers[a];
                Write.Int(temp.pInfo.userid);
                Write.UStr(temp.pInfo.usuario);
                Write.Byte(11);
                Write.Byte(0);
            }
            int buffersize = Write.ack.Length - 7;

            byte[] getComprimir = new byte[0];
            Array.Resize(ref getComprimir, Write.ack.Length - 7);
            Array.Copy(Write.ack, 7, getComprimir, 0, Write.ack.Length - 7);

            byte[] temp1 = GCNet.CoreLib.ZLib.CompressData(getComprimir);

            PacketManager Write2 = new PacketManager();

            Write2.OP(19);
            Write2.Hex("00 00 00 00 00 00 00 00 00 00 00 01");
            Write2.Int(temp1.Length + 4);
            Write2.Byte(1);
            Write2.Bytes(BitConverter.GetBytes(buffersize));
            Write2.Hex(BitConverter.ToString(temp1).Replace("-", " "));

            user.Send(Write2.ack);
        }
コード例 #2
0
        public void Salas(User user, Readers ler)
        {
            byte Tipo = ler.Byte();

            int           Numero = 0;
            PacketManager Write  = new PacketManager();

            foreach (Sala Sala in Ultilize.ListaDeSalas)
            {
                if (Tipo == 1)
                {
                    if (Sala.jogando == true || Sala.slotsAbertos() == 0)
                    {
                        continue;
                    }
                }
                Numero++;
            }
            Write.OP(17);
            Write.Int(Numero);
            foreach (Sala Sala in Ultilize.ListaDeSalas)
            {
                Write.Short(Sala.SalaID);
                Write.UStr(Sala.SalaNome);
                if (Sala.SalaSenha.Length > 0)
                {
                    Write.Byte(0);
                }
                else
                {
                    Write.Byte(1);
                }
                Write.Byte(0);
                Write.UStr(Sala.SalaSenha);
                Write.Short((short)(Sala.PlayersEmSala() + Sala.slotsAbertos()));
                Write.Short((short)Sala.PlayersEmSala());
                if (Sala.jogando == true)
                {
                    Write.Byte(1);
                }
                else
                {
                    Write.Byte(0);
                }
                Write.Hex("FC 7B 96 8B 0B 02 00 00 00 07 22 FC 68 7F 00 00 00 03 00 00 00 00 00 00 00 01");
                Write.UStr(Sala.ObterSessao().pInfo.nickname);
                Write.Hex("0B 00 00 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 04 5A 00 5A 00 00 00 00 00 00 00 00 00 00 00 00 07 FF");
            }
            int buffersize = Write.ack.Length - 7;

            byte[] getComprimir = new byte[0];
            Array.Resize(ref getComprimir, Write.ack.Length - 7);
            Array.Copy(Write.ack, 7, getComprimir, 0, Write.ack.Length - 7);

            byte[] temp1 = GCNet.CoreLib.ZLib.CompressData(getComprimir);

            PacketManager Write2 = new PacketManager();

            Write2.OP(17);
            Write2.Hex("00 00 00 00 00 00 00 00 00 00 00 01");
            Write2.Int(temp1.Length + 4);
            Write2.Byte(1);
            Write2.Bytes(BitConverter.GetBytes(buffersize));
            Write2.Hex(BitConverter.ToString(temp1).Replace("-", " "));

            user.Send(Write2.ack);
        }