예제 #1
0
        public void SendChat(string message)
        {
            List <string> lines = LineWrapper.Wordwrap(message, hasEmoteFix);

            // Need to combine chat line packets into one Send call, so that
            // multi-line messages from multiple threads don't interleave
            for (int i = 0; i < lines.Count;)
            {
                // Send buffer max size is 4096 bytes
                // Divide by 66 (size of chat packet) gives ~62 lines
                int    count = Math.Min(62, lines.Count - i);
                byte[] data  = new byte[count * 66];

                for (int j = 0; j < count; i++, j++)
                {
                    Packet.WriteMessage(lines[i], 0, player.hasCP437, data, j * 66);
                }
                Send(data);
            }
        }