From 40d15dc74f44f3b3fa0ea651cde5cfc16680c4d4 Mon Sep 17 00:00:00 2001 From: Dave Date: Wed, 7 Jun 2023 22:30:55 +0200 Subject: [PATCH] add "bad word filter" parameter --- .../Enums/ServerSettingsResetAction.cs | 1 + .../Globalization/en-US/en-US.xaml | 13 ++++ src/ARKServerManager/Lib/ServerProfile.cs | 77 +++++++++++++++++++ .../UserControls/ServerSettingsControl.xaml | 37 ++++++++- .../ServerSettingsControl.xaml.cs | 4 + 5 files changed, 131 insertions(+), 1 deletion(-) diff --git a/src/ARKServerManager/Enums/ServerSettingsResetAction.cs b/src/ARKServerManager/Enums/ServerSettingsResetAction.cs index f3a86bac..cba7329b 100644 --- a/src/ARKServerManager/Enums/ServerSettingsResetAction.cs +++ b/src/ARKServerManager/Enums/ServerSettingsResetAction.cs @@ -41,5 +41,6 @@ RCONWindowExtents, ServerOptions, ServerLogOptions, + ServerBadWordFilterOptions, } } diff --git a/src/ARKServerManager/Globalization/en-US/en-US.xaml b/src/ARKServerManager/Globalization/en-US/en-US.xaml index 360b5e43..b5ad4a0b 100644 --- a/src/ARKServerManager/Globalization/en-US/en-US.xaml +++ b/src/ARKServerManager/Globalization/en-US/en-US.xaml @@ -1261,6 +1261,19 @@ Cluster Directory Override If enabled, allows you to use a common cross-server storage location that functions between multiple servers running on the same machine. Uses the clusters directory in the server manager Data directory. + Bad Word Filter + Reset all bad word filter options to defaults. + Bad Word Filter URL: + Add the url to hosting your own bad words list. + Bad Word Whitelist URL: + Add the url to hosting your own good words list . + Filter Tribe Names + Filters out tribe names based on the bad words/good words list. + Filter Character Names + Filters out character names based on the bad words/good words list. + Filter Chat + Filters chat messages based on the bad word/good words list. + Server Log Options Reset all server log options to defaults. Enable Server Admin Logs diff --git a/src/ARKServerManager/Lib/ServerProfile.cs b/src/ARKServerManager/Lib/ServerProfile.cs index 0d442c09..78514783 100644 --- a/src/ARKServerManager/Lib/ServerProfile.cs +++ b/src/ARKServerManager/Lib/ServerProfile.cs @@ -740,6 +740,62 @@ namespace ServerManagerTool.Lib set { SetValue(UseVivoxProperty, value); } } + public static readonly DependencyProperty EnableBadWordListURLProperty = DependencyProperty.Register(nameof(EnableBadWordListURL), typeof(bool), typeof(ServerProfile), new PropertyMetadata(false)); + [DataMember] + public bool EnableBadWordListURL + { + get { return (bool)GetValue(EnableBadWordListURLProperty); } + set { SetValue(EnableBadWordListURLProperty, value); } + } + + public static readonly DependencyProperty BadWordListURLProperty = DependencyProperty.Register(nameof(BadWordListURL), typeof(string), typeof(ServerProfile), new PropertyMetadata("")); + [IniFileEntry(IniFiles.GameUserSettings, IniSections.GUS_ServerSettings, ServerProfileCategory.Administration, ConditionedOn = nameof(EnableBadWordListURL), QuotedString = QuotedStringType.True)] + public string BadWordListURL + { + get { return (string)GetValue(BadWordListURLProperty); } + set { SetValue(BadWordListURLProperty, value); } + } + + public static readonly DependencyProperty EnableBadWordWhiteListURLProperty = DependencyProperty.Register(nameof(EnableBadWordWhiteListURL), typeof(bool), typeof(ServerProfile), new PropertyMetadata(false)); + [DataMember] + public bool EnableBadWordWhiteListURL + { + get { return (bool)GetValue(EnableBadWordWhiteListURLProperty); } + set { SetValue(EnableBadWordWhiteListURLProperty, value); } + } + + public static readonly DependencyProperty BadWordWhiteListURLProperty = DependencyProperty.Register(nameof(BadWordWhiteListURL), typeof(string), typeof(ServerProfile), new PropertyMetadata("")); + [IniFileEntry(IniFiles.GameUserSettings, IniSections.GUS_ServerSettings, ServerProfileCategory.Administration, ConditionedOn = nameof(EnableBadWordWhiteListURL), QuotedString = QuotedStringType.True)] + public string BadWordWhiteListURL + { + get { return (string)GetValue(BadWordWhiteListURLProperty); } + set { SetValue(BadWordWhiteListURLProperty, value); } + } + + public static readonly DependencyProperty FilterTribeNamesProperty = DependencyProperty.Register(nameof(FilterTribeNames), typeof(bool), typeof(ServerProfile), new PropertyMetadata(false)); + [IniFileEntry(IniFiles.GameUserSettings, IniSections.GUS_ServerSettings, ServerProfileCategory.Administration, "bFilterTribeNames")] + public bool FilterTribeNames + { + get { return (bool)GetValue(FilterTribeNamesProperty); } + set { SetValue(FilterTribeNamesProperty, value); } + } + + public static readonly DependencyProperty FilterCharacterNamesProperty = DependencyProperty.Register(nameof(FilterCharacterNames), typeof(bool), typeof(ServerProfile), new PropertyMetadata(false)); + [IniFileEntry(IniFiles.GameUserSettings, IniSections.GUS_ServerSettings, ServerProfileCategory.Administration, "bFilterCharacterNames")] + public bool FilterCharacterNames + { + get { return (bool)GetValue(FilterCharacterNamesProperty); } + set { SetValue(FilterCharacterNamesProperty, value); } + } + + public static readonly DependencyProperty FilterChatProperty = DependencyProperty.Register(nameof(FilterChat), typeof(bool), typeof(ServerProfile), new PropertyMetadata(false)); + [IniFileEntry(IniFiles.GameUserSettings, IniSections.GUS_ServerSettings, ServerProfileCategory.Administration, "bFilterChat")] + public bool FilterChat + { + get { return (bool)GetValue(FilterChatProperty); } + set { SetValue(FilterChatProperty, value); } + } + public static readonly DependencyProperty OutputServerLogProperty = DependencyProperty.Register(nameof(OutputServerLog), typeof(bool), typeof(ServerProfile), new PropertyMetadata(true)); [DataMember] public bool OutputServerLog @@ -5445,6 +5501,17 @@ namespace ServerManagerTool.Lib this.ClearValue(ClusterDirOverrideProperty); } + public void ResetServerBadWordFilterOptions() + { + this.ClearValue(EnableBadWordListURLProperty); + this.ClearValue(EnableBadWordWhiteListURLProperty); + this.ClearValue(BadWordListURLProperty); + this.ClearValue(BadWordWhiteListURLProperty); + this.ClearValue(FilterTribeNamesProperty); + this.ClearValue(FilterCharacterNamesProperty); + this.ClearValue(FilterChatProperty); + } + public void ResetServerLogOptions() { this.ClearValue(EnableServerAdminLogsProperty); @@ -5495,6 +5562,7 @@ namespace ServerManagerTool.Lib this.ClearNullableValue(MOTDIntervalProperty); ResetServerOptions(); + ResetServerBadWordFilterOptions(); ResetServerLogOptions(); this.ClearValue(EnableWebAlarmProperty); @@ -6116,6 +6184,15 @@ namespace ServerManagerTool.Lib this.SetValue(UseItemDupeCheckProperty, sourceProfile.UseItemDupeCheck); this.SetValue(UseSecureSpawnRulesProperty, sourceProfile.UseSecureSpawnRules); + // server filter options + this.SetValue(EnableBadWordListURLProperty, sourceProfile.EnableBadWordListURL); + this.SetValue(EnableBadWordWhiteListURLProperty, sourceProfile.EnableBadWordWhiteListURL); + this.SetValue(BadWordListURLProperty, sourceProfile.BadWordListURL); + this.SetValue(BadWordWhiteListURLProperty, sourceProfile.BadWordWhiteListURL); + this.SetValue(FilterTribeNamesProperty, sourceProfile.FilterTribeNames); + this.SetValue(FilterCharacterNamesProperty, sourceProfile.FilterCharacterNames); + this.SetValue(FilterChatProperty, sourceProfile.FilterChat); + // server log options this.SetValue(EnableServerAdminLogsProperty, sourceProfile.EnableServerAdminLogs); this.SetValue(ServerAdminLogsIncludeTribeLogsProperty, sourceProfile.ServerAdminLogsIncludeTribeLogs); diff --git a/src/ARKServerManager/UserControls/ServerSettingsControl.xaml b/src/ARKServerManager/UserControls/ServerSettingsControl.xaml index ee8aeaf7..dc13a68b 100644 --- a/src/ARKServerManager/UserControls/ServerSettingsControl.xaml +++ b/src/ARKServerManager/UserControls/ServerSettingsControl.xaml @@ -1239,6 +1239,41 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + diff --git a/src/ARKServerManager/UserControls/ServerSettingsControl.xaml.cs b/src/ARKServerManager/UserControls/ServerSettingsControl.xaml.cs index 129eaf16..72ae68c0 100644 --- a/src/ARKServerManager/UserControls/ServerSettingsControl.xaml.cs +++ b/src/ARKServerManager/UserControls/ServerSettingsControl.xaml.cs @@ -4302,6 +4302,10 @@ namespace ServerManagerTool case ServerSettingsResetAction.ServerLogOptions: this.Settings.ResetServerLogOptions(); break; + + case ServerSettingsResetAction.ServerBadWordFilterOptions: + this.Settings.ResetServerBadWordFilterOptions(); + break; } }, canExecute: (action) => true