Skip to content

Commit

Permalink
Fixed Draw % order on label
Browse files Browse the repository at this point in the history
  • Loading branch information
VeXHarbinger committed Oct 19, 2018
1 parent 0ee105e commit 2939bb4
Show file tree
Hide file tree
Showing 10 changed files with 46 additions and 53 deletions.
6 changes: 2 additions & 4 deletions DrawPool/DisplayControl.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:props="clr-namespace:DrawPool.Properties"
xmlns:themes="clr-namespace:Hearthstone_Deck_Tracker.Utility.Themes;assembly=HearthstoneDeckTracker"
VerticalAlignment="Top"
FontStretch="Normal"
Grid.IsSharedSizeScope="True"
ScrollViewer.VerticalScrollBarVisibility="Auto"
Expand All @@ -21,14 +22,11 @@
</UserControl.Background>
<UserControl.Resources>
<Style TargetType="Label">
<Setter Property="Foreground" Value="White" />
<Setter Property="FontStretch" Value="Normal" />
<Setter Property="FontFamily" Value="Book Antiqua" />
<Setter Property="FontSize" Value="16" />
<Setter Property="MinWidth" Value="50" />
<Setter Property="Margin" Value="0" />
</Style>

<Style TargetType="RowDefinition">
<Setter Property="Height" Value="Auto" />
<Setter Property="MinHeight" Value="18" />
Expand All @@ -37,7 +35,7 @@
<Setter Property="MinWidth" Value="100" />
</Style>
</UserControl.Resources>
<StackPanel Visibility="Visible">
<StackPanel VerticalAlignment="Bottom" Visibility="Visible">
<hdtc:AnimatedCardList Name="CardList" Padding="2" />
<Grid Margin="0">
<Grid.RowDefinitions>
Expand Down
27 changes: 11 additions & 16 deletions DrawPool/DrawLogic/ElvenMinstrelControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public ElvenMinstrelControl()
/// Returns the list of Minions Grouped by their Counts, for statistical purposes.
/// </summary>
/// <returns>The list of Minions Grouped by their Counts, for statistical purposes</returns>
internal List<IGrouping<int, Card>> GroupedMinion() => QueryDeck.GroupBy(c => c.Count).OrderByDescending(grp => grp.Count()).ToList();
internal List<IGrouping<int, Card>> GroupedMinion() => QueryDeck.GroupBy(c => c.Count).OrderByDescending(grp => grp.Count()).OrderBy(g => g.Key).ToList();


/// <summary>
Expand All @@ -60,27 +60,18 @@ public void DoMath()
lblDeckMix.Content = WriteDeckMix(MinionCount(), Core.Game.Player.DeckCount);
if (MinionCount() >= 1)
{
lblProbability.Content = "";
var gm = GroupedMinion();
// Next, figure out our odds
lblProbability.Content = WriteDrawProbability(
gm.First<IGrouping<int, Card>>().First<Card>().Count,
MinionCount(),
2);
lblProbability.Content = WriteDrawProbability(gm.First<IGrouping<int, Card>>().First<Card>().Count, MinionCount(), 2);
if (gm.Count >= 2)
{
lblProbability.Content += " ";
lblProbability.Content += WriteDrawProbability(
gm[1].First<Card>().Count,
MinionCount(),
2);

lblProbability.Content += WriteDrawProbability(gm[1].First<Card>().Count, MinionCount(), 2);
if (gm.Count >= 3)
{
lblProbability.Content += " ";
lblProbability.Content += WriteDrawProbability(
gm.Last<IGrouping<int, Card>>().First<Card>().Count,
MinionCount(),
2);
lblProbability.Content += WriteDrawProbability(gm.Last<IGrouping<int, Card>>().First<Card>().Count, MinionCount(), 2);
}
}
}
Expand Down Expand Up @@ -129,7 +120,11 @@ public List<Card> BuildQueryDeck()
c.Type == "Minion" &&
(c.Count - c.InHandCount) > 0
)
.ToList().FixCreatedCards();
.OrderBy(c => c.Cost)
.ThenBy(c => c.Count)
.ThenBy(c => c.Name)
.ToList<Card>()
.FixCreatedCards();

var dups = playerDeck
.GroupBy(c => c.Id)
Expand All @@ -151,7 +146,7 @@ public List<Card> BuildQueryDeck()
}
}
playerDeck.RemoveAll(c => c.Count == 0);
return playerDeck.ToList<Card>();
return playerDeck;
}
}
}
13 changes: 0 additions & 13 deletions DrawPool/DrawLogic/WhichwoodPiper.cs

This file was deleted.

40 changes: 25 additions & 15 deletions DrawPool/DrawLogic/WitchWoodPiperControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,18 @@ public WitchWoodPiperControl()
/// <returns>The scoped list of <see cref="Card">Cards</see></returns>
internal List<Card> BuildQueryDeck()
{
return Core.Game.Player.PlayerCardList
.Where(c => c.Type == "Minion" && (c.Count - c.InHandCount) > 0)
.OrderBy(c => c.Cost)
.ThenBy(c => c.Count)
.ThenBy(c => c.Name)
.GroupBy(c => c.Cost)
.First()
.ToList<Card>();
var cd= Core.Game.Player.PlayerCardList
.Where(
c => c.Type == "Minion"
&& (c.Count - c.InHandCount) > 0
)
.OrderBy(c => c.Cost)
.ThenBy(c => c.Count)
.ThenBy(c => c.Name)
.GroupBy(c => c.Cost)
.First()
.ToList<Card>();
return cd;
}

/// <summary>
Expand All @@ -71,18 +75,24 @@ public void DoMath()
{
lblProbability.Content = "";
lblDeckMix.Content = WriteDeckMix(MinionCount(), Core.Game.Player.DeckCount);
if (QueryDeck.Count == 1 || QueryDeck.Count== MinionCount())
if (QueryDeck.Count == 1 || QueryDeck.Count == MinionCount())
{
lblProbability.Content = WriteDrawProbability(1, MinionCount(), 1);
}
else if (QueryDeck.Count >= 2)
{
lblProbability.Content += " ";
lblProbability.Content += WriteDrawProbability(QueryDeck[1].Count, MinionCount(), 1);
if (QueryDeck.Count > 3)
else {
if (QueryDeck.Count >= 1)
{
lblProbability.Content = WriteDrawProbability(1, MinionCount(), 1);
}
if (QueryDeck.Count >= 2)
{
lblProbability.Content += " ";
lblProbability.Content += WriteDrawProbability(QueryDeck.Last().Count, MinionCount(), 1);
lblProbability.Content += WriteDrawProbability(QueryDeck[1].Count, MinionCount(), 1);
if (QueryDeck.Count >= 3)
{
lblProbability.Content += " ";
lblProbability.Content += WriteDrawProbability(QueryDeck.Last().Count, MinionCount(), 1);
}
}
}
}
Expand Down
7 changes: 3 additions & 4 deletions DrawPool/DrawPoolWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,12 @@
xmlns:themes="clr-namespace:Hearthstone_Deck_Tracker.Utility.Themes;assembly=HearthstoneDeckTracker"
Title="Drawpool"
MinWidth="200"
MinHeight="200"
MinHeight="150"
MaxWidth="300"
Padding="0"
AutomationProperties.Name="Drawpool"
BorderThickness="1"
Focusable="True"
FontFamily="Segoe UI Semibold"
Foreground="White"
Grid.IsSharedSizeScope="True"
IsCloseButtonEnabled="False"
IsMaxRestoreButtonEnabled="False"
Expand All @@ -41,7 +39,7 @@
SizeToContent="WidthAndHeight"
SnapsToDevicePixels="True"
TextOptions.TextFormattingMode="Display"
TitleAlignment="Center"
TitleAlignment="Left"
TitleCaps="False"
Top="{Binding Source={x:Static props:Settings.Default}, Path=Top, Mode=TwoWay}"
Topmost="True">
Expand Down Expand Up @@ -70,6 +68,7 @@
</Controls:MetroWindow.IconTemplate>
<StackPanel
Name="DisplayBox"
VerticalAlignment="Top"
Background="Transparent"
Opacity="{Binding Source={x:Static props:Settings.Default}, Path=Opacity, Mode=OneWay}"
Visibility="Visible">
Expand Down
1 change: 1 addition & 0 deletions DrawPool/UserOptionsControl.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
xmlns:props="clr-namespace:DrawPool.Properties"
xmlns:sys="clr-namespace:System;assembly=mscorlib"
MinWidth="200"
MinHeight="150"
Margin="2"
Background="Transparent"
Grid.IsSharedSizeScope="True"
Expand Down
5 changes: 4 additions & 1 deletion ReadMe.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,7 @@ I hope to add in the mechanics for [Recruit](https://hearthstone.gamepedia.com/R


## Configuration
You can set where the window is displayed when the player hand hovers over the trigger card from the Options => Plug-in menu

* You can see and/or set where the window is displayed when the player hand hovers over the trigger card from the Options => Plug-in menu

* You can also set the windows opacity, as well as which Drawpool modules to use.
Binary file added images/DrawpoolOptions.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/MinstrelDisplaySample.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/PiperDisplaySample.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 2939bb4

Please sign in to comment.