Exemplo n.º 1
0
        /// <summary>
        /// Sends a formattable and broadcast-like message with custom styling to a
        /// specific session. Chainable, thread-safe and splits messages over 255 bytes
        /// in length automatically.
        /// </summary>
        /// <param name="session">
        /// Target session, or use 0 to broadcast to everybody. Alternatively, use
        /// <see cref="ConsoleBroadcast(ChatEffect, Color, string, string)"/>
        /// </param>
        /// <param name="name">
        /// Name to use for message, or blank string for a standalone message
        /// </param>
        /// <param name="effects">Effects to use on this message</param>
        /// <param name="color">Color to use on this message</param>
        /// <param name="message">Message to send</param>
        public Instance ConsoleMessage(int session, ChatEffect effects, Color color, string name, string message, params object[] parts)
        {
            var formatted = string.Format(message, parts);
            var chunks    = Unicode.ChunkByByteLimit(formatted);

            lock (Mutex)
                foreach (var chunk in chunks)
                {
                    Functions.Call(() => Functions.vp_console_message(Pointer, session, name, chunk, (int)effects, color.R, color.G, color.B));
                }

            return(this);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Sends a formatted chat message to current world. Chainable, thread-safe and
        /// splits messages over 255 bytes in length automatically.
        /// </summary>
        /// <seealso cref="string.Format(string, Object)"/>
        public Instance Say(string message, params object[] parts)
        {
            var formatted = string.Format(message, parts);
            var chunks    = Unicode.ChunkByByteLimit(formatted);

            lock (Mutex)
                foreach (var chunk in chunks)
                {
                    Functions.Call(() => Functions.vp_say(Pointer, chunk));
                }

            return(this);
        }