From 139c269dddc07c1a4a4f66e0ab4d6f2fac0bb6ad Mon Sep 17 00:00:00 2001 From: Liza Carvelli Date: Wed, 28 Feb 2024 12:01:38 +0100 Subject: [PATCH] Allow FC exclusions --- Influx/Configuration.cs | 7 ++++--- Influx/Influx/InfluxStatisticsClient.cs | 1 + Influx/Windows/ConfigurationWindow.cs | 14 +++++++++++++- 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/Influx/Configuration.cs b/Influx/Configuration.cs index 6c9e812..25ee867 100644 --- a/Influx/Configuration.cs +++ b/Influx/Configuration.cs @@ -15,9 +15,9 @@ public sealed class Configuration : IPluginConfiguration { public bool Enabled { get; set; } public string Server { get; set; } = "http://localhost:8086"; - public string Token { get; set; } = "xxx"; - public string Organization { get; set; } = "org"; - public string Bucket { get; set; } = "bucket"; + public string Token { get; set; } = ""; + public string Organization { get; set; } = ""; + public string Bucket { get; set; } = ""; } public sealed class CharacterInfo @@ -25,5 +25,6 @@ public sealed class Configuration : IPluginConfiguration public ulong LocalContentId { get; set; } public string? CachedPlayerName { get; set; } public string? CachedWorldName { get; set; } + public bool IncludeFreeCompany { get; set; } = true; } } diff --git a/Influx/Influx/InfluxStatisticsClient.cs b/Influx/Influx/InfluxStatisticsClient.cs index 4fd2228..b1dc97f 100644 --- a/Influx/Influx/InfluxStatisticsClient.cs +++ b/Influx/Influx/InfluxStatisticsClient.cs @@ -53,6 +53,7 @@ internal sealed class InfluxStatisticsClient : IDisposable var validFcIds = currencyStats.Keys .Where(x => x.CharacterType == CharacterType.Character) + .Where(x => _configuration.IncludedCharacters.SingleOrDefault(config => config.LocalContentId == x.CharacterId)?.IncludeFreeCompany == true) .Select(x => x.FreeCompanyId) .ToList(); Task.Run(async () => diff --git a/Influx/Windows/ConfigurationWindow.cs b/Influx/Windows/ConfigurationWindow.cs index b614dc0..b93f0de 100644 --- a/Influx/Windows/ConfigurationWindow.cs +++ b/Influx/Windows/ConfigurationWindow.cs @@ -88,9 +88,21 @@ internal sealed class ConfigurationWindow : Window $"Current Character: {_clientState.LocalPlayer?.Name} @ {worldName} ({_clientState.LocalContentId:X})"); ImGui.Indent(30); - if (_configuration.IncludedCharacters.Any(x => x.LocalContentId == _clientState.LocalContentId)) + Configuration.CharacterInfo? includedCharacter = + _configuration.IncludedCharacters.FirstOrDefault(x => x.LocalContentId == _clientState.LocalContentId); + if (includedCharacter != null) { ImGui.TextColored(ImGuiColors.HealerGreen, "This character is currently included."); + + bool includeFreeCompany = includedCharacter.IncludeFreeCompany; + if (ImGui.Checkbox("Include Free Company statistics", ref includeFreeCompany)) + { + includedCharacter.IncludeFreeCompany = includeFreeCompany; + Save(); + } + + ImGui.Spacing(); + if (ImGui.Button("Remove inclusion")) { _configuration.IncludedCharacters.RemoveAll(