Skip to content

Commit

Permalink
Settings Changes
Browse files Browse the repository at this point in the history
- Plugin Settings Folder
Graveyard.xml -> Plugin.Graveyard\Settings.xml
- Convert Position settings from pixels to percentages

Fixes
Update CardId references
Set to original set *not* to Wonders version
- Paladin
  - Silvermoon Portal
  - Lay on Hands
- Priest
  - Onyx Bishop
- Neutral
  -Street Trickster
  • Loading branch information
batstyx committed Sep 21, 2023
2 parents ab28b30 + 8bec8a0 commit ed45b9e
Show file tree
Hide file tree
Showing 22 changed files with 452 additions and 75 deletions.
42 changes: 27 additions & 15 deletions Graveyard/Graveyard.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using Hearthstone_Deck_Tracker.Enums;
using System.Collections.Generic;
using System.Linq;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;
using Card = Hearthstone_Deck_Tracker.Hearthstone.Card;
Expand Down Expand Up @@ -83,19 +84,19 @@ public class Graveyard
public Graveyard()
{

// Create container
EnemyPanel = new StackPanel();
EnemyPanel.Orientation = Orientation.Vertical;
Core.OverlayCanvas.Children.Add(EnemyPanel);
Canvas.SetTop(EnemyPanel, Settings.Default.EnemyTop);
Canvas.SetLeft(EnemyPanel, Settings.Default.EnemyLeft);
// Create container
EnemyPanel = new StackPanel
{
Orientation = Orientation.Vertical
};
Core.OverlayCanvas.Children.Add(EnemyPanel);

// Create container
FriendlyPanel = new StackPanel();
FriendlyPanel.Orientation = Settings.Default.FriendlyOrientation;
Core.OverlayCanvas.Children.Add(FriendlyPanel);
Canvas.SetTop(FriendlyPanel, Settings.Default.PlayerTop);
Canvas.SetLeft(FriendlyPanel, Settings.Default.PlayerLeft);
// Create container
FriendlyPanel = new StackPanel
{
Orientation = Settings.Default.FriendlyOrientation
};
Core.OverlayCanvas.Children.Add(FriendlyPanel);

Input = new InputManager(FriendlyPanel, EnemyPanel);

Expand Down Expand Up @@ -132,11 +133,22 @@ public void Update()
{
var visibility = (Core.Game.IsInMenu && Hearthstone_Deck_Tracker.Config.Instance.HideInMenu)
|| Core.Game.IsBattlegroundsMatch
|| Core.Game.IsMercenariesMatch ? System.Windows.Visibility.Collapsed : System.Windows.Visibility.Visible;
|| Core.Game.IsMercenariesMatch ? Visibility.Collapsed : Visibility.Visible;

FriendlyPanel.Visibility = visibility;
EnemyPanel.Visibility = visibility;
}
if (FriendlyPanel.Visibility == Visibility.Visible)
{
Canvas.SetTop(FriendlyPanel, Settings.Default.PlayerTop.PercentageToPixels(Core.OverlayWindow.Height));
Canvas.SetLeft(FriendlyPanel, Settings.Default.PlayerLeft.PercentageToPixels(Core.OverlayWindow.Width));
}

EnemyPanel.Visibility = visibility;
if (EnemyPanel.Visibility == Visibility.Visible)
{
Canvas.SetTop(EnemyPanel, Settings.Default.EnemyTop.PercentageToPixels(Core.OverlayWindow.Height));
Canvas.SetLeft(EnemyPanel, Settings.Default.EnemyLeft.PercentageToPixels(Core.OverlayWindow.Width));
}
}

/**
* Clear then recreate all Views.
Expand Down
4 changes: 4 additions & 0 deletions Graveyard/Graveyard.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,9 @@
<Compile Include="MenagerieView.cs" />
<Compile Include="MinionsCreatedView.cs" />
<Compile Include="MixtapeView.cs" />
<Compile Include="PositionHelpers.cs" />
<Compile Include="Properties\LibraryInfo.cs" />
<Compile Include="SettingsUpgrades\SettingsUpgradev0111.cs" />
<Compile Include="TyrsTearsView.cs" />
<Compile Include="ReanimateView.cs" />
<Compile Include="CardUpdatePoller.cs" />
Expand Down Expand Up @@ -167,6 +170,7 @@
<DependentUpon>Settings.settings</DependentUpon>
</Compile>
<None Include="app.config" />
<Compile Include="Settings.Default.cs" />
<None Include="Settings.settings">
<Generator>PublicSettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
Expand Down
13 changes: 6 additions & 7 deletions Graveyard/GraveyardPlugin.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using HDT.Plugins.Graveyard.Properties;
using Hearthstone_Deck_Tracker;
using Hearthstone_Deck_Tracker.API;
using Hearthstone_Deck_Tracker.Hearthstone;
Expand All @@ -14,19 +15,19 @@ public class Plugin : IPlugin
internal static EventManager Events { get; private set; }
internal static Graveyard Graveyard { get; private set; }
public string Author => "RedHatter";
public string ButtonText => Strings.GetLocalized("Settings");
public string ButtonText => Strings.GetLocalized(nameof(Resources.Strings.Settings));

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

public MenuItem MenuItem { get; set; }
public string Name => "Graveyard";
public string Name => LibraryInfo.Name;

public void OnButtonPress() => SettingsView.Flyout.IsOpen = true;
public void OnLoad()
{
Settings = Settings.Default;

MenuItem = new MenuItem { Header = Strings.GetLocalized("Graveyard") };
MenuItem = new MenuItem { Header = Strings.GetLocalized(nameof(Resources.Strings.Graveyard)) };
MenuItem.Click += (sender, args) => OnButtonPress();

Events = new EventManager();
Expand Down Expand Up @@ -91,8 +92,6 @@ public void OnUpdate()
Graveyard?.Update();
}

public static readonly Version AssemblyVersion = Assembly.GetExecutingAssembly().GetName().Version;
public static readonly Version PluginVersion = new Version(AssemblyVersion.Major, AssemblyVersion.Minor, AssemblyVersion.Build);
public Version Version => PluginVersion;
public Version Version => LibraryInfo.Version;
}
}
2 changes: 1 addition & 1 deletion Graveyard/ImpKingView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ internal static bool IsEponymousImp(Card card)
Warlock.ImprisonedScrapImp,
Warlock.TinyKnightOfEvilTGT,
Warlock.VulgarHomunculus,
Neutral.StreetTrickster,
Neutral.StreetTricksterGANGS,
Warlock.UnlicensedApothecary,
Neutral.SneakyDevil,
Warlock.EnvoyRustwix,
Expand Down
17 changes: 8 additions & 9 deletions Graveyard/InputManager.cs
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
using Hearthstone_Deck_Tracker;
using System;
using System.Windows;
using System.Windows.Controls;
using System.Collections.Generic;
using Hearthstone_Deck_Tracker;
using Core = Hearthstone_Deck_Tracker.API.Core;

namespace HDT.Plugins.Graveyard
{
public class InputManager
public class InputManager
{
private User32.MouseInput _mouseInput;
private StackPanel _player;
private StackPanel _enemy;
private readonly StackPanel _player;
private readonly StackPanel _enemy;

private String _selected;

Expand Down Expand Up @@ -58,12 +57,12 @@ private void MouseInputOnLmbUp(object sender, EventArgs eventArgs)
var p = Core.OverlayCanvas.PointFromScreen(new Point(pos.X, pos.Y));
if (_selected == "player")
{
Settings.Default.PlayerTop = p.Y;
Settings.Default.PlayerLeft = p.X;
Settings.Default.PlayerTop = p.Y.PixelsToPercentage(Core.OverlayWindow.Height);
Settings.Default.PlayerLeft = p.X.PixelsToPercentage(Core.OverlayWindow.Width);
} else if (_selected == "enemy")
{
Settings.Default.EnemyTop = p.Y;
Settings.Default.EnemyLeft = p.X;
Settings.Default.EnemyTop = p.Y.PixelsToPercentage(Core.OverlayWindow.Height);
Settings.Default.EnemyLeft = p.X.PixelsToPercentage(Core.OverlayWindow.Width);
}

_selected = null;
Expand Down
4 changes: 2 additions & 2 deletions Graveyard/LadyLiadrinView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ internal static ViewConfig Config
// 4
Paladin.BlessingOfKingsCore,
//Paladin.HammerOfWrath,
Paladin.SilvermoonPortal,
Paladin.SilvermoonPortalKARA,
// 5
Paladin.BlessedChampion,
Paladin.BlessingOfAuthority,
Expand All @@ -69,7 +69,7 @@ internal static ViewConfig Config
Paladin.SpikeridgedSteed,
// 8
Paladin.Dinosize,
Paladin.LayOnHands,
Paladin.LayOnHandsExpert1,
// 9
Paladin.LibramOfHope,
// 10
Expand Down
8 changes: 8 additions & 0 deletions Graveyard/PositionHelpers.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
namespace HDT.Plugins.Graveyard
{
public static class PositionHelpers
{
public static double PixelsToPercentage(this double value, double size) => value * 100 / size;
public static double PercentageToPixels(this double value, double size) => size * value / 100;
}
}
4 changes: 2 additions & 2 deletions Graveyard/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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.10.22.0")]
[assembly: AssemblyFileVersion("1.10.22.0")]
[assembly: AssemblyVersion("1.11.0.0")]
[assembly: AssemblyFileVersion("1.11.0.0")]
14 changes: 14 additions & 0 deletions Graveyard/Properties/LibraryInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
using System;
using System.Reflection;

namespace HDT.Plugins.Graveyard.Properties
{
public static class LibraryInfo
{
public static readonly AssemblyName AssemblyName = Assembly.GetExecutingAssembly().GetName();
public static readonly Version AssemblyVersion = AssemblyName.Version;

public static string Name = AssemblyName.Name;
public static readonly Version Version = new Version(AssemblyVersion.Major, AssemblyVersion.Minor, AssemblyVersion.Build);
}
}
54 changes: 54 additions & 0 deletions Graveyard/Resources/Strings.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 18 additions & 0 deletions Graveyard/Resources/Strings.resx
Original file line number Diff line number Diff line change
Expand Up @@ -226,9 +226,27 @@ This version built from https://github.com/batstyx/Graveyard</value>
<data name="SettingsDisplayTitle" xml:space="preserve">
<value>Display</value>
</data>
<data name="SettingsHorizontal" xml:space="preserve">
<value>Horizontal</value>
</data>
<data name="SettingsHorizontalTooltip" xml:space="preserve">
<value>% Screen Position (Left &lt;-&gt; Right)</value>
</data>
<data name="SettingsPositionTitle" xml:space="preserve">
<value>Position</value>
</data>
<data name="SettingsResetButtonTooltip" xml:space="preserve">
<value>Reset to Default</value>
</data>
<data name="SettingsTitle" xml:space="preserve">
<value>Graveyard Settings</value>
</data>
<data name="SettingsVertical" xml:space="preserve">
<value>Vertical</value>
</data>
<data name="SettingsVerticalTooltip" xml:space="preserve">
<value>% Screen Position (Top &lt;-&gt; Bottom)</value>
</data>
<data name="SI7" xml:space="preserve">
<value>SI:7</value>
</data>
Expand Down
2 changes: 1 addition & 1 deletion Graveyard/ResurrectView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ internal static ViewConfig Config
Neutral.BodyWrapper,
Priest.MassResurrection,
Priest.Resurrect,
Priest.OnyxBishop,
Priest.OnyxBishopKARA,
Priest.EternalServitudeICECROWN,
Priest.LesserDiamondSpellstone,
Neutral.Kazakus)
Expand Down
41 changes: 41 additions & 0 deletions Graveyard/Settings.Default.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
using System.Windows.Controls;

namespace HDT.Plugins.Graveyard
{
public sealed partial class Settings
{
private int GetDefaultIntValue(string key) => int.Parse(Properties[key].DefaultValue.ToString());
private double GetDefaultDblValue(string key) => double.Parse(Properties[key].DefaultValue.ToString());
public double DefaultPlayerLeft => GetDefaultDblValue(nameof(PlayerLeft));
public double DefaultPlayerTop => GetDefaultDblValue(nameof(PlayerTop));
public double DefaultEnemyLeft => GetDefaultDblValue(nameof(EnemyLeft));
public double DefaultEnemyTop => GetDefaultDblValue(nameof(EnemyTop));
public double DefaultFriendlyOpacity => GetDefaultDblValue(nameof(FriendlyOpacity));
public double DefaultFriendlyScale => GetDefaultDblValue(nameof(FriendlyScale));
public Orientation DefaultFriendlyOrientation => (Orientation)Properties[nameof(FriendlyOrientation)].DefaultValue;
public double DefaultEnemyOpacity => GetDefaultDblValue(nameof(EnemyOpacity));
public double DefaultEnemyScale => GetDefaultDblValue(nameof(EnemyScale));

public void ResetPlayerPosition()
{
PlayerLeft = DefaultPlayerLeft;
PlayerTop = DefaultPlayerTop;
}
public void ResetOpponentPosition()
{
EnemyLeft = DefaultEnemyLeft;
EnemyTop = DefaultEnemyTop;
}
public void ResetPlayerDisplay()
{
FriendlyOpacity = DefaultFriendlyOpacity;
FriendlyScale = DefaultFriendlyScale;
FriendlyOrientation = DefaultFriendlyOrientation;
}
public void ResetOpponentDisplay()
{
EnemyOpacity = DefaultEnemyOpacity;
EnemyScale = DefaultEnemyScale;
}
}
}
Loading

0 comments on commit ed45b9e

Please sign in to comment.