public static void LoginPersona(Blaze.Packet p, PlayerInfo pi, NetworkStream ns)
        {
            uint             t    = Blaze.GetUnixTimeStamp();
            List <Blaze.Tdf> SESS = new List <Blaze.Tdf>();

            SESS.Add(Blaze.TdfInteger.Create("BUID", pi.userId));
            SESS.Add(Blaze.TdfInteger.Create("FRST", 0));
            SESS.Add(Blaze.TdfString.Create("KEY\0", "some_client_key"));
            SESS.Add(Blaze.TdfInteger.Create("LLOG", t));
            SESS.Add(Blaze.TdfString.Create("MAIL", ""));
            List <Blaze.Tdf> PDTL = new List <Blaze.Tdf>();

            PDTL.Add(Blaze.TdfString.Create("DSNM", pi.profile.name));
            PDTL.Add(Blaze.TdfInteger.Create("LAST", t));
            PDTL.Add(Blaze.TdfInteger.Create("PID\0", pi.userId));
            PDTL.Add(Blaze.TdfInteger.Create("STAS", 0));
            PDTL.Add(Blaze.TdfInteger.Create("XREF", 0));
            PDTL.Add(Blaze.TdfInteger.Create("XTYP", 0));
            SESS.Add(Blaze.TdfStruct.Create("PDTL", PDTL));
            SESS.Add(Blaze.TdfInteger.Create("UID\0", pi.userId));
            byte[] buff = Blaze.CreatePacket(p.Component, p.Command, 0, 0x1000, p.ID, SESS);
            ns.Write(buff, 0, buff.Length);
            ns.Flush();

            AsyncUserSessions.NotifyUserAdded(pi, p, pi, ns);
            AsyncUserSessions.NotifyUserStatus(pi, p, pi, ns);
        }
        public static void JoinGame(Blaze.Packet p, PlayerInfo pi, NetworkStream ns)
        {
            PlayerInfo srv = null;

            foreach (PlayerInfo info in BlazeServer.allClients)
            {
                if (info.isServer)
                {
                    srv = info;
                    break;
                }
            }
            if (srv == null)
            {
                BlazeServer.Log("[CLNT] #" + pi.userId + " : cant find game to join!", System.Drawing.Color.Red);
                return;
            }
            pi.game = srv.game;
            pi.slot = srv.game.getNextSlot();
            BlazeServer.Log("[CLNT] #" + pi.userId + " : assigned Slot Id " + pi.slot, System.Drawing.Color.Blue);
            if (pi.slot == 255)
            {
                BlazeServer.Log("[CLNT] #" + pi.userId + " : server full!", System.Drawing.Color.Red);
                return;
            }
            srv.game.setNextSlot((int)pi.userId);
            srv.game.players[pi.slot] = pi;

            List <Blaze.Tdf> result = new List <Blaze.Tdf>();

            result.Add(Blaze.TdfInteger.Create("GID\0", srv.game.id));
            result.Add(Blaze.TdfInteger.Create("JGS\0", 0));
            byte[] buff = Blaze.CreatePacket(p.Component, p.Command, 0, 0x1000, p.ID, result);
            ns.Write(buff, 0, buff.Length);
            ns.Flush();

            pi.stat = 2;

            AsyncUserSessions.NotifyUserAdded(pi, p, pi, ns);
            AsyncUserSessions.NotifyUserStatus(pi, p, pi, ns);
            AsyncGameManager.NotifyClientGameSetup(pi, p, pi, srv, ns);

            AsyncUserSessions.NotifyUserAdded(srv, p, pi, srv.ns);
            AsyncUserSessions.NotifyUserStatus(srv, p, pi, srv.ns);
            AsyncUserSessions.UserSessionExtendedDataUpdateNotification(srv, p, pi, srv.ns);
            AsyncGameManager.NotifyPlayerJoining(srv, p, pi, srv.ns);
        }