Skip to content

Commit

Permalink
feat: add dual swords sharpens
Browse files Browse the repository at this point in the history
  • Loading branch information
DorielRivalet committed Jun 11, 2024
1 parent 85de9f6 commit 1846638
Show file tree
Hide file tree
Showing 12 changed files with 148 additions and 5 deletions.
9 changes: 9 additions & 0 deletions MHFZ_Overlay/App.config
Original file line number Diff line number Diff line change
Expand Up @@ -1029,6 +1029,15 @@
<setting name="PlayerInputPressedOpacity" serializeAs="String">
<value>0.5</value>
</setting>
<setting name="DualSwordsSharpensShown" serializeAs="String">
<value>True</value>
</setting>
<setting name="DualSwordsSharpensX" serializeAs="String">
<value>105</value>
</setting>
<setting name="DualSwordsSharpensY" serializeAs="String">
<value>102</value>
</setting>
</MHFZ_Overlay.Settings>
</userSettings>
</configuration>
Binary file added MHFZ_Overlay/Assets/Icons/png/whetstone_red.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions MHFZ_Overlay/MHFZ_Overlay.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -799,6 +799,7 @@
<None Remove="Assets\Icons\png\true_transcend.png" />
<None Remove="Assets\Icons\png\unknown.png" />
<None Remove="Assets\Icons\png\whetstone.png" />
<None Remove="Assets\Icons\png\whetstone_red.png" />
<None Remove="Assets\Icons\png\world.png" />
<None Remove="Assets\Icons\touhou\fumo1.png" />
<None Remove="Assets\Icons\touhou\fumo10.png" />
Expand Down Expand Up @@ -1855,6 +1856,7 @@
<Resource Include="Assets\Icons\png\true_transcend.png" />
<Resource Include="Assets\Icons\png\unknown.png" />
<Resource Include="Assets\Icons\png\whetstone.png" />
<Resource Include="Assets\Icons\png\whetstone_red.png" />
<Resource Include="Assets\Icons\png\world.png" />
<Resource Include="Assets\Icons\Sac_Icon_White.xaml" />
<Resource Include="Assets\Icons\Scale_Icon_White.xaml" />
Expand Down
3 changes: 3 additions & 0 deletions MHFZ_Overlay/Models/Addresses/AddressModelHGE.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1908,4 +1908,7 @@ public AddressModelHGE(Mem m)
/// <inheritdoc/>
public override int QuestVariant4() => this.M.ReadByte("mhfo-hd.dll+2AFA89A");

/// <inheritdoc/>
public override int DualSwordsSharpens() => this.M.ReadByte("mhfo-hd.dll+DC6C278");

}
4 changes: 4 additions & 0 deletions MHFZ_Overlay/Models/Addresses/AddressModelNotHGE.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1827,4 +1827,8 @@ public AddressModelNotHGE(Mem m)
/// <inheritdoc/>
public override int QuestVariant4() => this.M.ReadByte("mhfo.dll+28C2CEA");

/// <inheritdoc/>
public override int DualSwordsSharpens() => this.M.ReadByte("mhfo.dll+50346B8");


}
5 changes: 4 additions & 1 deletion MHFZ_Overlay/Services/OverlaySettingsService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ public static void SetConfigurationPreset(Settings s, ConfigurationPreset preset
s.PersonalBestTimePercentShown = false;
s.EnablePersonalBestPaceColor = false;
s.PlayerPositionShown = false;
s.DualSwordsSharpensShown = false;

s.TimerInfoShown = true;
s.EnableInputLogging = true;
Expand Down Expand Up @@ -109,7 +110,7 @@ public static void SetConfigurationPreset(Settings s, ConfigurationPreset preset
s.EnableInputLogging = false;
s.EnableMap = false;
s.PlayerPositionShown = false;

s.DualSwordsSharpensShown = false;
s.OverlayModeWatermarkShown = false;

s.Monster1IconShown = true;
Expand Down Expand Up @@ -140,6 +141,7 @@ public static void SetConfigurationPreset(Settings s, ConfigurationPreset preset
s.ActionsPerMinuteShown = false;
s.PersonalBestShown = false;
s.PlayerPositionShown = false;
s.DualSwordsSharpensShown = false;

s.OverlayModeWatermarkShown = false;

Expand Down Expand Up @@ -179,6 +181,7 @@ public static void SetConfigurationPreset(Settings s, ConfigurationPreset preset
s.TimerInfoShown = true;
s.EnableInputLogging = true;
s.EnableMap = true;
s.DualSwordsSharpensShown = true;

s.OverlayModeWatermarkShown = true;

Expand Down
36 changes: 36 additions & 0 deletions MHFZ_Overlay/Settings.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions MHFZ_Overlay/Settings.settings
Original file line number Diff line number Diff line change
Expand Up @@ -1022,5 +1022,14 @@
<Setting Name="PlayerInputPressedOpacity" Type="System.Double" Scope="User">
<Value Profile="(Default)">0.5</Value>
</Setting>
<Setting Name="DualSwordsSharpensShown" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">True</Value>
</Setting>
<Setting Name="DualSwordsSharpensX" Type="System.Double" Scope="User">
<Value Profile="(Default)">105</Value>
</Setting>
<Setting Name="DualSwordsSharpensY" Type="System.Double" Scope="User">
<Value Profile="(Default)">102</Value>
</Setting>
</Settings>
</SettingsFile>
46 changes: 44 additions & 2 deletions MHFZ_Overlay/ViewModels/Windows/AddressModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,8 @@ public AddressModel(Mem m)

public bool ShowPersonalBestAttemptsInfo { get; set; }

public bool ShowDualSwordsSharpens { get; set; }

public bool ShowMonster1HPBar { get; set; }

public bool ShowMonster2HPBar { get; set; }
Expand Down Expand Up @@ -1393,6 +1395,8 @@ 21747 or
/// <returns></returns>
public abstract int QuestVariant4();

public abstract int DualSwordsSharpens();

/// <summary>
/// Updates every 11 seconds
/// </summary>
Expand Down Expand Up @@ -1816,7 +1820,8 @@ public OverlayMode GetOverlayMode()
|| s.EnableMap
|| s.PersonalBestTimePercentShown
|| s.EnablePersonalBestPaceColor
|| s.PlayerPositionShown) // TODO monster 1 overview? and update README
|| s.PlayerPositionShown
|| s.DualSwordsSharpensShown) // TODO monster 1 overview? and update README
{
return OverlayMode.Standard;
}
Expand Down Expand Up @@ -3278,6 +3283,8 @@ public string IsLowestMonsterDefrate

public string DivaSongIcon { get; set; } = "../../Assets/Icons/png/diva_fountain.png";

public string DualSwordsSharpensIcon { get; set; } = "../../Assets/Icons/png/whetstone.png";

public string GuildFoodIcon { get; set; } = "../../Assets/Icons/png/guild_hall.png";

/// <summary>
Expand Down Expand Up @@ -3338,6 +3345,32 @@ public string ATK
}
}

public string DualSwordsSharpensColor
{
get
{
var count = this.DualSwordsSharpens();
if (count >= 4)
{
this.DualSwordsSharpensIcon = "../../Assets/Icons/png/whetstone_red.png";
}
else
{
this.DualSwordsSharpensIcon = "../../Assets/Icons/png/whetstone.png";
}

return count switch
{
4 => "#cba6f7", // Mauve
3 => "#f38ba8", // Red
2 => "#fab387", // Peach
1 => "#f9e2af", // Yellow
0 => "#f5e0dc", // Rosewater
_ => "#cdd6f4",
};
}
}

/// <summary>
/// Gets the color of the sharpness.
/// </summary>
Expand Down Expand Up @@ -3385,6 +3418,15 @@ public string SharpnessNumber
}
}

public string DualSwordsSharpensCount
{
get
{
var count = this.DualSwordsSharpens();
return count.ToString(CultureInfo.InvariantCulture);
}
}

/// <summary>
/// Gets the current weapon multiplier.
/// </summary>
Expand All @@ -3401,7 +3443,7 @@ public float CurrentWeaponMultiplier
}

/// <summary>
/// Gets the name of the current weapon.
/// Gets the name of the current weapon. This refers to the weapon type name.
/// </summary>
/// <value>
/// The name of the current weapon.
Expand Down
16 changes: 15 additions & 1 deletion MHFZ_Overlay/Views/Windows/ConfigWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -2439,6 +2439,8 @@
<RowDefinition Height="40"/>
<RowDefinition Height="40"/>
<RowDefinition Height="40"/>
<RowDefinition Height="40"/>
<RowDefinition Height="40"/>
</Grid.RowDefinitions>

<StackPanel Margin="5" Orientation="Horizontal" Grid.Row="0" Grid.Column="0" ToolTip="Show Timer">
Expand Down Expand Up @@ -2836,7 +2838,19 @@
<ui:TextBox IsUndoEnabled="False" TextAlignment="Center" PlaceholderText="X" Text="{Binding Source={StaticResource Settings},Path=GuildFoodTimerX}" PreviewTextInput="ValidateNumber"/>
<ui:TextBox IsUndoEnabled="False" TextAlignment="Center" PlaceholderText="Y" Margin="5,0,0,0" Text="{Binding Source={StaticResource Settings},Path=GuildFoodTimerY}" PreviewTextInput="ValidateNumber"/>
</StackPanel>
</Grid>

<StackPanel Margin="5" Orientation="Horizontal" Grid.Row="75" Grid.Column="0" ToolTip="Show Dual Swords Sharpen Streak Count">
<Image Source="../../Assets/Icons/png/whetstone.png" Margin="0,0,5,0"/>
<TextBlock Style="{StaticResource ConfigTextBox}" Text="Dual Swords Sharpens" />
</StackPanel>
<ui:ToggleSwitch HorizontalAlignment="Center" Grid.Row="75" Grid.Column="1" IsChecked="{Binding Source={StaticResource Settings}, Path=DualSwordsSharpensShown}"/>

<TextBlock Margin="5" Style="{StaticResource ConfigTextBox}" Grid.Row="76" Grid.Column="0" Text="Dual Swords Sharpens Position"/>
<StackPanel Orientation="Horizontal" Grid.Row="76" Grid.Column="1" HorizontalAlignment="Center">
<ui:TextBox IsUndoEnabled="False" TextAlignment="Center" PlaceholderText="X" Text="{Binding Source={StaticResource Settings},Path=DualSwordsSharpensX}" PreviewTextInput="ValidateNumber"/>
<ui:TextBox IsUndoEnabled="False" TextAlignment="Center" PlaceholderText="Y" Text="{Binding Source={StaticResource Settings},Path=DualSwordsSharpensY}" PreviewTextInput="ValidateNumber"/>
</StackPanel>
</Grid>
</ScrollViewer>
<customcontrols:MainConfigurationActions Grid.Row="1" Grid.ColumnSpan="1" Loaded="MainConfigurationActions_Loaded" Unloaded="MainConfigurationActions_Unloaded"/>
</Grid>
Expand Down
15 changes: 14 additions & 1 deletion MHFZ_Overlay/Views/Windows/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,20 @@

<customcontrols:OutlinedTextBlock HorizontalAlignment="Left" Text="{x:Bind DataLoader.Model.SharpnessNumber}" Grid.Column="0" Grid.Row="0" FontSize="{Binding Path=PrimaryFontSize, Source={StaticResource Settings}}" FontFamily="{Binding Path=PrimaryFontFamily, Source={StaticResource Settings}}" FontWeight="{Binding Path=PrimaryFontWeight, Source={StaticResource Settings}}" StrokeThickness="4" Stroke="#1e1e2e" Fill="{Binding SharpnessColor}"/>
</Grid>
<Grid x:Name="SessionTimeInfo" Canvas.Left="{Binding Source={StaticResource Settings},Path=SessionTimeX}" Canvas.Top="{Binding Source={StaticResource Settings},Path=SessionTimeY}" Width="Auto" Height="Auto" MouseLeftButtonDown="ElementMouseLeftButtonDown" Background="{Binding Source={StaticResource Settings},Path=TextBackGroundColor}" Visibility="{Binding ElementName=Window, Path=DataLoader.Model.ShowSessionTimeInfo, Converter={StaticResource BoolToVis}}">
<Grid x:Name=
"DualSwordsSharpensInfo" Canvas.Left="{Binding Source={StaticResource Settings},Path=DualSwordsSharpensX}" Canvas.Top="{Binding Source={StaticResource Settings},Path=DualSwordsSharpensY}" Width="Auto" Height="Auto" MouseLeftButtonDown="ElementMouseLeftButtonDown" Background="{Binding Source={StaticResource Settings},Path=TextBackGroundColor}" Visibility="{Binding ElementName=Window, Path=DataLoader.Model.ShowDualSwordsSharpens, Converter={StaticResource BoolToVis}}">
<Grid.ColumnDefinitions >
<ColumnDefinition Width="2*" />
<ColumnDefinition Width="4*" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>
<Border x:Name="DualSwordsSharpensBorder" BorderBrush="{StaticResource Red}" Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2" BorderThickness="0"/>
<Image Height="30" VerticalAlignment="Center" HorizontalAlignment="Right" Grid.Column="0" Source="{Binding DualSwordsSharpensIcon}" d:Source="../../Assets/Icons/png/whetstone.png"/>
<customcontrols:OutlinedTextBlock d:Text="4" d:Fill="{Binding Source={StaticResource Settings},Path=TextColor}" VerticalAlignment="Center" HorizontalAlignment="Left" Text="{x:Bind DataLoader.Model.DualSwordsSharpensCount}" Grid.Column="1" Grid.Row="0" FontSize="{Binding Path=PrimaryFontSize, Source={StaticResource Settings}}" FontFamily="{Binding Path=PrimaryFontFamily, Source={StaticResource Settings}}" FontWeight="{Binding Path=PrimaryFontWeight, Source={StaticResource Settings}}" StrokeThickness="4" Stroke="#1e1e2e" Fill="{Binding DualSwordsSharpensColor}" Margin="4,0,0,0"/>
</Grid>
<Grid x:Name="SessionTimeInfo" Canvas.Left="{Binding Source={StaticResource Settings},Path=SessionTimeX}" Canvas.Top="{Binding Source={StaticResource Settings},Path=SessionTimeY}" Width="Auto" Height="Auto" MouseLeftButtonDown="ElementMouseLeftButtonDown" Background="{Binding Source={StaticResource Settings},Path=TextBackGroundColor}" Visibility="{Binding ElementName=Window, Path=DataLoader.Model.ShowSessionTimeInfo, Converter={StaticResource BoolToVis}}">
<Grid.ColumnDefinitions >
<ColumnDefinition Width="2*" />
<ColumnDefinition Width="4*"/>
Expand Down
8 changes: 8 additions & 0 deletions MHFZ_Overlay/Views/Windows/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1327,6 +1327,9 @@ private void SetPlayerStatsVisibility(bool v, Settings s)
this.DataLoader.Model.ShowQuestAttemptsInfo = v && s.QuestAttemptsShown;
this.DataLoader.Model.ShowPersonalBestTimePercentInfo = v && s.PersonalBestTimePercentShown;
this.DataLoader.Model.ShowPersonalBestAttemptsInfo = v && s.PersonalBestAttemptsShown;

this.DataLoader.Model.ShowDualSwordsSharpens = v && s.DualSwordsSharpensShown && DataLoader.Model.CurrentWeaponName == "Dual Swords";

}

private double? yOffset { get; set; }
Expand Down Expand Up @@ -1458,6 +1461,10 @@ private void MainGrid_DragOver(object sender, DragEventArgs e)
s.MapX = (double)(pos.X - this.xOffset);
s.MapY = (double)(pos.Y - this.yOffset);
break;
case "DualSwordsSharpensInfo":
s.DualSwordsSharpensX = (double)(pos.X - this.xOffset);
s.DualSwordsSharpensY = (double)(pos.Y - this.yOffset);
break;

// case "OverlayModeWatermark":
// s.OverlayModeWatermarkX = (double)(pos.X - this.XOffset);
Expand Down Expand Up @@ -1712,6 +1719,7 @@ private void ToggleOverlayBorders()
this.PlayerDPSGraphGridBorder.BorderThickness = thickness;
this.PlayerHitsPerSecondGraphGridBorder.BorderThickness = thickness;
this.TitleBarBorder.BorderThickness = thickness;
this.DualSwordsSharpensBorder.BorderThickness = thickness;
}

private void ToggleClickThrough()
Expand Down

0 comments on commit 1846638

Please sign in to comment.