From 57467788ea98b43d1d1a4ca6aa7b295a48fbe086 Mon Sep 17 00:00:00 2001 From: Anna Date: Sat, 27 Jul 2024 22:48:13 -0400 Subject: [PATCH] feat: add minimum combatant thresholds --- Configuration.cs | 2 ++ Plugin.cs | 8 ++++++++ PluginUi.cs | 3 +++ 3 files changed, 13 insertions(+) diff --git a/Configuration.cs b/Configuration.cs index b52ed0c..7dc23a6 100644 --- a/Configuration.cs +++ b/Configuration.cs @@ -35,6 +35,8 @@ public class Configuration : IPluginConfiguration { [Evaluation.Poor] = 0.25f, [Evaluation.Awful] = 0f, }; + public int EvaluationMinCombatants; + public int EvaluationMinSameRole; } public enum MeterMode { diff --git a/Plugin.cs b/Plugin.cs index d49663c..1d7d219 100644 --- a/Plugin.cs +++ b/Plugin.cs @@ -219,6 +219,10 @@ public class Plugin : IDalamudPlugin { return; } + if (this.Client.Data.Combatants.Count < this.Config.EvaluationMinCombatants) { + return; + } + var combatants = this.Client.Data.Combatants.Values .Where(combatant => { var job = this.DataManager.GetExcelSheet()! @@ -227,6 +231,10 @@ public class Plugin : IDalamudPlugin { return job?.Role == player.ClassJob.GameData?.Role; }) .ToList(); + if (combatants.Count < this.Config.EvaluationMinSameRole) { + return; + } + combatants.Sort((a, b) => a.EncDps.CompareTo(b.EncDps)); var youIndex = combatants.FindIndex(combatant => combatant.Name == "YOU"); if (youIndex == -1) { diff --git a/PluginUi.cs b/PluginUi.cs index 1d57a45..7d6decc 100644 --- a/PluginUi.cs +++ b/PluginUi.cs @@ -162,6 +162,9 @@ public class PluginUi : IDisposable { } } } + + anyChanged |= ImGui.SliderInt("Minimum players to show evaluation", ref this.Plugin.Config.EvaluationMinCombatants, 0, 24); + anyChanged |= ImGui.SliderInt("Minimum players on the same role to show evaluation", ref this.Plugin.Config.EvaluationMinSameRole, 0, 8); } }