Exemplo n.º 1
0
        public void Parse(Shared.PC sender, Packet packet)
        {
            using (var ms = new MemoryStream(packet.Data))
            {
                using (var br = new BinaryReader(ms))
                {
                    Aid              = br.ReadInt32();
                    Authcode         = br.ReadInt32();
                    UserLevel        = br.ReadInt32();
                    Clienttype       = br.ReadInt16();
                    Sex              = br.ReadByte();
                    ((PC)sender).Aid = Aid;
                }
            }

            Logging.Debug(string.Format("Ch_Enter {{\n\tAID: {0},\n\tAuthCode: {1},\n\tUserLevel: {2},\n\tClienttype: {3},\n\tSex: {4}\n}}", Aid, Authcode, UserLevel, Clienttype, Sex));
            Worker.Singleton.Clients.Add((PC)sender);

            var ipPoint = (IPEndPoint)sender.Socket.RemoteEndPoint;

            using (var account = new Account.AccountClient())
            {
                var ah_logon_exist = account.Ha_Logon(Aid, Authcode, Sex, Worker.Singleton.Clients.Count(), Config.Sid, Helper.IpToInt(ipPoint.Address));
                if (ah_logon_exist != null)
                {
                    sender.Id    = ah_logon_exist.Id;
                    sender.Email = ah_logon_exist.Email;
                    sender.PacketQueue.Enqueue(Hc_Aid.CreateBuilder().SetAid(Aid).Build());
                    sender.PacketQueue.Enqueue(Hc_Accept_Enter.CreateBuilder().SetAid(Aid).Build());
                    sender.PacketQueue.Enqueue(Hc_Block_Character.CreateBuilder().Build());
                    sender.PacketQueue.Enqueue(Hc_Second_Password_Login.CreateBuilder().SetAid(Aid).SetSeed(0).SetResult(0).Build());
                }
            }
        }
Exemplo n.º 2
0
 public Builder MergeFrom(Hc_Accept_Enter other)
 {
     if (other == DefaultInstance)
     {
         return(this);
     }
     PrepareBuilder();
     return(this);
 }
Exemplo n.º 3
0
 private Hc_Accept_Enter PrepareBuilder()
 {
     if (resultIsReadOnly)
     {
         Hc_Accept_Enter original = result;
         result           = new Hc_Accept_Enter();
         resultIsReadOnly = false;
         MergeFrom(original);
     }
     return(result);
 }