Ejemplo n.º 1
0
        private static void UserInGame(Connection pConn, byte[] data)
        {
            UInt16 realL = BitConverter.ToUInt16(data, 0);

            if (Program.DEBUG_Game_Recv)
            {
                Output.WriteLine("GameServerRecv::UserInGame");
            }
            if (pConn.client.Status != Client.STATUS.Login)
            {
                if (Program.DEBUG_Game_Recv)
                {
                    Output.WriteLine("GameServerRecv::UserInGame - STATUS != LOGIN, close connection");
                }
                pConn.Close();
                return;
            }
            int  pUID   = BitConverter.ToInt32(data, Program.receivePrefixLength + 1);
            bool status = InGameUsers.Add(pUID, 0, pConn.TokenID);

            Output.WriteLine("RECV new user in game UID: " + pUID.ToString() + " STATUS: " + status.ToString());
        }
Ejemplo n.º 2
0
        private static void UserList(Connection pConn, byte[] data)
        {
            byte[] tmp = new byte[2];
            UInt16 realL;

            tmp[0] = data[1];
            tmp[1] = data[4];
            realL  = BitConverter.ToUInt16(tmp, 0);
            if (Program.DEBUG_Game_Recv)
            {
                Output.WriteLine("GameServerRecv::UserList");
            }
            if (pConn.client.Status != Client.STATUS.Login)
            {
                if (Program.DEBUG_Game_Recv)
                {
                    Output.WriteLine("GameServerRecv::UserList - STATUS != LOGIN, close connection");
                }
                pConn.Close();
                return;
            }
            int offset = Program.receivePrefixLength + 1;//+1 cuz we use first data byte as extended packet type

            while (true)
            {
                if (offset + 4 <= realL)
                {
                    int  pUID   = BitConverter.ToInt32(data, offset);
                    bool status = InGameUsers.Add(pUID, 0, pConn.TokenID);
                    Output.WriteLine("RECV user in game UID: " + pUID.ToString() + " STATUS: " + status.ToString());
                }
                else
                {
                    break;
                }
                offset = offset + 4;
            }
        }