Exemplo n.º 1
0
        private unsafe void Process_AuthAccountExPacket(LoginPlayer client, AccountExPacket packet)
        {
            var account = Database.ServerDatabase.Context.Accounts.GetByName(packet.Account);

            AuthResponsePacket reply = AuthResponsePacket.Create();

            if (account == null)
            {
                reply.Data1 = Constants.RESPONSE_INVALID;
            }
            else if (account.Permission == Enum.PlayerPermission.Banned)
            {
                reply.Data1 = Constants.RESPONSE_BANNED;
            }
            else if (account.Password.Equals(packet.Password))
            {
                client.Account       = new Account(account);
                client.Account.Token = (uint)LoginCounter.Counter;
                client.Account.AllowLogin();
                reply.Data1      = Constants.RESPONSE_VALID;
                reply.ServerPort = Constants.GAME_PORT;
                reply.Info       = Constants.GAME_IP;
                reply.AccountId  = account.Token;
                Console.WriteLine("Client {0} Connecting to server {1}", packet.Account, packet.Server);
            }
            client.Send(reply);
        }
Exemplo n.º 2
0
        private void Process_AuthMacAddressPacket(LoginPlayer client, MacAddressPacket packet)
        {
            ConnectAuthPacket msg;

            if (ConnectAuthPacket.Create(packet.AccountId, 20, "version.dat", out msg))
            {
                client.Send(msg);
            }
        }
Exemplo n.º 3
0
        public unsafe void Process(LoginPlayer client, byte *packet, byte[] safePacket, ushort type)
        {
            switch (type)
            {
            case 1051: Process_AuthAccountExPacket(client, packet); break;

            // case 1100: Process_AuthMacAddressPacket(client, packet); break;
            default:
            {
                // Console.WriteLine("Unknown packet type: " + type);
                client.Socket.Disconnect();
                break;
            }
            }
        }
Exemplo n.º 4
0
        private unsafe void Auth_OnConnect(NetworkClient client)
        {
            var user = new LoginPlayer(client);

            client.Owner = user;
        }