diff --git a/ArenaHelper.csproj b/ArenaHelper.csproj
index ab0a419..db9f5ef 100644
--- a/ArenaHelper.csproj
+++ b/ArenaHelper.csproj
@@ -84,6 +84,9 @@
DebugTextBlock.xaml
+
+ DeckRating.xaml
+
Hero.xaml
@@ -124,6 +127,10 @@
Designer
MSBuild:Compile
+
+ Designer
+ MSBuild:Compile
+
Designer
MSBuild:Compile
diff --git a/ArenaWindow.xaml b/ArenaWindow.xaml
index e7ba240..fca478b 100644
--- a/ArenaWindow.xaml
+++ b/ArenaWindow.xaml
@@ -4,12 +4,16 @@
xmlns:controls="clr-namespace:MahApps.Metro.Controls;assembly=MahApps.Metro"
xmlns:local="clr-namespace:ArenaHelper"
xmlns:localcontrols="clr-namespace:ArenaHelper.Controls"
- Title="Arena Helper" Height="255" MinHeight="255" MaxHeight="255" Width="400" MinWidth="400" MaxWidth="400"
- Background="{DynamicResource {x:Static SystemColors.ControlDarkDarkBrushKey}}" Topmost="True" LocationChanged="MetroWindow_LocationChanged" ShowMaxRestoreButton="False">
+ Title="Arena Helper" Height="255" MinHeight="255" MaxHeight="255" Width="480" MinWidth="480" MaxWidth="480"
+ Background="{DynamicResource WindowBackground}" Topmost="True" LocationChanged="MetroWindow_LocationChanged" ShowMaxRestoreButton="False">
+
+
+
+
@@ -39,7 +43,7 @@
-
+
@@ -51,17 +55,17 @@
-
+
Rembound
Hearthstone Arena Tier List
- Donate
+ donation
-
+
@@ -70,7 +74,7 @@
-
+
@@ -84,16 +88,16 @@
-
+
Hearthstone Arena Tier List
- Donate
+ donation
-
+
@@ -108,6 +112,8 @@
+
+
@@ -115,12 +121,12 @@
-
+
-
+
@@ -128,7 +134,7 @@
-
+
@@ -140,14 +146,14 @@
-
- text
- text
+
+ text
+ text
-
+
@@ -161,9 +167,10 @@
- text
+ text
+
@@ -194,23 +201,40 @@
-
+
+
-
-
-
+
+
+
+
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ All cards are picked. You can start a new arena run or save the deck.
+
+
+
\ No newline at end of file
diff --git a/ArenaWindow.xaml.cs b/ArenaWindow.xaml.cs
index 9be69d6..e12df0a 100644
--- a/ArenaWindow.xaml.cs
+++ b/ArenaWindow.xaml.cs
@@ -14,6 +14,7 @@
using MahApps.Metro.Controls.Dialogs;
using System.Windows.Navigation;
using System.Diagnostics;
+using MahApps.Metro;
#endregion
diff --git a/Controls/DeckRating.xaml b/Controls/DeckRating.xaml
new file mode 100644
index 0000000..3d1d26a
--- /dev/null
+++ b/Controls/DeckRating.xaml
@@ -0,0 +1,20 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Controls/DeckRating.xaml.cs b/Controls/DeckRating.xaml.cs
new file mode 100644
index 0000000..ceebba5
--- /dev/null
+++ b/Controls/DeckRating.xaml.cs
@@ -0,0 +1,28 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Navigation;
+using System.Windows.Shapes;
+
+namespace ArenaHelper.Controls
+{
+ ///
+ /// Interaction logic for DeckRating.xaml
+ ///
+ public partial class DeckRating : UserControl
+ {
+ public DeckRating()
+ {
+ InitializeComponent();
+ }
+ }
+}
diff --git a/Controls/Hero.xaml b/Controls/Hero.xaml
index d077b2b..9d47d40 100644
--- a/Controls/Hero.xaml
+++ b/Controls/Hero.xaml
@@ -6,8 +6,11 @@
xmlns:local="clr-namespace:ArenaHelper"
mc:Ignorable="d"
d:DesignHeight="200" d:DesignWidth="200">
+
+
+
-
+
diff --git a/Plugin.cs b/Plugin.cs
index 8d794a4..2fd2c73 100644
--- a/Plugin.cs
+++ b/Plugin.cs
@@ -117,6 +117,7 @@ public class ArenaData
public List detectedheroes;
public string pickedhero;
public List> detectedcards;
+ public List> cardrating;
public List pickedcards;
public ArenaData()
@@ -126,6 +127,7 @@ public ArenaData()
detectedheroes = new List();
pickedhero = "";
detectedcards = new List>();
+ cardrating = new List>();
pickedcards = new List();
}
}
@@ -135,6 +137,7 @@ public enum PluginState { Idle, SearchHeroes, SearchBigHero, DetectedHeroes, Sea
private List detectedcards = new List();
private List detectedheroes = new List();
private List detectedbighero = new List();
+ private List currentcardvalues = new List();
private static PluginState state;
private List mouseindex = new List();
private ArenaData arenadata = new ArenaData();
@@ -251,7 +254,7 @@ public string Author
public Version Version
{
- get { return new Version("0.8.4"); }
+ get { return new Version("0.8.5"); }
}
public MenuItem MenuItem
@@ -775,6 +778,8 @@ private void LoadArenaData(string filename)
// Set the data
arenadata = loadedarenadata;
validarenadata = true;
+
+ Log.Info("Arena Helper: Card Rating: " + arenadata.cardrating.Count);
}
else
{
@@ -883,6 +888,7 @@ private void NewArena()
arenadata.detectedheroes.Clear();
arenadata.pickedhero = "";
arenadata.detectedcards.Clear();
+ arenadata.cardrating.Clear();
arenadata.pickedcards.Clear();
// Invalidate arena
@@ -1248,6 +1254,7 @@ private void SetState(PluginState newstate)
arenawindow.ConfigureHeroPanel.Visibility = System.Windows.Visibility.Visible;
arenawindow.HeroPanel.Visibility = System.Windows.Visibility.Hidden;
arenawindow.CardPanel.Visibility = System.Windows.Visibility.Hidden;
+ arenawindow.DonePanel.Visibility = System.Windows.Visibility.Hidden;
} else if (!stablearena && state != PluginState.Done)
{
ShowOverlay(false);
@@ -1257,6 +1264,7 @@ private void SetState(PluginState newstate)
arenawindow.ConfigureHeroPanel.Visibility = System.Windows.Visibility.Hidden;
arenawindow.HeroPanel.Visibility = System.Windows.Visibility.Hidden;
arenawindow.CardPanel.Visibility = System.Windows.Visibility.Hidden;
+ arenawindow.DonePanel.Visibility = System.Windows.Visibility.Hidden;
}
else if (newstate == PluginState.SearchHeroes)
{
@@ -1269,6 +1277,7 @@ private void SetState(PluginState newstate)
arenawindow.ConfigureHeroPanel.Visibility = System.Windows.Visibility.Hidden;
arenawindow.HeroPanel.Visibility = System.Windows.Visibility.Hidden;
arenawindow.CardPanel.Visibility = System.Windows.Visibility.Hidden;
+ arenawindow.DonePanel.Visibility = System.Windows.Visibility.Hidden;
}
else if (newstate == PluginState.SearchBigHero)
{
@@ -1278,6 +1287,7 @@ private void SetState(PluginState newstate)
arenawindow.ConfigureHeroPanel.Visibility = System.Windows.Visibility.Hidden;
arenawindow.HeroPanel.Visibility = System.Windows.Visibility.Visible;
arenawindow.CardPanel.Visibility = System.Windows.Visibility.Hidden;
+ arenawindow.DonePanel.Visibility = System.Windows.Visibility.Hidden;
}
else if (newstate == PluginState.DetectedHeroes)
{
@@ -1287,6 +1297,7 @@ private void SetState(PluginState newstate)
arenawindow.ConfigureHeroPanel.Visibility = System.Windows.Visibility.Hidden;
arenawindow.HeroPanel.Visibility = System.Windows.Visibility.Visible;
arenawindow.CardPanel.Visibility = System.Windows.Visibility.Hidden;
+ arenawindow.DonePanel.Visibility = System.Windows.Visibility.Hidden;
}
else if (newstate == PluginState.SearchCards)
{
@@ -1300,6 +1311,7 @@ private void SetState(PluginState newstate)
arenawindow.ConfigureHeroPanel.Visibility = System.Windows.Visibility.Hidden;
arenawindow.HeroPanel.Visibility = System.Windows.Visibility.Hidden;
arenawindow.CardPanel.Visibility = System.Windows.Visibility.Hidden;
+ arenawindow.DonePanel.Visibility = System.Windows.Visibility.Hidden;
}
else if (newstate == PluginState.SearchCardValues)
{
@@ -1312,6 +1324,7 @@ private void SetState(PluginState newstate)
arenawindow.ConfigureHeroPanel.Visibility = System.Windows.Visibility.Hidden;
arenawindow.HeroPanel.Visibility = System.Windows.Visibility.Hidden;
arenawindow.CardPanel.Visibility = System.Windows.Visibility.Hidden;
+ arenawindow.DonePanel.Visibility = System.Windows.Visibility.Hidden;
}
else if (newstate == PluginState.DetectedCards)
{
@@ -1320,15 +1333,18 @@ private void SetState(PluginState newstate)
arenawindow.ConfigureHeroPanel.Visibility = System.Windows.Visibility.Hidden;
arenawindow.HeroPanel.Visibility = System.Windows.Visibility.Hidden;
arenawindow.CardPanel.Visibility = System.Windows.Visibility.Visible;
+ arenawindow.DonePanel.Visibility = System.Windows.Visibility.Hidden;
}
else if (newstate == PluginState.Done)
{
+ arenawindow.DeckRatingControl1.DeckRatingText.Text = GetDeckRating().ToString("0.##", System.Globalization.CultureInfo.InvariantCulture);
+
ShowOverlay(false);
- SetDetectingText("Done", DoneMessage, "");
- arenawindow.DetectingPanel.Visibility = System.Windows.Visibility.Visible;
+ arenawindow.DetectingPanel.Visibility = System.Windows.Visibility.Hidden;
arenawindow.ConfigureHeroPanel.Visibility = System.Windows.Visibility.Hidden;
arenawindow.HeroPanel.Visibility = System.Windows.Visibility.Hidden;
arenawindow.CardPanel.Visibility = System.Windows.Visibility.Hidden;
+ arenawindow.DonePanel.Visibility = System.Windows.Visibility.Visible;
}
}
@@ -1838,11 +1854,11 @@ private async Task SearchCardValues()
// Get the actual numerical value
double maxvalue = 0;
- List cardvalues = new List();
+ currentcardvalues.Clear();
for (int i = 0; i < 3; i++)
{
double dval = GetNumericalValue(values[i]);
- cardvalues.Add(dval);
+ currentcardvalues.Add(dval);
if (i == 0 || dval > maxvalue)
{
@@ -1856,7 +1872,7 @@ private async Task SearchCardValues()
SetValueText(i, values[i]);
// Highlight the card with the highest value, if no cards are missing
- if (!missing && cardvalues[i] == maxvalue)
+ if (!missing && currentcardvalues[i] == maxvalue)
{
valueoverlays[i].GradientStop1.Color = System.Windows.Media.Color.FromArgb(0xFF, 0xf5, 0xdb, 0x4c);
valueoverlays[i].GradientStop2.Color = System.Windows.Media.Color.FromArgb(0xFF, 0x8b, 0x68, 0x11);
@@ -2055,7 +2071,22 @@ private void PickCard(int pickindex)
Log.Info("AH: Missed a pick");
}
+ // Add picked card
arenadata.pickedcards.Add(cardid);
+
+ // Add card rating
+ double cardval0 = 0;
+ double cardval1 = 0;
+ double cardval2 = 0;
+ if (currentcardvalues.Count == 3)
+ {
+ cardval0 = currentcardvalues[0];
+ cardval1 = currentcardvalues[1];
+ cardval2 = currentcardvalues[2];
+ }
+ arenadata.cardrating.Add(new Tuple(cardval0, cardval1, cardval2));
+
+ // Save
SaveArenaData();
plugins.CardPicked(arenadata, pickindex, pickedcard);
@@ -2141,6 +2172,47 @@ private void UpdateTitle()
{
arenawindow.Header.Text = "Picking card " + (arenadata.pickedcards.Count + 1) + "/" + MaxCardCount;
arenawindow.DeckName.Content = arenadata.deckname;
+ arenawindow.DeckRatingControl0.DeckRatingText.Text = GetDeckRating().ToString("0.##", System.Globalization.CultureInfo.InvariantCulture);
+ }
+
+ private double GetDeckRating()
+ {
+ int pcount = arenadata.pickedcards.Count;
+ int dcount = arenadata.detectedcards.Count;
+ int ccount = arenadata.cardrating.Count;
+
+ // Check if valid counts
+ if (!(pcount > 0 && pcount <= dcount && pcount == ccount))
+ {
+ return 0;
+ }
+
+ // Calculate total rating
+ double totalrating = 0;
+ for (int i = 0; i < pcount; i++)
+ {
+ string curcard = arenadata.pickedcards[i];
+ double curcardval = 0;
+ if (curcard == arenadata.detectedcards[i].Item1)
+ {
+ curcardval = arenadata.cardrating[i].Item1;
+ }
+ else if (curcard == arenadata.detectedcards[i].Item2)
+ {
+ curcardval = arenadata.cardrating[i].Item2;
+ }
+ else if (curcard == arenadata.detectedcards[i].Item3)
+ {
+ curcardval = arenadata.cardrating[i].Item3;
+ }
+
+ totalrating += curcardval;
+ }
+
+
+ // Return average
+ double deckrating = totalrating / (double)pcount;
+ return deckrating;
}
private void SetDetectingText(string title, string text, string text2)