Guest User

Untitled

a guest
Jun 25th, 2018
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.32 KB | None | 0 0
  1. local inCombatAlpha = 0
  2. local outCombatAlpha = 1
  3.  
  4. local frames = {
  5.     TukuiInfoRight,
  6.     TukuiCubeLeft,
  7.     TukuiCubeRight,
  8.     TukuiInfoLeftLineVertical,
  9.     TukuiInfoRightLineVertcal,
  10.     TukuiLineToABRight,
  11.     TukuiLineToABLeft,
  12.     TukuiBar1,
  13.     TukuiBar2,
  14.     Tukuibar3,
  15.     Tukuibar4,
  16.     Tukuibar5,
  17.     Tukuibar6,
  18.     Tukuibar7,
  19.     Recount_MainWindow,
  20. }
  21.  
  22. local buttons = {
  23.     'MultiBarBottomLeftButton',
  24.     'MultiBarBottomRightButton',
  25.     'MultiBarLeftButton',
  26.     'MultiBarRightButton',
  27.     'ActionButton',
  28. }
  29.  
  30. for _, button in pairs(buttons) do
  31.     for index = 1, 12 do
  32.         table.insert(frames, _G[button .. index])
  33.         table.insert(frames, _G[button .. index .. 'Panel'])
  34.     end
  35. end
  36.  
  37. local addon = CreateFrame('Frame')
  38. addon:RegisterEvent('PLAYER_REGEN_ENABLED')
  39. addon:RegisterEvent('PLAYER_REGEN_DISABLED')
  40. addon:SetScript('OnEvent', function()
  41.     for _, frame in pairs(frames) do
  42.         if(InCombatLockdown()) then
  43.             frame:SetAlpha(inCombatAlpha)
  44.         else
  45.             frame:SetAlpha(outCombatAlpha)
  46.         end
  47.     end
  48. end)
  49.  
  50. local function OnEnter(self)
  51.     self:SetAlpha(outCombatAlpha)
  52. end
  53.  
  54. local function OnLeave(self)
  55.     if(InCombatLockdown()) then
  56.         self:SetAlpha(inCombatAlpha)
  57.     else
  58.         self:SetAlpha(outCombatAlpha)
  59.     end
  60. end
  61.  
  62. for _, frame in pairs(frames) do
  63.     frame:SetScript('OnEnter', OnEnter)
  64.     frame:SetScript('OnLeave', OnEnter)
  65.     frame:EnableMouse(true)
  66. end
Add Comment
Please, Sign In to add comment