Skip to content

Commit

Permalink
feat: add nationality option for quest logs
Browse files Browse the repository at this point in the history
  • Loading branch information
DorielRivalet committed Jan 13, 2023
1 parent 1de30e0 commit 019cf8f
Show file tree
Hide file tree
Showing 42 changed files with 872 additions and 57 deletions.
33 changes: 30 additions & 3 deletions MHFZ_Overlay/App.config
Original file line number Diff line number Diff line change
Expand Up @@ -445,8 +445,8 @@
<setting name="PlayerAvatarLink" serializeAs="String">
<value>https://raw.githubusercontent.com/DorielRivalet/mhfz-overlay/main/img/icon/transcend.png</value>
</setting>
<setting name="PlayerNationality" serializeAs="String">
<value>World</value>
<setting name="PlayerNationalityIndex" serializeAs="String">
<value>0</value>
</setting>
<setting name="DamagePerSecondShown" serializeAs="String">
<value>True</value>
Expand Down Expand Up @@ -506,7 +506,7 @@
<value>610</value>
</setting>
<setting name="ControllerLayoutShown" serializeAs="String">
<value>True</value>
<value>False</value>
</setting>
<setting name="ControllerLayoutX" serializeAs="String">
<value>160</value>
Expand Down Expand Up @@ -535,6 +535,33 @@
<setting name="EnableAverageActionsPerMinuteColor" serializeAs="String">
<value>True</value>
</setting>
<setting name="PlayerInputHorizontalGridShown" serializeAs="String">
<value>True</value>
</setting>
<setting name="PlayerInputHorizontalGridX" serializeAs="String">
<value>50</value>
</setting>
<setting name="PlayerInputHorizontalGridY" serializeAs="String">
<value>100</value>
</setting>
<setting name="PlayerInputVerticalGridShown" serializeAs="String">
<value>True</value>
</setting>
<setting name="PlayerInputVerticalGridX" serializeAs="String">
<value>0</value>
</setting>
<setting name="PlayerInputVerticalGridY" serializeAs="String">
<value>0</value>
</setting>
<setting name="Monster1OverviewShown" serializeAs="String">
<value>True</value>
</setting>
<setting name="Monster1OverviewX" serializeAs="String">
<value>0</value>
</setting>
<setting name="Monster1OverviewY" serializeAs="String">
<value>0</value>
</setting>
</MHFZ_Overlay.Settings>
</userSettings>
</configuration>
16 changes: 13 additions & 3 deletions MHFZ_Overlay/ConfigWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -316,8 +316,8 @@
<TextBlock Margin="5,5,5,5" Style="{StaticResource ConfigTextBox}" Grid.Row="31" Grid.Column="0" Text="Keyboard and Mouse Layout Y Coordinate"/>
<TextBox IsUndoEnabled="False" TextAlignment="Center" Background="#585b70" Style="{StaticResource ConfigTextField}" Grid.Row="31" Grid.Column="1" Text="{Binding Source={StaticResource Settings},Path=KBMLayoutY}" PreviewTextInput="ValidateNumber"/>

<TextBlock Margin="5,5,5,5" ToolTip="Show Gamepad Layout" Style="{StaticResource ConfigTextBox}" Grid.Row="32" Grid.Column="0" Text="Controller/Gamepad Layout"/>
<ToggleButton Grid.Row="32" Grid.Column="1" Style="{StaticResource MaterialDesignSwitchToggleButton}" IsChecked="{Binding Source={StaticResource Settings}, Path=ControllerLayoutShown}"/>
<TextBlock Margin="5,5,5,5" ToolTip="Show Gamepad Layout" Style="{StaticResource ConfigTextBox}" Grid.Row="32" Grid.Column="0" Text="(Not Implemented) Controller/Gamepad Layout"/>
<ToggleButton Grid.Row="32" Grid.Column="1" Style="{StaticResource MaterialDesignSwitchToggleButton}" IsChecked="{Binding Source={StaticResource Settings}, Path=ControllerLayoutShown}" Checked="ControllerLayoutButton_Click"/>
<TextBlock Margin="5,5,5,5" Style="{StaticResource ConfigTextBox}" Grid.Row="33" Grid.Column="0" Text="Controller/Gamepad Layout X Coordinate"/>
<TextBox IsUndoEnabled="False" TextAlignment="Center" Background="#585b70" Style="{StaticResource ConfigTextField}" Grid.Row="33" Grid.Column="1" Text="{Binding Source={StaticResource Settings},Path=ControllerLayoutX}" PreviewTextInput="ValidateNumber"/>
<TextBlock Margin="5,5,5,5" Style="{StaticResource ConfigTextBox}" Grid.Row="34" Grid.Column="0" Text="Controller/Gamepad Layout Y Coordinate"/>
Expand Down Expand Up @@ -1961,7 +1961,17 @@
<TextBlock Margin="5,5,5,5" ToolTip="Set a player avatar image link" Style="{StaticResource ConfigTextBox}" Grid.Row="3" Grid.Column="0" Text="Player Avatar Link" />
<TextBox IsUndoEnabled="False" TextAlignment="Center" Background="#585b70" Style="{StaticResource ConfigTextField}" Grid.Row="3" Grid.Column="1" Text="{Binding Source={StaticResource Settings},Path=PlayerAvatarLink}"/>
<TextBlock Margin="5,5,5,5" ToolTip="Select nationality to display on website for quest records" Style="{StaticResource ConfigTextBox}" Grid.Row="4" Grid.Column="0" Text="Player Nationality"/>
<ComboBox SelectedIndex="0" SelectionChanged="CountryComboBox_SelectionChanged" Name="CountryComboBox" Margin="5,5,5,5" Grid.Column="2" Grid.Row="4"/>
<ComboBox SelectedIndex="{Binding Source={StaticResource Settings}, Path=PlayerNationalityIndex}" Margin="5,5,5,5" Grid.Column="1" Grid.Row="4" x:Name="CountryComboBox" ItemsSource="{Binding Countries,Mode=OneTime}" SelectionChanged="CountryComboBox_SelectionChanged">
<ComboBox.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<Image Source="{Binding Flag.Png}" Width="20" Height="20" Margin="0,0,5,0"/>
<TextBlock Text="{Binding Name.Common}"/>
</StackPanel>
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>

<TextBlock Margin="5,5,5,5" ToolTip="Enable logging of inputs (KBM + Controller) during quests and inserts the information into a local database. WARNING: the runs with this option disabled will not be displayed on leaderboards, in order to prevent cheating." Style="{StaticResource ConfigTextBox}" Grid.Row="5" Grid.Column="0" Text="Log Inputs during Quest" />
<ToggleButton Grid.Row="5" Grid.Column="1" Style="{StaticResource MaterialDesignSwitchToggleButton}" IsChecked="{Binding Source={StaticResource Settings}, Path=EnableKeyLogging}"/>
<!--TODO: speedrun mode in overlay takes into account these settings + other things-->
Expand Down
19 changes: 18 additions & 1 deletion MHFZ_Overlay/ConfigWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
using MessageBox = System.Windows.MessageBox;
using SaveFileDialog = Microsoft.Win32.SaveFileDialog;
using Window = System.Windows.Window;
using RESTCountries.NET.Services;
using RESTCountries.NET.Models;

namespace MHFZ_Overlay
{
Expand Down Expand Up @@ -1204,7 +1206,22 @@ private void questLoggingToggle_Check(object sender, RoutedEventArgs e)

private void CountryComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
// TODO
Settings s = (Settings)Application.Current.TryFindResource("Settings");
s.PlayerNationalityIndex = CountryComboBox.SelectedIndex;
}

private void ControllerLayoutButton_Click(object sender, RoutedEventArgs e)
{
System.Windows.MessageBoxResult messageBoxResult = System.Windows.MessageBox.Show("Feature not yet implemented. Go to issues page?", "【MHF-Z】Overlay Information Missing", System.Windows.MessageBoxButton.YesNo, System.Windows.MessageBoxImage.Warning, MessageBoxResult.No);
if (messageBoxResult.ToString() == "Yes")
{
string issueLink = "https://github.com/DorielRivalet/mhfz-overlay/issues/43";
var sInfo = new System.Diagnostics.ProcessStartInfo(issueLink)
{
UseShellExecute = true,
};
System.Diagnostics.Process.Start(sInfo);
}
}
};

Expand Down
11 changes: 6 additions & 5 deletions MHFZ_Overlay/Core/Class/DataAccessLayer/DatabaseManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -538,7 +538,7 @@ public void InsertQuestData(string connectionString, DataLoader dataLoader)
cmd.ExecuteNonQuery();
}

InsertPlayerDictionaryDataIntoTable(conn);
InsertPlayerDictionaryDataIntoTable(conn, dataLoader);

// Get the ID of the last inserted row in the Players table
//sql = "SELECT LAST_INSERT_ROWID()";
Expand Down Expand Up @@ -2423,7 +2423,7 @@ private bool CompareDatabaseSchemas(Dictionary<string, Dictionary<string, object
return schemaChanged;
}

private void InsertPlayerDictionaryDataIntoTable(SQLiteConnection conn)
private void InsertPlayerDictionaryDataIntoTable(SQLiteConnection conn, DataLoader dataLoader)
{
// Start a transaction
using (SQLiteTransaction transaction = conn.BeginTransaction())
Expand Down Expand Up @@ -2501,7 +2501,8 @@ private void InsertPlayerDictionaryDataIntoTable(SQLiteConnection conn)
guildName = s.GuildName;
serverName = s.ServerName;
gender = s.GenderExport;
nationality = s.PlayerNationality;
//TODO test
nationality = dataLoader.model.Countries.ToList()[s.PlayerNationalityIndex].Name.Common;
}

// Set the parameter values
Expand Down Expand Up @@ -2834,8 +2835,8 @@ CREATE TABLE IF NOT EXISTS Players (
{
cmd.ExecuteNonQuery();
}

InsertPlayerDictionaryDataIntoTable(conn);
InsertPlayerDictionaryDataIntoTable(conn, dataLoader);

/*
* mhfdat.bin
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
using LiveChartsCore.SkiaSharpView.Painting.ImageFilters;
using System.Collections.Generic;
using static System.Net.Mime.MediaTypeNames;
using System.Reflection.Metadata;
using System.Windows.Forms;

namespace Dictionary
{
///<summary>
///The color list
///</summary>
/// /// Labels Hex RGB HSL
//Rosewater #f5e0dc rgb(245, 224, 220) hsl(10, 56%, 91%)
//Flamingo #f2cdcd rgb(242, 205, 205) hsl(0, 59%, 88%)
//Pink #f5c2e7 rgb(245, 194, 231) hsl(316, 72%, 86%)
//Mauve #cba6f7 rgb(203, 166, 247) hsl(267, 84%, 81%)
//Red #f38ba8 rgb(243, 139, 168) hsl(343, 81%, 75%)
//Maroon #eba0ac rgb(235, 160, 172) hsl(350, 65%, 77%)
//Peach #fab387 rgb(250, 179, 135) hsl(23, 92%, 75%)
//Yellow #f9e2af rgb(249, 226, 175) hsl(41, 86%, 83%)
//Green #a6e3a1 rgb(166, 227, 161) hsl(115, 54%, 76%)
//Teal #94e2d5 rgb(148, 226, 213) hsl(170, 57%, 73%)
//Sky #89dceb rgb(137, 220, 235) hsl(189, 71%, 73%)
//Sapphire #74c7ec rgb(116, 199, 236) hsl(199, 76%, 69%)
//Blue #89b4fa rgb(137, 180, 250) hsl(217, 92%, 76%)
//Lavender #b4befe rgb(180, 190, 254) hsl(232, 97%, 85%)
//Text #cdd6f4 rgb(205, 214, 244) hsl(226, 64%, 88%)
//Subtext1 #bac2de rgb(186, 194, 222) hsl(227, 35%, 80%)
//Subtext0 #a6adc8 rgb(166, 173, 200) hsl(228, 24%, 72%)
//Overlay2 #9399b2 rgb(147, 153, 178) hsl(228, 17%, 64%)
//Overlay1 #7f849c rgb(127, 132, 156) hsl(230, 13%, 55%)
//Overlay0 #6c7086 rgb(108, 112, 134) hsl(231, 11%, 47%)
//Surface2 #585b70 rgb(88, 91, 112) hsl(233, 12%, 39%)
//Surface1 #45475a rgb(69, 71, 90) hsl(234, 13%, 31%)
//Surface0 #313244 rgb(49, 50, 68) hsl(237, 16%, 23%)
//Base #1e1e2e rgb(30, 30, 46) hsl(240, 21%, 15%)
//Mantle #181825 rgb(24, 24, 37) hsl(240, 21%, 12%)
//Crust #11111b rgb(17, 17, 27) hsl(240, 23%, 9%)
public static class CatppuccinMochaColorsDictionary
{
public static IReadOnlyDictionary<string, string> CatppuccinMochaColors { get; } = new Dictionary<string, string>
{
{"Rosewater","#f5e0dc" },
{ "Flamingo","#f2cdcd"},
{ "Pink","#f5c2e7"},
{ "Mauve","#cba6f7"},
{ "Red","#f38ba8"},
{ "Maroon","#eba0ac"},
{ "Peach","#fab387"},
{ "Yellow","#f9e2af"},
{ "Green","#a6e3a1"},
{ "Teal","#94e2d5"},
{ "Sky","#89dceb"},
{ "Sapphire","#74c7ec"},
{ "Blue","#89b4fa"},
{ "Lavender","#b4befe"},
{ "Text","#cdd6f4"},
{ "Subtext1","#bac2de"},
{ "Subtext0","#a6adc8"},
{ "Overlay2","#9399b2"},
{ "Overlay1","#7f849c"},
{ "Overlay0","#6c7086"},
{ "Surface2","#585b70"},
{ "Surface1","#45475a"},
{ "Surface0","#313244"},
{ "Base","#1e1e2e"},
{ "Mantle","#181825"},
{ "Crust","#11111b"}
};
}
}
Loading

0 comments on commit 019cf8f

Please sign in to comment.