private async Task HandlePlayerAuthRequest(PlayerAuthRequest msg) { // Create response PlayerAuthResponse response = new PlayerAuthResponse(); response.AccountId = msg.AccountId; if (LoginService.Instance.VerifySession(msg.AccountId, msg.LoginAuthKey, msg.GameAuthKey)) { response.Result = 1; } else { response.Result = 0; } await SendPacketAsync(0x01, response); }
public async Task <bool> GetPlayerAuthedAsync(int accountId, int loginAuthKey, int gameAuthKey) { AuthRequest request = new AuthRequest(); if (_authRequests.TryAdd(accountId, request)) { PlayerAuthRequest msg = new PlayerAuthRequest() { AccountId = accountId, LoginAuthKey = loginAuthKey, GameAuthKey = gameAuthKey, Server = ServerId }; await SendPacketAsync(0x01, msg); await request.Signal.WaitAsync(); } return(request.Success); }