| | |
| | | return; |
| | | } |
| | | |
| | | public static uint toPlayer = 0; |
| | | public static string toPlayerName = string.Empty; |
| | | public static int toPlayerLevel = 0; |
| | | public void VerifyChat(string content, ChatInfoType channelType, Action<bool, string> callback) |
| | | { |
| | | int channel = 0; |
| | | var chatCenter = ChatCenter.Instance; |
| | | if (chatCenter.IsChatBanned || chatCenter.IsClientBan(channelType)) |
| | | { |
| | | if (!(IsFairyFeast(channelType) || IsSystemChat(content))) |
| | | { |
| | | return; |
| | | } |
| | | } |
| | | |
| | | if (!GetChannel(channelType, out channel)) |
| | | { |
| | | return; |
| | | } |
| | | if (callback != null) |
| | | { |
| | | callback(true, content); |
| | | callback = null; |
| | | } |
| | | |
| | | } |
| | | |
| | | Dictionary<long, List<string>> transferContents = new Dictionary<long, List<string>>(); |
| | | Dictionary<long, List<int>> splitContents = new Dictionary<long, List<int>>(); |
| | | |
| | |
| | | AddMathcs(WordAnalysis.Color_Start_Regex.Matches(content)); |
| | | AddMathcs(WordAnalysis.Color_End_Regex.Matches(content)); |
| | | AddMathcs(ImgAnalysis.FaceRegex.Matches(content)); |
| | | AddMathcs(ChatManager.InviteRegex.Matches(content)); |
| | | AddMathcs(WordAnalysis.Size_Start_Regex.Matches(content)); |
| | | AddMathcs(WordAnalysis.Size_End_Regex.Matches(content)); |
| | | AddMathcs(WordAnalysis.Space_Regex.Matches(content)); |
| | | AddMathcs(ChatManager.KillRegex.Matches(content)); |
| | | AddMathcs(ChatCenter.s_VoiceRegex.Matches(content)); |
| | | matchs.Sort((x, y) => |
| | | { |
| | | return x.index.CompareTo(y.index); |
| | |
| | | content = WordAnalysis.Color_Start_Regex.Replace(content, string.Empty); |
| | | content = WordAnalysis.Color_End_Regex.Replace(content, string.Empty); |
| | | content = ImgAnalysis.FaceRegex.Replace(content, string.Empty); |
| | | content = ChatManager.InviteRegex.Replace(content, string.Empty); |
| | | content = WordAnalysis.Size_Start_Regex.Replace(content, string.Empty); |
| | | content = WordAnalysis.Size_End_Regex.Replace(content, string.Empty); |
| | | content = WordAnalysis.Space_Regex.Replace(content, string.Empty); |
| | | content = ChatManager.KillRegex.Replace(content, string.Empty); |
| | | content = ChatCenter.s_VoiceRegex.Replace(content, string.Empty); |
| | | return content; |
| | | } |
| | | |
| | |
| | | transferContents.Remove(tick); |
| | | splitContents.Remove(tick); |
| | | return sb.ToString(); |
| | | } |
| | | |
| | | bool IsSystemChat(string content) |
| | | { |
| | | if (ChatManager.InviteRegex.IsMatch(content) |
| | | || ChatManager.KillRegex.IsMatch(content)) |
| | | { |
| | | return true; |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | bool GetChannel(ChatInfoType type, out int channel) |
| | | { |
| | | channel = 0; |
| | | switch (type) |
| | | { |
| | | case ChatInfoType.World: |
| | | case ChatInfoType.CrossServer: |
| | | channel = 0; |
| | | break; |
| | | case ChatInfoType.Team: |
| | | channel = 4; |
| | | break; |
| | | case ChatInfoType.Area: |
| | | case ChatInfoType.Trumpet: |
| | | case ChatInfoType.default1: |
| | | channel = 5; |
| | | break; |
| | | case ChatInfoType.Fairy: |
| | | channel = 2; |
| | | break; |
| | | case ChatInfoType.Friend: |
| | | channel = 3; |
| | | break; |
| | | default: |
| | | return false; |
| | | } |
| | | return true; |
| | | } |
| | | |
| | | bool IsFairyFeast(ChatInfoType type) |
| | | { |
| | | // TODO YYL |
| | | // var dailyQuestModel = ModelCenter.Instance.GetModel<DailyQuestModel>(); |
| | | // DailyQuestOpenTime dailyQuestOpenTime; |
| | | // if (dailyQuestModel.TryGetOpenTime((int)DailyQuestType.FairyFeast, out dailyQuestOpenTime)) |
| | | // { |
| | | // return type == ChatInfoType.Fairy && dailyQuestOpenTime.InOpenTime(); |
| | | // } |
| | | return false; |
| | | } |
| | | |
| | | public class VerifyResponse |