Exemplo n.º 1
0
        void c_ClientUnitConnectionInfo(object sender, ClientUnitConnectionInfoEventArgs e)
        {
            if (ClientUnitConnection != null)
            {
                ClientUnitConnection(sender, e);
            }

            Client    c = (Client)sender;
            UnitLogin u = e.UnitLoginDetails;

            int accountId = u.AccountID;

            if (accountManager.ConnectVerification(accountId))
            {
                byte[] bufferUniLoginState = PacketManager.SendUnitLoginState(LoginState.Success, u.CharacterID);
                c.Send(bufferUniLoginState);
            }
            else
            {
                Client[] otherPlayer = clients.Where(x => (x.AccountID == u.AccountID) && (x != c)).ToArray();
                for (int i = 0; i < otherPlayer.Length; i++)
                {
                    otherPlayer[i].Send(PacketManager.SendUnitLoginState(LoginState.OtherConnecting, 0));
                    otherPlayer[i].Dispose();
                }

                byte[] bufferUniLoginState = PacketManager.SendUnitLoginState(LoginState.Success, u.CharacterID);
                c.Send(bufferUniLoginState);
            }
        }
Exemplo n.º 2
0
        private void HandleRecvUnitLogin(Packet parsed)
        {
            UnitLogin u = PacketManager.RecvUnitLogin(parsed);

            this.accountId = u.AccountID;
            if (ClientUnitConnectionInfo != null)
            {
                ClientUnitConnectionInfo(this, new ClientUnitConnectionInfoEventArgs(u, parsed));
            }
        }
Exemplo n.º 3
0
        void c_ClientUnitConnectionInfo(object sender, ClientUnitConnectionInfoEventArgs e)
        {
            if (ClientUnitConnection != null)
            {
                ClientUnitConnection(sender, e);
            }

            Client    c = (Client)sender;
            UnitLogin u = e.UnitLoginDetails;

            int accountId = u.AccountID;

            byte[] bufferUniLoginState = PacketManager.SendUnitLoginState(LoginState.Success, u.CharacterID);
            c.Send(bufferUniLoginState);

            Character[] charList = characterManager.GetAllCharactersByAccountId(accountId);

            byte[] bufferCharacterList = PacketManager.SendCharacterList(charList);
            c.Send(bufferCharacterList);
        }
Exemplo n.º 4
0
 public ClientUnitConnectionInfoEventArgs(UnitLogin unitLoginDetails, Packet p)
 {
     this.unitlogin = unitLoginDetails;
 }