Exemple #1
0
        public async static void OnReceivedPacket21(Client Client, AriesPacket Packet)
        {
            string AvatarID           = Packet.ReadNullString(112);
            string AriesClientVersion = Packet.ReadNullString(80);
            string Email    = Packet.ReadNullString(40);
            string Authserv = Packet.ReadNullString(84);
            ushort Product  = Packet.ReadUInt16();

            Packet.ReadByte(); //Unknown.
            string ServiceIdent = Packet.ReadNullString(3);

            Packet.ReadUInt16(); //Unknown.
            uint AuthTicket = uint.Parse(Packet.ReadNullString((int)Packet.PacketSize - 331));

            Packet.ReadBytes(7); //Reserved.

            Console.WriteLine("AvatarID: " + "'" + AvatarID + "'");
            Console.WriteLine("AriesClientVersion: " + "'" + AriesClientVersion + "'");
            Console.WriteLine("Email: " + "'" + Email + "'");
            Console.WriteLine("Authserv: " + "'" + Authserv + "'");
            Console.WriteLine("ServiceIdent: " + "'" + ServiceIdent + "'");
            Console.WriteLine("AuthTicket: " + "'" + AuthTicket + "'");

            bool    SessionIDAcknowledged = false;
            Account PlayerAccount         = new Account();

            IEnumerable <Account> Accs = await DatabaseFacade.GetAccountsAsync();

            foreach (Account Acc in Accs)
            {
                //if (string.Equals(Acc.AuthTicket, AuthTicket, StringComparison.CurrentCultureIgnoreCase))
                if (Acc.AuthTicket == AuthTicket)
                {
                    SessionIDAcknowledged = true;
                    PlayerAccount         = Acc;

                    Console.WriteLine("Valid SessionID found!");
                }
            }

            Client.PlayerAccount = PlayerAccount;

            if (SessionIDAcknowledged)
            {
                await Client.SendData(
                    Client.StringPacketsTogether(new VoltronPacket[] { new HostOnlinePDU(),
                                                                       new UpdatePlayerPDU(AvatarID, PlayerAccount) }));

                //await Client.SendData(new HostOnlinePDU().ToArray());

                m_Logger.Info("Sent HostOnlinePDU: " + new HostOnlinePDU().ToHexString());
                m_Logger.Info("Sent UpdatePlayerPDU: " + new UpdatePlayerPDU(AvatarID, PlayerAccount).ToHexString());
            }
            else
            {
                await Client.SendData(new ServerByePDU().ToArray());
            }
        }
Exemple #2
0
        public static void OnReceivedClientOnlinePDU(Client Client, AriesPacket Packet)
        {
            Client.VersionInfo.m_majorVersion = Packet.ReadByte();
            Client.VersionInfo.m_minorVersion = Packet.ReadByte();
            Client.VersionInfo.m_pointVersion = Packet.ReadByte();
            Client.VersionInfo.m_artVersion   = Packet.ReadByte();

            Packet.ReadUInt32();                           //Unknown
            uint   Time             = Packet.ReadUInt32(); //A unix timestamp - time required.
            ushort NumberOfAttempts = Packet.ReadUInt16(); //Number of attempts to connect?

            uint LastExitCode    = Packet.ReadUInt32();
            byte LastFailureType = Packet.ReadByte();
            byte FailureCount    = Packet.ReadByte();
            byte IsRunning       = Packet.ReadByte();
            byte IsRelogging     = Packet.ReadByte();

            Packet.ReadByte(); //Unknown.

            Console.WriteLine("Client's version: " + Client.VersionInfo.m_minorVersion.ToString() + "." +
                              Client.VersionInfo.m_majorVersion.ToString());
            Console.WriteLine("Client's point version: " + Client.VersionInfo.m_pointVersion);
            Console.WriteLine("Client's art version: " + Client.VersionInfo.m_artVersion);
        }