/// <summary> /// Sends a message to all clients on a certain map. /// </summary> public static void SendMapChat(HypercubeMap map, string message, sbyte messageType = 0, bool log = false) { var chat = new Message {PlayerId = messageType}; message = Text.CleanseString(message); if (log) ServerCore.Logger.Log(map.CWMap.MapName, message, LogType.Chat); message = EmoteReplace(message); if (message.Length > 0 && Text.StringMatches(message.Substring(message.Length - 1))) message += "."; var sending = SplitLines(message); foreach(var c in map.ClientsList) { foreach (var b in sending) { chat.Text = b; c.SendQueue.Enqueue(chat); } } }
/// <summary> /// Sends chat to an individual client /// </summary> public static void SendClientChat(NetworkClient client, string message, sbyte messageType = 0) { message = Text.CleanseString(message); message = EmoteReplace(message); if (!client.CS.CPEExtensions.ContainsKey("EmoteFix") && Text.StringMatches(message.Substring(message.Length - 1))) message += "."; var sending = SplitLines(message); var chat = new Message {PlayerId = messageType}; foreach (var b in sending) { chat.Text = b; client.SendQueue.Enqueue(chat); } }