/// <summary>
        /// Sends a message to the game client. This message will appear in the game chat window.
        /// </summary>
        /// <param name="message">A string containing the message to be sent.</param>
        public static void SendMessage(Socket sender, MessageType type, string message)
        {
            MessagePacket messagePacket = new MessagePacket
            {
                MessageType = type,
                TargetId    = User.Instance.SessionId,
                Message     = message,
                Opcode      = (ushort)ServerOpcode.ChatMessage
            };

            Log.Instance.Chat("[" + World.Instance.ServerName + "] " + message); //show sent message on launcher output window (TODO: make it optional?)

            Packet packet = new Packet(new SubPacket(messagePacket)
            {
                SourceId = User.Instance.SessionId, TargetId = User.Instance.SessionId
            });

            sender.Send(packet.ToBytes());
        }
Ejemplo n.º 2
0
        public Packet(MessagePacket messagePacket)
        {
            SubPacket subPacket = new SubPacket(messagePacket);

            AddSubPacket(subPacket);
        }