| | |
| | | }
|
| | | #endregion
|
| | |
|
| | | #region 聊天黑名单
|
| | |
|
| | | public string SetChatExtra()
|
| | | {
|
| | | var vipLevel = PlayerDatas.Instance.baseData.VIPLv;
|
| | | var job = PlayerDatas.Instance.baseData.Job;
|
| | | return StringUtility.Contact(vipLevel.ToString().PadLeft(2, '0'), 0, job);
|
| | | }
|
| | |
|
| | | public void HandleChatBanned(ChatInfoType channel, string message, int toPlayer)
|
| | | {
|
| | | bool isBanned = IsChatBanned(channel, message);
|
| | | if (isBanned)
|
| | | {
|
| | | var playerId = PlayerDatas.Instance.baseData.PlayerID;
|
| | | var playerName = UIHelper.ServerStringTrim(PlayerDatas.Instance.baseData.PlayerName);
|
| | | switch (channel)
|
| | | {
|
| | | case ChatInfoType.World:
|
| | | ChatCtrl.Inst.RevChatInfo(new H0201_tagTalkGong()
|
| | | {
|
| | | Content = message,
|
| | | Extras = SetChatExtra(),
|
| | | PlayerID = playerId,
|
| | | Name = playerName,
|
| | | });
|
| | | break;
|
| | | case ChatInfoType.Area:
|
| | | ChatCtrl.Inst.RevChatInfo(new H0207_tagTalkArea()
|
| | | {
|
| | | Content = message,
|
| | | Extras = SetChatExtra(),
|
| | | PlayerID = playerId,
|
| | | SrcName = playerName,
|
| | | });
|
| | | break;
|
| | | case ChatInfoType.Team:
|
| | | ChatCtrl.Inst.RevChatInfo(new H0205_tagTalkDui()
|
| | | {
|
| | | PlayerID = playerId,
|
| | | Name = playerName,
|
| | | Content = message,
|
| | | Extras = SetChatExtra(),
|
| | | });
|
| | | break;
|
| | | case ChatInfoType.Fairy:
|
| | | ChatCtrl.Inst.RevChatInfo(new H0203_tagTalkBang()
|
| | | {
|
| | | PlayerID = playerId,
|
| | | Content = message,
|
| | | Extras = SetChatExtra(),
|
| | | Name = playerName,
|
| | | });
|
| | | break;
|
| | | case ChatInfoType.Friend:
|
| | | ChatCtrl.Inst.RevChatInfo(new H0206_tagTalkMi()
|
| | | {
|
| | | PlayerID = playerId,
|
| | | SrcName = playerName,
|
| | | Content = message,
|
| | | Extras = SetChatExtra(),
|
| | | ToPlayerID = (uint)toPlayer,
|
| | | ToName = string.Empty,
|
| | | TalkType = 1,
|
| | | });
|
| | | break;
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | public bool IsChatBanned(ChatInfoType channel, string message)
|
| | | {
|
| | | var value = PlayerDatas.Instance.baseData.ExAttr11;
|
| | | var serverBanned = value == 1;
|
| | | if (!serverBanned)
|
| | | {
|
| | | return false;
|
| | | }
|
| | | switch (channel)
|
| | | {
|
| | | case ChatInfoType.World:
|
| | | if (ChatCtrl.Inst.IsInviteChat(message))
|
| | | {
|
| | | return false;
|
| | | }
|
| | | break;
|
| | | case ChatInfoType.Trumpet:
|
| | | return false;
|
| | | case ChatInfoType.Fairy:
|
| | | var dailyQuestModel = ModelCenter.Instance.GetModel<DailyQuestModel>();
|
| | | DailyQuestOpenTime fairyFeastTime;
|
| | | if (dailyQuestModel.TryGetOpenTime((int)DailyQuestType.FairyFeast, out fairyFeastTime))
|
| | | {
|
| | | if (fairyFeastTime.InOpenTime())
|
| | | {
|
| | | return false;
|
| | | }
|
| | | }
|
| | | break;
|
| | | case ChatInfoType.Friend:
|
| | | if (ChatCtrl.KillRegex.IsMatch(message))
|
| | | {
|
| | | return false;
|
| | | }
|
| | | break;
|
| | | }
|
| | | return true;
|
| | | }
|
| | | #endregion
|
| | |
|
| | | }
|
| | | }
|
| | |
|
| | |
| | | {
|
| | | try
|
| | | {
|
| | | if (chatCenter.IsChatBanned(chatType, content))
|
| | | {
|
| | | return;
|
| | | }
|
| | | var channelName = string.Empty;
|
| | | switch (chatType)
|
| | | {
|
| | |
| | |
|
| | | 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))
|
| | | {
|
| | |
| | |
|
| | | 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)
|
| | |
| | | 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(type, msg))
|
| | | {
|
| | | 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:
|
| | |
| | | _pak.Text = msg;
|
| | | GameNetSystem.Instance.SendInfo(_pak);
|
| | | }
|
| | | }
|
| | | break;
|
| | | case ChatInfoType.Invite:
|
| | | {
|
| | | SendInvite(msg);
|
| | | }
|
| | | break;
|
| | | }
|
| | |
| | | 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
|
| | |
| | | public void VerifyChat(string content, ChatInfoType channelType, Action<bool, string> callback)
|
| | | {
|
| | | int channel = 0;
|
| | | var chatCenter = ModelCenter.Instance.GetModel<ChatCenter>();
|
| | | if (!requireVerify || !GetChannel(channelType, out channel) || PlayerDatas.Instance.baseData.VIPLv >= 4
|
| | | || IsFairyFeast(channelType))
|
| | | || IsFairyFeast(channelType) || chatCenter.IsChatBanned(channelType, content))
|
| | | {
|
| | | if (callback != null)
|
| | | {
|