Hi, since I myself had a bit of trouble finding how to calculate cooldowns for Death Knights due to the fact that runes play a vital part on cd calculation and that theres little information about how to retrive rune states in a non inyected way, I decided to post the class I did for this purpose.
The C# class is pretty straight foward and can be easily ported to c++ or any other language except autoIt (Note: if you port it to autoIt you brain will melt and all your extremities that don't serve a moving, grabbing or noding purpose will fall to the floor )
Anyway here you have, ready to use out of the box.
Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Diagnostics;
namespace yourappname
{
class DKRunes
{
//****UPDATE ON PATCH RELASE****
//Current version: 3.2.2
//SUB_573820
uint runeState = 0x121AF44;
uint runeType = 0x121AEC0;
//******************************
//----RuneType values----
//Blood = 0
//Frost = 2
//Unholy = 1
//Death = 3
//-----------------------
//WOW handle
static IntPtr hProcess;
//Base conversion variables
const int base10 = 10;
char[] cHexa = new char[] { 'A', 'B', 'C', 'D', 'E', 'F' };
int[] iHexaNumeric = new int[] { 10, 11, 12, 13, 14, 15 };
int[] iHexaIndices = new int[] { 0, 1, 2, 3, 4, 5 };
const int asciiDiff = 48;
public DKRunes()
{
Process.EnterDebugMode();
hProcess = Memory.OpenProcess(Memory.GetProcessIdByProcessName("wow.exe"));
}
public String DecimalToBase(int iDec, int numbase)
{
string strBin = "";
int[] result = new int[32];
int MaxBit = 32;
for (; iDec > 0; iDec /= numbase)
{
int rem = iDec % numbase;
result[--MaxBit] = rem;
}
for (int i = 0; i < result.Length; i++)
if ((int)result.GetValue(i) >= base10)
strBin += cHexa[(int)result.GetValue(i) % base10];
else
strBin += result.GetValue(i);
strBin = strBin.TrimStart(new char[] { '0' });
return strBin;
}
public Boolean isBloodRuneReady()
{
//Rune State
int state = Memory.ReadInt(hProcess, runeState);
String stateToBin = DecimalToBase(state, 2);
char[] stateCharArray = stateToBin.ToCharArray();
//Rune Type
uint runetype1 = Memory.ReadUInt(hProcess, runeType + 0x00);
uint runetype2 = Memory.ReadUInt(hProcess, runeType + 0x04);
uint runetype3 = Memory.ReadUInt(hProcess, runeType + 0x10);
uint runetype4 = Memory.ReadUInt(hProcess, runeType + 0x14);
uint runetype5 = Memory.ReadUInt(hProcess, runeType + 0x08);
uint runetype6 = Memory.ReadUInt(hProcess, runeType + 0x0C);
if (stateCharArray[7] == '0' && stateCharArray[6] == '0')
{
if (runetype1 == 3 && stateCharArray[7] == '1')
{
return true;
}
if (runetype2 == 3 && stateCharArray[6] == '1')
{
return true;
}
if (runetype3 == 3 && stateCharArray[5] == '1')
{
return true;
}
if (runetype4 == 3 && stateCharArray[4] == '1')
{
return true;
}
if (runetype5 == 3 && stateCharArray[3] == '1')
{
return true;
}
if (runetype6 == 3 && stateCharArray[2] == '1')
{
return true;
}
return false;
}
return true;
}
public Boolean isFrostRuneReady(){
//Rune State
int state = Memory.ReadInt(hProcess, runeState);
String stateToBin = DecimalToBase(state, 2);
char[] stateCharArray = stateToBin.ToCharArray();
//Rune Type
uint runetype1 = Memory.ReadUInt(hProcess, runeType + 0x00);
uint runetype2 = Memory.ReadUInt(hProcess, runeType + 0x04);
uint runetype3 = Memory.ReadUInt(hProcess, runeType + 0x10);
uint runetype4 = Memory.ReadUInt(hProcess, runeType + 0x14);
uint runetype5 = Memory.ReadUInt(hProcess, runeType + 0x08);
uint runetype6 = Memory.ReadUInt(hProcess, runeType + 0x0C);
if (stateCharArray[3] == '0' && stateCharArray[2] == '0')
{
if (runetype1 == 3 && stateCharArray[7] == '1')
{
return true;
}
if (runetype2 == 3 && stateCharArray[6] == '1')
{
return true;
}
if (runetype3 == 3 && stateCharArray[5] == '1')
{
return true;
}
if (runetype4 == 3 && stateCharArray[4] == '1')
{
return true;
}
if (runetype5 == 3 && stateCharArray[3] == '1')
{
return true;
}
if (runetype6 == 3 && stateCharArray[2] == '1')
{
return true;
}
return false;
}
return true;
}
public Boolean isUnholyRuneReady()
{
//Rune State
int state = Memory.ReadInt(hProcess, runeState);
String stateToBin = DecimalToBase(state, 2);
char[] stateCharArray = stateToBin.ToCharArray();
//Rune Type
uint runetype1 = Memory.ReadUInt(hProcess, runeType + 0x00);
uint runetype2 = Memory.ReadUInt(hProcess, runeType + 0x04);
uint runetype3 = Memory.ReadUInt(hProcess, runeType + 0x10);
uint runetype4 = Memory.ReadUInt(hProcess, runeType + 0x14);
uint runetype5 = Memory.ReadUInt(hProcess, runeType + 0x08);
uint runetype6 = Memory.ReadUInt(hProcess, runeType + 0x0C);
if (stateCharArray[5] == '0' && stateCharArray[4] == '0')
{
if (runetype1 == 3 && stateCharArray[7] == '1')
{
return true;
}
if (runetype2 == 3 && stateCharArray[6] == '1')
{
return true;
}
if (runetype3 == 3 && stateCharArray[5] == '1')
{
return true;
}
if (runetype4 == 3 && stateCharArray[4] == '1')
{
return true;
}
if (runetype5 == 3 && stateCharArray[3] == '1')
{
return true;
}
if (runetype6 == 3 && stateCharArray[2] == '1')
{
return true;
}
return false;
}
return true;
}
}
}
Credits go for all that people who actually spend time helping other in this forum, even I their questions had been covered 2^99999 times, and that no matter what, they always find a way to help and cheer your day .