WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   Lua/XML Help (https://www.wowinterface.com/forums/forumdisplay.php?f=16)
-   -   Debufftype timer (https://www.wowinterface.com/forums/showthread.php?t=59126)

darhanger 05-12-22 07:26 AM

Debufftype timer
 
For exmaple i have for certaine debuff by spell id or name. How i can make it for debuff type?
Lua Code:
  1. debufftimer = function(t, id, filter)
  2.     local spellName;
  3.     if tonumber(id) ~= nil then
  4.         spellName = GetSpellInfo(id);
  5.     else
  6.         spellName = id
  7.     end
  8.    
  9.     local expirationTime = select(7, UnitDebuff(t, spellName, filter))
  10.     local duration = select(6, UnitDebuff(t, spellName, filter))
  11.     if expirationTime ~= nil then
  12.         return duration - (expirationTime - GetTime())  
  13.     else
  14.         return 0
  15.     end
  16. end;

Like
Lua Code:
  1. if debufftypetime("player", "Magic") > 3 then
  2. --- do stuff
  3. end

nonexistentx_x 05-12-22 11:36 AM

for example:
Lua Code:
  1. local PostUpdateDebuff = function(self, unit, button, index)
  2.     local name, _, _, _, dtype, duration, expTime = UnitAura(unit, index, button.filter)
  3.  
  4.     if dtype == "Magic" and button.debuff then
  5.         button.stealable:Show()
  6.     end
  7. end


All times are GMT -6. The time now is 06:12 PM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI