public static void ReplayGame(Blaze.Packet p, PlayerInfo pi, NetworkStream ns)
 {
     byte[] buff = Blaze.CreatePacket(p.Component, p.Command, 0, 0x1000, p.ID, new List <Blaze.Tdf>());
     ns.Write(buff, 0, buff.Length);
     ns.Flush();
     pi.game.GSTA = 130;
     pi.timeout.Restart();
     foreach (PlayerInfo peer in pi.game.players)
     {
         if (peer != null)
         {
             AsyncGameManager.NotifyGameStateChange(peer, p, pi, peer.ns);
         }
     }
 }
        public static void AdvanceGameState(Blaze.Packet p, PlayerInfo pi, NetworkStream ns)
        {
            List <Blaze.Tdf> input = Blaze.ReadPacketContent(p);

            pi.game.GSTA = (uint)((Blaze.TdfInteger)input[1]).Value;
            byte[] buff = Blaze.CreatePacket(p.Component, p.Command, 0, 0x1000, p.ID, new List <Blaze.Tdf>());
            ns.Write(buff, 0, buff.Length);
            ns.Flush();

            foreach (PlayerInfo peer in pi.game.players)
            {
                if (peer != null)
                {
                    AsyncGameManager.NotifyGameStateChange(peer, p, pi, peer.ns);
                }
            }
        }
        public static void CreateGame(Blaze.Packet p, PlayerInfo pi, NetworkStream ns)
        {
            pi.stat = 4;
            pi.slot = pi.game.getNextSlot();
            pi.game.setNextSlot((int)pi.userId);
            pi.game.id         = 1;
            pi.game.isRunning  = true;
            pi.game.GSTA       = 7;
            pi.game.players[0] = pi;

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

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

            AsyncGameManager.NotifyGameStateChange(pi, p, pi, ns);
            AsyncGameManager.NotifyServerGameSetup(pi, p, pi, ns);
        }