Guest User

Untitled

a guest
Oct 23rd, 2017
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 6.74 KB | None | 0 0
  1. local T, E, C, L = unpack(Tukui)
  2.  
  3. -- Config/Class Settings
  4. local Options = {
  5.     iconSpacing = 3,
  6.     iconSize = 36,
  7. }
  8.  
  9. -- Handy macro's for getting SpellID's
  10.  
  11. -- Buffs
  12. --/run for i = 1, 40 do local n,_,_,_,_,_,_,_,_,_,id = UnitAura("player", i) if n then print(n.." = "..id) end end
  13. -- Debuffs
  14. --/run for i = 1, 40 do local n,_,_,_,_,_,_,_,_,_,id = UnitDebuff("target", i) if n then print(n.." = "..id) end end
  15.  
  16. local GetSpell = function(SpellID)
  17.     local name = select(1, GetSpellInfo(SpellID))
  18.     return name
  19. end
  20.  
  21. local Config = {
  22.     ROGUE = {
  23.         [1] = {"target", "Deadly Poison", nil, "HARMFUL"},        -- Deadly Poison
  24.         [2] = {"target", "Crippling Poison", nil, "HARMFUL"},     -- Cripping Poison
  25.         [3] = {"target", "Rupture", nil, "HARMFUL"},              -- Rupture
  26.         [4] = {"player", "Recuperate", nil, "HELPFUL"},           -- Recuperate
  27.         [5] = {"player", "Slice and Dice", nil, "HELPFUL"},       -- Slice and Dice
  28.         [6] = {"player", "Evasion", nil, "HELPFUL"},              -- Evasion
  29.         [7] = {"player", "Cloak of Shadows", nil, "HELPFUL"},     -- Cloak of Shadows
  30.         [8] = {"player", "Sprint", nil, "HELPFUL"},               -- Sprint
  31.     },
  32.     PRIEST = {
  33.         [1] = {"player", GetSpell(17), nil, "HELPFUL"},           -- Power Word: Shield
  34.         [2] = {"player", GetSpell(6788), nil, "HARMFUL"},         -- Weakened Soul
  35.         [3] = {"target", GetSpell(589), nil, "HARMFUL"},          -- Shadow Word: Pain
  36.         [4] = {"target", GetSpell(2944), nil, "HARMFUL"},         -- Devouring Plague
  37.         [5] = {"target", "Vampiric Touch", nil, "HARMFUL"},       -- Vampiric Touch
  38.         [6] = {"target", GetSpell(14914), nil, "HARMFUL"},        -- Holy Fire
  39.         [7] = {"player", GetSpell(74241), nil, "HELPFUL"},        -- Power Torrent
  40.         [8] = {"target", GetSpell(15357), nil, "HELPFUL"},        -- Inspiration
  41.         [9] = {"player", GetSpell(91139), nil, "HELPFUL"},        -- Trinket
  42.         [10] = {"player", GetSpell(91141), nil, "HELPFUL"},       -- Trinket
  43.         [11] = {"player", GetSpell(139), nil, "HELPFUL"},         -- Renew
  44.         [12] = {"player", GetSpell(47753), nil, "HELPFUL"},       -- Divine Aegis
  45.         [13] = {"player", GetSpell(41635), nil, "HELPFUL"},       -- Prayer of Mending
  46.     },
  47.     DRUID = {
  48.         [1] = {"target", "Rip", nil, "HARMFUL"},                  -- Rip
  49.         [2] = {"target", "Rake", nil, "HARMFUL"},                 -- Rake
  50.         [3] = {"target", "Mangle", nil, "HARMFUL"},               -- Mangle
  51.         [4] = {"player", "Savage Roar", nil, "HELPFUL"},          -- Savage Roar
  52.     },
  53.     WARRIOR = {
  54.         [1] = {"target", "Rend", nil, "HARMFUL"},                 -- Rend
  55.         [2] = {"player", "Flurry", nil, "HELPFUL"},               -- Flurry
  56.         [3] = {"player", "Bloodthirst", nil, "HELPFUL"},          -- Bloodthirst
  57.     },
  58.     WARLOCK = {
  59.         [1] = {"target", "Bane of Agony", nil, "HARMFUL"},        -- Bane of Agony
  60.         [2] = {"target", "Corruption", nil, "HARMFUL"},           -- Corruption
  61.         [3] = {"target", "Immolate", nil, "HARMFUL"},             -- Immolate
  62.     },
  63.     HUNTER = {
  64.         [1] = {"target", "Serpent Sting", nil, "HARMFUL"},        -- Serpent Sting
  65.         [2] = {"target", "Explosive Shot", nil, "HARMFUL"},       -- Explosive Shot
  66.         [3] = {"target", "Hunter's Mark", nil, "HARMFUL"},        -- Hunter's Mark
  67.         [4] = {"player", "Black Arrow", nil, "HELPFUL"},          -- Black Arrow
  68.     },
  69.     SHAMAN = {
  70.         [1] = {"player", "Water Shield", nil, "HELPFUL"},         -- Water Shield
  71.         [2] = {"player", "Unleash Life", nil, "HELPFUL"},         -- Unleash Elements (Earthliving)
  72.         [3] = {"player", "Tidal Waves", nil, "HELPFUL"},          -- Tidal Waves
  73.         [4] = {"player", "Riptide", nil, "HELPFUL"},              -- Riptide
  74.         [5] = {"target", "Riptide", nil, "HELPFUL"},              -- Target: Riptide
  75.         [6] = {"player", "Power Torrent", nil, "HELPFUL"},        -- Enchant: Power Torrent
  76.         [7] = {"player", "GetSpell(16191),", nil, "HELPFUL"},     -- Mana Tide Totem
  77.         [8] = {"player", "GetSpell(98007),", nil, "HELPFUL"},     -- Spirit Link Totem
  78.     },
  79.     DEATHKNIGHT = {
  80.         [1] = {"target", "Blood Plague", nil, "HARMFUL"},         -- Blood Plague
  81.         [2] = {"target", "Frost Fever", nil, "HARMFUL"},          -- Frost Fever
  82.         [3] = {"target", "Unholy Blight", nil, "HARMFUL"},        -- Unholy Blight
  83.         [4] = {"player", "Blood Shield", nil, "HELPFUL"},         -- Blood Shield
  84.     },
  85.     PALADIN = {
  86.         [1] = {"target", "Beacon of Light", nil, "HELPFUL"},      -- Beacon of Light
  87.         [2] = {"target", "Judgement of Light", nil, "HARMFUL"},   -- Judgement of Light
  88.         [3] = {"player", "Divine Plea", nil, "HELPFUL"},          -- Divine Plea
  89.         [4] = {"player", "Divine Illumination", nil, "HELPFUL"},  -- Divine Illumination
  90.     },
  91.     MAGE = {
  92.         [1] = {"target", "Scorch", nil, "HARMFUL"},               -- Scorch
  93.         [2] = {"target", "Arcane Blast", nil, "HARMFUL"},         -- Arcane Blast
  94.         [3] = {"player", "Missile Barrage", nil, "HELPFUL"},      -- Missile Barrage
  95.         [4] = {"player", "Fireball!", nil, "HELPFUL"},            -- Fireball!
  96.     },
  97. }
  98.  
  99. -- Core
  100. local cache = {}
  101. local offset = 0
  102.  
  103. local CreateBars = function(self, ela)
  104.     if cache[1] then
  105.         for i = 1, getn(cache) do
  106.             cache[i]:Kill()
  107.         end
  108.         wipe(cache)
  109.     end
  110.  
  111.     for i, v in pairs(Config[T.myclass]) do
  112.         local name, _, icon, count, _, duration, expires, unit, _, _, _ = UnitAura(unpack(v))
  113.        
  114.         --
  115.  
  116.         if count and unit == "player" then
  117.             local min, max = (-1 * (GetTime() - expires)), duration
  118.             local r, g, b = ElvUF.ColorGradient(min/max, 1,0,0,1,1,0,0,1,0)
  119.  
  120.             -- Create timers
  121.             local frame = CreateFrame("Frame", "tIconBG"..i, UIParent)
  122.             frame:CreatePanel(nil, Options.iconSize, Options.iconSize, "CENTER", UIParent, "CENTER", 0, 0)
  123.  
  124.             frame.Icon = frame:CreateTexture(nil, "ARTWORK")
  125.             frame.Icon:Point("TOPLEFT", frame, "TOPLEFT", 2, -2)
  126.             frame.Icon:Point("BOTTOMRIGHT", frame, "BOTTOMRIGHT", -2, 2)
  127.             frame.Icon:SetTexCoord(0.08, 0.92, 0.08, 0.92)
  128.             frame.Icon:SetTexture(icon)
  129.  
  130.             frame.Time = E.SetFontString(frame, C["media"].font, 14, "THINOUTLINE")
  131.             frame.Time:Point("BOTTOMLEFT", frame, "BOTTOMLEFT", 2, 2)
  132.             frame.Time:SetText(floor(min).."s")
  133.             frame.Time:SetTextColor(r, g, b)
  134.            
  135.             if count > 0 then
  136.                 frame.Time = E.SetFontString(frame, C["media"].font, 12, "THINOUTLINE")
  137.                 frame.count:Point("TOPRIGHT", frame, "TOPRIGHT", -2, -2)
  138.                 frame.count:SetText(count)
  139.             end
  140.            
  141.             tinsert(cache, frame)
  142.         end
  143.     end
  144.    
  145.     for key, frame in ipairs(cache) do
  146.         offset = getn(cache) * 18 - 18
  147.         frame:ClearAllPoints()
  148.         if key == 1 then
  149.             frame:Point("CENTER", UIParent, "CENTER", -offset, 200)
  150.         else
  151.             frame:Point("LEFT", cache[key-1], "RIGHT", Options.iconSpacing, 0)
  152.         end
  153.     end
  154. end
  155.  
  156. local StartTimers = function(self, event)
  157.     self:UnregisterEvent("UNIT_AURA")
  158.     self:SetScript("OnUpdate", CreateBars)
  159. end
  160.  
  161. local CheckAuras = CreateFrame("Frame")
  162. CheckAuras:RegisterEvent("UNIT_AURA")
  163. CheckAuras:SetScript("OnEvent", StartTimers)
Add Comment
Please, Sign In to add comment