Guest User

Untitled

a guest
Jul 18th, 2018
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.26 KB | None | 0 0
  1. public static class DkRunes
  2. {
  3. public enum RuneType
  4. {
  5. Blood = 0,
  6. Unholy,
  7. Frost,
  8. Death
  9. } ;
  10.  
  11. //****UPDATE ON PATCH RELASE****
  12. //Current version: 3.2.2
  13. //SUB_573820
  14.  
  15. const uint runeType = 0x121AEC0;
  16. //******************************
  17.  
  18. //Base conversion variables
  19. const int Base10 = 10;
  20. static readonly char[] CHexa = new[] { 'A', 'B', 'C', 'D', 'E', 'F' };
  21.  
  22. private static string DecimalToBase(int iDec, int numbase)
  23. {
  24. string strBin = "";
  25. var result = new int[32];
  26. int maxBit = 32;
  27.  
  28. for (; iDec > 0; iDec /= numbase)
  29. {
  30. int rem = iDec % numbase;
  31. result[--maxBit] = rem;
  32. }
  33.  
  34. for (int i = 0; i < result.Length; i++)
  35. {
  36. if ((int)result.GetValue(i) >= Base10)
  37. strBin += CHexa[(int)result.GetValue(i) % Base10];
  38.  
  39. else
  40. strBin += result.GetValue(i);
  41. }
  42.  
  43. strBin = strBin.TrimStart(new[] { '0' });
  44. return strBin;
  45. }
  46.  
  47. const uint RuneState = 0x121AF44;
  48.  
  49. public static bool IsRuneReady(RuneType type)
  50. {
  51. switch (type)
  52. {
  53. case RuneType.Blood:
  54. return IsBloodRuneReady();
  55.  
  56.  
  57. case RuneType.Unholy:
  58. return IsUnholyRuneReady();
  59.  
  60. case RuneType.Frost:
  61. return IsFrostRuneReady();
  62.  
  63. default:
  64. throw new ArgumentException("Invalid type in IsRuneReady:{0}", type.ToString());
  65. }
  66. }
  67.  
  68. public static bool IsBloodRuneReady()
  69. {
  70. //Rune State
  71. var state = ObjectManager.Wow.Read<int>(RuneState);
  72.  
  73. var lol = ObjectManager.Wow.Read<BitVector32>(RuneState);
  74.  
  75. var stateToBin = DecimalToBase(state, 2);
  76. char[] stateCharArray = stateToBin.ToCharArray();
  77.  
  78.  
  79.  
  80. //Rune Type
  81. var runetype1 = ObjectManager.Wow.Read<uint>(runeType + 0x00);
  82. var runetype2 = ObjectManager.Wow.Read<uint>(runeType + 0x04);
  83. var runetype3 = ObjectManager.Wow.Read<uint>(runeType + 0x10);
  84. var runetype4 = ObjectManager.Wow.Read<uint>(runeType + 0x14);
  85. var runetype5 = ObjectManager.Wow.Read<uint>(runeType + 0x08);
  86. var runetype6 = ObjectManager.Wow.Read<uint>(runeType + 0x0C);
  87.  
  88.  
  89.  
  90. if (!lol[7] && !lol[6]) // if both blood runes are on cooldown...
  91. {
  92. if (runetype1 == 3 && lol[7])
  93. return true;
  94.  
  95. if (runetype2 == 3 && lol[6])
  96. return true;
  97.  
  98. if (runetype3 == 3 && lol[5])
  99. return true;
  100.  
  101. if (runetype4 == 3 && lol[4])
  102. return true;
  103.  
  104. if (runetype5 == 3 && lol[3])
  105. return true;
  106.  
  107. if (runetype6 == 3 && lol[2])
  108. return true;
  109.  
  110. return false;
  111. }
  112.  
  113. if (stateCharArray[7] == '0' && stateCharArray[6] == '0')
  114. {
  115. if (runetype1 == 3 && stateCharArray[7] == '1')
  116. return true;
  117.  
  118. if (runetype2 == 3 && stateCharArray[6] == '1')
  119. return true;
  120.  
  121. if (runetype3 == 3 && stateCharArray[5] == '1')
  122. return true;
  123.  
  124. if (runetype4 == 3 && stateCharArray[4] == '1')
  125. return true;
  126.  
  127. if (runetype5 == 3 && stateCharArray[3] == '1')
  128. return true;
  129.  
  130. if (runetype6 == 3 && stateCharArray[2] == '1')
  131. return true;
  132.  
  133. return false;
  134. }
  135.  
  136. return true;
  137. }
  138.  
  139. public static bool IsFrostRuneReady()
  140. {
  141. //Rune State
  142. var state = ObjectManager.Wow.Read<int>(RuneState);
  143. string stateToBin = DecimalToBase(state, 2);
  144. char[] stateCharArray = stateToBin.ToCharArray();
  145.  
  146. //Rune Type
  147. var runetype1 = ObjectManager.Wow.Read<uint>(runeType + 0x00);
  148. var runetype2 = ObjectManager.Wow.Read<uint>(runeType + 0x04);
  149. var runetype3 = ObjectManager.Wow.Read<uint>(runeType + 0x10);
  150. var runetype4 = ObjectManager.Wow.Read<uint>(runeType + 0x14);
  151. var runetype5 = ObjectManager.Wow.Read<uint>(runeType + 0x08);
  152. var runetype6 = ObjectManager.Wow.Read<uint>(runeType + 0x0C);
  153.  
  154. if (stateCharArray[3] == '0' && stateCharArray[2] == '0')
  155. {
  156. if (runetype1 == 3 && stateCharArray[7] == '1')
  157. return true;
  158.  
  159. if (runetype2 == 3 && stateCharArray[6] == '1')
  160. {
  161. return true;
  162. }
  163. if (runetype3 == 3 && stateCharArray[5] == '1')
  164. {
  165. return true;
  166. }
  167. if (runetype4 == 3 && stateCharArray[4] == '1')
  168. {
  169. return true;
  170. }
  171. if (runetype5 == 3 && stateCharArray[3] == '1')
  172. {
  173. return true;
  174. }
  175. if (runetype6 == 3 && stateCharArray[2] == '1')
  176. {
  177. return true;
  178. }
  179. return false;
  180. }
  181. return true;
  182.  
  183. }
  184.  
  185. public static bool IsUnholyRuneReady()
  186. {
  187. //Rune State
  188. var state = ObjectManager.Wow.Read<int>(RuneState);
  189. string stateToBin = DecimalToBase(state, 2);
  190. char[] stateCharArray = stateToBin.ToCharArray();
  191.  
  192. //Rune Type
  193. var runetype1 = ObjectManager.Wow.Read<uint>(runeType + 0x00);
  194. var runetype2 = ObjectManager.Wow.Read<uint>(runeType + 0x04);
  195. var runetype3 = ObjectManager.Wow.Read<uint>(runeType + 0x10);
  196. var runetype4 = ObjectManager.Wow.Read<uint>(runeType + 0x14);
  197. var runetype5 = ObjectManager.Wow.Read<uint>(runeType + 0x08);
  198. var runetype6 = ObjectManager.Wow.Read<uint>(runeType + 0x0C);
  199.  
  200. if (stateCharArray[5] == '0' && stateCharArray[4] == '0')
  201. {
  202. if (runetype1 == 3 && stateCharArray[7] == '1')
  203. return true;
  204.  
  205. if (runetype2 == 3 && stateCharArray[6] == '1')
  206. return true;
  207.  
  208. if (runetype3 == 3 && stateCharArray[5] == '1')
  209. return true;
  210.  
  211. if (runetype4 == 3 && stateCharArray[4] == '1')
  212. return true;
  213.  
  214. if (runetype5 == 3 && stateCharArray[3] == '1')
  215. return true;
  216.  
  217. if (runetype6 == 3 && stateCharArray[2] == '1')
  218. return true;
  219.  
  220. return false;
  221. }
  222.  
  223. return true;
  224. }
  225. }
Add Comment
Please, Sign In to add comment