Guest User

glow

a guest
Oct 27th, 2017
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 22.38 KB | None | 0 0
  1. if UnitClass("player") == "Warrior" then
  2.  
  3. local function PlayInterruptSound()
  4.     if WHUD_VARS["Interrupt Sound"].enabled then
  5.         PlaySoundFile("Interface\\AddOns\\Lulleh_WarriorHUD\\sounds\\IM.ogg", "Master")
  6.     end
  7. end
  8.  
  9. local _G = getfenv(0)
  10. local WHUD_GLOWING = {}
  11. local Glow, Glow_Table, Glow_Spell, HasGlow
  12. local frames = {} local framecount = 0
  13. local flag = false
  14. local AntTexCoords = {
  15.         {0.0078125, 0.1796875, 0.00390625, 0.17578125}, {0.1953125, 0.3671875, 0.00390625, 0.17578125}, {0.3828125, 0.5546875, 0.00390625, 0.17578125}, {0.5703125, 0.7421875, 0.00390625, 0.17578125}, {0.7578125, 0.9296875, 0.00390625, 0.17578125},
  16.         {0.0078125, 0.1796875, 0.19140625, 0.36328125}, {0.1953125, 0.3671875, 0.19140625, 0.36328125}, {0.3828125, 0.5546875, 0.19140625, 0.36328125}, {0.5703125, 0.7421875, 0.19140625, 0.36328125}, {0.7578125, 0.9296875, 0.19140625, 0.36328125},
  17.         {0.0078125, 0.1796875, 0.37890625, 0.55078125}, {0.1953125, 0.3671875, 0.37890625, 0.55078125}, {0.3828125, 0.5546875, 0.37890625, 0.55078125}, {0.5703125, 0.7421875, 0.37890625, 0.55078125}, {0.7578125, 0.9296875, 0.37890625, 0.55078125},
  18.         {0.0078125, 0.1796875, 0.56640625, 0.73828125}, {0.1953125, 0.3671875, 0.56640625, 0.73828125}, {0.3828125, 0.5546875, 0.56640625, 0.73828125}, {0.5703125, 0.7421875, 0.56640625, 0.73828125}, {0.7578125, 0.9296875, 0.56640625, 0.73828125},
  19.         {0.0078125, 0.1796875, 0.75390625, 0.92578125}, {0.1953125, 0.3671875, 0.75390625, 0.92578125}, {0.3828125, 0.5546875, 0.75390625, 0.92578125}, {0.5703125, 0.7421875, 0.75390625, 0.92578125}, {0.7578125, 0.9296875, 0.75390625, 0.92578125},
  20. }
  21.  
  22. function WHUD_Glow_Init()
  23.     WHUD_RegisterEvent("COMBAT_TEXT_UPDATE")
  24.     WHUD_RegisterEvent("PLAYER_TARGET_CHANGED")
  25.     WHUD_RegisterEvent("PLAYER_AURAS_CHANGED")
  26.     WHUD_RegisterEvent("UNIT_RAGE")
  27.     WHUD_RegisterEvent("PLAYER_DEAD")
  28.     WHUD_RegisterEvent("UPDATE_BONUS_ACTIONBAR")
  29. end
  30.  
  31. SLASH_WHDEBUG1 = "/whdebug";
  32.  
  33. SlashCmdList["WHDEBUG"] = function(msg)
  34.     DEFAULT_CHAT_FRAME:AddMessage("DEBUGGING:")
  35.     for x=1,table.getn(WHUD_GLOWING) do
  36.         DEFAULT_CHAT_FRAME:AddMessage(WHUD_GLOWING[x])
  37.     end
  38. end
  39.  
  40. function Glow_Spell(name,show)
  41.     if name == "" then return end
  42.     local glowing = false
  43.     for x=1,table.getn(WHUD_GLOWING) do
  44.         if show then
  45.             if WHUD_GLOWING[x] == name then
  46.                 return -- it is already glowing
  47.             end
  48.         else
  49.             if WHUD_GLOWING[x] == name then
  50.                 glowing = true
  51.             end
  52.             if x == table.getn(WHUD_GLOWING) then
  53.                 if not glowing then
  54.                     return -- it is already hidden
  55.                 end
  56.             end
  57.         end
  58.     end
  59.     if show then
  60.         for i=1,120 do -- checking the ActionSlot IDs
  61.             if GetActionTexture(i) then
  62.                 if WHUD_SPELLINFO[name][1] ~= 1 and
  63.                    GetActionTexture(i) == GetSpellTexture(WHUD_SPELLINFO[name][1],"BOOKTYPE_SPELL") then
  64.                     local number = i
  65.                     local display = true
  66.                     local frameName = ""
  67.                     -- Blizzards default ActionBars/Bartender3/Bartender4/ElvUI actionbars
  68.                     local bar = ""
  69.                     if i > 24 and i < 37 then
  70.                         bar = "MultiBarRightButton"
  71.                         number = i - 24
  72.                     elseif i > 36 and i < 49 then
  73.                         bar = "MultiBarLeftButton"
  74.                         number = i - 36
  75.                     elseif i > 48 and i < 61 then
  76.                         bar = "MultiBarBottomRightButton"
  77.                         number = i - 48
  78.                     elseif i > 60 and i < 73 then
  79.                         bar = "MultiBarBottomLeftButton"
  80.                         number = i - 60
  81.                     elseif i > 72 and i < 85 then
  82.                         bar = "BonusActionButton"
  83.                         number = i - 72
  84.                         --local _,_, active = GetShapeshiftFormInfo(1)
  85.                         --if not active then display = false end
  86.                     elseif i > 84 and i < 97 then
  87.                         bar = "BonusActionButton"
  88.                         number = i - 84
  89.                         --local _,_, active = GetShapeshiftFormInfo(2)
  90.                         --if not active then display = false end
  91.                     elseif i > 96 and i < 108 then
  92.                         bar = "BonusActionButton"
  93.                         number = i - 96
  94.                         --local _,_, active = GetShapeshiftFormInfo(3)
  95.                         --if not active then display = false end
  96.                     end
  97.                     if bar ~= "" then frameName = bar..number; end
  98.                     if AddonIsActive("DiscordActionBars") then
  99.                         if i > 72 and i < 85 then       -- battle stance
  100.                             number = i - 72
  101.                             --local _,_, active = GetShapeshiftFormInfo(1)
  102.                            -- f not active then display = false end
  103.                         elseif i > 84 and i < 97 then   -- defensive stance
  104.                             number = i - 84
  105.                             --local _,_, active = GetShapeshiftFormInfo(2)
  106.                             --if not active then display = false end
  107.                         elseif i > 96 and i < 108 then  -- berserker stance
  108.                             number = i - 96
  109.                             --local _,_, active = GetShapeshiftFormInfo(3)
  110.                             --if not active then display = false end
  111.                         end
  112.                         frameName = "DAB_ActionButton_"..number;
  113.                     end
  114.                     if AddonIsActive("Bongos") then
  115.                         if i > 72 and i < 85 then
  116.                             number = i - 72
  117.                             --local _,_, active = GetShapeshiftFormInfo(1)
  118.                             --if not active then display = false end
  119.                         elseif i > 84 and i < 97 then
  120.                             number = i - 84
  121.                             --local _,_, active = GetShapeshiftFormInfo(2)
  122.                             --if not active then display = false end
  123.                         elseif i > 96 and i < 108 then
  124.                             number = i - 96
  125.                             --local _,_, active = GetShapeshiftFormInfo(3)
  126.                             --if not active then display = false end
  127.                         end
  128.                         frameName = "BActionButton"..number;
  129.                     end
  130.                     if AddonIsActive("ElvUI") then
  131.                         local bar = ""
  132.                         if i > 0 and i < 13 then
  133.                             bar = "ElvUI_Bar1Button"
  134.                             number = i
  135.                         elseif i > 12 and i < 25 then
  136.                             bar = "ElvUI_Bar6Button"
  137.                             number = i - 12
  138.                         elseif i > 24 and i < 30 then
  139.                             bar = "ElvUI_Bar5Button"
  140.                             number = i - 24
  141.                         elseif i > 36 and i < 49 then
  142.                             bar = "ElvUI_Bar4Button"
  143.                             number = i - 36
  144.                         elseif i > 48 and i < 61 then
  145.                             bar = "ElvUI_Bar2Button"
  146.                             number = i - 48
  147.                         elseif i > 60 and i < 67 then
  148.                             bar = "ElvUI_Bar3Button"
  149.                             number = i - 60
  150.                         elseif i > 72 and i < 85 then
  151.                             bar = "ElvUI_Bar7Button"
  152.                             number = i - 72
  153.                         elseif i > 84 and i < 97 then
  154.                             bar = "ElvUI_Bar8Button"
  155.                             number = i - 84
  156.                         elseif i > 96 and i < 109 then
  157.                             bar = "ElvUI_Bar9Button"
  158.                             number = i - 96
  159.                         elseif i > 108 and i < 121 then
  160.                             bar = "ElvUI_Bar10Button"
  161.                             number = i - 108
  162.                         end
  163.                         display = true
  164.                         if bar ~= "" then frameName = bar..number; end
  165.                     end
  166.                     if AddonIsActive("Bartender3") then
  167.                         local bar = ""
  168.                         if UnitClass("player") == "Warrior" then
  169.                             if i > 12 and i < 73 then
  170.                                 number = i
  171.                             elseif i > 72 and i < 85 then
  172.                                 number = i - 72
  173.                                 --local _,_, active = GetShapeshiftFormInfo(1)
  174.                                 --if not active then display = false end
  175.                             elseif i > 84 and i < 97 then
  176.                                 number = i - 84
  177.                                 --local _,_, active = GetShapeshiftFormInfo(2)
  178.                                 --if not active then display = false end
  179.                             elseif i > 96 and i < 109 then
  180.                                 number = i - 96
  181.                                 --local _,_, active = GetShapeshiftFormInfo(3)
  182.                                 --if not active then display = false end
  183.                             elseif i > 108 and i < 121 then
  184.                                 number = i
  185.                             end
  186.                         end
  187.                         if UnitClass("player") == "Druid" then
  188.                         -- TODO
  189.                         end
  190.                         if i > 12 and i < 121 and UnitClass("player") ~= "Warrior" and UnitClass("player") ~= "Druid" then
  191.                             number = i
  192.                         end
  193.                         frameName = "BT3Button"..number
  194.                     end
  195.                     if AddonIsActive("Bartender4") then
  196.                         local bar = ""
  197.                         if UnitClass("player") == "Warrior" then
  198.                             if i > 12 and i < 73 then
  199.                                 number = i
  200.                             elseif i > 72 and i < 85 then
  201.                                 number = i - 72
  202.                                 --local _,_, active = GetShapeshiftFormInfo(1)
  203.                                 --if not active then display = false end
  204.                             elseif i > 84 and i < 97 then
  205.                                 number = i - 84
  206.                                 --local _,_, active = GetShapeshiftFormInfo(2)
  207.                                 --if not active then display = false end
  208.                             elseif i > 96 and i < 109 then
  209.                                 number = i - 96
  210.                                 --local _,_, active = GetShapeshiftFormInfo(3)
  211.                                 --if not active then display = false end
  212.                             elseif i > 108 and i < 121 then
  213.                                 number = i
  214.                             end
  215.                         end
  216.                         if UnitClass("player") == "Druid" then
  217.                         -- TODO
  218.                         end
  219.                         if i > 12 and i < 121 and UnitClass("player") ~= "Warrior" and UnitClass("player") ~= "Druid" then
  220.                             number = i
  221.                         end
  222.                         frameName = "BT4Button"..number.."Secure"
  223.                     end
  224.                     if frameName ~= "" then
  225.                         if _G[frameName]:IsVisible() and display then
  226.                             Glow(frameName,show)
  227.                             Glow_Table(name,show,frameName)
  228.                         end
  229.                     end
  230.                 end
  231.             end
  232.         end
  233.     else
  234.         if WHUD_GLOWING[name] ~= nil then
  235.             for i=1,table.getn(WHUD_GLOWING[name]) do
  236.                 if WHUD_GLOWING[name][i] ~= "" then
  237.                     if _G[WHUD_GLOWING[name][i]]:IsVisible() then
  238.                         Glow(WHUD_GLOWING[name][i],false)
  239.                         Glow_Table(name,false,WHUD_GLOWING[name][i])
  240.                     end
  241.                 end
  242.             end
  243.         end
  244.     end
  245. end
  246.  
  247. function Glow_Table(name,add,button)
  248.     if add then
  249.         if WHUD_GLOWING[name] == nil then
  250.             WHUD_GLOWING[name] = {button}
  251.         else
  252.             local already = false
  253.             for i=1,table.getn(WHUD_GLOWING[name]) do
  254.                 if WHUD_GLOWING[name][i] == button then already = true end    
  255.             end
  256.             if not already then
  257.                 for i=1,table.getn(WHUD_GLOWING[name]) do
  258.                     if WHUD_GLOWING[name][i] == "" then
  259.                         WHUD_GLOWING[name][i] = button
  260.                         return
  261.                     end
  262.                 end
  263.                 WHUD_GLOWING[name][table.getn(WHUD_GLOWING[name])+1] = button
  264.             end
  265.         end
  266.     else   
  267.         if WHUD_GLOWING[name] ~= nil then
  268.             for i=1,table.getn(WHUD_GLOWING[name]) do
  269.                 if WHUD_GLOWING[name][i] == button then
  270.                    WHUD_GLOWING[name][i] = ""
  271.                 end
  272.             end
  273.         end
  274.     end
  275. end
  276.    
  277. function Glow(button,show)
  278.     button = _G[button]
  279.     if show then
  280.         -- Credits to Numielle @ Feenix(wow-one.com/forum) for this code
  281.         if not button.overlay then
  282.             button.overlay = GetOverlay(button)
  283.             button.overlay:SetParent(button);
  284.             if AddonIsActive("DiscordActionBars") then
  285.                 button.overlay:SetWidth(button:GetWidth()*1.2)
  286.                 button.overlay:SetHeight(button:GetHeight()*1.2)
  287.                 button.overlay:SetPoint("CENTER",button,0,1)
  288.             else
  289.                 button.overlay:SetWidth(button:GetWidth()*1.1)
  290.                 button.overlay:SetHeight(button:GetHeight()*1.1)
  291.                 button.overlay:SetPoint("CENTER",button)
  292.             end
  293.             button.overlay.index = 1
  294.             button.overlay.lastUpdated = 0
  295.             button.overlay:Show()
  296.             button.overlay:SetScript("OnUpdate", function()
  297.                 button.overlay.lastUpdated = button.overlay.lastUpdated + arg1 -- elapsed
  298.                 if (button.overlay.lastUpdated > 0.0175) then
  299.                     if button.overlay.index == 22 then button.overlay.index = 1
  300.                     else button.overlay.index = button.overlay.index + 1 end
  301.                     button.overlay.glow:SetTexCoord(AntTexCoords[button.overlay.index][1], AntTexCoords[button.overlay.index][2], AntTexCoords[button.overlay.index][3], AntTexCoords[button.overlay.index][4]);
  302.                     button.overlay.lastUpdated = 0;
  303.                 end
  304.             end);
  305.         end
  306.     else
  307.         if button.overlay then
  308.             local overlay = button.overlay -- use temporary reference to reset overlay BEFORE putting it back in the pool
  309.             button.overlay:SetScript("OnUpdate", nil);
  310.             button.overlay:Hide();
  311.             button.overlay:SetParent(UIParent);
  312.             button.overlay = nil;
  313.  
  314.             tinsert(frames, overlay) -- put the frame into the pool to reuse it in the future
  315.         end
  316.     end
  317. end
  318.  
  319. local function GetBuffExpire(unitTarget, buff)
  320.     local n = 1
  321.     local name,_,_,_,_,expire = UnitBuff(unitTarget, n)
  322.     while name do
  323.         if name == buff then
  324.             if expire ~= nil then
  325.                 return expire
  326.             end
  327.         end
  328.  
  329.         n = n + 1
  330.         name,_,_,_,_,expire = UnitBuff(unitTarget, n)
  331.     end
  332.  
  333.     return -1
  334. end
  335.  
  336. local pummelGlowFlag = false
  337. function WHUD_Glow_OnUpdate()   -- the Glow OnUpdate will hide it again
  338.     for i=1,table.getn(WHUD_SPELLS) do
  339.         local name = WHUD_SPELLS[i]
  340.         if WHUD_VARS.Glow["Execute"] and name == "Execute" then
  341.             if UnitExists("target") then
  342.                 local ap = 2755.5
  343.                 local playerAP = 0
  344.                 if not WHUD_VARS.Alerts["Impexecute"] and WHUD_VARS.Alerts["4T6"] then ap = 2895.5 end
  345.                 if WHUD_VARS.Alerts["Impexecute"] and not WHUD_VARS.Alerts["4T6"] then ap = 2988.8 end
  346.                 if WHUD_VARS.Alerts["Impexecute"] and WHUD_VARS.Alerts["4T6"] then ap = 3128.8 end
  347.                 local base, posBuff, negBuff = UnitAttackPower("player")
  348.                 playerAP = base + posBuff + negBuff
  349.                 local HPperc = math.floor((UnitHealth("target")/UnitHealthMax("target")) * 100)
  350.                 if playerAP >= ap then
  351.                     if HPperc > 19 or UnitIsDeadOrGhost("target") or not UnitCanAttack("player","target") then
  352.                         Glow_Spell("Execute",false)
  353.                         Glow_Spell("Bloodthirst",false)
  354.                     else
  355.                         Glow_Spell("Execute",false)
  356.                         Glow_Spell("Bloodthirst",true)
  357.                     end
  358.                 elseif playerAP < ap then
  359.                     if HPperc > 19 or UnitIsDeadOrGhost("target") or not UnitCanAttack("player","target") then
  360.                         Glow_Spell("Execute",false)
  361.                         Glow_Spell("Bloodthirst",false)
  362.                     else
  363.                         Glow_Spell("Execute",true)
  364.                         Glow_Spell("Bloodthirst",false)
  365.                     end
  366.                 end
  367.             else
  368.                 Glow_Spell("Execute",false)
  369.                 Glow_Spell("Bloodthirst",false)
  370.             end
  371.         end
  372.         if WHUD_VARS.Glow["Overpower"] then
  373.             if name == "Overpower" then
  374.                 --local _,_, active = GetShapeshiftFormInfo(1)
  375.                 if not IsUsableSpell("Overpower") then
  376.                     Glow_Spell("Overpower",false)
  377.                 end
  378.             elseif IsUsableSpell("Overpower") then Glow_Spell("Overpower",true) end
  379.         end
  380.         if WHUD_VARS.Glow["Revenge"] then
  381.             if name == "Revenge" then
  382.                 local _,_, active = GetShapeshiftFormInfo(2)
  383.                 if not active or not IsUsableSpell("Revenge") then
  384.                     Glow_Spell("Revenge",false)
  385.                 end
  386.             elseif IsUsableSpell("Revenge") and GetShapeshiftForm() == 2 then Glow_Spell("Revenge",true) end
  387.         end
  388.         if name == "Battle Shout" then
  389.             local doneGlow = false
  390.             if WHUD_VARS.Glow["Battleshout"] then
  391.                 if GetBuffExpire("player", name) > 10 then
  392.                     doneGlow = true
  393.                     Glow_Spell(name, false)
  394.                 else
  395.                     doneGlow = true
  396.                     Glow_Spell(name, true)
  397.                 end
  398.             end
  399.  
  400.             if doneGlow == false then
  401.                 Glow_Spell(name, false)
  402.             end
  403.         end
  404.         if name == "Commanding Shout" then
  405.             local doneGlow = false
  406.             if WHUD_VARS.Glow["Commanding"] then
  407.                 if GetBuffExpire("player", name) > 10 then
  408.                     doneGlow = true
  409.                     Glow_Spell(name, false)
  410.                 else
  411.                     doneGlow = true
  412.                     Glow_Spell(name, true)
  413.                 end
  414.             end
  415.  
  416.             if doneGlow == false then
  417.                 Glow_Spell(name, false)
  418.             end
  419.         end
  420.         if WHUD_VARS.Glow["Rampage"] and name == "Rampage" then
  421.             local active = false
  422.             if GetBuffExpire("player", name) > 6 then
  423.                 active = true
  424.             end
  425.             if not active and UnitAffectingCombat("player") then Glow_Spell("Rampage", true) else Glow_Spell("Rampage", false) end
  426.         end
  427.         if WHUD_VARS.Glow["Pummel"] and name == "Pummel" then
  428.             -- Check if the unit exists and is attackable
  429.             local doGlow = false
  430.             if UnitExists("target") and UnitCanAttack("player","target") then
  431.                 -- Check if the unit is casting a spell
  432.                 local spellName,_,_,_,_,endTime = UnitCastingInfo("target")
  433.                 if spellName ~= nil and endTime ~= nil then
  434.                     if tContains(blacklistedInterruptableSpells, spellName) == nil then    
  435.                         -- Check if the endtime of the spell is less than our current cooldown on our interrupt
  436.                         local spellTimeLeft = (endTime / 1000.0) - GetTime()
  437.                         local interruptSpellCastAtTime,interruptSpellMaximumCooldown,_ = GetSpellCooldown("Pummel")
  438.                         if endTime ~= nil and interruptSpellCastAtTime ~= nil then
  439.                             local currentCooldown = interruptSpellMaximumCooldown - (GetTime() - interruptSpellCastAtTime)
  440.                             if currentCooldown < spellTimeLeft then
  441.                                 -- Glow the interrupt spell
  442.                                 doGlow = true
  443.                                 Glow_Spell("Pummel", true)
  444.                                 if pummelGlowFlag == false then
  445.                                     PlayInterruptSound()
  446.                                     pummelGlowFlag = true
  447.                                 end
  448.                             end
  449.                         end
  450.                     end
  451.                 end
  452.             end
  453.             -- Check if we did not set the glow
  454.             if doGlow == false then
  455.                 -- Remove glow from the interrupt spell
  456.                 pummelGlowFlag = false
  457.                 Glow_Spell("Pummel", false)
  458.             end
  459.         end
  460.         if WHUD_VARS.Glow["Bash"] and name == "Shield Bash" then
  461.             if UnitExists("target") and GetShapeshiftForm() == 2 then
  462.                 local name,_,_,_,_,endTime = UnitCastingInfo("target")
  463.                 local cd = 0
  464.                 local finish = 0
  465.                 _,cd,_ = GetSpellCooldown("Shield Bash")
  466.                 if endTime ~= nil then finish = endTime/1000 - GetTime() end
  467.                 if name ~= nil and cd < finish and UnitCanAttack("player","target") then canInterrupt = true else canInterrupt = false end
  468.                 if not flag and canInterrupt then PlayInterruptSound() flag = true end
  469.                 if name == nil then flag = false end
  470.                 if canInterrupt and not UnitIsDeadOrGhost("target") and UnitCanAttack("player","target") and GetShapeshiftForm() == 2 then
  471.                     Glow_Spell("Shield Bash", true)
  472.                 elseif not canInterrupt or UnitIsDeadOrGhost("target") or not UnitCanAttack("player","target") or not GetShapeshiftForm() == 2 then
  473.                     Glow_Spell("Shield Bash", false)
  474.                 end
  475.             else
  476.                 Glow_Spell("Shield Bash", false)
  477.             end
  478.         end
  479.         if WHUD_VARS.Glow["Heroicstrike"] and name == "Heroic Strike" then
  480.             if UnitExists("target") then
  481.                 if UnitMana("player") < WHUD_VARS.Ragebar["threshold"] or UnitIsDeadOrGhost("target") or not UnitCanAttack("player","target") then
  482.                     Glow_Spell("Heroic Strike", false)
  483.                 elseif UnitMana("player") >= WHUD_VARS.Ragebar["threshold"] and not UnitIsDeadOrGhost("target") and UnitCanAttack("player","target") then
  484.                     Glow_Spell("Heroic Strike", true)
  485.                 end
  486.             else
  487.                 Glow_Spell("Heroic Strike", false)
  488.             end
  489.         end
  490.     end
  491. end
  492.  
  493. function WHUD_Glow_OnEvent(event,arg1,arg2,arg3)
  494.     if event == "UPDATE_BONUS_ACTIONBAR" then
  495.         for i=1,table.getn(WHUD_IMPORTANTSPELLS)+5 do
  496.             local name = WHUD_IMPORTANTSPELLS[i]
  497.             if i == table.getn(WHUD_IMPORTANTSPELLS)+1 then name = "Overpower"
  498.             elseif i == table.getn(WHUD_IMPORTANTSPELLS)+2 then name = "Revenge"
  499.             elseif i == table.getn(WHUD_IMPORTANTSPELLS)+3 then name = "Pummel"
  500.             elseif i == table.getn(WHUD_IMPORTANTSPELLS)+4 then name = "Shield Bash"
  501.             elseif i == table.getn(WHUD_IMPORTANTSPELLS)+5 then name = "Execute" end
  502.             if WHUD_GLOWING[name] ~= nil then
  503.                 Glow_Spell(name,false)
  504.                 Glow_Spell(name,true)
  505.             end
  506.         end
  507.     elseif event == "PLAYER_DEAD" then
  508.         for i=1,table.getn(WHUD_GLOWING) do
  509.             Glow_Spell(WHUD_GLOWING[i],false)
  510.         end
  511.     end
  512. end
  513.  
  514. function HasGlow(button)
  515.     for i=1,table.getn(WHUD_SPELLS) do
  516.         if WHUD_GLOWING[WHUD_SPELLS[i]] then
  517.             for j=1,table.getn(WHUD_GLOWING[WHUD_SPELLS[i]]) do
  518.                 if WHUD_GLOWING[WHUD_SPELLS[i]][j] == button then
  519.                     return WHUD_SPELLS[i]    
  520.                 end
  521.             end
  522.         end
  523.     end
  524.     return nil
  525. end
  526.  
  527. function IsBuffed(unit, spell)
  528.     for i=0,16 do
  529.         local name = UnitBuff(unit, i)
  530.         if name == spell then
  531.             return true
  532.         end
  533.     end
  534.     return false
  535. end
  536.  
  537. function IsDebuffed(unit, spell)
  538.     for i=0,16 do
  539.         local name = UnitDebuff(unit, i)
  540.         if name == spell then
  541.             return true
  542.         end
  543.     end
  544.     return false
  545. end
  546.    
  547. function GetOverlay()
  548.     -- Credits to Numielle @ Feenix(wow-one.com/forum) for this code
  549.     local overlay = tremove(frames)
  550.     if ( not overlay ) then
  551.         framecount = framecount + 1
  552.         overlay = CreateFrame("Frame", "ActionButtonOverlay"..framecount)
  553.         overlay:SetFrameStrata("TOOLTIP")
  554.  
  555.         overlay.background = overlay:CreateTexture(nil, "BACKGROUND")
  556.         overlay.background:SetTexture("Interface\\AddOns\\Lulleh_WarriorHUD\\textures\\IconAlert")
  557.         overlay.background:SetTexCoord(0.0546875, 0.4609375, 0.30078125, 0.50390625)
  558.         overlay.background:SetAllPoints(overlay)
  559.  
  560.         overlay.glow = overlay:CreateTexture(nil, "MEDIUM")
  561.         overlay.glow:SetTexture("Interface\\AddOns\\Lulleh_WarriorHUD\\textures\\IconAlertAnts")
  562.         overlay.glow:SetTexCoord(AntTexCoords[1][1], AntTexCoords[1][2], AntTexCoords[1][3], AntTexCoords[1][4])
  563.         overlay.glow:SetAllPoints(overlay)
  564.     end
  565.     return overlay
  566. end
  567.    
  568. end
Add Comment
Please, Sign In to add comment