From ff35d2702be7948c9b558f9ca96445aad73cc383 Mon Sep 17 00:00:00 2001 From: Ethan Moffat Date: Wed, 3 May 2023 22:55:04 -0700 Subject: [PATCH] Exclusive curse filter now properly filters curses from other players --- EOLib/Domain/Chat/ChatActions.cs | 4 ++-- .../Subscribers/OtherCharacterEventSubscriber.cs | 13 +++++++++++-- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/EOLib/Domain/Chat/ChatActions.cs b/EOLib/Domain/Chat/ChatActions.cs index 6ad3da35..e2de5c0d 100644 --- a/EOLib/Domain/Chat/ChatActions.cs +++ b/EOLib/Domain/Chat/ChatActions.cs @@ -71,11 +71,11 @@ public class ChatActions : IChatActions } else if (chatType == ChatType.Party && !_partyDataProvider.Members.Any()) { - return (ChatResult.HideAll, String.Empty); + return (ChatResult.HideAll, string.Empty); } else if (chatType == ChatType.Global && _currentMapStateProvider.IsJail) { - return (ChatResult.JailProtection, String.Empty); + return (ChatResult.JailProtection, string.Empty); } chat = _chatProcessor.RemoveFirstCharacterIfNeeded(chat, chatType, targetCharacter); diff --git a/EndlessClient/Subscribers/OtherCharacterEventSubscriber.cs b/EndlessClient/Subscribers/OtherCharacterEventSubscriber.cs index 304ce80d..86c2df45 100644 --- a/EndlessClient/Subscribers/OtherCharacterEventSubscriber.cs +++ b/EndlessClient/Subscribers/OtherCharacterEventSubscriber.cs @@ -3,6 +3,8 @@ using EndlessClient.Rendering.Character; using EndlessClient.Services; using EOLib; +using EOLib.Config; +using EOLib.Domain.Chat; using EOLib.Domain.Notifiers; using System; using System.Linq; @@ -15,14 +17,20 @@ public class OtherCharacterEventSubscriber : IOtherCharacterEventNotifier private readonly IChatBubbleActions _chatBubbleActions; private readonly ICharacterRendererProvider _characterRendererProvider; private readonly IFriendIgnoreListService _friendIgnoreListService; + private readonly IConfigurationProvider _configurationProvider; + private readonly IChatProcessor _chatProcessor; public OtherCharacterEventSubscriber(IChatBubbleActions chatBubbleActions, ICharacterRendererProvider characterRendererProvider, - IFriendIgnoreListService friendIgnoreListService) + IFriendIgnoreListService friendIgnoreListService, + IConfigurationProvider configurationProvider, + IChatProcessor chatProcessor) { _chatBubbleActions = chatBubbleActions; _characterRendererProvider = characterRendererProvider; _friendIgnoreListService = friendIgnoreListService; + _configurationProvider = configurationProvider; + _chatProcessor = chatProcessor; } public void OtherCharacterTakeDamage(int characterID, int playerPercentHealth, int damageTaken, bool isHeal) @@ -57,7 +65,8 @@ private void SaySomethingShared(int characterID, string message, bool isGroupCha var name = _characterRendererProvider.CharacterRenderers[characterID].Character.Name; var ignoreList = _friendIgnoreListService.LoadList(Constants.IgnoreListFile); - if (ignoreList.Any(x => x.Equals(name, StringComparison.InvariantCultureIgnoreCase))) + if (ignoreList.Any(x => x.Equals(name, StringComparison.InvariantCultureIgnoreCase)) || + (_configurationProvider.StrictFilterEnabled && !_chatProcessor.FilterCurses(message).ShowChat)) return; _characterRendererProvider.CharacterRenderers[characterID].ShowChatBubble(message, isGroupChat);