Exemplo n.º 1
0
        public override async Task DoWork(Socket client)
        {
            var worker = new NodeSession(client);

            worker.Id = ++Manager.Session.LastSessionId;

            if (Manager.Session.Add(worker.Id, worker))
                await Task.Factory.StartNew(Manager.Session.Sessions[worker.Id].Accept);
        }
Exemplo n.º 2
0
        public override async Task DoWork(Socket client)
        {
            var worker = new NodeSession(client);

            worker.Id = ++Manager.Session.LastSessionId;

            if (Manager.Session.Add(worker.Id, worker))
            {
                await Task.Factory.StartNew(Manager.Session.Sessions[worker.Id].Accept);
            }
        }
Exemplo n.º 3
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.º 4
0
 public static async void HandlerLogoutRequest(LogoutRequest logoutRequest, NodeSession session)
 {
     await session.Send(new LogoutResponse { Reason = 0, Instant = true });
 }
Exemplo n.º 5
0
 public static void HandlerQueuedMessagesEnd(QueuedMessagesEnd queuedMessagedEnd, NodeSession session)
 {
     //not implemented 
 }
Exemplo n.º 6
0
 public static void HandlerRequestCemeteryList(RequestCemeteryList requestCemeteryList, NodeSession session)
 {
     // not implemented
     //await session.Send(new RequestCemeteryListResponse { IsGossipTriggered = false, Count = 0 } );
 }
Exemplo n.º 7
0
 public static void HandlerViolenceLevel(ViolenceLevel violenceLevel, NodeSession session)
 {
     // not implemented
 }
Exemplo n.º 8
0
 public static async void HandleLogoutRequest(LogoutRequest logoutRequest, NodeSession session)
 {
     await session.Send(new LogoutComplete());
 }