Skip to content

Commit

Permalink
Merge pull request #60 from batstyx/master
Browse files Browse the repository at this point in the history
Changes made May 20, 2020 onwards
  • Loading branch information
RedHatter authored Jun 1, 2021
2 parents e73876c + a529115 commit 543a9ce
Show file tree
Hide file tree
Showing 39 changed files with 1,151 additions and 202 deletions.
9 changes: 4 additions & 5 deletions Graveyard/AnyfinView.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
using System.Linq;
using System.Windows;
using System.Collections.Generic;
using Hearthstone_Deck_Tracker;
using Hearthstone_Deck_Tracker.Hearthstone;
using HDT.Plugins.Graveyard.Resources;
using System.Collections.Generic;
using System.Linq;
using System.Windows;

namespace HDT.Plugins.Graveyard
{
Expand All @@ -20,7 +19,7 @@ public static bool isValid()
public AnyfinView()
{
// Section Label
Label.Text = Strings.Anyfin;
Label.Text = Strings.GetLocalized("Anyfin");

// Damage Label
_dmg = new HearthstoneTextBlock();
Expand Down
10 changes: 2 additions & 8 deletions Graveyard/CavernsView.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
using HDT.Plugins.Graveyard.Resources;
using Hearthstone_Deck_Tracker;
using Hearthstone_Deck_Tracker;
using Hearthstone_Deck_Tracker.Hearthstone;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace HDT.Plugins.Graveyard
{
Expand All @@ -19,7 +13,7 @@ public static bool isValid()
public CavernsView()
{
// Section Label
Label.Text = Strings.Caverns;
Label.Text = Strings.GetLocalized("Caverns");
}

public bool Update(Card card)
Expand Down
11 changes: 4 additions & 7 deletions Graveyard/DeathrattleView.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
using HDT.Plugins.Graveyard.Resources;
using Hearthstone_Deck_Tracker;
using Hearthstone_Deck_Tracker;
using Hearthstone_Deck_Tracker.Hearthstone;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace HDT.Plugins.Graveyard
{
Expand All @@ -14,6 +9,8 @@ public class DeathrattleView : NormalView
public static bool isValid()
{
return Core.Game.Player.PlayerCardList.FindIndex(card =>
card.Id == HearthDb.CardIds.Collectible.Hunter.JewelOfNzoth ||
card.Id == HearthDb.CardIds.Collectible.Neutral.Vectus ||
card.Id == HearthDb.CardIds.Collectible.Hunter.NineLives ||
card.Id == HearthDb.CardIds.Collectible.Neutral.DaUndatakah ||
card.Id == HearthDb.CardIds.Collectible.Priest.TwilightsCall
Expand All @@ -23,7 +20,7 @@ public static bool isValid()
public DeathrattleView()
{
// Section Label
Label.Text = Strings.Deathrattle;
Label.Text = Strings.GetLocalized("Deathrattle");
}

public bool Update(Card card)
Expand Down
3 changes: 1 addition & 2 deletions Graveyard/DiscardView.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
using HDT.Plugins.Graveyard.Resources;
using Hearthstone_Deck_Tracker;
using Hearthstone_Deck_Tracker.Hearthstone;

Expand All @@ -16,7 +15,7 @@ public static bool isValid()
public DiscardView()
{
// Section Label
Label.Text = Strings.DiscardTitle;
Label.Text = Strings.GetLocalized("DiscardTitle");
}

public bool Update(Card card)
Expand Down
10 changes: 2 additions & 8 deletions Graveyard/DragoncallerAlannaView.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using HDT.Plugins.Graveyard.Resources;
using Hearthstone_Deck_Tracker;
using Hearthstone_Deck_Tracker;
using Hearthstone_Deck_Tracker.Hearthstone;

namespace HDT.Plugins.Graveyard
Expand All @@ -18,7 +12,7 @@ public static bool isValid()

public DragoncallerAlannaView()
{
Label.Text = Strings.Alanna;
Label.Text = Strings.GetLocalized("Alanna");
}

public bool Update(Card card)
Expand Down
23 changes: 23 additions & 0 deletions Graveyard/EnumToBoolConverter.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Data;

namespace HDT.Plugins.Graveyard
{
public class EnumToBoolConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
return ((Enum)value).HasFlag((Enum)parameter);
}

public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
return value.Equals(true) ? parameter : Binding.DoNothing;
}
}
}
37 changes: 35 additions & 2 deletions Graveyard/Graveyard.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ public class Graveyard
public SoulwardenView Soulwarden;
public ZuljinView Zuljin;
public HoardPillagerView HoardPillager;
public LadyLiadrinView LadyLiadrin;
public NZothGotDView NZothGotD;
public RallyView Rally;
public SaurfangView Saurfang;

private StackPanel _friendlyPanel;
private StackPanel _enemyPanel;
Expand All @@ -54,7 +58,7 @@ public Graveyard()

// Create container
_friendlyPanel = new StackPanel();
_friendlyPanel.Orientation = Orientation.Vertical;
_friendlyPanel.Orientation = Settings.Default.FriendlyOrientation;
Core.OverlayCanvas.Children.Add(_friendlyPanel);
Canvas.SetTop(_friendlyPanel, Settings.Default.PlayerTop);
Canvas.SetLeft(_friendlyPanel, Settings.Default.PlayerLeft);
Expand Down Expand Up @@ -82,6 +86,7 @@ public Graveyard()
//on year change clear out the grid and update the data
private void SettingsChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
{
_friendlyPanel.Orientation = Settings.Default.FriendlyOrientation;
_friendlyPanel.RenderTransform = new ScaleTransform(Settings.Default.FriendlyScale / 100, Settings.Default.FriendlyScale / 100);
_friendlyPanel.Opacity = Settings.Default.FriendlyOpacity / 100;
_enemyPanel.RenderTransform = new ScaleTransform(Settings.Default.EnemyScale / 100, Settings.Default.EnemyScale / 100);
Expand Down Expand Up @@ -288,6 +293,30 @@ public void Reset()
{
HoardPillager = null;
}
if (Settings.Default.LadyLiadrinEnabled && LadyLiadrinView.isValid())
{
LadyLiadrin = new LadyLiadrinView();
_friendlyPanel.Children.Add(LadyLiadrin);
}
else
{
LadyLiadrin = null;
}
if (Settings.Default.NZothGotDEnabled && NZothGotDView.isValid())
{
NZothGotD = new NZothGotDView();
_friendlyPanel.Children.Add(NZothGotD);
}
if (Settings.Default.RallyEnabled && RallyView.isValid())
{
Rally = new RallyView();
_friendlyPanel.Children.Add(Rally);
}
if (Settings.Default.SaurfangEnabled && SaurfangView.isValid())
{
Saurfang = new SaurfangView();
_friendlyPanel.Children.Add(Saurfang);
}
}

public void PlayerGraveyardUpdate(Card card)
Expand All @@ -302,7 +331,10 @@ public void PlayerGraveyardUpdate(Card card)
var kangor = Kangor?.Update(card) ?? false;
var witching = WitchingHour?.Update(card) ?? false;
var hoardpillager = HoardPillager?.Update(card) ?? false;
if (!(any || deathrattle || nzoth || hadr || guldan || rez || mulch || kangor || witching || hoardpillager))
var nzothgotd = NZothGotD?.Update(card) ?? false;
var rally = Rally?.Update(card) ?? false;
var saurfang = Saurfang?.Update(card) ?? false;
if (!(any || deathrattle || nzoth || hadr || guldan || rez || mulch || kangor || witching || hoardpillager || nzothgotd || rally || saurfang))
{
Normal?.Update(card);
}
Expand All @@ -327,6 +359,7 @@ public void PlayerPlayUpdate(Card card)
Caverns?.Update(card);
TessGreymane?.Update(card);
Zuljin?.Update(card);
LadyLiadrin?.Update(card);
}
}
}
12 changes: 12 additions & 0 deletions Graveyard/Graveyard.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -75,22 +75,28 @@
<Compile Include="ChancesTracker.cs" />
<Compile Include="DeathrattleView.cs" />
<Compile Include="DragoncallerAlannaView.cs" />
<Compile Include="EnumToBoolConverter.cs" />
<Compile Include="HadronoxView.cs" />
<Compile Include="GuldanView.cs" />
<Compile Include="HoardPillagerView.cs" />
<Compile Include="KangorView.cs" />
<Compile Include="LadyLiadrinView.cs" />
<Compile Include="MulchmuncherView.cs" />
<Compile Include="NZothGotDView.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="DiscardView.cs" />
<Compile Include="GraveyardPlugin.cs" />
<Compile Include="AnyfinCalculator.cs" />
<Compile Include="AnyfinView.cs" />
<Compile Include="NormalView.cs" />
<Compile Include="RallyView.cs" />
<Compile Include="Resources\Strings.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Strings.resx</DependentUpon>
</Compile>
<Compile Include="SaurfangView.cs" />
<Compile Include="Strings.cs" />
<Compile Include="ResurrectView.cs" />
<Compile Include="NZothView.cs" />
<Compile Include="InputManager.cs" />
Expand Down Expand Up @@ -123,15 +129,21 @@
<PackageReference Include="MahApps.Metro">
<Version>1.6.5</Version>
</PackageReference>
<PackageReference Include="WPFLocalizeExtension">
<Version>3.5.0</Version>
</PackageReference>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Resources\Strings.resx">
<Generator>PublicResXFileCodeGenerator</Generator>
<LastGenOutput>Strings.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="Resources\Strings.zh-CN.resx" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Target Name="AfterBuild" Condition=" '$(Configuration)' == 'Debug' ">
<Copy SourceFiles="bin/x86/Debug/Graveyard.dll" DestinationFolder="$(AppData)\HearthstoneDeckTracker\Plugins" />
<Copy SourceFiles="bin/x86/Debug/zh-CN/Graveyard.resources.dll" DestinationFolder="$(AppData)\HearthstoneDeckTracker\Plugins\zh-CN" />
</Target>
</Project>
12 changes: 5 additions & 7 deletions Graveyard/GraveyardPlugin.cs
Original file line number Diff line number Diff line change
@@ -1,19 +1,17 @@
using Hearthstone_Deck_Tracker.Plugins;
using System;
using System.Reflection;
using System.Windows.Controls;
using HDT.Plugins.Graveyard.Resources;
using Hearthstone_Deck_Tracker.Plugins;

namespace HDT.Plugins.Graveyard
{
public class GraveyardPlugin : IPlugin
public class GraveyardPlugin : IPlugin
{
public Graveyard GraveyardInstance;
public string Author => "RedHatter";
public string ButtonText => Strings.Settings;

public string ButtonText => Strings.GetLocalized("Settings");

public string Description => Strings.GraveyardDescription;
public string Description => Strings.GetLocalized("GraveyardDescription");

public MenuItem MenuItem => null;
public string Name => "Graveyard";
Expand All @@ -24,7 +22,7 @@ public void OnUnload()
{
Settings.Default.Save();

GraveyardInstance.Dispose();
GraveyardInstance?.Dispose();
GraveyardInstance = null;
}
public void OnUpdate() { }
Expand Down
15 changes: 11 additions & 4 deletions Graveyard/GuldanView.cs
Original file line number Diff line number Diff line change
@@ -1,25 +1,32 @@
using HDT.Plugins.Graveyard.Resources;
using Hearthstone_Deck_Tracker;
using Hearthstone_Deck_Tracker.Hearthstone;
using static HearthDb.CardIds.Collectible;

namespace HDT.Plugins.Graveyard
{
public class GuldanView : NormalView
{
private ChancesTracker _chances = new ChancesTracker();

public static bool isValid()
{
return Core.Game.Player.PlayerCardList.FindIndex(card => card.Id == HearthDb.CardIds.Collectible.Warlock.BloodreaverGuldan) > -1;
return Core.Game.Player.PlayerCardList.FindIndex(card => card.Id == Warlock.BloodreaverGuldan || card.Id == Warlock.KanrethadEbonlocke) > -1;
}

public GuldanView()
{
// Section Label
Label.Text = Strings.Guldan;
Label.Text = Strings.GetLocalized("Guldan");
}

public bool Update(Card card)
{
return card.Race == "Demon" && base.Update(card);
var update = card.Race == "Demon" && base.Update(card);

if (update)
_chances.Update(card, Cards, View);

return update;
}
}
}
5 changes: 2 additions & 3 deletions Graveyard/HadronoxView.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using System.Linq;
using HDT.Plugins.Graveyard.Resources;
using Hearthstone_Deck_Tracker;
using Hearthstone_Deck_Tracker.Hearthstone;
using System.Linq;

namespace HDT.Plugins.Graveyard
{
Expand All @@ -15,7 +14,7 @@ public static bool isValid()
public HadronoxView()
{
// Section Label
Label.Text = Strings.Hadronox;
Label.Text = Strings.GetLocalized("Hadronox");
}

public bool Update(Card card)
Expand Down
10 changes: 2 additions & 8 deletions Graveyard/HoardPillagerView.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
using HDT.Plugins.Graveyard.Resources;
using Hearthstone_Deck_Tracker;
using Hearthstone_Deck_Tracker;
using Hearthstone_Deck_Tracker.Hearthstone;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace HDT.Plugins.Graveyard
{
Expand All @@ -21,7 +15,7 @@ public static bool isValid()

public HoardPillagerView()
{
Label.Text = Strings.HoardPillager;
Label.Text = Strings.GetLocalized("HoardPillager");
}

public bool Update(Card card)
Expand Down
Loading

0 comments on commit 543a9ce

Please sign in to comment.