Created
May 23, 2018 02:08
-
-
Save nirinium/0d77cd8eb327d81190b0310cba3460a5 to your computer and use it in GitHub Desktop.
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
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using System.Threading.Tasks; | |
using System.Threading; | |
using System.Windows.Forms; | |
using System.Diagnostics; | |
using System.Drawing; | |
using System.Runtime.InteropServices; | |
using Gma.System.MouseKeyHook; | |
namespace ESOTest1 | |
{ | |
class Combat | |
{ | |
public Combat() | |
{ | |
handle = FindWindow(null, "Elder Scrolls Online"); | |
} | |
[System.Runtime.InteropServices.DllImport("User32.dll")] | |
public static extern bool SetForegroundWindow(IntPtr hWnd); | |
[System.Runtime.InteropServices.DllImport("User32.dll")] | |
public static extern IntPtr FindWindow(string lpClassName, string lpWindowName); | |
[System.Runtime.InteropServices.DllImport("User32.dll")] | |
public static extern IntPtr GetForegroundWindow(); | |
[System.Runtime.InteropServices.DllImport("user32.dll")] | |
public static extern int SendMessage(IntPtr hWnd, uint uMsg, int wParam, int lParam); | |
private const uint WM_KEYDOWN = 0x0100; | |
private const uint WM_KEYUP = 0x0101; | |
private const uint WM_MOUSEMOVE = 0x0200; | |
private const uint WM_LBUTTONDOWN = 0x0201; | |
private const uint WM_LBUTTONUP = 0x0202; | |
private const uint WM_RBUTTONDOWN = 0x0204; | |
private const uint WM_RBUTTONUP = 0x0205; | |
private IntPtr handle; | |
public void KeyDown(int key) | |
{ | |
SendMessage(handle, WM_KEYDOWN, key, 0); | |
} | |
public void KeyUp(int key) | |
{ | |
SendMessage(handle, WM_KEYUP, key, 0); | |
} | |
public void MouseButtonDown() | |
{ | |
SendMessage(handle, WM_RBUTTONDOWN, (int)Keys.RButton, 0); | |
} | |
public void MouseButtonUp() | |
{ | |
SendMessage(handle, WM_RBUTTONUP, (int)Keys.RButton, 0); | |
} | |
public void LMouseButtonUp() //LEFT CLICK UP | |
{ | |
SendMessage(handle, WM_LBUTTONUP, (int)Keys.LButton, 0); | |
}//LEFT CLICK UP | |
public void LMouseButtonDown() | |
{ | |
SendMessage(handle, WM_LBUTTONDOWN, (int)Keys.LButton, 0); | |
}//LEFT CLICK DOWN | |
public void LeftClick() | |
{ | |
SendMessage(handle, WM_LBUTTONDOWN, (int)Keys.LButton, 0); | |
SendMessage(handle, WM_LBUTTONUP, (int)Keys.LButton, 0); | |
} | |
public void LightAttack() | |
{ | |
LMouseButtonDown(); | |
Thread.Sleep(200); | |
LMouseButtonUp(); | |
} | |
public void HeavyAttack() | |
{ | |
LMouseButtonDown(); | |
Thread.Sleep(2000); | |
LMouseButtonUp(); | |
} | |
public void EndlessHail() | |
{ | |
SendMessage(handle, WM_KEYDOWN, (int)Keys.D1, 0); // RTrap | |
SendMessage(handle, WM_KEYUP, (int)Keys.D1, 0); | |
Thread.Sleep(200); | |
LeftClick(); | |
} | |
public void StamBladeBuffs() | |
{ | |
IntPtr currentWindow = GetForegroundWindow(); | |
SetForegroundWindow(handle); | |
//Thread.Sleep(3500); //delay for testing | |
SendMessage(handle, WM_KEYDOWN, (int)Keys.D5, 0); | |
SendMessage(handle, WM_KEYUP, (int)Keys.D5, 0); | |
Thread.Sleep(700); | |
SendMessage(handle, WM_KEYDOWN, (int)Keys.D2, 0); | |
SendMessage(handle, WM_KEYUP, (int)Keys.D2, 0); | |
Thread.Sleep(700); | |
SendMessage(handle, WM_KEYDOWN, (int)Keys.NumPad0, 0); | |
SendMessage(handle, WM_KEYUP, (int)Keys.NumPad0, 0); | |
Thread.Sleep(700); | |
SendMessage(handle, WM_KEYDOWN, (int)Keys.D5, 0); | |
SendMessage(handle, WM_KEYUP, (int)Keys.D5, 0); | |
Thread.Sleep(700); | |
SetForegroundWindow(currentWindow); | |
} //BUFFS | |
public void StamBladeRanged() // StamBlade Ranged/Traps | |
{ | |
IntPtr currentWindow = GetForegroundWindow(); | |
SetForegroundWindow(handle); | |
SendMessage(handle, WM_KEYDOWN, (int)Keys.D2, 0); // RTrap | |
SendMessage(handle, WM_KEYUP, (int)Keys.D2, 0); | |
Thread.Sleep(1000); | |
LightAttack(); | |
Thread.Sleep(1000); | |
EndlessHail(); | |
Thread.Sleep(950); | |
SetForegroundWindow(currentWindow); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment