Skip to content

Commit

Permalink
feat: add dual swords sharpens graphs
Browse files Browse the repository at this point in the history
  • Loading branch information
DorielRivalet committed Jun 11, 2024
1 parent e22fcb2 commit 84c01e0
Show file tree
Hide file tree
Showing 3 changed files with 93 additions and 1 deletion.
10 changes: 9 additions & 1 deletion MHFZ_Overlay/ViewModels/Windows/AddressModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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;
Expand All @@ -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);
Expand Down Expand Up @@ -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)}
");
}
}
Expand Down
1 change: 1 addition & 0 deletions MHFZ_Overlay/Views/Windows/ConfigWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -870,6 +870,7 @@
<ComboBoxItem>(Run ID) Monster Attack Multiplier</ComboBoxItem>
<ComboBoxItem>(Run ID) Monster Defense Rate</ComboBoxItem>
<ComboBoxItem>(Run ID) Monster Status Ailments Thresholds</ComboBoxItem>
<ComboBoxItem>(Run ID) Dual Swords Sharpens</ComboBoxItem>
</ComboBox>

<TextBlock Padding="10,0,10,0" Text="Compare with Run ID" HorizontalAlignment="Center" VerticalAlignment="Center"/>
Expand Down
83 changes: 83 additions & 0 deletions MHFZ_Overlay/Views/Windows/ConfigWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3790,6 +3790,86 @@ private void SetStepLineSeriesForPersonalBestByAttempts(Dictionary<long, long> d
this.personalBestChart.YAxes = this.PersonalBestYAxes;
}

private void SetStepLineSeriesForDictionaryIntInt(Dictionary<int, int> data, Dictionary<int, int>? extraData)
{
if (this.graphChart == null)
{
return;
}

List<ISeries> series = new();
ObservableCollection<ObservablePoint> collection = new();

var newData = GetElapsedTime(data);

foreach (var entry in newData)
{
collection.Add(new ObservablePoint(entry.Key, entry.Value));
}

series.Add(new StepLineSeries<ObservablePoint>
{
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<ObservablePoint> collection2 = new();

var newData2 = GetElapsedTime(extraData);

foreach (var entry in newData2)
{
collection2.Add(new ObservablePoint(entry.Key, entry.Value));
}

series.Add(new StepLineSeries<ObservablePoint>
{
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<DateTime, long> data)
{
if (this.personalBestChart == null)
Expand Down Expand Up @@ -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<ISeries>(); // TODO test
this.graphChart.XAxes = this.XAxes;
Expand Down

0 comments on commit 84c01e0

Please sign in to comment.