| | |
| | | }
|
| | | #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
|
| | |
|
| | | }
|
| | | }
|
| | |
|