Advertisement
Guest User

AuthServer_OnClientReceive

a guest
Dec 7th, 2019
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.62 KB | None | 0 0
  1. public static void AuthServer_OnClientReceive(byte[] buffer, int length, ClientWrapper arg3)
  2. {
  3. var player = arg3.Connector as Client.AuthClient;
  4.  
  5. player.Cryptographer.Decrypt(buffer, length);
  6. player.Queue.Enqueue(buffer, length);
  7. while (player.Queue.CanDequeue())
  8. {
  9. byte[] packet = player.Queue.Dequeue();
  10.  
  11. ushort len = BitConverter.ToUInt16(packet, 0);
  12. ushort id = BitConverter.ToUInt16(packet, 2);
  13.  
  14. if (len == 312)
  15. {
  16. player.Info = new ConquerMatrix.Network.AuthPackets.Authentication();
  17. player.Info.Deserialize(packet);
  18. player.Account = new AccountTable(player.Info.Username);
  19.  
  20. msvcrt.msvcrt.srand(player.PasswordSeed);
  21.  
  22. Forward Fw = new Forward();
  23.  
  24. if (player.Account.Password == player.Info.Password && player.Account.exists)
  25. Fw.Type = Forward.ForwardType.Ready;
  26. else
  27. Fw.Type = Forward.ForwardType.InvalidInfo;
  28. if (Fw.Type == Network.AuthPackets.Forward.ForwardType.Ready)
  29. {
  30. Fw.Identifier = player.Account.GenerateKey();
  31. Kernel.AwaitingPool[Fw.Identifier] = player.Account;
  32. Fw.IP = Program.GameIP;
  33. Fw.Port = Program.GamePort;
  34. }
  35. player.Send(Fw);
  36. }
  37. }
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement