From e0e26b782cb8d9da397414be7accd3e8283367ef Mon Sep 17 00:00:00 2001 From: Dean Sheather Date: Thu, 11 Apr 2024 18:32:35 +1000 Subject: [PATCH] fix: avoid warning logs about extrachat --- ChatTwo/Code/ChatTypeExt.cs | 15 +++++++++++++++ ChatTwo/Ui/SettingsTabs/ChatColours.cs | 8 ++++++-- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/ChatTwo/Code/ChatTypeExt.cs b/ChatTwo/Code/ChatTypeExt.cs index 96b6347..ccc6c93 100755 --- a/ChatTwo/Code/ChatTypeExt.cs +++ b/ChatTwo/Code/ChatTypeExt.cs @@ -87,6 +87,8 @@ internal static class ChatTypeExt ChatType.MessageBook, ChatType.Alarm, }), + // Note: ExtraChat linkshells are handled separately in the tab settings + // UI. }; internal static string Name(this ChatType type) @@ -355,6 +357,19 @@ internal static class ChatTypeExt _ => false, }; + internal static bool IsExtraChatLinkshell(this ChatType type) => type switch + { + ChatType.ExtraChatLinkshell1 => true, + ChatType.ExtraChatLinkshell2 => true, + ChatType.ExtraChatLinkshell3 => true, + ChatType.ExtraChatLinkshell4 => true, + ChatType.ExtraChatLinkshell5 => true, + ChatType.ExtraChatLinkshell6 => true, + ChatType.ExtraChatLinkshell7 => true, + ChatType.ExtraChatLinkshell8 => true, + _ => false, + }; + internal static bool HasSource(this ChatType type) => type switch { // Battle diff --git a/ChatTwo/Ui/SettingsTabs/ChatColours.cs b/ChatTwo/Ui/SettingsTabs/ChatColours.cs index 0571895..2addc28 100755 --- a/ChatTwo/Ui/SettingsTabs/ChatColours.cs +++ b/ChatTwo/Ui/SettingsTabs/ChatColours.cs @@ -19,9 +19,13 @@ internal sealed class ChatColours : ISettingsTab { #if DEBUG var sortable = ChatTypeExt.SortOrder .SelectMany(entry => entry.Item2) - .Where(type => !type.IsGm()) + // Users can set colours for ExtraChat linkshells in the ExtraChat + // plugin directly. + .Where(type => !type.IsGm() && !type.IsExtraChatLinkshell()) + .ToHashSet(); + var total = Enum.GetValues() + .Where(type => !type.IsGm() && !type.IsExtraChatLinkshell()) .ToHashSet(); - var total = Enum.GetValues().Where(type => !type.IsGm()).ToHashSet(); if (sortable.Count != total.Count) { Plugin.Log.Warning($"There are {sortable.Count} sortable channels, but there are {total.Count} total channels."); total.ExceptWith(sortable);