-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
First Version
- Loading branch information
Showing
7 changed files
with
293 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
# Visual Studio Version 17 | ||
VisualStudioVersion = 17.7.34202.233 | ||
MinimumVisualStudioVersion = 10.0.40219.1 | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HDT-BGhelper", "HDT-BGhelper\HDT-BGhelper.csproj", "{88D8EBB0-95E5-4779-9CD5-401BBE5538E8}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{88D8EBB0-95E5-4779-9CD5-401BBE5538E8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{88D8EBB0-95E5-4779-9CD5-401BBE5538E8}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{88D8EBB0-95E5-4779-9CD5-401BBE5538E8}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{88D8EBB0-95E5-4779-9CD5-401BBE5538E8}.Release|Any CPU.Build.0 = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
GlobalSection(ExtensibilityGlobals) = postSolution | ||
SolutionGuid = {D6C1A2A5-50D3-46B8-A2C1-F7720D0B143C} | ||
EndGlobalSection | ||
EndGlobal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
using System; | ||
using System.Windows.Forms; | ||
using System.Runtime.InteropServices; | ||
using Hearthstone_Deck_Tracker; | ||
using Gma.System.MouseKeyHook; | ||
|
||
namespace HDT_BGhelper | ||
{ | ||
internal class BGhelper | ||
{ | ||
const int MOUSEEVENTF_LEFTDOWN = 0x02; | ||
const int MOUSEEVENTF_LEFTUP = 0x04; | ||
private IKeyboardMouseEvents m_GlobalHook; | ||
|
||
[DllImport("user32.dll", SetLastError = true)] | ||
static extern void mouse_event(uint dwFlags, int dx, int dy, uint dwData, UIntPtr dwExtraInfo); | ||
|
||
[DllImport("user32.dll")] | ||
static extern void SetCursorPos(int x, int y); | ||
|
||
internal void GameStart() | ||
{ | ||
m_GlobalHook = Hook.GlobalEvents(); | ||
m_GlobalHook.MouseDownExt += GlobalHookMouseDownExt; | ||
} | ||
|
||
internal void InMenu() | ||
{ | ||
Disable(); | ||
} | ||
|
||
private void GlobalHookMouseDownExt(object sender, MouseEventExtArgs e) | ||
{ | ||
if (Core.Overlay.IsVisible) | ||
{ | ||
if (e.Button == MouseButtons.Right) | ||
{ | ||
double x = Core.Overlay.Left; | ||
double y = Core.Overlay.Top; | ||
|
||
var size = Core.Overlay.RenderSize; | ||
double w = size.Width; | ||
double h = size.Height; | ||
|
||
double dx = w / 1920 * 1130; | ||
double dy = h / 1080 * 200; | ||
|
||
double nx = w / 1920 * 960; | ||
double ny = h / 1080 * 700; | ||
|
||
SetCursorPos(Convert.ToInt32(x + dx), Convert.ToInt32(y + dy)); | ||
System.Threading.Thread.Sleep(10); | ||
mouse_event(MOUSEEVENTF_LEFTDOWN | MOUSEEVENTF_LEFTUP, 0, 0, 0, UIntPtr.Zero); | ||
System.Threading.Thread.Sleep(10); | ||
SetCursorPos(Convert.ToInt32(x + nx), Convert.ToInt32(y + ny)); | ||
} | ||
else if (e.Button == MouseButtons.Middle) | ||
{ | ||
double x = Core.Overlay.Left; | ||
double y = Core.Overlay.Top; | ||
|
||
var size = Core.Overlay.RenderSize; | ||
double w = size.Width; | ||
double h = size.Height; | ||
|
||
double dx = w / 1920 * 1240; | ||
double dy = h / 1080 * 170; | ||
|
||
double nx = w / 1920 * 960; | ||
double ny = h / 1080 * 700; | ||
|
||
SetCursorPos(Convert.ToInt32(x + dx), Convert.ToInt32(y + dy)); | ||
System.Threading.Thread.Sleep(10); | ||
mouse_event(MOUSEEVENTF_LEFTDOWN | MOUSEEVENTF_LEFTUP, 0, 0, 0, UIntPtr.Zero); | ||
System.Threading.Thread.Sleep(10); | ||
SetCursorPos(Convert.ToInt32(x + nx), Convert.ToInt32(y + ny)); | ||
} | ||
} | ||
} | ||
|
||
public void Disable() | ||
{ | ||
m_GlobalHook.MouseDownExt -= GlobalHookMouseDownExt; | ||
m_GlobalHook.Dispose(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
using System; | ||
using Hearthstone_Deck_Tracker.API; | ||
using Hearthstone_Deck_Tracker.Plugins; | ||
|
||
namespace HDT_BGhelper | ||
{ | ||
public class BGhelperPlugin : IPlugin | ||
{ | ||
private BGhelper helper; | ||
|
||
public string Author | ||
{ | ||
get { return "IBM5100"; } | ||
} | ||
|
||
public string ButtonText | ||
{ | ||
get { return "No Settings"; } | ||
} | ||
|
||
public string Description | ||
{ | ||
get { return "A battleground plugin makes shortcuts for refresh and freeze.\n" + | ||
"Right click = refresh, middle click = freeze"; } | ||
} | ||
|
||
public System.Windows.Controls.MenuItem MenuItem | ||
{ | ||
get { return null; } | ||
} | ||
|
||
public string Name | ||
{ | ||
get { return "HDT-BGhelper"; } | ||
} | ||
|
||
public void OnButtonPress() | ||
{ | ||
} | ||
|
||
public void OnLoad() | ||
{ | ||
helper = new BGhelper(); | ||
GameEvents.OnGameStart.Add(helper.GameStart); | ||
GameEvents.OnInMenu.Add(helper.InMenu); | ||
} | ||
|
||
public void OnUnload() | ||
{ | ||
helper.Disable(); | ||
} | ||
|
||
public void OnUpdate() | ||
{ | ||
} | ||
|
||
public Version Version | ||
{ | ||
get { return new Version(1, 0); } | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /> | ||
<PropertyGroup> | ||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | ||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | ||
<ProjectGuid>{88D8EBB0-95E5-4779-9CD5-401BBE5538E8}</ProjectGuid> | ||
<OutputType>Library</OutputType> | ||
<AppDesignerFolder>Properties</AppDesignerFolder> | ||
<RootNamespace>HDT_BGhelper</RootNamespace> | ||
<AssemblyName>HDT-BGhelper</AssemblyName> | ||
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion> | ||
<FileAlignment>512</FileAlignment> | ||
<TargetFrameworkProfile /> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> | ||
<DebugSymbols>true</DebugSymbols> | ||
<DebugType>full</DebugType> | ||
<Optimize>false</Optimize> | ||
<OutputPath>bin\Debug\</OutputPath> | ||
<DefineConstants>DEBUG;TRACE</DefineConstants> | ||
<ErrorReport>prompt</ErrorReport> | ||
<WarningLevel>4</WarningLevel> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> | ||
<DebugType>pdbonly</DebugType> | ||
<Optimize>true</Optimize> | ||
<OutputPath>bin\Release\</OutputPath> | ||
<DefineConstants>TRACE</DefineConstants> | ||
<ErrorReport>prompt</ErrorReport> | ||
<WarningLevel>4</WarningLevel> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<Reference Include="Gma.System.MouseKeyHook, Version=5.7.1.0, Culture=neutral, processorArchitecture=MSIL"> | ||
<HintPath>..\packages\MouseKeyHook.5.7.1\lib\net472\Gma.System.MouseKeyHook.dll</HintPath> | ||
</Reference> | ||
<Reference Include="HearthDb, Version=7.1.1.17994, Culture=neutral, processorArchitecture=x86"> | ||
<SpecificVersion>False</SpecificVersion> | ||
<HintPath>..\..\..\..\Hearthstone-Deck-Tracker-master\Hearthstone Deck Tracker\bin\x86\Debug\HearthDb.dll</HintPath> | ||
<Private>False</Private> | ||
</Reference> | ||
<Reference Include="HearthstoneDeckTracker, Version=1.1.7.0, Culture=neutral, processorArchitecture=x86"> | ||
<SpecificVersion>False</SpecificVersion> | ||
<HintPath>..\..\..\..\Hearthstone-Deck-Tracker-master\Hearthstone Deck Tracker\bin\x86\Debug\HearthstoneDeckTracker.exe</HintPath> | ||
<Private>False</Private> | ||
</Reference> | ||
<Reference Include="PresentationCore" /> | ||
<Reference Include="PresentationFramework" /> | ||
<Reference Include="System" /> | ||
<Reference Include="System.Core" /> | ||
<Reference Include="System.Windows.Forms" /> | ||
<Reference Include="System.Xaml" /> | ||
<Reference Include="System.Xml.Linq" /> | ||
<Reference Include="System.Data.DataSetExtensions" /> | ||
<Reference Include="Microsoft.CSharp" /> | ||
<Reference Include="System.Data" /> | ||
<Reference Include="System.Xml" /> | ||
<Reference Include="WindowsBase" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<Compile Include="BGhelper.cs" /> | ||
<Compile Include="BGhelperPlugin.cs" /> | ||
<Compile Include="Properties\AssemblyInfo.cs" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<None Include="packages.config" /> | ||
</ItemGroup> | ||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> | ||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it. | ||
Other similar extension points exist, see Microsoft.Common.targets. | ||
<Target Name="BeforeBuild"> | ||
</Target> | ||
<Target Name="AfterBuild"> | ||
</Target> | ||
--> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
using System.Reflection; | ||
using System.Runtime.CompilerServices; | ||
using System.Runtime.InteropServices; | ||
|
||
// 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("HDT-BGhelper")] | ||
[assembly: AssemblyDescription("")] | ||
[assembly: AssemblyConfiguration("")] | ||
[assembly: AssemblyCompany("")] | ||
[assembly: AssemblyProduct("HDT-BGhelper")] | ||
[assembly: AssemblyCopyright("Copyright © 2023")] | ||
[assembly: AssemblyTrademark("")] | ||
[assembly: AssemblyCulture("")] | ||
|
||
// Setting ComVisible to false makes the types in this assembly not visible | ||
// to COM components. If you need to access a type in this assembly from | ||
// COM, set the ComVisible attribute to true on that type. | ||
[assembly: ComVisible(false)] | ||
|
||
// The following GUID is for the ID of the typelib if this project is exposed to COM | ||
[assembly: Guid("a195695e-35c9-4d21-aa0a-e0d404813b41")] | ||
|
||
// Version information for an assembly consists of the following four values: | ||
// | ||
// Major Version | ||
// Minor Version | ||
// Build Number | ||
// Revision | ||
// | ||
// 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.0")] | ||
[assembly: AssemblyFileVersion("1.0")] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<packages> | ||
<package id="MouseKeyHook" version="5.7.1" targetFramework="net472" /> | ||
</packages> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# HDT Plugin | ||
|
||
## Building the Plugin |