fac8827 - aura updates
[wowui.git] / OmaTMW / TellMeWhen.lua
index fd9b0fc..b5a5a2b 100644 (file)
@@ -7,9 +7,47 @@ local UnitAura = UnitAura;
 local GetTotemInfo = GetTotemInfo;
 
 -- character specific frames
+-- TODO try with auraFilter, remove characters, change to classes
+--[[local classes = {
+    ["PALADIN"] = {
+        ["PLAYER HELPFUL"] = {
+            {
+                unit = "player",
+                auras = {["Divine Shield"]=1, ""},
+                frames = {
+                    [1] = {
+                        x = 0,
+                        y = 0,
+                        width = 1,
+                        height = 1,
+                    },
+                },
+            },
+        },
+    },
+};
+local specs = {
+    [retSpecid] = {
+        ["PLAYER HELPFUL"] = {
+            {
+                unit = "player",
+                auras = {["Judgment"]=1},
+                frames = {
+                    [1] = {
+                    },
+                },
+            },
+        },
+        ["PLAYER HARMFUL"] = {
+            {
+            },
+        },
+    },
+};
+--]]
 local chars = {
-    ["Stormreaver"] = {
-        ["Vildan"] = {
+    ["Sylvanas"] = {
+        ["Vildana"] = {
             {
                 unit = "target",
                 spec = 3, -- Retribution
@@ -27,8 +65,8 @@ local chars = {
                 auraFilter = "PLAYER HELPFUL",
                 x = 570,
                 y = 530,
-                width = 80,
-                height = 80,
+                width = 40,
+                height = 40,
             },
             {
                 unit = "player",
@@ -50,14 +88,263 @@ local chars = {
                 height = 80,
             },
         },
-        ["Gedren"] = {
+    },
+    ["Stormreaver"] = {
+        ["Vildan"] = {
+            {
+                unit = "target",
+                auras = {"Bursting With Pride"},
+                auraFilter = "HELPFUL",
+                x = 570, -- placed over Innervate frame
+                y = 440,
+                width = 80,
+                height = 80,
+            },
+            {
+                unit = "player",
+                auras = {"Divine Purpose"},
+                auraFilter = "PLAYER HELPFUL",
+                x = 570,
+                y = 530,
+                width = 40,
+                height = 40,
+            },
+            {
+                unit = "player",
+                spec = 2, -- Protection
+                auras = {"Shield of the Righteous"},
+                auraFilter = "PLAYER HELPFUL",
+                x = 570,
+                y = 440,
+                width = 60,
+                height = 60,
+            },
             {
-                totems = {1},
+                unit = "player",
+                spec = 2, -- Protection
+                auras = {"Shining Light"},
+                auraFilter = "PLAYER HELPFUL",
+                x = 630,
+                y = 440,
+                width = 60,
+                height = 60,
+            },
+            {
+                unit = "player",
+                auras = {"Seraphim", "Righteous Verdict"},
+                auraFilter = "PLAYER HELPFUL",
                 x = 570,
+                y = 480,
+                width = 40,
+                height = 40,
+            },
+            {
+                unit = "player",
+                auras = {"Divine Shield"},
+                auraFilter = "PLAYER HELPFUL",
+                x = 660,
                 y = 440,
                 width = 80,
                 height = 80,
             },
+            {
+                unit = "player",
+                auras = {"Devotion Aura"},
+                auraFilter = "HELPFUL",
+                invert = true,
+                x = 720,
+                y = 440,
+                width = 60,
+                height = 60,
+            },
+        },
+        ["Gilden"] = {
+            {
+                unit = "target",
+                auras = {"Shadow Word: Pain", "Purge the Wicked"},
+                auraFilter = "PLAYER HARMFUL",
+                x = 660,
+                y = 440,
+                width = 60,
+                height = 60,
+            },
+            {
+                unit = "player",
+                auras = {"Power Word: Fortitude"},
+                auraFilter = "HELPFUL",
+                invert = true,
+                x = 720,
+                y = 440,
+                width = 60,
+                height = 60,
+            },
+            {
+                unit = "player",
+                auras = {"Overcharge Mana"},
+                auraFilter = "PLAYER HELPFUL",
+                x = 720,
+                y = 440,
+                width = 60,
+                height = 60,
+            },
+        },
+        ["Gedren"] = {
+            {
+                totems = {1}, -- Efflorescence
+                x = 660,
+                y = 440,
+                width = 80,
+                height = 80,
+            },
+        },
+        ["Gazden"] = {
+            {
+                unit = "player",
+                auras = {"Tidal Waves"},
+                auraFilter = "PLAYER HELPFUL",
+                x = 660,
+                y = 440,
+                width = 40,
+                height = 40,
+            },
+            {
+                unit = "player",
+                auras = {"Healing Rain"},
+                auraFilter = "PLAYER HELPFUL",
+                x = 700,
+                y = 440,
+                width = 40,
+                height = 40,
+            },
+            {
+                unit = "player",
+                auras = {"Unleash Life"},
+                auraFilter = "PLAYER HELPFUL",
+                x = 740,
+                y = 440,
+                width = 40,
+                height = 40,
+            },
+        },
+        ["Gran"] = {
+            {
+                unit = "player",
+                auras = {"Tidal Waves"},
+                auraFilter = "PLAYER HELPFUL",
+                x = 660,
+                y = 440,
+                width = 40,
+                height = 40,
+            },
+            {
+                unit = "player",
+                auras = {"Healing Rain"},
+                auraFilter = "PLAYER HELPFUL",
+                x = 700,
+                y = 440,
+                width = 40,
+                height = 40,
+            },
+            {
+                unit = "player",
+                auras = {"Unleash Life"},
+                auraFilter = "PLAYER HELPFUL",
+                x = 740,
+                y = 440,
+                width = 40,
+                height = 40,
+            },
+        },
+        ["Gedrin"] = {
+            {
+                unit = "pet",
+                auras = {"Frenzy"},
+                auraFilter = "HELPFUL",
+                x = 660,
+                y = 440,
+                width = 40,
+                height = 40,
+            },
+        },
+        ["Iled"] = {
+            {
+                unit = "player",
+                auras = {"Arcane Intellect"},
+                auraFilter = "HELPFUL",
+                invert = true,
+                x = 720,
+                y = 460,
+                width = 60,
+                height = 60,
+            },
+            {
+                unit = "player",
+                auras = {"Rune of Power"},
+                auraFilter = "PLAYER HELPFUL",
+                x = 660,
+                y = 460,
+                width = 40,
+                height = 40,
+            },
+            {
+                unit = "target",
+                spec = 3, -- Frost
+                auras = {"Winter's Chill"},
+                auraFilter = "PLAYER HARMFUL",
+                x = 700,
+                y = 460,
+                width = 40,
+                height = 40,
+            },
+            {
+                unit = "player",
+                spec = 2, -- Fire
+                auras = {"Sun King's Blessing"},
+                auraFilter = "PLAYER HELPFUL",
+                x = 700,
+                y = 460,
+                width = 40,
+                height = 40,
+            },
+            {
+                unit = "player",
+                spec = 3, -- Frost
+                auras = {"Icy Veins"},
+                auraFilter = "PLAYER HELPFUL",
+                x = 660,
+                y = 420,
+                width = 40,
+                height = 40,
+            },
+            {
+                unit = "player",
+                spec = 2, -- Fire
+                auras = {"Combustion"},
+                auraFilter = "PLAYER HELPFUL",
+                x = 660,
+                y = 420,
+                width = 40,
+                height = 40,
+            },
+            {
+                unit = "player",
+                spec = 2, -- Fire
+                auras = {"Infernal Cascade"},
+                auraFilter = "PLAYER HELPFUL",
+                x = 620,
+                y = 420,
+                width = 40,
+                height = 40,
+            },
+            {
+                unit = "player",
+                auras = {"Alter Time"},
+                auraFilter = "PLAYER HELPFUL",
+                x = 700,
+                y = 420,
+                width = 40,
+                height = 40,
+            },
         },
     },
 };
@@ -77,19 +364,37 @@ local chars = {
 local settings = {
     {
         unit = "player",
-        auras = {"Innervate"},
+        auras = {"Innervate", "Gift of the Titans", "Power Infusion"},
         auraFilter = "HELPFUL",
         x = 570,
         y = 440,
         width = 80,
         height = 80,
     },
+    {
+        unit = "player",
+        auras = {"Ineffable Truth"},
+        auraFilter = "HELPFUL",
+        x = 570,
+        y = 440,
+        width = 40,
+        height = 40,
+    },
     {
         unit = "player",
         auras = {
             "Delusions", "Entropic Blast", "Necrotic Embrace", "Flametouched", "Shadowtouched",
             "Blazing Eruption", "Shattering Scream", "Consuming Hunger", "Unstable Soul",
-            "Time Bomb", "Broken Shard",
+            "Time Bomb", "Broken Shard", "Demolished", "Fetid Rot", "Roiling Deceit",
+            "Putrid Blood", "Endemic Virus", "Lingering Infection", "Gigavolt Charge",
+            "Crackling Lightning", "Storm's Wail", "Death's Door", "Deathly Withering",
+            "Chilling Touch", "Volatile Charge", "Liquid Gold", "Drained Soul", "Evoke Anguish",
+            "Ancient Curse", "Corrosion", "Debilitating Spit", "Tasty Morsel", "Encroaching Shadows",
+            "Corrupted Existence", "Madness Bomb", "Crimson Chorus", "Essence Sap", "Bloodlight",
+            "Arcane Vulnerability", "Wicked Laceration", "Withering Touch", "Fragment of Destiny",
+            "Flameclasp Eruption", "Wailing Arrow", "Frozen Destruction",
+            "Remnant: Mort'regar's Echoes", "Barbed Arrow", "Scorn", "Ire", "Song of Dissolution",
+            "Grim Portent", "Exposed Threads of Fate", "Despair"
         },
         auraFilter = "HARMFUL",
         x = 660,
@@ -97,6 +402,17 @@ local settings = {
         width = 80,
         height = 80,
     },
+    {
+        unit = "player",
+        auras = {
+            "Adaptive Membrane", "Gluttonous Miasma", "Remnant: Soulforge Heat"
+        },
+        auraFilter = "HARMFUL",
+        x = 660,
+        y = 780,
+        width = 160,
+        height = 160,
+    },
 };
 
 local frames = {};
@@ -113,11 +429,15 @@ local Indicators = CreateFrame("Frame", "OmaTMW", UIParent);
 local function updateAuraFrame(frame)
     local unit = frame.unit;
     if UnitExists(unit) and (not frame.spec or frame.spec == currentSpec) then
-        local name, icon, count, duration, expires;
-        for _, aura in pairs(frame.auras) do
-            name, _, icon, count, _, duration, expires = UnitAura(unit, aura, nil, frame.auraFilter);
-            if name then
-                if count > 0 then
+        local name, icon, count, duration, expires, id;
+        local auraFilter = frame.auraFilter;
+        local i = 1;
+        while true do
+            name, icon, count, _, duration, expires, _, _, _, id = UnitAura(unit, i, auraFilter);
+            if not name then break end
+            -- possible improvement to add spellID as an option
+            if frame.auras[name] and not frame.invert then
+                if count > 1 then
                     frame.stack:SetText(count);
                     frame.stack:Show();
                 else
@@ -132,7 +452,16 @@ local function updateAuraFrame(frame)
                 frame.icon:SetTexture(icon);
                 frame:Show();
                 return;
+            elseif frame.auras[name] and frame.invert then
+                frame.icon:SetTexture(icon);
+                frame:Hide();
+                return;
             end
+            i = i + 1;
+        end
+        if frame.invert then
+            frame:Show(); -- not functional without first hiding once to get SetTexture
+            return;
         end
     end
     frame:Hide();
@@ -172,9 +501,15 @@ local function createTMW(name, config, parent)
     frame:SetPoint("BOTTOMRIGHT", parent, "BOTTOMLEFT", config.x+config.width, config.y);
     frame.unit = config.unit;
     frame.spec = config.spec;
-    frame.auras = config.auras;
+    if config.auras then
+        frame.auras = {};
+        for _, v in pairs(config.auras) do
+            frame.auras[v] = true;
+        end
+    end
     frame.auraFilter = config.auraFilter;
     frame.totems = config.totems;
+    frame.invert = config.invert;
     frame:Hide();
     frame.base = frame:CreateTexture(nil, "BACKGROUND");
     frame.base:SetAllPoints();
@@ -184,6 +519,7 @@ local function createTMW(name, config, parent)
     frame.icon:SetPoint("BOTTOMRIGHT", frame.base, "BOTTOMRIGHT", -1, 1);
     frame.icon:SetTexCoord(0.07, 0.93, 0.07, 0.93);
     frame.stack = frame:CreateFontString(nil, "OVERLAY", "NumberFontNormalLarge");
+    frame.stack:SetFont(STANDARD_TEXT_FONT, 26, "OUTLINE");
     frame.stack:SetPoint("TOPLEFT");
     frame.stack:Hide();
     frame.cd = CreateFrame("Cooldown", name.."CD", frame, "CooldownFrameTemplate");
@@ -247,7 +583,9 @@ Indicators:SetScript("OnEvent", function(self, event, arg1)
         currentSpec = GetSpecialization();
         for _, frame in pairs(frames) do
             if frame.auras then updateAuraFrame(frame) end
-            if frame.totems then updateTotemFrame(frame) end
+            if frame.totems then
+                for _, slot in pairs(frame.totems) do updateTotemFrame(frame, slot) end
+            end
         end
     elseif event == "PLAYER_LOGIN" then
         initialize();