Skip to content

Commit

Permalink
Add project files.
Browse files Browse the repository at this point in the history
  • Loading branch information
Sarah committed Oct 29, 2019
1 parent dbd8e49 commit df5367a
Show file tree
Hide file tree
Showing 7 changed files with 307 additions and 0 deletions.
25 changes: 25 additions & 0 deletions AutoGolem.sln
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 16
VisualStudioVersion = 16.0.29215.179
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AutoGolem", "AutoGolem\AutoGolem.csproj", "{22C65BF2-0588-4D65-83AF-F863343BACCB}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{22C65BF2-0588-4D65-83AF-F863343BACCB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{22C65BF2-0588-4D65-83AF-F863343BACCB}.Debug|Any CPU.Build.0 = Debug|Any CPU
{22C65BF2-0588-4D65-83AF-F863343BACCB}.Release|Any CPU.ActiveCfg = Release|Any CPU
{22C65BF2-0588-4D65-83AF-F863343BACCB}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {DF77CECA-2A78-4A22-9166-863A5E1FC9C8}
EndGlobalSection
EndGlobal
67 changes: 67 additions & 0 deletions AutoGolem/AutoGolem.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" 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>{22C65BF2-0588-4D65-83AF-F863343BACCB}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>AutoGolem</RootNamespace>
<AssemblyName>AutoGolem</AssemblyName>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
<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="ExileCore">
<HintPath>E:\Desktop\hud\PoeHelper\ExileCore.dll</HintPath>
</Reference>
<Reference Include="Serilog, Version=2.0.0.0, Culture=neutral, PublicKeyToken=24c2f752a8e58a10, processorArchitecture=MSIL">
<HintPath>..\packages\Serilog.2.9.0\lib\net46\Serilog.dll</HintPath>
</Reference>
<Reference Include="SharpDX, Version=4.2.0.0, Culture=neutral, PublicKeyToken=b4dcf0f35e5521f1, processorArchitecture=MSIL">
<HintPath>..\packages\SharpDX.4.2.0\lib\net45\SharpDX.dll</HintPath>
</Reference>
<Reference Include="SharpDX.Mathematics, Version=4.2.0.0, Culture=neutral, PublicKeyToken=b4dcf0f35e5521f1, processorArchitecture=MSIL">
<HintPath>..\packages\SharpDX.Mathematics.4.2.0\lib\net45\SharpDX.Mathematics.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="AutoGolemSettings.cs" />
<Compile Include="AutoGolemPlugin.cs" />
<Compile Include="GolemSettings.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
116 changes: 116 additions & 0 deletions AutoGolem/AutoGolemPlugin.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
using ExileCore;
using ExileCore.PoEMemory.Components;
using ExileCore.PoEMemory.MemoryObjects;
using ExileCore.Shared;
using SharpDX;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace AutoGolem
{
public class AutoGolemPlugin : BaseSettingsPlugin<AutoGolemSettings>
{
public override Job Tick()
{
var player = this.GameController.Player;
var life = player.GetComponent<Life>();
var deployedObjects = player.GetComponent<Actor>().DeployedObjects;
var entities = this.GameController.Entities;
var aliveEnties = deployedObjects.Select(o => o.Entity).Where(e => e != null && e.IsAlive).ToList();

// Return if forground
if (!GameController.Window.IsForeground())
{
return null;
}

// Return if invalid local player
if (!GameController.Game.IngameState.Data.LocalPlayer.IsValid)
{
return null;
}

// Return if disabled
if (!this.Settings.Enable)
{
return null;
}

// Return if life
if (this.Settings.MinLife.Value / 100F > life.HPPercentage)
{
return null;
}

// Return if shield
if (this.Settings.MinShield / 100F > life.ESPercentage)
{
return null;
}

// Return if distance
if (this.Settings.MinDistance > 0)
{
foreach (var entity in entities)
{
if (entity.IsAlive && entity.IsHostile)
{
float distance = (player.Pos - entity.Pos).Length();
if (distance <= this.Settings.MinDistance)
{
return null;
}
}
}
}

// Get which golems are alive
bool chaosAlive = aliveEnties.Any(e => e.Path.Contains("ChaosElemental"));
bool fireAlive = aliveEnties.Any(e => e.Path.Contains("FireElemental"));
bool iceAlive = aliveEnties.Any(e => e.Path.Contains("IceElemental"));
bool lightningAlive = aliveEnties.Any(e => e.Path.Contains("LightningGolem"));
bool stoneAlive = aliveEnties.Any(e => e.Path.Contains("RockGolem"));
bool bestialUrsa = aliveEnties.Any(e => e.Path.Contains("DropBearUniqueSummoned"));

// Get keys to press
List<Keys> pressMe = new List<Keys>();
if (this.Settings.ChaosGolem.Enable && !chaosAlive)
{
pressMe.Add(this.Settings.ChaosGolem.HotKey);
}
if (this.Settings.FireGolem.Enable && !fireAlive)
{
pressMe.Add(this.Settings.FireGolem.HotKey);
}
if (this.Settings.IceGolem.Enable && !iceAlive)
{
pressMe.Add(this.Settings.IceGolem.HotKey);
}
if (this.Settings.LightingGolem.Enable && !lightningAlive)
{
pressMe.Add(this.Settings.LightingGolem.HotKey);
}
if (this.Settings.StoneGolem.Enable && !stoneAlive)
{
pressMe.Add(this.Settings.StoneGolem.HotKey);
}
if (this.Settings.BestialUrsa.Enable && !bestialUrsa)
{
pressMe.Add(this.Settings.BestialUrsa.HotKey);
}

foreach(var press in pressMe)
{
Input.KeyDown(press);
Input.KeyUp(press);
}

return null;
}
}
}
40 changes: 40 additions & 0 deletions AutoGolem/AutoGolemSettings.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
using ExileCore.Shared.Attributes;
using ExileCore.Shared.Interfaces;
using ExileCore.Shared.Nodes;

namespace AutoGolem
{
public class AutoGolemSettings : ISettings
{
[Menu("Enable", 1)]
public ToggleNode Enable { get; set; } = new ToggleNode(true);

[Menu("Chaos Golem", 2)]
public GolemSettings ChaosGolem { get; set; } = new GolemSettings();

[Menu("Fire Golem", 3)]
public GolemSettings FireGolem { get; set; } = new GolemSettings();

[Menu("Ice Golem", 4)]
public GolemSettings IceGolem { get; set; } = new GolemSettings();

[Menu("Lighting Golem", 5)]
public GolemSettings LightingGolem { get; set; } = new GolemSettings();

[Menu("Stone Golem", 6)]
public GolemSettings StoneGolem { get; set; } = new GolemSettings();

[Menu("Bestial Ursal", 7)]
public GolemSettings BestialUrsa { get; set; } = new GolemSettings();

[Menu("Only summon when enemies are this far away", 8)]
public RangeNode<int> MinDistance { get; set; } = new RangeNode<int>(1500, 0, 10000);

[Menu("Only summon when life is at least this percentage", 9)]
public RangeNode<int> MinLife { get; set; } = new RangeNode<int>(0, 0, 100);

[Menu("Only summon when shield is at least this percentage", 10)]
public RangeNode<int> MinShield { get; set; } = new RangeNode<int>(0, 0, 100);
}

}
17 changes: 17 additions & 0 deletions AutoGolem/GolemSettings.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using ExileCore.Shared.Attributes;
using ExileCore.Shared.Interfaces;
using ExileCore.Shared.Nodes;
using System.Windows.Forms;

namespace AutoGolem
{
public class GolemSettings : ISettings
{
[Menu("Enable", 1)]
public ToggleNode Enable { get; set; } = new ToggleNode(true);

[Menu("Hotkey", 2)]
public HotkeyNode HotKey { get; set; } = new HotkeyNode(Keys.None);
}

}
36 changes: 36 additions & 0 deletions AutoGolem/Properties/AssemblyInfo.cs
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("AutoGolem")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("AutoGolem")]
[assembly: AssemblyCopyright("Copyright © 2019")]
[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("22c65bf2-0588-4d65-83af-f863343baccb")]

// 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.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
6 changes: 6 additions & 0 deletions AutoGolem/packages.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Serilog" version="2.9.0" targetFramework="net48" />
<package id="SharpDX" version="4.2.0" targetFramework="net472" />
<package id="SharpDX.Mathematics" version="4.2.0" targetFramework="net472" />
</packages>

0 comments on commit df5367a

Please sign in to comment.