5d20ef0 - Separate TellMeWhen component
authorAleksi Blinnikka <aleksi.blinnikka@gmail.com>
Fri, 23 Feb 2018 15:10:17 +0000
committerAleksi Blinnikka <aleksi.blinnikka@gmail.com>
Fri, 23 Feb 2018 15:10:17 +0000
OmaAB/OmaAB.toc
OmaTMW/Healthstone.lua [moved from OmaAB/Healthstone.lua with 100% similarity]
OmaTMW/OmaTMW.toc [new file with mode: 0644]
OmaTMW/TellMeWhen.lua [moved from OmaAB/TellMeWhen.lua with 90% similarity]

index 82c89ed..da88f1c 100644 (file)
@@ -6,6 +6,4 @@
 
 Bindings.xml
 ExpBar.lua
-Healthstone.lua
-TellMeWhen.lua
 ActionBars.lua
similarity index 100%
rename from OmaAB/Healthstone.lua
rename to OmaTMW/Healthstone.lua
diff --git a/OmaTMW/OmaTMW.toc b/OmaTMW/OmaTMW.toc
new file mode 100644 (file)
index 0000000..a4740e4
--- /dev/null
@@ -0,0 +1,8 @@
+## Interface: 70300
+## Title: Oma TellMeWhen
+## Version: 1.0
+## Author: schyrio
+## Notes: My TellMeWhen
+
+Healthstone.lua
+TellMeWhen.lua
similarity index 90%
rename from OmaAB/TellMeWhen.lua
rename to OmaTMW/TellMeWhen.lua
index a43d22d..b7ba1e8 100644 (file)
@@ -4,6 +4,7 @@ local pairs = pairs;
 local GetSpecialization = GetSpecialization;
 local UnitExists = UnitExists;
 local UnitAura = UnitAura;
+local GetTotemInfo = GetTotemInfo;
 
 -- character specific frames
 local chars = {
@@ -49,6 +50,15 @@ local chars = {
                 height = 80,
             },
         },
+        ["Gedren"] = {
+            {
+                totems = {1},
+                x = 570,
+                y = 440,
+                width = 80,
+                height = 80,
+            },
+        },
     },
 };
 
@@ -136,14 +146,22 @@ local function updateAuras(unit)
     end
 end
 
-local function updateTotemFrame(frame)
-    print("totem frame not implemented");
+local function updateTotemFrame(frame, slot)
+    local _, name, start, duration, icon = GetTotemInfo(slot);
+    if name ~= "" then
+        frame.cd:SetCooldown(start, duration);
+        frame.cd:Show();
+        frame.icon:SetTexture(icon);
+        frame:Show();
+    else
+        frame:Hide();
+    end
 end
 
 local function updateTotems(slot)
     if totems[slot] then
         for _, i in pairs(totems[slot]) do
-            updateTotemFrame(frames[i]);
+            updateTotemFrame(frames[i], slot);
         end
     end
 end
@@ -167,6 +185,7 @@ local function createTMW(name, config, parent)
     frame.icon:SetTexCoord(0.07, 0.93, 0.07, 0.93);
     frame.stack = frame:CreateFontString(nil, "OVERLAY", "NumberFontNormalLarge");
     frame.stack:SetPoint("TOPLEFT");
+    frame.stack:Hide();
     frame.cd = CreateFrame("Cooldown", name.."CD", frame, "CooldownFrameTemplate");
     frame.cd:SetReverse(true);
     frame.cd:SetAllPoints();
@@ -201,7 +220,9 @@ local function initialize()
 
     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
 end