diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..eba1110 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,2 @@ +# Auto detect text files and perform LF normalization +* text=auto \ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..f652b45 --- /dev/null +++ b/.gitignore @@ -0,0 +1,299 @@ +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. +## +## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore + +# User-specific files +*.suo +*.user +*.userosscache +*.sln.docstates + +# User-specific files (MonoDevelop/Xamarin Studio) +*.userprefs + +# Build results +[Dd]ebug/ +[Dd]ebugPublic/ +[Rr]elease/ +[Rr]eleases/ +x64/ +x86/ +bld/ +[Bb]in/ +[Oo]bj/ +[Ll]og/ + +# Visual Studio 2015 cache/options directory +.vs/ +# Uncomment if you have tasks that create the project's static files in wwwroot +#wwwroot/ + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +# NUNIT +*.VisualState.xml +TestResult.xml + +# Build Results of an ATL Project +[Dd]ebugPS/ +[Rr]eleasePS/ +dlldata.c + +# Benchmark Results +BenchmarkDotNet.Artifacts/ + +# .NET Core +project.lock.json +project.fragment.lock.json +artifacts/ +**/Properties/launchSettings.json + +*_i.c +*_p.c +*_i.h +*.ilk +*.meta +*.obj +*.pch +*.pdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*.log +*.vspscc +*.vssscc +.builds +*.pidb +*.svclog +*.scc + +# Chutzpah Test files +_Chutzpah* + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opendb +*.opensdf +*.sdf +*.cachefile +*.VC.db +*.VC.VC.opendb + +# Visual Studio profiler +*.psess +*.vsp +*.vspx +*.sap + +# TFS 2012 Local Workspace +$tf/ + +# Guidance Automation Toolkit +*.gpState + +# ReSharper is a .NET coding add-in +_ReSharper*/ +*.[Rr]e[Ss]harper +*.DotSettings.user + +# JustCode is a .NET coding add-in +.JustCode + +# TeamCity is a build add-in +_TeamCity* + +# DotCover is a Code Coverage Tool +*.dotCover + +# AxoCover is a Code Coverage Tool +.axoCover/* +!.axoCover/settings.json + +# Visual Studio code coverage results +*.coverage +*.coveragexml + +# NCrunch +_NCrunch_* +.*crunch*.local.xml +nCrunchTemp_* + +# MightyMoose +*.mm.* +AutoTest.Net/ + +# Web workbench (sass) +.sass-cache/ + +# Installshield output folder +[Ee]xpress/ + +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html + +# Click-Once directory +publish/ + +# Publish Web Output +*.[Pp]ublish.xml +*.azurePubxml +# Note: Comment the next line if you want to checkin your web deploy settings, +# but database connection strings (with potential passwords) will be unencrypted +*.pubxml +*.publishproj + +# Microsoft Azure Web App publish settings. Comment the next line if you want to +# checkin your Azure Web App publish settings, but sensitive information contained +# in these scripts will be unencrypted +PublishScripts/ + +# NuGet Packages +*.nupkg +# The packages folder can be ignored because of Package Restore +**/packages/* +# except build/, which is used as an MSBuild target. +!**/packages/build/ +# Uncomment if necessary however generally it will be regenerated when needed +#!**/packages/repositories.config +# NuGet v3's project.json files produces more ignorable files +*.nuget.props +*.nuget.targets + +# Microsoft Azure Build Output +csx/ +*.build.csdef + +# Microsoft Azure Emulator +ecf/ +rcf/ + +# Windows Store app package directories and files +AppPackages/ +BundleArtifacts/ +Package.StoreAssociation.xml +_pkginfo.txt +*.appx + +# Visual Studio cache files +# files ending in .cache can be ignored +*.[Cc]ache +# but keep track of directories ending in .cache +!*.[Cc]ache/ + +# Others +ClientBin/ +~$* +*~ +*.dbmdl +*.dbproj.schemaview +*.jfm +*.pfx +*.publishsettings +orleans.codegen.cs + +# Since there are multiple workflows, uncomment next line to ignore bower_components +# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) +#bower_components/ + +# RIA/Silverlight projects +Generated_Code/ + +# Backup & report files from converting an old project file +# to a newer Visual Studio version. Backup files are not needed, +# because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML +UpgradeLog*.htm + +# SQL Server files +*.mdf +*.ldf +*.ndf + +# Business Intelligence projects +*.rdl.data +*.bim.layout +*.bim_*.settings + +# Microsoft Fakes +FakesAssemblies/ + +# GhostDoc plugin setting file +*.GhostDoc.xml + +# Node.js Tools for Visual Studio +.ntvs_analysis.dat +node_modules/ + +# Typescript v1 declaration files +typings/ + +# Visual Studio 6 build log +*.plg + +# Visual Studio 6 workspace options file +*.opt + +# Visual Studio 6 auto-generated workspace file (contains which files were open etc.) +*.vbw + +# Visual Studio LightSwitch build output +**/*.HTMLClient/GeneratedArtifacts +**/*.DesktopClient/GeneratedArtifacts +**/*.DesktopClient/ModelManifest.xml +**/*.Server/GeneratedArtifacts +**/*.Server/ModelManifest.xml +_Pvt_Extensions + +# Paket dependency manager +.paket/paket.exe +paket-files/ + +# FAKE - F# Make +.fake/ + +# JetBrains Rider +.idea/ +*.sln.iml + +# CodeRush +.cr/ + +# Python Tools for Visual Studio (PTVS) +__pycache__/ +*.pyc + +# Cake - Uncomment if you are using it +# tools/** +# !tools/packages.config + +# Tabs Studio +*.tss + +# Telerik's JustMock configuration file +*.jmconfig + +# BizTalk build output +*.btp.cs +*.btm.cs +*.odx.cs +*.xsd.cs diff --git a/Hearthstone-Quest-Tracker.sln b/Hearthstone-Quest-Tracker.sln new file mode 100644 index 0000000..165efa3 --- /dev/null +++ b/Hearthstone-Quest-Tracker.sln @@ -0,0 +1,18 @@ + +Microsoft Visual Studio Solution File, Format Version 11.00 +# Visual Studio 2010 +# SharpDevelop 5.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Hearthstone-Quest-Tracker", "Hearthstone-Quest-Tracker\Hearthstone-Quest-Tracker.csproj", "{3655D916-5691-4C22-A543-6B4DB358AE53}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {3655D916-5691-4C22-A543-6B4DB358AE53}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {3655D916-5691-4C22-A543-6B4DB358AE53}.Debug|Any CPU.Build.0 = Debug|Any CPU + {3655D916-5691-4C22-A543-6B4DB358AE53}.Release|Any CPU.ActiveCfg = Release|Any CPU + {3655D916-5691-4C22-A543-6B4DB358AE53}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/Hearthstone-Quest-Tracker/Hearthstone-Quest-Tracker.csproj b/Hearthstone-Quest-Tracker/Hearthstone-Quest-Tracker.csproj new file mode 100644 index 0000000..cd83def --- /dev/null +++ b/Hearthstone-Quest-Tracker/Hearthstone-Quest-Tracker.csproj @@ -0,0 +1,78 @@ + + + + {3655D916-5691-4C22-A543-6B4DB358AE53} + {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + Debug + AnyCPU + Library + Hearthstone_Quest_Tracker + Hearthstone-Quest-Tracker + v4.0 + Properties + + + AnyCPU + + + bin\Debug\ + True + Full + False + True + DEBUG;TRACE + + + bin\Release\ + False + None + True + False + TRACE + + + + D:\Gaming\Hearthstone Deck Tracker\HearthDb.dll + + + D:\Gaming\Hearthstone Deck Tracker\Hearthstone Deck Tracker.exe + + + 4.0 + + + 3.0 + + + 3.0 + + + + 3.5 + + + 4.0 + + + + 3.5 + + + 3.0 + + + + + + QuestOverlay.xaml + Code + + + + + + + + + + \ No newline at end of file diff --git a/Hearthstone-Quest-Tracker/Properties/AssemblyInfo.cs b/Hearthstone-Quest-Tracker/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..6db6021 --- /dev/null +++ b/Hearthstone-Quest-Tracker/Properties/AssemblyInfo.cs @@ -0,0 +1,31 @@ +#region Using directives + +using System; +using System.Reflection; +using System.Runtime.InteropServices; + +#endregion + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Hearthstone-Quest-Tracker")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Hearthstone-Quest-Tracker")] +[assembly: AssemblyCopyright("Copyright 2017")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// This sets the default COM visibility of types in the assembly to invisible. +// If you need to expose a type to COM, use [ComVisible(true)] on that type. +[assembly: ComVisible(false)] + +// The assembly version has following format : +// +// Major.Minor.Build.Revision +// +// You can specify all the values or you can use the default the Revision and +// Build Numbers by using the '*' as shown below: +[assembly: AssemblyVersion("1.0.*")] diff --git a/Hearthstone-Quest-Tracker/Quest.cs b/Hearthstone-Quest-Tracker/Quest.cs new file mode 100644 index 0000000..3803bd0 --- /dev/null +++ b/Hearthstone-Quest-Tracker/Quest.cs @@ -0,0 +1,40 @@ +/* + * Created by SharpDevelop. + * User: Burhanuddin + * Date: 02-12-2017 + * Time: 02:05 AM + * + * To change this template use Tools | Options | Coding | Edit Standard Headers. + */ +using System; +using System.Collections.Generic; +using System.Windows.Controls; +using Hearthstone_Deck_Tracker.Hearthstone; +using Hearthstone_Deck_Tracker.API; +using Hearthstone_Deck_Tracker.Plugins; + +using Hearthstone_Deck_Tracker.Hearthstone.Entities; +using Hearthstone_Deck_Tracker.Enums; +using Hearthstone_Deck_Tracker.Utility.Logging; + +namespace Hearthstone_Quest_Tracker +{ + /// + /// Description of Quest. + /// + public class Quest + { + internal string quest_name {get; set;} + internal int count {get; set;} + internal string category {get; set;} + internal int reward; + + public Quest(string qname) + { + this.quest_name = qname; + if(qname.Equals("Warrior") || qname.Equals("Shaman") || qname.Equals("Rogue") || qname.Equals("Paladin") || qname.Equals("Hunter") || qname.Equals("Druid") || qname.Equals("Warlock") || qname.Equals("Mage") || qname.Equals("Priest")) + this.category = "class"; + this.count = 0; + } + } +} diff --git a/Hearthstone-Quest-Tracker/QuestOverlay.xaml b/Hearthstone-Quest-Tracker/QuestOverlay.xaml new file mode 100644 index 0000000..7caee52 --- /dev/null +++ b/Hearthstone-Quest-Tracker/QuestOverlay.xaml @@ -0,0 +1,126 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Hearthstone-Quest-Tracker/QuestOverlay.xaml.cs b/Hearthstone-Quest-Tracker/QuestOverlay.xaml.cs new file mode 100644 index 0000000..3aec250 --- /dev/null +++ b/Hearthstone-Quest-Tracker/QuestOverlay.xaml.cs @@ -0,0 +1,98 @@ +/* + * Created by SharpDevelop. + * User: Burhanuddin + * Date: 02-12-2017 + * Time: 02:07 AM + * + * To change this template use Tools | Options | Coding | Edit Standard Headers. + */ +using System; +using System.Collections.Generic; +using System.Text; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using Hearthstone_Deck_Tracker.API; +using Hearthstone_Deck_Tracker.Hearthstone; +using Hearthstone_Deck_Tracker.Utility.Logging; + +namespace Hearthstone_Quest_Tracker +{ + /// + /// Interaction logic for QuestOverlay.xaml + /// + public partial class QuestOverlay : UserControl + { + public QuestOverlay() + { + InitializeComponent(); + + classBlock1.Text = ""; + classBlock2.Text = ""; + classBlock3.Text = ""; + playedBlock1.Text = ""; + playedBlock2.Text = ""; + playedBlock3.Text = ""; + + Log.Info("----- Display did get initialized -----"); + } + + public void UpdatePosition(int qcount) + { + this.Visibility = (qcount > 0) ? Visibility.Visible : Visibility.Hidden; + Canvas.SetTop(this, (Core.OverlayWindow.Height * 85 / 100)-this.Height); + Canvas.SetRight(this, 0); + Log.Info("----- Display tried to get shown -----"); + } + + public void UpdateQuests(List quest_list) + { + classBlock1.Text = ""; + classBlock2.Text = ""; + classBlock3.Text = ""; + playedBlock1.Text = ""; + playedBlock2.Text = ""; + playedBlock3.Text = ""; + + switch(quest_list.Count) + { + case 3: + classBlock3.Text = quest_list[2].quest_name; + playedBlock3.Text = quest_list[2].count.ToString(); + goto case 2; + + case 2: + classBlock2.Text = quest_list[1].quest_name; + playedBlock2.Text = quest_list[1].count.ToString(); + goto case 1; + + case 1: + classBlock1.Text = quest_list[0].quest_name; + playedBlock1.Text = quest_list[0].count.ToString(); + break; + + case 0: + break; + + default: + Log.Info("----- Invalid quests number -----"); + break; + } + + UpdatePosition(quest_list.Count); + } + + public void Show() + { + this.Visibility = Visibility.Visible; + } + + public void Hide() + { + this.Visibility = Visibility.Hidden; + } + } +} \ No newline at end of file diff --git a/Hearthstone-Quest-Tracker/QuestPlugin.cs b/Hearthstone-Quest-Tracker/QuestPlugin.cs new file mode 100644 index 0000000..2fbf920 --- /dev/null +++ b/Hearthstone-Quest-Tracker/QuestPlugin.cs @@ -0,0 +1,127 @@ +/* + * Created by SharpDevelop. + * User: Burhanuddin + * Date: 02-12-2017 + * Time: 01:56 AM + * + * To change this template use Tools | Options | Coding | Edit Standard Headers. + */ +using System; +using System.Collections.Generic; +using System.Windows.Controls; +using System.Linq; + +using Hearthstone_Deck_Tracker; +using Hearthstone_Deck_Tracker.Hearthstone; +using Hearthstone_Deck_Tracker.API; +using Hearthstone_Deck_Tracker.Plugins; + +using Hearthstone_Deck_Tracker.Hearthstone.Entities; +using Hearthstone_Deck_Tracker.Enums; +using Hearthstone_Deck_Tracker.Utility.Logging; +using CoreAPI = Hearthstone_Deck_Tracker.API.Core; + +namespace Hearthstone_Quest_Tracker +{ + public class QuestPlugin : IPlugin + { + private QuestOverlay overlay; + MenuItem menuItem = null; + + public void OnLoad() + { + //when it's loaded upon each restart/turned on by the user + Log.Info("Hello from quest this is load"); + overlay = new QuestOverlay(); + CoreAPI.OverlayCanvas.Children.Add(overlay); + QuestTracker tracker = new QuestTracker(overlay); + + GameEvents.OnGameStart.Add(tracker.GameStart); + GameEvents.OnTurnStart.Add(tracker.TurnStart); + GameEvents.OnPlayerPlay.Add(tracker.CardPlay); + GameEvents.OnGameEnd.Add(tracker.GameEnd); + + /* this.menuItem = new MenuItem() { Header = "Choose Quest" }; + var chooseclass = new MenuItem() {Header = "Class"}; + var warrior = new MenuItem() {Header = "Warrior"}; + warrior.Click += (sender, e) => tracker.SetQuest("Warrior"); + var shaman = new MenuItem() {Header = "Shaman"}; + shaman.Click += (sender, e) => tracker.SetQuest("Shaman"); + var rogue = new MenuItem() {Header = "Rogue"}; + rogue.Click += (sender, e) => tracker.SetQuest("Rogue"); + var paladin = new MenuItem() {Header = "Paladin"}; + paladin.Click += (sender, e) => tracker.SetQuest("Paladin"); + var hunter = new MenuItem() {Header = "Hunter"}; + hunter.Click += (sender, e) => tracker.SetQuest("Hunter"); + var druid = new MenuItem() {Header = "Druid"}; + druid.Click += (sender, e) => tracker.SetQuest("Druid"); + var warlock = new MenuItem() {Header = "Warlock"}; + warlock.Click += (sender, e) => tracker.SetQuest("Warlock"); + var mage = new MenuItem() {Header = "Mage"}; + mage.Click += (sender, e) => tracker.SetQuest("Mage"); + var priest = new MenuItem() {Header = "Priest"}; + priest.Click += (sender, e) => tracker.SetQuest("Priest"); + chooseclass.Items.Add(warrior); + chooseclass.Items.Add(shaman); + chooseclass.Items.Add(rogue); + chooseclass.Items.Add(paladin); + chooseclass.Items.Add(hunter); + chooseclass.Items.Add(druid); + chooseclass.Items.Add(warlock); + chooseclass.Items.Add(mage); + chooseclass.Items.Add(priest); + menuItem.Items.Add(chooseclass); + */ + } + + public void OnUnload() + { + // handle unloading here. HDT does not literally unload the assembly + CoreAPI.OverlayCanvas.Children.Remove(overlay); + } + + public void OnButtonPress() + { + //when user presses the menu button + } + + public void OnUpdate() + { + // called every ~100ms + } + + + public string Name + { + get { return "Hearthstone Quest Tracker"; } + } + + public string Author + { + get { return "Burhanuddin M. Lakdawala"; } + } + + public string ButtonText + { + get { return "Settings - Coming Soon!"; } + } + + public string Description + { + get { return "Tracks the daily play quests progress"; } + } + + public MenuItem MenuItem + { + get + { + return this.menuItem; + } + } + + public Version Version + { + get { return new Version(0, 0, 1); } + } + } +} \ No newline at end of file diff --git a/Hearthstone-Quest-Tracker/QuestTracker.cs b/Hearthstone-Quest-Tracker/QuestTracker.cs new file mode 100644 index 0000000..15b2e55 --- /dev/null +++ b/Hearthstone-Quest-Tracker/QuestTracker.cs @@ -0,0 +1,101 @@ +/* + * Created by SharpDevelop. + * User: Burhanuddin + * Date: 02-12-2017 + * Time: 02:03 AM + * + * To change this template use Tools | Options | Coding | Edit Standard Headers. + */ +using System; +using System.Collections.Generic; +using System.Windows.Controls; +using System.Linq; + +using Hearthstone_Deck_Tracker; +using Hearthstone_Deck_Tracker.Hearthstone; +using Hearthstone_Deck_Tracker.API; +using Hearthstone_Deck_Tracker.Plugins; + +using Hearthstone_Deck_Tracker.Hearthstone.Entities; +using Hearthstone_Deck_Tracker.Enums; +using Hearthstone_Deck_Tracker.Utility.Logging; +using CoreAPI = Hearthstone_Deck_Tracker.API.Core; + +namespace Hearthstone_Quest_Tracker +{ + /// + /// Description of QuestTracker. + /// + public class QuestTracker + { + internal QuestOverlay overlay; + internal List quest_list; + + public QuestTracker(QuestOverlay _overlay) + { + this.overlay = _overlay; + quest_list = new List(); + SetQuest("Paladin"); + SetQuest("Hunter"); + SetQuest("Warrior"); + + if (Config.Instance.HideInMenu && CoreAPI.Game.IsInMenu) + overlay.Hide(); + + } + + internal void SetQuest(string qname) + { + Quest q = new Quest(qname); + if(quest_list.Count < 3) + { + quest_list.Add(q); + Log.Info("----- Added quest for "+qname+" -----"); + } + else + { + Log.Info("----- Quest list is full! -----"); + } + } + + internal void TurnStart(ActivePlayer player) + { + Log.Info("Internal TurnStart just triggered !!!"); + } + + internal void GameStart() + { + Log.Info("Internal GameStart just triggered !!!"); + // TODO: Tracker should not run in practice or Spectate mode + overlay.UpdateQuests(quest_list); + } + + internal void GameEnd() + { + Log.Info("----- Game has Ended -----"); + // TODO: Hide overlay only after victory screen + overlay.Hide(); + } + + internal void CardPlay(Card card) + { + bool classQuest = quest_list.Any(quest => quest.category.Equals("class")); + bool minionQuest = quest_list.Any(quest => quest.category.Equals("minion")); + bool otherQuest = quest_list.Any(quest => quest.category.Equals("other")); + + if(classQuest) + { + foreach(var q in quest_list) + { + if(card.IsClass(q.quest_name)) + q.count++; + } + + } + + string oldClass = card.GetPlayerClass; + Log.Info("----- You just played " + oldClass + " card -----"); + overlay.UpdateQuests(quest_list); + } + } +} diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..83e0b56 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2017 PyroGenesis + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..e057c49 --- /dev/null +++ b/README.md @@ -0,0 +1 @@ +# Hearthstone Quest Tracker