From dc4f8964138b38967121fcc617acedae9fb12ac5 Mon Sep 17 00:00:00 2001 From: Slim Debug Date: Sun, 24 Jul 2022 13:32:34 +0200 Subject: [PATCH] added four new toggleable columns that summarize multiple columns in order to improve readability --- HuntMmrReader/Enums/PlayerOptions.cs | 14 ++- HuntMmrReader/HuntMmrReader.csproj | 4 +- HuntMmrReader/Models/HuntPlayer.cs | 4 + .../ViewModels/MainWindowViewModel.cs | 86 ++++++++++++++++++- HuntMmrReader/Views/MainWindow.xaml | 37 +++++++- 5 files changed, 140 insertions(+), 5 deletions(-) diff --git a/HuntMmrReader/Enums/PlayerOptions.cs b/HuntMmrReader/Enums/PlayerOptions.cs index 0f0b15c..c988b65 100644 --- a/HuntMmrReader/Enums/PlayerOptions.cs +++ b/HuntMmrReader/Enums/PlayerOptions.cs @@ -78,9 +78,21 @@ internal enum PlayerOptions ///This should be a bool. [Description("teamextraction")] TeamExtraction = 2097152, + ///This should be a ulong. + OverallKilledByMe = 4194304, + + ///This should be a ulong. + OverallKilledByTeammate = 8388608, + + ///This should be a ulong. + OverallKilledMe = 16777216, + + ///This should be a ulong. + OverallKilledTeammate = 33554432, + ///All values combined. All = BloodLineName | BountyExtracted | BountyPickedUp | DownedByMe | DownedByTeammate | DownedMe | DownedTeammate | HadWellspring | HadBounty | IsPartner | IsSoulSurvivor | KilledByMe | KilledByTeammate | KilledMe | KilledTeammate | Mmr | ProfileId | Proximity | ProximityToMe | ProximityToTeammate | SkillBased | - TeamExtraction + TeamExtraction | OverallKilledByMe | OverallKilledByTeammate | OverallKilledMe | OverallKilledTeammate } \ No newline at end of file diff --git a/HuntMmrReader/HuntMmrReader.csproj b/HuntMmrReader/HuntMmrReader.csproj index 478b7e0..ce98fd4 100644 --- a/HuntMmrReader/HuntMmrReader.csproj +++ b/HuntMmrReader/HuntMmrReader.csproj @@ -5,8 +5,8 @@ net6.0-windows enable true - 1.3.2.0 - 1.3.2.0 + 1.3.3.0 + 1.3.3.0 diff --git a/HuntMmrReader/Models/HuntPlayer.cs b/HuntMmrReader/Models/HuntPlayer.cs index 64e9d0a..2f906ae 100644 --- a/HuntMmrReader/Models/HuntPlayer.cs +++ b/HuntMmrReader/Models/HuntPlayer.cs @@ -85,6 +85,10 @@ public HuntPlayer(ushort id, string? mmr, string? bloodLineName, string? bountyE public bool ProximityToTeammate { get; } public bool SkillBased { get; } public bool TeamExtraction { get; } + public ushort OverallKilledByMe => (ushort) (DownedByMe + KilledByMe); + public ushort OverallKilledByTeammate => (ushort) (KilledByTeammate + DownedByTeammate); + public ushort OverallKilledMe => (ushort) (KilledMe + DownedMe); + public ushort OverallKilledTeammate => (ushort) (KilledTeammate + DownedTeammate); public override string ToString() { diff --git a/HuntMmrReader/ViewModels/MainWindowViewModel.cs b/HuntMmrReader/ViewModels/MainWindowViewModel.cs index a80d49e..6712e67 100644 --- a/HuntMmrReader/ViewModels/MainWindowViewModel.cs +++ b/HuntMmrReader/ViewModels/MainWindowViewModel.cs @@ -2,6 +2,7 @@ using System.Collections.ObjectModel; using System.ComponentModel; using System.Diagnostics; +using System.Globalization; using System.IO; using System.Linq; using System.Windows; @@ -126,12 +127,95 @@ private void LoadSettings() } catch { - FilePath = ""; + FilePath = string.Empty; _displayOptions = PlayerOptions.None; } } private void HandleOption(PlayerOptions option) + { + switch (option) + { + case PlayerOptions.None: + case PlayerOptions.All: + DisplayOptions = option; + break; + case PlayerOptions.BloodLineName: + case PlayerOptions.BountyExtracted: + case PlayerOptions.BountyPickedUp: + case PlayerOptions.HadWellspring: + case PlayerOptions.HadBounty: + case PlayerOptions.IsPartner: + case PlayerOptions.IsSoulSurvivor: + case PlayerOptions.Mmr: + case PlayerOptions.ProfileId: + case PlayerOptions.Proximity: + case PlayerOptions.ProximityToMe: + case PlayerOptions.ProximityToTeammate: + case PlayerOptions.SkillBased: + case PlayerOptions.TeamExtraction: + ToggleOption(option); + break; + // OverallKilledByMe option handling + case PlayerOptions.DownedByMe: + case PlayerOptions.KilledByMe: + if (DisplayOptions.HasFlag(PlayerOptions.OverallKilledByMe)) + DisplayOptions &= ~PlayerOptions.OverallKilledByMe; + ToggleOption(option); + break; + case PlayerOptions.OverallKilledByMe: + foreach (var opt in new[] {PlayerOptions.DownedByMe, PlayerOptions.KilledByMe}) + if (DisplayOptions.HasFlag(opt)) + DisplayOptions &= ~opt; + ToggleOption(option); + break; + // OverallKilledByTeammate option handling + case PlayerOptions.DownedByTeammate: + case PlayerOptions.KilledByTeammate: + if (DisplayOptions.HasFlag(PlayerOptions.OverallKilledByTeammate)) + DisplayOptions &= ~PlayerOptions.OverallKilledByTeammate; + ToggleOption(option); + break; + case PlayerOptions.OverallKilledByTeammate: + foreach (var opt in new[] {PlayerOptions.DownedByTeammate, PlayerOptions.KilledByTeammate}) + if (DisplayOptions.HasFlag(opt)) + DisplayOptions &= ~opt; + ToggleOption(option); + break; + // OverallKilledMe option handling + case PlayerOptions.DownedMe: + case PlayerOptions.KilledMe: + if (DisplayOptions.HasFlag(PlayerOptions.OverallKilledMe)) + DisplayOptions &= ~PlayerOptions.OverallKilledMe; + ToggleOption(option); + break; + case PlayerOptions.OverallKilledMe: + foreach (var opt in new[] {PlayerOptions.DownedMe, PlayerOptions.KilledMe}) + if (DisplayOptions.HasFlag(opt)) + DisplayOptions &= ~opt; + ToggleOption(option); + break; + // OverallKilledTeammate option handling + case PlayerOptions.DownedTeammate: + case PlayerOptions.KilledTeammate: + if (DisplayOptions.HasFlag(PlayerOptions.OverallKilledTeammate)) + DisplayOptions &= ~PlayerOptions.OverallKilledTeammate; + ToggleOption(option); + break; + case PlayerOptions.OverallKilledTeammate: + foreach (var opt in new[] {PlayerOptions.DownedTeammate, PlayerOptions.KilledTeammate}) + if (DisplayOptions.HasFlag(opt)) + DisplayOptions &= ~opt; + ToggleOption(option); + break; + default: + AddException(new ArgumentOutOfRangeException(nameof(option), option, + $"{((int) option).ToString(CultureInfo.InvariantCulture)} is not a valid {nameof(option)} value.")); + break; + } + } + + private void ToggleOption(PlayerOptions option) { if (DisplayOptions.HasFlag(option)) DisplayOptions &= ~option; diff --git a/HuntMmrReader/Views/MainWindow.xaml b/HuntMmrReader/Views/MainWindow.xaml index d9f788f..5b79165 100644 --- a/HuntMmrReader/Views/MainWindow.xaml +++ b/HuntMmrReader/Views/MainWindow.xaml @@ -69,6 +69,25 @@ + + + + - @@ -346,16 +365,32 @@ + + + +