Advertisement
Guest User

Untitled

a guest
Feb 26th, 2017
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 26.06 KB | None | 0 0
  1. function ()
  2.  
  3. local show_allExterns = true;
  4. local show_allCDs = true;
  5. local show_allUtility = true;
  6. local show_aoeCCs = true;
  7. local show_allRezzes = true;
  8. local show_allInterrupts = true;
  9.  
  10. --The following affects whether or not certain sections are displayed in a raid instance
  11. local show_raidBattleRezTimer = true; --If true, will display how many Battle Rez charges are available, and how long until a new charge becomes ready
  12.  
  13. local show_allInterrupts_inRaid = false; --If false, will hide if you're in a raid instance or there are more than 20 players in your group
  14. local show_aoeCCs_inRaid = false; --If false, will hide if you're in a raid instance or there are more than 20 players in your group
  15. local show_Ankh_inRaid = true; --If true, Ankh CD will be displayed in addition to your Battle Rez timer
  16.  
  17. local raidCDsIndentAmount = " " --Indents players' names under the title of their respective sections
  18.  
  19. if (_raidCDs_textPoll == nil) then _raidCDs_textPoll = GetTime() end
  20. if (_raidCDs_namesText == nil) then _raidCDs_namesText = "" end
  21.  
  22. if (GetTime() - _raidCDs_textPoll < 0.5) then
  23. return _raidCDs_namesText;
  24. else
  25. _raidCDs_textPoll = GetTime();
  26. end
  27.  
  28. local _, instanceType = IsInInstance();
  29.  
  30. _raidCDs_namesText = "";
  31. _raidCDs_cdText = "";
  32. _raidCDs_timeText = "";
  33.  
  34. if WeakAuras.IsOptionsOpen() then
  35. if (GetNumGroupMembers() > 0) then
  36. _raidCDs_namesText = _raidCDs_namesText.."|cFF00A2E8Made by Tehr of Sargeras (US) |r"
  37. _raidCDs_cdText = _raidCDs_cdText..""
  38. _raidCDs_timeText = _raidCDs_timeText..""
  39. else
  40. _raidCDs_namesText = _raidCDs_namesText.."\n|cFF00A2E8Made by Tehr |r\n\n"..raidCDsIndentAmount.."|cFFC41F3BTehr (US)|r\n".."\n|cFF00A2E8Battle.net |r\n\n"..raidCDsIndentAmount.."|cFFFF7D0ATehr|r\n".."\n|cFF00A2E8Discord |r\n\n"..raidCDsIndentAmount.."|cFFC79C6ETehr|r\n".."\n|cFF00A2E8Stream |r\n\n"..raidCDsIndentAmount.."|cFFF58CBAtwitch.tv/tehrible|r\n".."\n|cFF00A2E8PayPal |r\n\n"..raidCDsIndentAmount.."|cFFFFFFFFtehrible@gmail.com|r\n".."\n|cFF00A2E8Latest updates available from: |r\n\n"..raidCDsIndentAmount.."|cFF00FF96wago.io/NyJLsr8PW|r\n"
  41. _raidCDs_cdText = _raidCDs_cdText.."\n\n\n|cFFC41F3BSargeras|r\n\n\n\n|cFFFF7D0A#1477|r\n\n\n\n|cFFC79C6E#5246|r\n\n\n\n\n\n\n\n\n\n\n\n\n";
  42. _raidCDs_timeText = _raidCDs_timeText.."\n\n\n|cFF00FF00READY|r\n\n\n\n|cFFFFCC0000:09|r\n\n\n\n|cFFFF660000:59|r\n\n\n\n|cFFFF000001:59|r\n\n\n\n|cFFFF660059|r\n\n\n\n|cFF555555READY|r\n";
  43. end
  44. end
  45.  
  46. if (GetNumGroupMembers() > 0) then
  47.  
  48. if (show_allExterns) then
  49.  
  50. _raidCDs_namesText = _raidCDs_namesText.."\n|cFF00A2E8External CDs |r\n\n";
  51. _raidCDs_cdText = _raidCDs_cdText.."\n\n\n";
  52. _raidCDs_timeText = _raidCDs_timeText.."\n\n\n";
  53.  
  54. local allExterns = {};
  55.  
  56. allExterns["|cFFFF7D0A"] = _externCDs_druids;
  57. allExterns["|cFF00FF96"] = _externCDs_monks;
  58. allExterns["|cFFF58CBA"] = _externCDs_paladins;
  59. allExterns["|cFFFFFFFF"] = _externCDs_priests;
  60. allExterns["|cFFC79C6E"] = _externCDs_warriors;
  61. allExterns["|cFFA330C9"] = _externCDs_dhs;
  62.  
  63. for theCDGroupColor, theCDGroup in pairs(allExterns) do
  64.  
  65. if (theCDGroup ~= nil) then
  66. for name, cdData in pairs(theCDGroup) do
  67. for cdName, cdTime in pairs(cdData) do
  68.  
  69. local timeColor;
  70. local cdDTime = cdTime - GetTime();
  71.  
  72. if (UnitHealth(name) <= 0) then
  73. nameColor = "|cFF555555";
  74. timeColor = "|cFF555555";
  75. else
  76. if (cdDTime <= 0) then
  77. timeColor = "|cFF00FF00";
  78. elseif (cdDTime <= 10) then
  79. timeColor = "|cFFFFCC00";
  80. elseif (cdDTime <= 60) then
  81. timeColor = "|cFFFF6600";
  82. else
  83. timeColor = "|cFFFF0000";
  84. end
  85. end
  86. if (cdDTime <= 0) then
  87. cdDTime = timeColor.."READY|r";
  88. else
  89. cdDTime = timeColor..string.format("%02d:%02d", math.floor(cdDTime/60), math.floor(cdDTime - 60*math.floor(cdDTime/60))).."|r"
  90. end
  91.  
  92. dashpos = string.find(name,"-");
  93. if (dashpos ~= nil) then name = string.sub(name, 0, dashpos - 1) end
  94.  
  95. newName = string.sub(name, 0, 8);
  96.  
  97. if (string.len(newName) < string.len(name)) then newName = newName..".." end
  98.  
  99. _raidCDs_namesText = _raidCDs_namesText..raidCDsIndentAmount..theCDGroupColor..newName.."\n"
  100. _raidCDs_cdText = _raidCDs_cdText..theCDGroupColor..cdName.."\n";
  101. _raidCDs_timeText = _raidCDs_timeText..cdDTime.."\n";
  102.  
  103. end
  104. end
  105. end
  106.  
  107. end
  108. end
  109.  
  110. if (show_allCDs) then
  111.  
  112. _raidCDs_namesText = _raidCDs_namesText.."\n|cFF00A2E8Raid CDs |r\n\n";
  113. _raidCDs_cdText = _raidCDs_cdText.."\n\n\n";
  114. _raidCDs_timeText = _raidCDs_timeText.."\n\n\n";
  115.  
  116. local allCDs = { };
  117.  
  118. allCDs["|cFFFF7D0A"] = _raidCDs_druids;
  119. allCDs["|cFF00FF96"] = _raidCDs_monks;
  120. allCDs["|cFFF58CBA"] = _raidCDs_paladins;
  121. allCDs["|cFFFFFFFF"] = _raidCDs_priests;
  122. allCDs["|cFF0070DE"] = _raidCDs_shamans;
  123. allCDs["|cFFC79C6E"] = _raidCDs_warriors;
  124. allCDs["|cFFA330C9"] = _raidCDs_dhs;
  125.  
  126. for theCDGroupColor, theCDGroup in pairs(allCDs) do
  127.  
  128. if (theCDGroup ~= nil) then
  129. for name, cdData in pairs(theCDGroup) do
  130. for cdName, cdTime in pairs(cdData) do
  131.  
  132. local timeColor;
  133. local cdDTime = cdTime - GetTime();
  134.  
  135. if (UnitHealth(name) <= 0) then
  136. nameColor = "|cFF555555";
  137. timeColor = "|cFF555555";
  138. else
  139. if (cdDTime <= 0) then
  140. timeColor = "|cFF00FF00";
  141. elseif (cdDTime <= 10) then
  142. timeColor = "|cFFFFCC00";
  143. elseif (cdDTime <= 60) then
  144. timeColor = "|cFFFF6600";
  145. else
  146. timeColor = "|cFFFF0000";
  147. end
  148. end
  149. if (cdDTime <= 0) then
  150. cdDTime = timeColor.."READY|r";
  151. else
  152. cdDTime = timeColor..string.format("%02d:%02d", math.floor(cdDTime/60), math.floor(cdDTime - 60*math.floor(cdDTime/60))).."|r"
  153. end
  154.  
  155. dashpos = string.find(name,"-");
  156. if (dashpos ~= nil) then name = string.sub(name, 0, dashpos - 1) end
  157.  
  158. newName = string.sub(name, 0, 8);
  159.  
  160. if (string.len(newName) < string.len(name)) then newName = newName..".." end
  161.  
  162. _raidCDs_namesText = _raidCDs_namesText..raidCDsIndentAmount..theCDGroupColor..newName.."\n"
  163. _raidCDs_cdText = _raidCDs_cdText..theCDGroupColor..cdName.."\n";
  164. _raidCDs_timeText = _raidCDs_timeText..cdDTime.."\n";
  165.  
  166. end
  167. end
  168. end
  169. end
  170. end
  171.  
  172. if (show_allUtility) then
  173.  
  174. _raidCDs_namesText = _raidCDs_namesText.."\n|cFF00A2E8Utility CDs |r\n\n";
  175. _raidCDs_cdText = _raidCDs_cdText.."\n\n\n";
  176. _raidCDs_timeText = _raidCDs_timeText.."\n\n\n";
  177.  
  178. local allCDs = { };
  179.  
  180. allCDs["|cFFC41F3B"] = _utilityCDs_dks;
  181. allCDs["|cFFA330C9"] = _utilityCDs_dhs;
  182. allCDs["|cFFFF7D0A"] = _utilityCDs_druids;
  183. allCDs["|cFFF58CBA"] = _utilityCDs_paladins;
  184. allCDs["|cFFFFFFFF"] = _utilityCDs_priests;
  185. allCDs["|cFF0070DE"] = _utilityCDs_shamans;
  186.  
  187. for theCDGroupColor, theCDGroup in pairs(allCDs) do
  188.  
  189. if (theCDGroup ~= nil) then
  190. for name, cdData in pairs(theCDGroup) do
  191. for cdName, cdTime in pairs(cdData) do
  192.  
  193. local timeColor;
  194. local cdDTime = cdTime - GetTime();
  195.  
  196. if (UnitHealth(name) <= 0) then
  197. nameColor = "|cFF555555";
  198. timeColor = "|cFF555555";
  199. else
  200. if (cdDTime <= 0) then
  201. timeColor = "|cFF00FF00";
  202. elseif (cdDTime <= 10) then
  203. timeColor = "|cFFFFCC00";
  204. elseif (cdDTime <= 60) then
  205. timeColor = "|cFFFF6600";
  206. else
  207. timeColor = "|cFFFF0000";
  208. end
  209. end
  210. if (cdDTime <= 0) then
  211. cdDTime = timeColor.."READY|r";
  212. else
  213. cdDTime = timeColor..string.format("%02d:%02d", math.floor(cdDTime/60), math.floor(cdDTime - 60*math.floor(cdDTime/60))).."|r"
  214. end
  215.  
  216. dashpos = string.find(name,"-");
  217. if (dashpos ~= nil) then name = string.sub(name, 0, dashpos - 1) end
  218.  
  219. newName = string.sub(name, 0, 8);
  220.  
  221. if (string.len(newName) < string.len(name)) then newName = newName..".." end
  222.  
  223. _raidCDs_namesText = _raidCDs_namesText..raidCDsIndentAmount..theCDGroupColor..newName.."\n"
  224. _raidCDs_cdText = _raidCDs_cdText..theCDGroupColor..cdName.."\n";
  225. _raidCDs_timeText = _raidCDs_timeText..cdDTime.."\n";
  226.  
  227. end
  228. end
  229. end
  230. end
  231. end
  232.  
  233. if (show_aoeCCs) then
  234.  
  235. if ((instanceType ~= "raid") and GetNumGroupMembers()<21) or (show_aoeCCs_inRaid == true) then
  236.  
  237. _raidCDs_namesText = _raidCDs_namesText.."\n|cFF00A2E8Crowd Control |r\n\n";
  238. _raidCDs_cdText = _raidCDs_cdText.."\n\n\n";
  239. _raidCDs_timeText = _raidCDs_timeText.."\n\n\n";
  240.  
  241. local allCDs = { };
  242.  
  243. allCDs["|cFFFF7D0A"] = _aoeCCs_druids;
  244. allCDs["|cFFFFFFFF"] = _aoeCCs_priests;
  245. allCDs["|cFFABD473"] = _aoeCCs_hunters;
  246. allCDs["|cFF69CCF0"] = _aoeCCs_mages;
  247. allCDs["|cFF00FF96"] = _aoeCCs_monks;
  248. allCDs["|cFF0070DE"] = _aoeCCs_shamans;
  249. allCDs["|cFFC79C6E"] = _aoeCCs_warriors;
  250. allCDs["|cFFA330C9"] = _aoeCCs_dhs;
  251. allCDs["|cFF9482C9"] = _aoeCCs_warlocks;
  252. allCDs["|cFFC41F3B"] = _aoeCCs_dks;
  253. allCDs["|cFFB4B4B4"] = _aoeCCs_tauren;
  254.  
  255. for theCDGroupColor, theCDGroup in pairs(allCDs) do
  256.  
  257. if (theCDGroup ~= nil) then
  258. for name, cdData in pairs(theCDGroup) do
  259. for cdName, cdTime in pairs(cdData) do
  260.  
  261. local timeColor;
  262. local cdDTime = cdTime - GetTime();
  263.  
  264. if (UnitHealth(name) <= 0) then
  265. nameColor = "|cFF555555";
  266. timeColor = "|cFF555555";
  267. else
  268. if (cdDTime <= 0) then
  269. timeColor = "|cFF00FF00";
  270. elseif (cdDTime <= 10) then
  271. timeColor = "|cFFFFCC00";
  272. elseif (cdDTime <= 60) then
  273. timeColor = "|cFFFF6600";
  274. else
  275. timeColor = "|cFFFF0000";
  276. end
  277. end
  278. if (cdDTime <= 0) then
  279. cdDTime = timeColor.."READY|r";
  280. else
  281. cdDTime = timeColor..string.format("%02d:%02d", math.floor(cdDTime/60), math.floor(cdDTime - 60*math.floor(cdDTime/60))).."|r"
  282. end
  283.  
  284. dashpos = string.find(name,"-");
  285. if (dashpos ~= nil) then name = string.sub(name, 0, dashpos - 1) end
  286.  
  287. newName = string.sub(name, 0, 8);
  288.  
  289. if (string.len(newName) < string.len(name)) then newName = newName..".." end
  290.  
  291. _raidCDs_namesText = _raidCDs_namesText..raidCDsIndentAmount..theCDGroupColor..newName.."\n"
  292. _raidCDs_cdText = _raidCDs_cdText..theCDGroupColor..cdName.."\n";
  293. _raidCDs_timeText = _raidCDs_timeText..cdDTime.."\n";
  294.  
  295. end
  296. end
  297. end
  298. end
  299. end
  300. end
  301.  
  302. if (show_allInterrupts) then
  303.  
  304. if ((instanceType ~= "raid") and GetNumGroupMembers()<21) or (show_allInterrupts_inRaid == true) then
  305.  
  306. _raidCDs_namesText = _raidCDs_namesText.."\n|cFF00A2E8Interrupts |r\n\n";
  307. _raidCDs_cdText = _raidCDs_cdText.."\n\n\n";
  308. _raidCDs_timeText = _raidCDs_timeText.."\n\n\n";
  309.  
  310. local allinterrupts = { };
  311.  
  312. allinterrupts["|cFFFF7D0A"] = _interrupts_druids;
  313. allinterrupts["|cFFFFFFFF"] = _interrupts_priests;
  314. allinterrupts["|cFFABD473"] = _interrupts_hunters;
  315. allinterrupts["|cFF69CCF0"] = _interrupts_mages;
  316. allinterrupts["|cFF00FF96"] = _interrupts_monks;
  317. allinterrupts["|cFFF58CBA"] = _interrupts_paladins;
  318. allinterrupts["|cFF0070DE"] = _interrupts_shamans;
  319. allinterrupts["|cFFC41F3B"] = _interrupts_dks;
  320. allinterrupts["|cFFFFF569"] = _interrupts_rogues;
  321. allinterrupts["|cFFC79C6E"] = _interrupts_warriors;
  322. allinterrupts["|cFFA330C9"] = _interrupts_dhs;
  323. allinterrupts["|cFF9482C9"] = _interrupts_warlocks;
  324. allinterrupts["|cFFB4B4B4"] = _interrupts_belfs;
  325.  
  326. for theCDGroupColor, theCDGroup in pairs(allinterrupts) do
  327.  
  328. if (theCDGroup ~= nil) then
  329. for name, cdData in pairs(theCDGroup) do
  330. for cdName, cdTime in pairs(cdData) do
  331.  
  332. local timeColor;
  333. local cdDTime = cdTime - GetTime();
  334.  
  335. if (UnitHealth(name) <= 0) then
  336. nameColor = "|cFF555555";
  337. timeColor = "|cFF555555";
  338. else
  339. if (cdDTime <= 0) then
  340. timeColor = "|cFF00FF00";
  341. elseif (cdDTime <= 10) then
  342. timeColor = "|cFFFFCC00";
  343. elseif (cdDTime <= 60) then
  344. timeColor = "|cFFFF6600";
  345. else
  346. timeColor = "|cFFFF0000";
  347. end
  348. end
  349. if (cdDTime <= 0) then
  350. cdDTime = timeColor.."READY|r";
  351. else
  352. cdDTime = timeColor..math.floor(cdDTime).."|r";
  353. end
  354.  
  355. dashpos = string.find(name,"-");
  356. if (dashpos ~= nil) then name = string.sub(name, 0, dashpos - 1) end
  357.  
  358. newName = string.sub(name, 0, 8);
  359.  
  360. if (string.len(newName) < string.len(name)) then newName = newName..".." end
  361.  
  362. _raidCDs_namesText = _raidCDs_namesText..raidCDsIndentAmount..theCDGroupColor..newName.."\n"
  363. _raidCDs_cdText = _raidCDs_cdText..theCDGroupColor..cdName.."\n";
  364. _raidCDs_timeText = _raidCDs_timeText..cdDTime.."\n";
  365.  
  366. end
  367. end
  368. end
  369. end
  370. end
  371. end
  372.  
  373. if (show_allRezzes) then
  374.  
  375. if (instanceType ~= "raid") or (show_Ankh_inRaid == true) then
  376.  
  377. local allCDs = { };
  378. local rezType = "Battle Rezzes"
  379.  
  380. if (instanceType ~= "raid") then
  381. allCDs["|cFFC41F3B"] = _rezCDs_dks;
  382. allCDs["|cFFFF7D0A"] = _rezCDs_druids;
  383. allCDs["|cFFABD473"] = _rezCDs_hunters;
  384. allCDs["|cFF9482C9"] = _rezCDs_warlocks;
  385. allCDs["|cFF0070DE"] = _rezCDs_shamans;
  386. else
  387. allCDs["|cFF0070DE"] = _rezCDs_shamans;
  388. end
  389.  
  390. _raidCDs_namesText = _raidCDs_namesText.."\n|cFF00A2E8"..rezType.." |r\n\n";
  391. _raidCDs_cdText = _raidCDs_cdText.."\n\n\n";
  392. _raidCDs_timeText = _raidCDs_timeText.."\n\n\n";
  393.  
  394. for theCDGroupColor, theCDGroup in pairs(allCDs) do
  395.  
  396. if (theCDGroup ~= nil) then
  397. for name, cdData in pairs(theCDGroup) do
  398. for cdName, cdTime in pairs(cdData) do
  399.  
  400. local timeColor;
  401. local cdDTime = cdTime - GetTime();
  402.  
  403. if (UnitHealth(name) <= 0) then
  404. nameColor = "|cFF555555";
  405. timeColor = "|cFF555555";
  406. else
  407. if (cdDTime <= 0) then
  408. timeColor = "|cFF00FF00";
  409. elseif (cdDTime <= 10) then
  410. timeColor = "|cFFFFCC00";
  411. elseif (cdDTime <= 60) then
  412. timeColor = "|cFFFF6600";
  413. else
  414. timeColor = "|cFFFF0000";
  415. end
  416. end
  417. if (cdDTime <= 0) then
  418. cdDTime = timeColor.."READY|r";
  419. else
  420. cdDTime = timeColor..string.format("%02d:%02d", math.floor(cdDTime/60), math.floor(cdDTime - 60*math.floor(cdDTime/60))).."|r"
  421. end
  422.  
  423. dashpos = string.find(name,"-");
  424. if (dashpos ~= nil) then name = string.sub(name, 0, dashpos - 1) end
  425.  
  426. newName = string.sub(name, 0, 8);
  427.  
  428. if (string.len(newName) < string.len(name)) then newName = newName..".." end
  429.  
  430. _raidCDs_namesText = _raidCDs_namesText..raidCDsIndentAmount..theCDGroupColor..newName.."\n"
  431. _raidCDs_cdText = _raidCDs_cdText..theCDGroupColor..cdName.."\n";
  432. _raidCDs_timeText = _raidCDs_timeText..cdDTime.."\n";
  433.  
  434. end
  435. end
  436. end
  437. end
  438. end
  439. end
  440.  
  441. if (show_raidBattleRezTimer) then
  442.  
  443. if (instanceType == "raid") then
  444.  
  445. -- BIG THANKS to Krazyito for this code and his help http://www.mmo-champion.com/threads/1686033-Weak-Auras-Battle-Res-Monitor-Looking-for-feedback
  446.  
  447. if TehrsCDs_encounterStart then
  448.  
  449. local rezCharges, _, started, duration = GetSpellCharges(20484)
  450. local timerString = ""
  451.  
  452. if started then
  453. local brezTimer = duration - (GetTime() - started)
  454. local m = floor(brezTimer/60)
  455. local s = mod(brezTimer, 60)
  456. timerString = string.format("%02d:%02d", m, s)
  457. end
  458.  
  459. if rezCharges == nil then
  460. rezCharges = 0
  461. end
  462.  
  463. if rezCharges == 0 then
  464. rezCharges = "|cFF555555"..rezCharges.."|r"
  465. else
  466. rezCharges ="|cFF00FF00"..rezCharges.."|r"
  467. end
  468.  
  469. _raidCDs_namesText = _raidCDs_namesText..raidCDsIndentAmount.."|cFFFFFFFFCharges|r:\n"
  470. _raidCDs_cdText = _raidCDs_cdText..rezCharges.."\n";
  471. _raidCDs_timeText = _raidCDs_timeText..timerString.."\n";
  472.  
  473. end
  474. end
  475. end
  476. end
  477.  
  478. local _, lineCount = string.gsub(_raidCDs_namesText, "\n", "");
  479. lineCount = lineCount + 1;
  480.  
  481. if WeakAuras.regions["RaidCDs_Background"] then
  482. --
  483. WeakAuras.regions["RaidCDs_Background"].region:SetHeight( (lineCount * 11) - 10 );
  484. end
  485. return _raidCDs_namesText;
  486. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement