Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,30 @@ Network Trash Folder
Temporary Items
.apdisk
*.pdb
System.Buffers.xml
System.Buffers.dll
SharpDX.xml
SharpDX.dll
SharpDX.Desktop.dll
PoeHUD.exe.config
PoeFilterParser.dll
Newtonsoft.Json.xml
ImGui.NET.xml
ImGui.NET.dll
Gma.System.MouseKeyHook.dll
System.Runtime.CompilerServices.Unsafe.dll
System.Numerics.Vectors.xml
System.Numerics.Vectors.dll
SharpDX.Direct3D9.xml
SharpDX.Direct3D9.dll
Newtonsoft.Json.dll
Trinet.Core.IO.Ntfs.xml
Trinet.Core.IO.Ntfs.dll
System.Runtime.CompilerServices.Unsafe.xml
SharpDX.Mathematics.xml
SharpDX.Mathematics.dll
PoeHUD.exe
Antlr4.Runtime.xml
Antlr4.Runtime.dll
SharpDX.Desktop.xml
netstandard.dll
Binary file modified AutoGolem.dll
Binary file not shown.
2 changes: 1 addition & 1 deletion src/AutoGolem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ private void GolemMain()
if (!GameController.Game.IngameState.Data.LocalPlayer.IsValid)
return;

var playerLife = GameController.Game.IngameState.Data.LocalPlayer.GetComponent<Life>();
var playerLife = GameController.Game?.IngameState?.Data?.LocalPlayer?.GetComponent<Life>();
if (playerLife == null || isTown)
return;

Expand Down
14 changes: 8 additions & 6 deletions src/AutoGolem.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>true</Optimize>
<OutputPath>..\</OutputPath>
<Optimize>false</Optimize>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>0</WarningLevel>
Expand All @@ -34,9 +34,11 @@
<PlatformTarget>x64</PlatformTarget>
</PropertyGroup>
<ItemGroup>
<Reference Include="SharpDX.Mathematics">
<HintPath>..\..\..\..\..\packages\SharpDX.Mathematics.4.0.1\lib\net40\SharpDX.Mathematics.dll</HintPath>
<Private>False</Private>
<Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\..\..\..\..\..\packages\Newtonsoft.Json.12.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="SharpDX.Mathematics, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b4dcf0f35e5521f1, processorArchitecture=MSIL">
<HintPath>..\..\..\PoEHUD\src\packages\SharpDX.Mathematics.4.0.1\lib\net45\SharpDX.Mathematics.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
Expand All @@ -51,17 +53,17 @@
<ItemGroup>
<Compile Include="AutoGolem.cs" />
<Compile Include="AutoGolemSettings.cs" />
<Compile Include="Keyboard.cs" />
<Compile Include="KeyboardHelper.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\..\src\PoeHUD.csproj">
<ProjectReference Include="..\..\..\..\..\..\PoeHUD.csproj">
<Project>{e86368b2-ae1e-4489-a749-e29a0ab48f83}</Project>
<Name>PoeHUD</Name>
<Private>False</Private>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
Expand Down
56 changes: 56 additions & 0 deletions src/Keyboard.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
using System;
using System.Runtime.InteropServices;
using System.Threading;
using System.Windows.Forms;

namespace Stashie.Utils
{
public static class Keyboard
{
[DllImport("user32.dll")]
private static extern uint keybd_event(byte bVk, byte bScan, int dwFlags, int dwExtraInfo);

private const int KEYEVENTF_EXTENDEDKEY = 0x0001;
private const int KEYEVENTF_KEYUP = 0x0002;
private const int KEY_TOGGLED = 0x0001;
private const int KEY_PRESSED = 0x8000;
private const int ACTION_DELAY = 1;


public static void KeyDown(Keys key)
{
keybd_event((byte) key, 0, KEYEVENTF_EXTENDEDKEY | 0, 0);
}

public static void KeyUp(Keys key)
{
keybd_event((byte) key, 0, KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP, 0); //0x7F
}

public static void KeyPress(Keys key)
{
KeyDown(key);
Thread.Sleep(ACTION_DELAY);
KeyUp(key);
}

[DllImport("USER32.dll")]
private static extern short GetKeyState(int nVirtKey);

public static bool IsKeyDown(int nVirtKey)
{
return GetKeyState(nVirtKey) < 0;
}

public static bool IsKeyPressed(Keys key)
{
return Convert.ToBoolean(GetKeyState((int) key) & KEY_PRESSED);
}


public static bool IsKeyToggled(Keys key)
{
return Convert.ToBoolean(GetKeyState((int) key) & KEY_TOGGLED);
}
}
}
14 changes: 3 additions & 11 deletions src/KeyboardHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using System.Runtime.InteropServices;
using System.Threading;
using System.Windows.Forms;
using Stashie.Utils;

namespace AutoGolem
{
Expand Down Expand Up @@ -34,18 +35,9 @@ public void SetLatency(float latency)
private static extern short GetKeyState(int nVirtKey);
public void KeyDown(Keys key)
{
SendMessage(_gameHandle.Window.Process.MainWindowHandle, 0x100, (int)key, 0);
}

public static bool IsKeyDown(int nVirtKey)
{
return GetKeyState(nVirtKey) < 0;
}

public void KeyUp(Keys key)
{
SendMessage(_gameHandle.Window.Process.MainWindowHandle, 0x101, (int)key, 0);
Keyboard.KeyPress(key);
}

public bool KeyPressRelease(Keys key)
{
KeyDown(key);
Expand Down
2 changes: 1 addition & 1 deletion src/packages.config
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Newtonsoft.Json" version="10.0.3" targetFramework="net462" />
<package id="Newtonsoft.Json" version="12.0.1" targetFramework="net462" />
<package id="SharpDX" version="4.0.1" targetFramework="net462" />
<package id="SharpDX.Direct3D9" version="4.0.1" targetFramework="net462" />
<package id="SharpDX.Mathematics" version="4.0.1" targetFramework="net462" />
Expand Down