public bool DoStep(NetworkClient networkClient, GameClient client)
        {
            DateTime now = DateTime.Now;
            ChatMessage[] outChatMessages = _outChatMessages.Where(cm => cm.MessageTime <= now ).ToArray();

            if (outChatMessages.Length > 0)
            {
                foreach (ChatMessage chatMessage in outChatMessages)
                {
                    _outChatMessages.Remove(chatMessage);

                    //1: From, 2: To, 3: Type, 4: Message
                    string message = Packet.BuildPacket(FromClient.CHAT_MESSAGE,
                        Chat.POST, client.Login, chatMessage.Sender, chatMessage.Type,
                        chatMessage.Message);
                    networkClient.SendChatData(message);

                    //Play notification for private message
                    _soundPlayer.Play();

                    //Out chat message
                    string logMessage = string.Format("[{0}] {1} [{2}] {3}",
                        client.Login,
                        chatMessage.Type == ChatMessageType.Pivate ? "private" : "to",
                        chatMessage.Sender, chatMessage.Message);
                    networkClient.OutChatMessage(logMessage);
                }
                return true;
            }

            return false;
        }
        public bool DoStep(NetworkClient networkClient, GameClient client)
        {
            int curTickCount = Environment.TickCount;

            //Just started
            if (_prewPingTime == 0)
            {
                _prewPingTime = curTickCount;
                return false;
            }

            if (curTickCount - _prewPingTime >= PING_DELAY_MS)
            {
                //Query params: 0: is a first time ping?, [1]: I1, [2]: ID2, [3]: ID1
                string ping = Packet.BuildPacket(FromClient.PING,
                    _firstTime,
                    client.AdditionalData[ObjectPropertyName.I1][0],
                    client.AdditionalData[ObjectPropertyName.ID2][0],
                    client.AdditionalData[ObjectPropertyName.ID1][0]);
                networkClient.SendData(ping);
                networkClient.SendChatData(ping);

                _firstTime = false;
                _prewPingTime = Environment.TickCount;
                return true;
            }

            return false;
        }
        public bool DoStep(NetworkClient networkClient, GameClient client)
        {
            bool chatStarted = false;
            networkClient.OutLogMessage("Starting chat...");

            //Get chat info
            string getInfo = Packet.BuildPacket(FromClient.CHAT_CTRL, Chat.START);
            networkClient.SendData(getInfo);

            //Start chat
            Packet chat = networkClient.InputQueue.Pop(FromServer.CHAT_CTRL);
            if (chat != null)
            {
                string chatServer = chat["@server"];
                string sessionId = (string)client.AdditionalData[ObjectPropertyName.SESSION_ID][0];
                chatStarted = networkClient.StartChat(chatServer, sessionId);
                if (chatStarted)
                {
                    //1: Session ID, 2: Login
                    string chatAuth = Packet.BuildPacket(FromClient.CHAT_CTRL, Chat.AUTH,
                        sessionId, client.Login);
                    networkClient.SendChatData(chatAuth);
                }
            }

            networkClient.OutLogMessage(!chatStarted
                ? "WARNING: chat wasn`t started"
                : "Chat was successfully started");

            return true;
        }