Skip to content

Commit

Permalink
Exclusive curse filter now properly filters curses from other players
Browse files Browse the repository at this point in the history
  • Loading branch information
ethanmoffat committed May 4, 2023
1 parent e47a425 commit ff35d27
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
4 changes: 2 additions & 2 deletions EOLib/Domain/Chat/ChatActions.cs
Expand Up @@ -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);
Expand Down
13 changes: 11 additions & 2 deletions EndlessClient/Subscribers/OtherCharacterEventSubscriber.cs
Expand Up @@ -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;
Expand All @@ -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)
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit ff35d27

Please sign in to comment.