From 84c01e02b8c0ae2c3df967a71b2fc48bfe41206f Mon Sep 17 00:00:00 2001 From: Doriel Rivalet <100863878+DorielRivalet@users.noreply.github.com> Date: Tue, 11 Jun 2024 07:53:48 -0300 Subject: [PATCH] feat: add dual swords sharpens graphs --- .../ViewModels/Windows/AddressModel.cs | 10 ++- MHFZ_Overlay/Views/Windows/ConfigWindow.xaml | 1 + .../Views/Windows/ConfigWindow.xaml.cs | 83 +++++++++++++++++++ 3 files changed, 93 insertions(+), 1 deletion(-) diff --git a/MHFZ_Overlay/ViewModels/Windows/AddressModel.cs b/MHFZ_Overlay/ViewModels/Windows/AddressModel.cs index 6e87598f..18f7f6d6 100644 --- a/MHFZ_Overlay/ViewModels/Windows/AddressModel.cs +++ b/MHFZ_Overlay/ViewModels/Windows/AddressModel.cs @@ -8351,6 +8351,9 @@ public string GenerateGearStats(long? runID = null) emd: {GetGamePatchInfo(GamePatchFile.emd, mhfemdHash)} dll: {GetGamePatchInfo(GamePatchFile.dll, mhfodllHash)} hddll: {GetGamePatchInfo(GamePatchFile.hddll, mhfohddllHash)} + +Weapon Specific: +Dual Swords dropped combos: {this.DualSwordsSharpensDictionary.Count((e) => e.Value == 0)} "); this.SavedGearStats = stats; var formattedStats = string.Format( @@ -8432,6 +8435,9 @@ public string GenerateGearStats(long? runID = null) emd: {GetGamePatchInfo(GamePatchFile.emd, mhfemdHash)} dll: {GetGamePatchInfo(GamePatchFile.dll, mhfodllHash)} hddll: {GetGamePatchInfo(GamePatchFile.hddll, mhfohddllHash)} + +Weapon Specific: +Dual Swords dropped combos: {this.DualSwordsSharpensDictionary.Count((e) => e.Value == 0)} "); this.MarkdownSavedGearStats = formattedStats; return stats; @@ -8458,7 +8464,6 @@ public string GenerateGearStats(long? runID = null) var activeFeature = DatabaseManagerInstance.GetActiveFeature((long)runID); var courses = DatabaseManagerInstance.GetCourses((long)runID); var guildPoogie = DatabaseManagerInstance.GetGuildPoogie((long)runID); - // TODO var weaponBuffs = DatabaseManagerInstance.GetQuestsWeaponBuffs((long)runID); var halk = DatabaseManagerInstance.GetHalk((long)runID); var toggleMode = DatabaseManagerInstance.GetQuestToggleMode((long)runID); @@ -8600,6 +8605,9 @@ public string GenerateGearStats(long? runID = null) emd: {patchInfo.mhfemdInfo} dll: {patchInfo.mhfodllInfo} hddll: {patchInfo.mhfohddllInfo} + +Weapon Specific: +Dual Swords dropped combos: {weaponBuffs.DualSwordsSharpensDictionary.Count((e) => e.Value == 0)} "); } } diff --git a/MHFZ_Overlay/Views/Windows/ConfigWindow.xaml b/MHFZ_Overlay/Views/Windows/ConfigWindow.xaml index db70367c..ca5ea0f0 100644 --- a/MHFZ_Overlay/Views/Windows/ConfigWindow.xaml +++ b/MHFZ_Overlay/Views/Windows/ConfigWindow.xaml @@ -870,6 +870,7 @@ (Run ID) Monster Attack Multiplier (Run ID) Monster Defense Rate (Run ID) Monster Status Ailments Thresholds + (Run ID) Dual Swords Sharpens diff --git a/MHFZ_Overlay/Views/Windows/ConfigWindow.xaml.cs b/MHFZ_Overlay/Views/Windows/ConfigWindow.xaml.cs index 69bfc4be..04c41bc3 100644 --- a/MHFZ_Overlay/Views/Windows/ConfigWindow.xaml.cs +++ b/MHFZ_Overlay/Views/Windows/ConfigWindow.xaml.cs @@ -3790,6 +3790,86 @@ private void SetStepLineSeriesForPersonalBestByAttempts(Dictionary d this.personalBestChart.YAxes = this.PersonalBestYAxes; } + private void SetStepLineSeriesForDictionaryIntInt(Dictionary data, Dictionary? extraData) + { + if (this.graphChart == null) + { + return; + } + + List series = new(); + ObservableCollection collection = new(); + + var newData = GetElapsedTime(data); + + foreach (var entry in newData) + { + collection.Add(new ObservablePoint(entry.Key, entry.Value)); + } + + series.Add(new StepLineSeries + { + Values = collection, + GeometrySize = 0, + Stroke = new SolidColorPaint(new SKColor(this.MainWindow.DataLoader.Model.HexColorToDecimal("#fff38ba8"))) { StrokeThickness = 2 }, + Fill = new LinearGradientPaint(new SKColor(this.MainWindow.DataLoader.Model.HexColorToDecimal("#fff38ba8", "7f")), new SKColor(this.MainWindow.DataLoader.Model.HexColorToDecimal("#fff38ba8", "00")), new SKPoint(0.5f, 0), new SKPoint(0.5f, 1)), + }); + + if (extraData != null) + { + ObservableCollection collection2 = new(); + + var newData2 = GetElapsedTime(extraData); + + foreach (var entry in newData2) + { + collection2.Add(new ObservablePoint(entry.Key, entry.Value)); + } + + series.Add(new StepLineSeries + { + Values = collection2, + GeometrySize = 0, + Stroke = new SolidColorPaint(new SKColor(this.MainWindow.DataLoader.Model.HexColorToDecimal("#ff89b4fa"))) { StrokeThickness = 2 }, + Fill = new LinearGradientPaint(new SKColor(this.MainWindow.DataLoader.Model.HexColorToDecimal("#ff89b4fa", "7f")), new SKColor(this.MainWindow.DataLoader.Model.HexColorToDecimal("#ff89b4fa", "00")), new SKPoint(0.5f, 0), new SKPoint(0.5f, 1)), + }); + + if (this.runIDComparisonTextBlock != null && this.extraRunIDTextBox != null) + { + var runComparisonPercentage = CalculateBetterLinePercentage(newData, newData2); + var betterRun = runComparisonPercentage >= 0.0 ? RunIDTextBox.Text : extraRunIDTextBox.Text; + this.runIDComparisonTextBlock.Text = string.Format(CultureInfo.InvariantCulture, "Run {0} is higher by around {1:0.##}%", betterRun, Math.Abs(runComparisonPercentage)); + } + } + + this.XAxes = new Axis[] + { + new Axis + { + TextSize = 12, + Labeler = (value) => TimeService.GetMinutesSecondsFromFrames(value), + NamePaint = new SolidColorPaint(new SKColor(this.MainWindow.DataLoader.Model.HexColorToDecimal("#a6adc8"))), + LabelsPaint = new SolidColorPaint(new SKColor(this.MainWindow.DataLoader.Model.HexColorToDecimal("#a6adc8"))), + }, + }; + + this.YAxes = new Axis[] + { + new Axis + { + NameTextSize = 12, + TextSize = 12, + NamePadding = new LiveChartsCore.Drawing.Padding(0), + NamePaint = new SolidColorPaint(new SKColor(this.MainWindow.DataLoader.Model.HexColorToDecimal("#a6adc8"))), + LabelsPaint = new SolidColorPaint(new SKColor(this.MainWindow.DataLoader.Model.HexColorToDecimal("#a6adc8"))), + }, + }; + + this.graphChart.Series = series; + this.graphChart.XAxes = this.XAxes; + this.graphChart.YAxes = this.YAxes; + } + private void SetStepLineSeriesForPersonalBestByDate(Dictionary data) { if (this.personalBestChart == null) @@ -4911,6 +4991,9 @@ private void UpdateStatsGraphs(string selectedOption) CalculateMonsterStatusAilmentThresholds( DatabaseManager.GetMonster1StunThresholdDictionary(runID))); return; + case "(Run ID) Dual Swords Sharpens": + this.SetStepLineSeriesForDictionaryIntInt(DatabaseManager.GetDualSwordsSharpensDictionary(runID), DatabaseManager.GetDualSwordsSharpensDictionary(extraRunID)); + return; default: this.graphChart.Series = this.Series ?? Array.Empty(); // TODO test this.graphChart.XAxes = this.XAxes;