From 052bb69a8b50948052165847ea44312b8d4f6607 Mon Sep 17 00:00:00 2001
From: client_linchunjie <461730578@qq.com>
Date: 星期四, 20 九月 2018 16:13:14 +0800
Subject: [PATCH] Merge branch 'master' into 1871天赋功能

---
 System/Chat/ChatCtrl.cs |   47 +++++++++++++++++++++++++++++++++--------------
 1 files changed, 33 insertions(+), 14 deletions(-)

diff --git a/System/Chat/ChatCtrl.cs b/System/Chat/ChatCtrl.cs
index 208cbe7..220b877 100644
--- a/System/Chat/ChatCtrl.cs
+++ b/System/Chat/ChatCtrl.cs
@@ -210,6 +210,10 @@
     {
         try
         {
+            if (chatCenter.IsChatBanned)
+            {
+                return;
+            }
             var channelName = string.Empty;
             switch (chatType)
             {
@@ -247,7 +251,8 @@
 
     public void SendChatInfo(ChatInfoType type, string msg, ChatExtraData? info = null)
     {
-        bool _dirty = false;
+        bool isDirty = false;
+        bool isVoice = ChatCenter.s_VoiceRegex.IsMatch(msg);
 
         if (CheckEmptyChat(msg))
         {
@@ -257,10 +262,9 @@
 
         ChatReport(type, msg, PteChatName);
 
-        if (!ChatCenter.s_VoiceRegex.IsMatch(msg)
-            && !InviteRegex.IsMatch(msg))
+        if (!isVoice && !InviteRegex.IsMatch(msg))
         {
-            _dirty = DirtyWordConfig.IsDirtWord(msg);
+            isDirty = DirtyWordConfig.IsDirtWord(msg);
             msg = DirtyWordConfig.IsDirtWord(msg, '*');
             var length = msg.Length;
             if (length > CHAT_INFO_CNT)
@@ -276,12 +280,24 @@
              if (ok)
              {
                  ChatCenter.RecentlyChat _recentlyChat = null;
-                 if (!_dirty)
+                 if (!isDirty && !isVoice)
                  {
                      _recentlyChat = chatCenter.SaveRecentlyChat(result);
                  }
                  msg = CheckHasItem(result, _recentlyChat);
                  chatCenter.recentlyChat = null;
+
+                 if (chatCenter.IsChatBanned)
+                 {
+                     var toPlayer = PteChatID;
+                     if (info.HasValue && info.Value.infoint1 == 0)
+                     {
+                         toPlayer = info.Value.infoint1;
+                     }
+                     chatCenter.HandleChatBanned(type, msg, toPlayer);
+                     return;
+                 }
+
                  switch (type)
                  {
                      case ChatInfoType.World:
@@ -347,11 +363,6 @@
                                  _pak.Text = msg;
                                  GameNetSystem.Instance.SendInfo(_pak);
                              }
-                         }
-                         break;
-                     case ChatInfoType.Invite:
-                         {
-                             SendInvite(msg);
                          }
                          break;
                  }
@@ -649,10 +660,18 @@
                     ItemConfig cfg = Config.Instance.Get<ItemConfig>(itemID);
                     if (cfg != null)
                     {
-                        string append = string.Format("<a><Word info=item id={1} userdata={5} chatsend=1/>|showitem={1} isbind={2} itemcnt={3} stone={4} userdata={5} suitLv={6} suitCnt={7} place={8} equipwash={9}</a>",
-                            cfg.ItemColor, strarray[0], strarray[1], strarray[2], strarray[3], strarray[4], strarray[5], strarray[6], strarray[7], strarray[8]);
-                        append = UIHelper.GetTextColorByItemColor(cfg.ItemColor, append);
-                        data.richText.Append(append);
+                        try
+                        {
+                            string append = string.Format("<a><Word info=item id={0} userdata={4} chatsend=1/>|showitem={0} isbind={1} itemcnt={2} stone={3} userdata={4} suitLv={5} suitCnt={6} place={7} equipwash={8}</a>",
+                                      strarray[0], strarray[1], strarray[2], strarray[3], strarray[4], strarray[5], strarray[6], strarray[7], strarray[8]);
+                            append = UIHelper.GetTextColorByItemColor(cfg.ItemColor, append);
+                            data.richText.Append(append);
+                        }
+                        catch (Exception e)
+                        {
+                            data.richText.Append(cfg.ItemName);
+                            DebugEx.Log(e.Message);
+                        }
                     }
                 }
                 else

--
Gitblit v1.8.0