Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static class DkRunes
- {
- public enum RuneType
- {
- Blood = 0,
- Unholy,
- Frost,
- Death
- } ;
- //****UPDATE ON PATCH RELASE****
- //Current version: 3.2.2
- //SUB_573820
- const uint runeType = 0x121AEC0;
- //******************************
- //Base conversion variables
- const int Base10 = 10;
- static readonly char[] CHexa = new[] { 'A', 'B', 'C', 'D', 'E', 'F' };
- private static string DecimalToBase(int iDec, int numbase)
- {
- string strBin = "";
- var 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[] { '0' });
- return strBin;
- }
- const uint RuneState = 0x121AF44;
- public static bool IsRuneReady(RuneType type)
- {
- switch (type)
- {
- case RuneType.Blood:
- return IsBloodRuneReady();
- case RuneType.Unholy:
- return IsUnholyRuneReady();
- case RuneType.Frost:
- return IsFrostRuneReady();
- default:
- throw new ArgumentException("Invalid type in IsRuneReady:{0}", type.ToString());
- }
- }
- public static bool IsBloodRuneReady()
- {
- //Rune State
- var state = ObjectManager.Wow.Read<int>(RuneState);
- var lol = ObjectManager.Wow.Read<BitVector32>(RuneState);
- var stateToBin = DecimalToBase(state, 2);
- char[] stateCharArray = stateToBin.ToCharArray();
- //Rune Type
- var runetype1 = ObjectManager.Wow.Read<uint>(runeType + 0x00);
- var runetype2 = ObjectManager.Wow.Read<uint>(runeType + 0x04);
- var runetype3 = ObjectManager.Wow.Read<uint>(runeType + 0x10);
- var runetype4 = ObjectManager.Wow.Read<uint>(runeType + 0x14);
- var runetype5 = ObjectManager.Wow.Read<uint>(runeType + 0x08);
- var runetype6 = ObjectManager.Wow.Read<uint>(runeType + 0x0C);
- if (!lol[7] && !lol[6]) // if both blood runes are on cooldown...
- {
- if (runetype1 == 3 && lol[7])
- return true;
- if (runetype2 == 3 && lol[6])
- return true;
- if (runetype3 == 3 && lol[5])
- return true;
- if (runetype4 == 3 && lol[4])
- return true;
- if (runetype5 == 3 && lol[3])
- return true;
- if (runetype6 == 3 && lol[2])
- return true;
- return false;
- }
- 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 static bool IsFrostRuneReady()
- {
- //Rune State
- var state = ObjectManager.Wow.Read<int>(RuneState);
- string stateToBin = DecimalToBase(state, 2);
- char[] stateCharArray = stateToBin.ToCharArray();
- //Rune Type
- var runetype1 = ObjectManager.Wow.Read<uint>(runeType + 0x00);
- var runetype2 = ObjectManager.Wow.Read<uint>(runeType + 0x04);
- var runetype3 = ObjectManager.Wow.Read<uint>(runeType + 0x10);
- var runetype4 = ObjectManager.Wow.Read<uint>(runeType + 0x14);
- var runetype5 = ObjectManager.Wow.Read<uint>(runeType + 0x08);
- var runetype6 = ObjectManager.Wow.Read<uint>(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 static bool IsUnholyRuneReady()
- {
- //Rune State
- var state = ObjectManager.Wow.Read<int>(RuneState);
- string stateToBin = DecimalToBase(state, 2);
- char[] stateCharArray = stateToBin.ToCharArray();
- //Rune Type
- var runetype1 = ObjectManager.Wow.Read<uint>(runeType + 0x00);
- var runetype2 = ObjectManager.Wow.Read<uint>(runeType + 0x04);
- var runetype3 = ObjectManager.Wow.Read<uint>(runeType + 0x10);
- var runetype4 = ObjectManager.Wow.Read<uint>(runeType + 0x14);
- var runetype5 = ObjectManager.Wow.Read<uint>(runeType + 0x08);
- var runetype6 = ObjectManager.Wow.Read<uint>(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;
- }
- }
Add Comment
Please, Sign In to add comment