0051bb4 - add death strike tracking
authorAleksi Blinnikka <aleksi.blinnikka@iki.fi>
Wed, 30 Jun 2021 16:27:49 +0000
committerAleksi Blinnikka <aleksi.blinnikka@iki.fi>
Wed, 30 Jun 2021 16:27:49 +0000
kehys/events.lua
kehys/frame.lua
kehys/updater.lua

index 170c029..7d46c61 100644 (file)
@@ -77,6 +77,12 @@ local function updateName(frame, unit)
 
     local _, class = UnitClass(unit);
     local color = RAID_CLASS_COLORS[class];
+    if class == "DEATHKNIGHT" then
+        frame.isdk = true;
+    else
+        frame.isdk = nil;
+    end
+
     if color then
         if not frame.raid then
             if not UnitPlayerControlled(unit) and UnitIsTapDenied(unit) then
@@ -123,11 +129,11 @@ end
 addon.Events.UpdateVehicle = updateVehicle;
 
 local function updateRole(frame, unit)
-    local role = UnitGroupRolesAssigned(unit);
-    if role == "HEALER" then
+    frame.rolename = UnitGroupRolesAssigned(unit);
+    if frame.rolename == "HEALER" then
         frame.role:SetTexCoord(0.75, 1, 0, 1);
         frame.role:Show();
-    elseif role == "TANK" then
+    elseif frame.rolename == "TANK" then
         frame.role:SetTexCoord(0.5, 0.75, 0, 1);
         frame.role:Show();
     else
index 4f1615f..f740c77 100644 (file)
@@ -57,6 +57,8 @@ function addon.NewRaidFrame(parent, width, height, unit, attributes,
     f.buff1 = {}; -- custom buff indicator 1
     f.buff2 = {}; -- custom buff indicator 2
     f.incoming = {}; -- incoming ability indicator
+    f.rolename = nil; -- TANK, HEALER, DAMAGER, NONE
+    f.isdk = nil; -- DK death strike tracker for DK tanks
     f.raid = true;
     f.rounds = 0;
     -- set up periodic updates
@@ -137,6 +139,11 @@ function addon.NewRaidFrame(parent, width, height, unit, attributes,
     f.overlay:SetPoint("BOTTOMRIGHT", f.background, "BOTTOMRIGHT");
     f.overlay:SetColorTexture(1, 1, 1);
     f.overlay:Hide();
+    f.bottomwarn = f:CreateTexture(nil, "ARTWORK", nil, 1);
+    f.bottomwarn:SetPoint("TOPLEFT", f.background, "BOTTOMLEFT", 16, 5);
+    f.bottomwarn:SetPoint("BOTTOMRIGHT", f.background, "BOTTOMRIGHT", -16, 1);
+    f.bottomwarn:SetColorTexture(1, 0.3, 0.1, 0.66);
+    f.bottomwarn:Hide();
     f.role = f:CreateTexture(nil, "ARTWORK", nil, 2);
     f.role:SetPoint("BOTTOMRIGHT", f, "BOTTOMRIGHT", -3, 3);
     f.role:SetPoint("TOPLEFT", f, "BOTTOMRIGHT", -15, 15);
index 72c51ed..94977d4 100644 (file)
@@ -267,6 +267,17 @@ function addon.FrameUpdate(frame)
             elseif frame.glow:IsShown() then
                 frame.glow:Hide();
             end
+            -- DK death strike tracking
+            if frame.isdk and frame.rolename == "TANK" then
+                local power = UnitPower(unit);
+                if power < 45 then
+                    frame.bottomwarn:Show();
+                elseif frame.bottomwarn:IsShown() then
+                    frame.bottomwarn:Hide();
+                end
+            elseif frame.bottomwarn:IsShown() then
+                frame.bottomwarn:Hide();
+            end
             -- overlays
             if next(frame.alert) then
                 -- major