Skip to content

Commit

Permalink
Block party requests if interaction is disabled
Browse files Browse the repository at this point in the history
  • Loading branch information
ethanmoffat committed Jun 14, 2022
1 parent 4b4b866 commit 8c9d15f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
9 changes: 8 additions & 1 deletion EndlessClient/Dialogs/Actions/PartyDialogActions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using EndlessClient.Audio;
using EndlessClient.Dialogs.Factories;
using EndlessClient.HUD;
using EOLib.Config;
using EOLib.Domain.Chat;
using EOLib.Domain.Notifiers;
using EOLib.Domain.Party;
Expand All @@ -19,24 +20,30 @@ public class PartyDialogActions : IPartyEventNotifier
private readonly IStatusLabelSetter _statusLabelSetter;
private readonly ILocalizedStringFinder _localizedStringFinder;
private readonly IChatRepository _chatRepository;
private readonly IConfigurationProvider _configurationProvider;

public PartyDialogActions(IPartyActions partyActions,
ISfxPlayer sfxPlayer,
IEOMessageBoxFactory messageBoxFactory,
IStatusLabelSetter statusLabelSetter,
ILocalizedStringFinder localizedStringFinder,
IChatRepository chatRepository)
IChatRepository chatRepository,
IConfigurationProvider configurationProvider)
{
_partyActions = partyActions;
_sfxPlayer = sfxPlayer;
_messageBoxFactory = messageBoxFactory;
_statusLabelSetter = statusLabelSetter;
_localizedStringFinder = localizedStringFinder;
_chatRepository = chatRepository;
_configurationProvider = configurationProvider;
}

public void NotifyPartyRequest(PartyRequestType type, short playerId, string name)
{
if (!_configurationProvider.Interaction)
return;

var dlg = _messageBoxFactory.CreateMessageBox(
char.ToUpper(name[0]) + name[1..],
type == PartyRequestType.Join
Expand Down
2 changes: 1 addition & 1 deletion EndlessClient/HUD/Panels/SettingsPanel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ private void SettingChange(WhichSetting setting)
_configurationRepository.LogChatToFile = !_configurationRepository.LogChatToFile;
break;
case WhichSetting.Interaction:
// todo: block party/trade requests when this is true
// todo: block trade requests when this is true
_configurationRepository.Interaction = !_configurationRepository.Interaction;
break;
}
Expand Down

0 comments on commit 8c9d15f

Please sign in to comment.