Advertisement
Guest User

Visible buff on frame macro

a guest
Jan 4th, 2016
6,901
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.81 KB | None | 0 0
  1. local indicators = {}
  2. local buffs = {}
  3. local_, class = UnitClass("player");
  4.  
  5. if ( class == "DRUID" ) then
  6. buffs = {["Mark of the Wild"] = true}
  7. end
  8. if (class == "PRIEST" ) then
  9. buffs = {["Power Word: Fortitude"] = true}
  10. end
  11. if (class == "MAGE" ) then
  12. buffs = {["Arcane Brilliance"] = true}
  13. end
  14. if (class == "MONK" ) then
  15. buffs = {
  16. ["Legacy of the White Tiger"] = true,
  17. ["Legacy of the Emperor"] = true
  18. }
  19. end
  20. if (class == "DEATHKNIGHT" ) then
  21. buffs = {["Horn of Winter"] = true}
  22. end
  23. if (class == "PALADIN" ) then
  24. buffs = {
  25. ["Blessing of Kings"] = true,
  26. ["Blessing of Might"] = true
  27. }
  28. end
  29. if (class == "WARLOCK" ) then
  30. buffs = {["Dark Intent"] = true}
  31. end
  32. if (class == "WARRIOR" ) then
  33. buffs = {
  34. ["Battle Shout"] = true,
  35. ["Commanding Shout"] = true
  36. }
  37. end
  38.  
  39.  
  40.  
  41. local function getIndicator(frame)
  42. local indicator = indicators[frame:GetName()]
  43. if not indicator then
  44. indicator = CreateFrame("Button", nil, frame, "CompactAuraTemplate")
  45. indicator:ClearAllPoints()
  46. indicator:SetPoint("TOPRIGHT", frame, "TOPRIGHT", -3, -2)
  47. indicator:SetSize(22, 22)
  48. indicator:SetAlpha(0.6)
  49. indicators[frame:GetName()] = indicator
  50. end
  51. return indicator
  52. end
  53.  
  54. local function updateBuffs(frame)
  55. if not frame:IsVisible() then return end
  56.  
  57. local indicator = getIndicator(frame)
  58. local buffName = nil
  59. for i = 1, 40 do
  60. local _, _, _, _, _, d, _, ut, _, sc, s, c = UnitBuff(frame.displayedUnit, i);
  61. buffName = UnitBuff(frame.displayedUnit, i);
  62. if not buffName then break end
  63. if buffs[buffName] and ( ut == "player" or ut == "pet" ) then
  64. indicator:SetSize(frame.buffFrames[1]:GetSize()) -- scale
  65. CompactUnitFrame_UtilSetBuff(indicator, frame.displayedUnit, i, nil);
  66. return
  67. end
  68. end
  69. indicator:Hide()
  70. end
  71. hooksecurefunc("CompactUnitFrame_UpdateBuffs", updateBuffs)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement