├── .gitignore ├── PluginExample.sln ├── PluginExample ├── Curvy.cs ├── CurvyList.xaml ├── CurvyList.xaml.cs ├── CurvyPlugin.cs ├── PluginExample.csproj └── Properties │ └── AssemblyInfo.cs └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | 4 | # User-specific files 5 | *.suo 6 | *.user 7 | *.userosscache 8 | *.sln.docstates 9 | 10 | # User-specific files (MonoDevelop/Xamarin Studio) 11 | *.userprefs 12 | 13 | # Build results 14 | [Dd]ebug/ 15 | [Dd]ebugPublic/ 16 | [Rr]elease/ 17 | [Rr]eleases/ 18 | x64/ 19 | x86/ 20 | build/ 21 | bld/ 22 | [Bb]in/ 23 | [Oo]bj/ 24 | 25 | # Visual Studo 2015 cache/options directory 26 | .vs/ 27 | 28 | # MSTest test Results 29 | [Tt]est[Rr]esult*/ 30 | [Bb]uild[Ll]og.* 31 | 32 | # NUNIT 33 | *.VisualState.xml 34 | TestResult.xml 35 | 36 | # Build Results of an ATL Project 37 | [Dd]ebugPS/ 38 | [Rr]eleasePS/ 39 | dlldata.c 40 | 41 | *_i.c 42 | *_p.c 43 | *_i.h 44 | *.ilk 45 | *.meta 46 | *.obj 47 | *.pch 48 | *.pdb 49 | *.pgc 50 | *.pgd 51 | *.rsp 52 | *.sbr 53 | *.tlb 54 | *.tli 55 | *.tlh 56 | *.tmp 57 | *.tmp_proj 58 | *.log 59 | *.vspscc 60 | *.vssscc 61 | .builds 62 | *.pidb 63 | *.svclog 64 | *.scc 65 | 66 | # Chutzpah Test files 67 | _Chutzpah* 68 | 69 | # Visual C++ cache files 70 | ipch/ 71 | *.aps 72 | *.ncb 73 | *.opensdf 74 | *.sdf 75 | *.cachefile 76 | 77 | # Visual Studio profiler 78 | *.psess 79 | *.vsp 80 | *.vspx 81 | 82 | # TFS 2012 Local Workspace 83 | $tf/ 84 | 85 | # Guidance Automation Toolkit 86 | *.gpState 87 | 88 | # ReSharper is a .NET coding add-in 89 | _ReSharper*/ 90 | *.[Rr]e[Ss]harper 91 | *.DotSettings.user 92 | 93 | # JustCode is a .NET coding addin-in 94 | .JustCode 95 | 96 | # TeamCity is a build add-in 97 | _TeamCity* 98 | 99 | # DotCover is a Code Coverage Tool 100 | *.dotCover 101 | 102 | # NCrunch 103 | _NCrunch_* 104 | .*crunch*.local.xml 105 | 106 | # MightyMoose 107 | *.mm.* 108 | AutoTest.Net/ 109 | 110 | # Web workbench (sass) 111 | .sass-cache/ 112 | 113 | # Installshield output folder 114 | [Ee]xpress/ 115 | 116 | # DocProject is a documentation generator add-in 117 | DocProject/buildhelp/ 118 | DocProject/Help/*.HxT 119 | DocProject/Help/*.HxC 120 | DocProject/Help/*.hhc 121 | DocProject/Help/*.hhk 122 | DocProject/Help/*.hhp 123 | DocProject/Help/Html2 124 | DocProject/Help/html 125 | 126 | # Click-Once directory 127 | publish/ 128 | 129 | # Publish Web Output 130 | *.[Pp]ublish.xml 131 | *.azurePubxml 132 | # TODO: Comment the next line if you want to checkin your web deploy settings 133 | # but database connection strings (with potential passwords) will be unencrypted 134 | *.pubxml 135 | *.publishproj 136 | 137 | # NuGet Packages 138 | *.nupkg 139 | # The packages folder can be ignored because of Package Restore 140 | **/packages/* 141 | # except build/, which is used as an MSBuild target. 142 | !**/packages/build/ 143 | # Uncomment if necessary however generally it will be regenerated when needed 144 | #!**/packages/repositories.config 145 | 146 | # Windows Azure Build Output 147 | csx/ 148 | *.build.csdef 149 | 150 | # Windows Store app package directory 151 | AppPackages/ 152 | 153 | # Others 154 | *.[Cc]ache 155 | ClientBin/ 156 | [Ss]tyle[Cc]op.* 157 | ~$* 158 | *~ 159 | *.dbmdl 160 | *.dbproj.schemaview 161 | *.pfx 162 | *.publishsettings 163 | node_modules/ 164 | bower_components/ 165 | 166 | # RIA/Silverlight projects 167 | Generated_Code/ 168 | 169 | # Backup & report files from converting an old project file 170 | # to a newer Visual Studio version. Backup files are not needed, 171 | # because we have git ;-) 172 | _UpgradeReport_Files/ 173 | Backup*/ 174 | UpgradeLog*.XML 175 | UpgradeLog*.htm 176 | 177 | # SQL Server files 178 | *.mdf 179 | *.ldf 180 | 181 | # Business Intelligence projects 182 | *.rdl.data 183 | *.bim.layout 184 | *.bim_*.settings 185 | 186 | # Microsoft Fakes 187 | FakesAssemblies/ 188 | 189 | # Node.js Tools for Visual Studio 190 | .ntvs_analysis.dat 191 | 192 | # Visual Studio 6 build log 193 | *.plg 194 | 195 | # Visual Studio 6 workspace options file 196 | *.opt 197 | -------------------------------------------------------------------------------- /PluginExample.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 2013 4 | VisualStudioVersion = 12.0.31101.0 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PluginExample", "PluginExample\PluginExample.csproj", "{88D8EBB0-95E5-4779-9CD5-401BBE5538E8}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Release|Any CPU = Release|Any CPU 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {88D8EBB0-95E5-4779-9CD5-401BBE5538E8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 15 | {88D8EBB0-95E5-4779-9CD5-401BBE5538E8}.Debug|Any CPU.Build.0 = Debug|Any CPU 16 | {88D8EBB0-95E5-4779-9CD5-401BBE5538E8}.Release|Any CPU.ActiveCfg = Release|Any CPU 17 | {88D8EBB0-95E5-4779-9CD5-401BBE5538E8}.Release|Any CPU.Build.0 = Release|Any CPU 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | EndGlobal 23 | -------------------------------------------------------------------------------- /PluginExample/Curvy.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Linq; 3 | using HearthDb.Enums; 4 | using Hearthstone_Deck_Tracker; 5 | using Hearthstone_Deck_Tracker.Enums; 6 | using Hearthstone_Deck_Tracker.Hearthstone; 7 | using Hearthstone_Deck_Tracker.Hearthstone.Entities; 8 | using CoreAPI = Hearthstone_Deck_Tracker.API.Core; 9 | 10 | namespace PluginExample 11 | { 12 | internal class Curvy 13 | { 14 | private int _mana = 0; 15 | private CurvyList _list = null; 16 | 17 | public Curvy(CurvyList list) 18 | { 19 | _list = list; 20 | // Hide in menu, if necessary 21 | if (Config.Instance.HideInMenu && CoreAPI.Game.IsInMenu) 22 | _list.Hide(); 23 | } 24 | 25 | internal List Entities => 26 | Helper.DeepClone>(CoreAPI.Game.Entities).Values.ToList(); 27 | 28 | internal Entity Opponent => Entities?.FirstOrDefault(x => x.IsOpponent); 29 | 30 | // Reset on when a new game starts 31 | internal void GameStart() 32 | { 33 | _mana = 0; 34 | _list.Update(new List()); 35 | } 36 | 37 | // Need to handle hiding the element when in the game menu 38 | internal void InMenu() 39 | { 40 | if (Config.Instance.HideInMenu) 41 | { 42 | _list.Hide(); 43 | } 44 | } 45 | 46 | // Update the card list on player's turn 47 | internal void TurnStart(ActivePlayer player) 48 | { 49 | if (player == ActivePlayer.Player && Opponent != null) 50 | { 51 | _list.Show(); 52 | var mana = AvailableMana(); 53 | var klass = KlassConverter(CoreAPI.Game.Opponent.Class); 54 | var cards = HearthDb.Cards.Collectible.Values 55 | .Where(c => c.Cost == mana && c.Class == klass && c.Set == CardSet.CORE) 56 | .Select(c => new Card(c)) 57 | .OrderBy(c => c.Rarity) 58 | .ToList(); 59 | _list.Update(cards); 60 | } 61 | } 62 | 63 | // Calculate the mana opponent will have on his next turn 64 | internal int AvailableMana() 65 | { 66 | var opp = Opponent; 67 | if (opp != null) 68 | { 69 | var mana = opp.GetTag(GameTag.RESOURCES); 70 | var overload = opp.GetTag(GameTag.OVERLOAD_OWED); 71 | // looking a turn ahead, so add one mana 72 | _mana = mana + 1 - overload; 73 | } 74 | return _mana; 75 | } 76 | 77 | // Convert hero class string to enum 78 | internal CardClass KlassConverter(string klass) 79 | { 80 | switch (klass.ToLowerInvariant()) 81 | { 82 | case "druid": 83 | return CardClass.DRUID; 84 | 85 | case "hunter": 86 | return CardClass.HUNTER; 87 | 88 | case "mage": 89 | return CardClass.MAGE; 90 | 91 | case "paladin": 92 | return CardClass.PALADIN; 93 | 94 | case "priest": 95 | return CardClass.PRIEST; 96 | 97 | case "rogue": 98 | return CardClass.ROGUE; 99 | 100 | case "shaman": 101 | return CardClass.SHAMAN; 102 | 103 | case "warlock": 104 | return CardClass.WARLOCK; 105 | 106 | case "warrior": 107 | return CardClass.WARRIOR; 108 | 109 | default: 110 | return CardClass.NEUTRAL; 111 | } 112 | } 113 | } 114 | } -------------------------------------------------------------------------------- /PluginExample/CurvyList.xaml: -------------------------------------------------------------------------------- 1 |  9 | 10 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /PluginExample/CurvyList.xaml.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Windows; 3 | using System.Windows.Controls; 4 | using Hearthstone_Deck_Tracker.API; 5 | using Hearthstone_Deck_Tracker.Hearthstone; 6 | 7 | namespace PluginExample 8 | { 9 | public partial class CurvyList 10 | { 11 | public CurvyList() 12 | { 13 | InitializeComponent(); 14 | } 15 | 16 | public void Update(List cards) 17 | { 18 | // hide if card list is empty 19 | this.Visibility = cards.Count <= 0 ? Visibility.Hidden : Visibility.Visible; 20 | this.ItemsSource = cards; 21 | UpdatePosition(); 22 | } 23 | 24 | public void UpdatePosition() 25 | { 26 | Canvas.SetTop(this, Core.OverlayWindow.Height * 5 / 100); 27 | Canvas.SetRight(this, Core.OverlayWindow.Width * 20 / 100); 28 | } 29 | 30 | public void Show() 31 | { 32 | this.Visibility = Visibility.Visible; 33 | } 34 | 35 | public void Hide() 36 | { 37 | this.Visibility = Visibility.Hidden; 38 | } 39 | } 40 | } -------------------------------------------------------------------------------- /PluginExample/CurvyPlugin.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Windows.Controls; 3 | using Hearthstone_Deck_Tracker.API; 4 | using Hearthstone_Deck_Tracker.Plugins; 5 | 6 | namespace PluginExample 7 | { 8 | public class CurvyPlugin : IPlugin 9 | { 10 | private CurvyList _list; 11 | 12 | public string Author 13 | { 14 | get { return "andburn"; } 15 | } 16 | 17 | public string ButtonText 18 | { 19 | get { return "Settings"; } 20 | } 21 | 22 | public string Description 23 | { 24 | get { return "A simple example plugin showing the oppoents class cards on curve."; } 25 | } 26 | 27 | public MenuItem MenuItem 28 | { 29 | get { return null; } 30 | } 31 | 32 | public string Name 33 | { 34 | get { return "Curvy"; } 35 | } 36 | 37 | public void OnButtonPress() 38 | { 39 | } 40 | 41 | public void OnLoad() 42 | { 43 | _list = new CurvyList(); 44 | Core.OverlayCanvas.Children.Add(_list); 45 | Curvy curvy = new Curvy(_list); 46 | 47 | GameEvents.OnGameStart.Add(curvy.GameStart); 48 | GameEvents.OnInMenu.Add(curvy.InMenu); 49 | GameEvents.OnTurnStart.Add(curvy.TurnStart); 50 | } 51 | 52 | public void OnUnload() 53 | { 54 | Core.OverlayCanvas.Children.Remove(_list); 55 | } 56 | 57 | public void OnUpdate() 58 | { 59 | } 60 | 61 | public Version Version 62 | { 63 | get { return new Version(0, 1, 1); } 64 | } 65 | } 66 | } -------------------------------------------------------------------------------- /PluginExample/PluginExample.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {88D8EBB0-95E5-4779-9CD5-401BBE5538E8} 8 | Library 9 | Properties 10 | PluginExample 11 | PluginExample 12 | v4.7.2 13 | 512 14 | 15 | 16 | 17 | true 18 | full 19 | false 20 | bin\Debug\ 21 | DEBUG;TRACE 22 | prompt 23 | 4 24 | 25 | 26 | pdbonly 27 | true 28 | bin\Release\ 29 | TRACE 30 | prompt 31 | 4 32 | 33 | 34 | 35 | False 36 | ..\..\build\Hearthstone Deck Tracker\HearthDb.dll 37 | False 38 | 39 | 40 | False 41 | ..\..\build\Hearthstone Deck Tracker\HearthstoneDeckTracker.exe 42 | False 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | CurvyList.xaml 60 | 61 | 62 | 63 | 64 | 65 | 66 | Designer 67 | MSBuild:Compile 68 | 69 | 70 | 71 | 78 | -------------------------------------------------------------------------------- /PluginExample/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("PluginExample")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("PluginExample")] 13 | [assembly: AssemblyCopyright("Copyright © 2015")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("a195695e-35c9-4d21-aa0a-e0d404813b41")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("0.1.1.0")] 36 | [assembly: AssemblyFileVersion("0.1.1.0")] 37 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # HDT Plugin Example 2 | 3 | [![GitHub release](https://img.shields.io/github/release/andburn/hdt-plugin-example.svg?maxAge=604800)](https://github.com/andburn/hdt-plugin-example/releases/latest) 4 | 5 | A simple plugin for [Hearthstone Deck Tracker](https://github.com/Epix37/Hearthstone-Deck-Tracker) to illustrate some basic functionality and how to get started. 6 | It displays your opponent's on curve class cards for his next turn. 7 | 8 | ![screenshot](http://i.imgur.com/dBBnawz.png) 9 | 10 | ## Building the Plugin 11 | 12 | - To build the plugin you first need to build a development version of [Hearthstone Deck Tracker](https://github.com/Epix37/Hearthstone-Deck-Tracker), this should be as simple as getting the source from github and opening and building the project in Visual Studio. 13 | - The next step is to build the plugin, double clicking `PluginExample.sln` will open the project in Visual Studio. 14 | - First thing to do is add a reference to the location of your Hearthstone Deck Tracker executable (compiled in the first step). 15 | 16 | ![Add Reference](http://i.imgur.com/LLpgkOH.png) 17 | 18 | and then set that references *Copy Local* property to false. 19 | 20 | ![Copy Local](http://i.imgur.com/kbiMhko.png) 21 | 22 | - Add another reference for the `HearthDB.dll` found in the same directory as the Hearthstone Deck Tracker executable. 23 | - You should then be able to build the plugin successfully. 24 | - Go to your `PluginExample\bin\Release` folder and copy `PluginExample.dll` to the Hearthstone Deck Tracker Plugins folder. 25 | --------------------------------------------------------------------------------