diff --git a/Graveyard.csproj b/Graveyard.csproj index d9665be..46c9e9c 100644 --- a/Graveyard.csproj +++ b/Graveyard.csproj @@ -53,6 +53,8 @@ + + diff --git a/README.md b/README.md index 829e9c6..8191718 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,13 @@ Displays Murlocs killed by both the player and opponent as well as a damage calc * **N'Zoth the Corruptor** Displays deathrattle minions that have died. -* **Resurrect** or **Onyx Bishop** or **Kazakus** +* **Hadronox** +Displays taunt minions that have died. + +* **Bloodraver Gul'dan** +Displays friendly demons that have died. + +* **Resurrect** or **Onyx Bishop** or **Eternal Servitude** or **Kazakus** Displays resurrect chance next to each minion that has died. * **Cruel Dinomancer** diff --git a/src/ChancesTracker.cs b/src/ChancesTracker.cs new file mode 100644 index 0000000..774e205 --- /dev/null +++ b/src/ChancesTracker.cs @@ -0,0 +1,39 @@ +using System; +using System.Linq; +using System.Windows; +using System.Windows.Shapes; +using System.Windows.Controls; +using System.Collections.Generic; +using Hearthstone_Deck_Tracker; +using Hearthstone_Deck_Tracker.Controls; +using Card = Hearthstone_Deck_Tracker.Hearthstone.Card; + +namespace HDT.Plugins.Graveyard +{ + public class ChancesTracker + { + private Dictionary _chances = new Dictionary(); + + public void Update(Card card, List Cards, AnimatedCardList View) + { + var count = (double)Cards.Aggregate(0, (total, c) => total + c.Count); + for (var i = 0; i < Cards.Count(); i++) + { + if (!_chances.ContainsKey(Cards[i])) + { + var chance = new HearthstoneTextBlock(); + chance.FontSize = 18; + chance.TextAlignment = TextAlignment.Left; + var grid = (View.Items.GetItemAt(i) as UserControl).Content as Grid; + grid.Width = 260; + (grid.Children[0] as Hearthstone_Deck_Tracker.Controls.Card).HorizontalAlignment = HorizontalAlignment.Right; + (grid.Children[1] as Rectangle).Width = 260; + grid.Children.Add(chance); + _chances.Add(Cards[i], chance); + } + + _chances[Cards[i]].Text = $"{Math.Round(Cards[i].Count / count * 100)}%"; + } + } + } +} diff --git a/src/DiscardView.cs b/src/DiscardView.cs index 3dd5cad..bf20feb 100644 --- a/src/DiscardView.cs +++ b/src/DiscardView.cs @@ -1,9 +1,3 @@ -using System; -using System.Linq; -using System.Windows; -using System.Windows.Shapes; -using System.Windows.Controls; -using System.Collections.Generic; using Hearthstone_Deck_Tracker; using Hearthstone_Deck_Tracker.Hearthstone; @@ -11,7 +5,7 @@ namespace HDT.Plugins.Graveyard { public class DiscardView : NormalView { - private Dictionary _chances; + private ChancesTracker _chances = new ChancesTracker(); public static bool isValid() { @@ -22,8 +16,6 @@ public DiscardView() { // Section Label Label.Text = "Discarded"; - - _chances = new Dictionary(); } new public bool Update(Card card) @@ -34,24 +26,7 @@ public DiscardView() } // Silverware Golem and Clutchmother Zaras are still counted as discarded, even when their effects trigger - var count = (double)Cards.Aggregate(0, (total, c) => total + c.Count); - for (var i = 0; i < Cards.Count(); i++) - { - if (!_chances.ContainsKey(Cards[i])) - { - var chance = new HearthstoneTextBlock(); - chance.FontSize = 18; - chance.TextAlignment = TextAlignment.Left; - var grid = (View.Items.GetItemAt(i) as UserControl).Content as Grid; - grid.Width = 260; - (grid.Children[0] as Rectangle).HorizontalAlignment = HorizontalAlignment.Right; - (grid.Children[1] as Rectangle).Width = 260; - grid.Children.Add(chance); - _chances.Add(Cards[i], chance); - } - - _chances[Cards[i]].Text = $"{Math.Round(Cards[i].Count / count * 100)}%"; - } + _chances.Update(card, Cards, View); return true; } diff --git a/src/Graveyard.cs b/src/Graveyard.cs index 0b608c1..7f1953a 100644 --- a/src/Graveyard.cs +++ b/src/Graveyard.cs @@ -20,6 +20,7 @@ public class Graveyard public ResurrectView Resurrect; public AnyfinView Anyfin; public NZothView NZoth; + public HadronoxView Hadronox; public DiscardView Discard; public GuldanView Guldan; @@ -136,6 +137,16 @@ public void Reset() NZoth = null; } + if (Settings.Default.HadronoxEnabled && HadronoxView.isValid()) + { + Hadronox = new HadronoxView(); + _friendlyPanel.Children.Add(Hadronox); + } + else + { + Hadronox = null; + } + if (Settings.Default.DiscardEnabled && DiscardView.isValid()) { Discard = new DiscardView(); @@ -161,9 +172,10 @@ public void PlayerGraveyardUpdate(Card card) { var any = Anyfin?.Update(card) ?? false; var nzoth = NZoth?.Update(card) ?? false; - var rez = Resurrect?.Update(card) ?? false; + var hadr = Hadronox?.Update(card) ?? false; var guldan = Guldan?.Update(card) ?? false; - if (!(any || nzoth || rez || guldan)) + var rez = Resurrect?.Update(card) ?? false; + if (!(any || nzoth || hadr || guldan || rez)) { Normal?.Update(card); } diff --git a/src/GraveyardPlugin.cs b/src/GraveyardPlugin.cs index 5cbec9b..2404191 100644 --- a/src/GraveyardPlugin.cs +++ b/src/GraveyardPlugin.cs @@ -20,7 +20,13 @@ public string ButtonText public string Description { - get { return "Displays minions that have died this game. Includes specialized displays: deathrattle minions for N'Zoth decks, resurrect chance for Resurrect Priest, and Murloc minions with a damage calculator for Anyfin Can Happen."; } + get { return @"Displays minions that have died this game. Includes specialized displays: +deathrattle minions for N'Zoth, +taunt minions for Hadronox, +demons for Bloodreaver Gul'dan, +resurrect chance for priest resurrect cards, +Murloc minions with a damage calculator for Anyfin Can Happen, +and resurrect chance for Cruel Dinomancer."; } } public MenuItem MenuItem @@ -53,7 +59,7 @@ public void OnUpdate() {} public Version Version { - get { return new Version(1, 2, 0); } + get { return new Version(1, 3, 0); } } } } diff --git a/src/GuldanView.cs b/src/GuldanView.cs index 370c87d..725ac74 100644 --- a/src/GuldanView.cs +++ b/src/GuldanView.cs @@ -1,4 +1,3 @@ -using System.Linq; using Hearthstone_Deck_Tracker; using Hearthstone_Deck_Tracker.Hearthstone; diff --git a/src/HadronoxView.cs b/src/HadronoxView.cs new file mode 100644 index 0000000..ddebf53 --- /dev/null +++ b/src/HadronoxView.cs @@ -0,0 +1,25 @@ +using System.Linq; +using Hearthstone_Deck_Tracker; +using Hearthstone_Deck_Tracker.Hearthstone; + +namespace HDT.Plugins.Graveyard +{ + public class HadronoxView : NormalView + { + public static bool isValid() + { + return Core.Game.Player.PlayerCardList.FindIndex(card => card.Id == HearthDb.CardIds.Collectible.Druid.Hadronox) > -1; + } + + public HadronoxView() + { + // Section Label + Label.Text = "Hadronox"; + } + + new public bool Update(Card card) + { + return card.Mechanics.Contains("Taunt") && base.Update(card); + } + } +} diff --git a/src/Properties/AssemblyInfo.cs b/src/Properties/AssemblyInfo.cs index 73d3e87..702ed13 100644 --- a/src/Properties/AssemblyInfo.cs +++ b/src/Properties/AssemblyInfo.cs @@ -32,5 +32,5 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.2.0.0")] -[assembly: AssemblyFileVersion("1.2.0.0")] +[assembly: AssemblyVersion("1.3.0.0")] +[assembly: AssemblyFileVersion("1.3.0.0")] diff --git a/src/ResurrectView.cs b/src/ResurrectView.cs index 351a9d4..d66fc7b 100644 --- a/src/ResurrectView.cs +++ b/src/ResurrectView.cs @@ -1,9 +1,3 @@ -using System; -using System.Linq; -using System.Windows; -using System.Windows.Shapes; -using System.Windows.Controls; -using System.Collections.Generic; using Hearthstone_Deck_Tracker; using Hearthstone_Deck_Tracker.Hearthstone; @@ -11,7 +5,7 @@ namespace HDT.Plugins.Graveyard { public class ResurrectView : NormalView { - private Dictionary _chances; + private ChancesTracker _chances = new ChancesTracker(); public static bool isValid() { @@ -27,8 +21,6 @@ public ResurrectView() { // Section Label Label.Text = "Resurrect"; - - _chances = new Dictionary(); } new public bool Update(Card card) @@ -38,24 +30,7 @@ public ResurrectView() return false; } - var count = (double)Cards.Aggregate(0, (total, c) => total + c.Count); - for (var i = 0; i < Cards.Count(); i++) - { - if (!_chances.ContainsKey(Cards[i])) - { - var chance = new HearthstoneTextBlock(); - chance.FontSize = 18; - chance.TextAlignment = TextAlignment.Left; - var grid = (View.Items.GetItemAt(i) as UserControl).Content as Grid; - grid.Width = 260; - (grid.Children[0] as Rectangle).HorizontalAlignment = HorizontalAlignment.Right; - (grid.Children[1] as Rectangle).Width = 260; - grid.Children.Add(chance); - _chances.Add(Cards[i], chance); - } - - _chances[Cards[i]].Text = $"{Math.Round(Cards[i].Count / count * 100)}%"; - } + _chances.Update(card, Cards, View); return true; } diff --git a/src/Settings.Designer.cs b/src/Settings.Designer.cs index 657f87a..1f4431c 100644 --- a/src/Settings.Designer.cs +++ b/src/Settings.Designer.cs @@ -193,6 +193,18 @@ public bool DiscardEnabled { } } + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("True")] + public bool HadronoxEnabled { + get { + return ((bool)(this["HadronoxEnabled"])); + } + set { + this["HadronoxEnabled"] = value; + } + } + [global::System.Configuration.UserScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Configuration.DefaultSettingValueAttribute("True")] diff --git a/src/Settings.settings b/src/Settings.settings index 049aa0b..b0d28fd 100644 --- a/src/Settings.settings +++ b/src/Settings.settings @@ -47,5 +47,11 @@ True + + True + + + True + diff --git a/src/SettingsView.xaml b/src/SettingsView.xaml index 71f3d42..4cae7f5 100644 --- a/src/SettingsView.xaml +++ b/src/SettingsView.xaml @@ -29,7 +29,7 @@