/// <summary> Broadcasts a message, prefixing wrapped lines. </summary> /// <param name="source"> List of players who will receive the message. </param> /// <param name="prefix"> Prefix to prepend to prepend to each line after the 1st, /// if any line-wrapping occurs. Does NOT get prepended to first line. </param> /// <param name="message"> String/message to send. </param> /// <returns> Number of players who received the message. </returns> public static int MessagePrefixed([NotNull] this IEnumerable <Player> source, [NotNull] string prefix, [NotNull] string message, [Optional] MessageType?type) { if (source == null) { throw new ArgumentNullException("source"); } if (prefix == null) { throw new ArgumentNullException("prefix"); } if (message == null) { throw new ArgumentNullException("message"); } if (type == null) { type = 0; } int i = 0; if (!MessageTypeUtil.Enabled() || message.Length >= 64) { type = MessageType.Chat; } foreach (Player player in source) { foreach (Packet packet in LineWrapper.WrapPrefixed(prefix, message, player.SupportsFullCP437, type.Value)) { player.Send(packet); i++; } } return(i); }