Exemplo n.º 1
0
        public static async void HandleAuthContinuedSession(AuthContinuedSession authContinuedSession, NodeSession session)
        {
            var accountInfo = Manager.Redirect.GetAccountInfo(authContinuedSession.Key);

            // Delete redirect key
            Manager.Redirect.DeleteRedirectKey(authContinuedSession.Key);

            if (accountInfo != null)
            {
                var sha1 = new SHA1Managed();

                var emailBytes = Encoding.UTF8.GetBytes(accountInfo.Item1.Id + "#" + accountInfo.Item2.Index);
                var sessionKeyBytes = accountInfo.Item2.SessionKey.ToByteArray();
                var challengeBytes = BitConverter.GetBytes(session.Challenge);

                sha1.TransformBlock(emailBytes, 0, emailBytes.Length, emailBytes, 0);
                sha1.TransformBlock(sessionKeyBytes, 0, 40, sessionKeyBytes, 0);
                sha1.TransformFinalBlock(challengeBytes, 0, 4);

                if (sha1.Hash.Compare(authContinuedSession.Digest))
                {
                    session.State = SessionState.Authenticated;

                    session.Account = DB.Auth.Single<Account>(a => a.Id == accountInfo.Item2.AccountId);
                    session.GameAccount = accountInfo.Item2;
                    session.Player = new Player(DB.Character.Single<Character>(c => c.Guid == accountInfo.Item3), false);

                    session.Crypt = new Framework.Cryptography.WoW.WoWCrypt();
                    session.Crypt.Initialize(accountInfo.Item2.SessionKey.ToByteArray(), session.ClientSeed, session.ServerSeed);

                    // Resume on the new connection
                    await session.Send(new ResumeComms());

                    session.State = SessionState.InWorld;

                    return;
                }
            }

            session.Dispose();
        }
Exemplo n.º 2
0
 public static async void HandlerLogoutRequest(LogoutRequest logoutRequest, NodeSession session)
 {
     await session.Send(new LogoutResponse { Reason = 0, Instant = true });
 }
Exemplo n.º 3
0
 public static async void HandleLogoutRequest(LogoutRequest logoutRequest, NodeSession session)
 {
     await session.Send(new LogoutComplete());
 }