示例#1
0
        private static void GMSHandlePacket(Socket s, byte[] data)
        {
            try
            {
                if (!s.Connected)
                {
                    return;
                }

                ReadPacket packet = new ReadPacket(data, XCRYPT.GameManagerServerPrivKey);
                if (!packet.IsInitialized())
                {
                    return;
                }

                Header packet_header = packet.GetHeader();
                byte[] packet_data   = packet.GetBody();


                byte packet_type = packet.GetPacketType();
                Console.WriteLine("Received packet: " + packet_type);

                switch (packet_type)
                {
                case 0:
                    Console.WriteLine("[*] Listando personagens ...");
                    SendData.SendListCharacters(s, GameManagerServer.id_idx);
                    break;

                case 2:     // my characters data
                    Console.WriteLine("[*] Personagens recebidos!");
                    ParseCharacters(packet_data);
                    break;

                case 7:     // connection aproved
                    Console.WriteLine("[*] Você logou no servidor com sucesso!");
                    break;

                case 6:     // select char
                    Console.WriteLine("Received: 6");
                    ParseEnterCharacter(packet_data);
                    break;

                case 9:     // gms info
                    Console.WriteLine("[*] Received gms info");
                    ParseGMSInfo(packet_data);
                    SendData.SelectEnterGameCharacter(s, GameManagerServer.id_idx, GameManagerServer.charactername, GameManagerServer.hero_order);
                    break;
                }
            }
            catch
            {
                return;
            }
        }
示例#2
0
        private static void LGSHandlePacket(Socket s, byte[] data)
        {
            try
            {
                if (!s.Connected)
                {
                    return;
                }

                ReadPacket packet = new ReadPacket(data, XCRYPT.LoginServerPrivkey);
                if (!packet.IsInitialized())
                {
                    return;
                }

                Header packet_header = packet.GetHeader();
                byte[] packet_data   = packet.GetBody();


                byte packet_type = packet.GetPacketType();


                switch (packet_type)
                {
                case 11:     // version okay
                    Console.WriteLine("LGS Version OK!");
                    SendData.SendLogin(s, LoginServer.Usuario, LoginServer.Password);
                    break;

                case 23:     // user and password incorrects
                    Console.WriteLine("Usuario e senhadas incorretos!");
                    break;

                case 24:     // password incorrect
                    Console.WriteLine("Senha incorreta");
                    break;

                case 22:     // login efetuado com sucesso, go go gms haha
                    Console.WriteLine("Login realizado com sucesso!");
                    ParseLoginResponse(s, packet_data);

                    byte[] EnterGMSPacket = { 0x02, 0x00, 0x2a, 0xa1, 0xd6 };
                    LGSSend(s, EnterGMSPacket);
                    //SendData.EnterServer(s);
                    break;

                case 28:     // token lgs para autenticar no gms
                    Console.WriteLine("Token GMS recebido!");
                    ParseTokenGMS(s, packet_data);

                    LoginServer.s.Disconnect(false);
                    LoginServer.s.Dispose();


                    GameManagerServer.Conn.GameManagerServer gms = new GameManagerServer.Conn.GameManagerServer(LoginServer.GMS_IP, LoginServer.GMS_PORT, LoginServer.id_idx, LoginServer.GMS_TOKEN, LoginServer.Usuario);


                    break;
                }
            }
            catch
            {
                return;
            }
        }