feat: add minimum combatant thresholds

This commit is contained in:
Anna 2024-07-27 22:48:13 -04:00
parent 7e77b5100a
commit 57467788ea
Signed by: anna
GPG Key ID: D0943384CD9F87D1
3 changed files with 13 additions and 0 deletions

View File

@ -35,6 +35,8 @@ public class Configuration : IPluginConfiguration {
[Evaluation.Poor] = 0.25f, [Evaluation.Poor] = 0.25f,
[Evaluation.Awful] = 0f, [Evaluation.Awful] = 0f,
}; };
public int EvaluationMinCombatants;
public int EvaluationMinSameRole;
} }
public enum MeterMode { public enum MeterMode {

View File

@ -219,6 +219,10 @@ public class Plugin : IDalamudPlugin {
return; return;
} }
if (this.Client.Data.Combatants.Count < this.Config.EvaluationMinCombatants) {
return;
}
var combatants = this.Client.Data.Combatants.Values var combatants = this.Client.Data.Combatants.Values
.Where(combatant => { .Where(combatant => {
var job = this.DataManager.GetExcelSheet<ClassJob>()! var job = this.DataManager.GetExcelSheet<ClassJob>()!
@ -227,6 +231,10 @@ public class Plugin : IDalamudPlugin {
return job?.Role == player.ClassJob.GameData?.Role; return job?.Role == player.ClassJob.GameData?.Role;
}) })
.ToList(); .ToList();
if (combatants.Count < this.Config.EvaluationMinSameRole) {
return;
}
combatants.Sort((a, b) => a.EncDps.CompareTo(b.EncDps)); combatants.Sort((a, b) => a.EncDps.CompareTo(b.EncDps));
var youIndex = combatants.FindIndex(combatant => combatant.Name == "YOU"); var youIndex = combatants.FindIndex(combatant => combatant.Name == "YOU");
if (youIndex == -1) { if (youIndex == -1) {

View File

@ -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);
} }
} }