public static void SendPlayerIntoGame(int _fromClient, Packet _packet)
 {
     using (var context = ContextLayer.GetContext())
     {
         int _clientIdCheck = _packet.ReadInt();
         var _username      = _packet.ReadString();
         var _characterId   = _packet.ReadLong();
         //change to use token / other
         var user       = ContextLayer.GetUser(_username, context);
         var characters = PlayerCharacter.ToCharacterList(ContextLayer.GetUserCharacters(user.Id, context));
         Server.clients[_fromClient].SendIntoGame(_username, characters.FirstOrDefault(c => c.Id == _characterId));
     }
 }
        public static void WelcomeReceived(int _fromClient, Packet _packet)
        {
            int    _clientIdCheck   = _packet.ReadInt();
            bool   _newUser         = _packet.ReadBool();
            string _username        = _packet.ReadString();
            string _passwordAttempt = _packet.ReadString();

            try
            {
                if (!_newUser)
                {
                    using (var context = ContextLayer.GetContext())
                    {
                        if (!ContextLayer.UserCredentialsCorrect(_username, _passwordAttempt, context))
                        {
                            Console.WriteLine("Invalid User");
                            ServerSend.Alert(_clientIdCheck, "Username / password are invalid or User does not exist.");
                        }
                        else
                        {
                            var user = ContextLayer.GetUser(_username, context);
                            Console.WriteLine($"Client: {Server.clients[_fromClient].tcp.socket.Client.RemoteEndPoint} connected successfully and {_username} is now player {_fromClient}.");
                            if (_fromClient != _clientIdCheck)
                            {
                                Console.WriteLine($"Player \"{_username}\" (ID: {_fromClient}) has assumed the wrong client ID ({_clientIdCheck})!");
                            }
                            // TODO: send player into game
                            var characters = PlayerCharacter.ToCharacterList(ContextLayer.GetUserCharacters(user.Id, context));
                            ServerSend.LoginSuccess(_clientIdCheck, new UserSigninData
                            {
                                UserName   = user.Name,
                                Characters = characters
                            });
                            //Server.clients[_fromClient].SendIntoGame(_username);
                        }
                    }
                }
            }
            catch (Exception e)
            {
            }
        }