X-Git-Url: https://www.aleksib.fi/git/wowui.git/blobdiff_plain/79feebea0985e4fc1d0fee41cbeca982c5e389f9..35c82f135359357cf4046c3f3252c93a1d20219d:/kehys/updater.lua?ds=sidebyside diff --git a/kehys/updater.lua b/kehys/updater.lua index 8e1fcc6..42aedf0 100644 --- a/kehys/updater.lua +++ b/kehys/updater.lua @@ -14,6 +14,7 @@ local UnitGetIncomingHeals, UnitGetTotalAbsorbs = UnitGetIncomingHeals, UnitGetT local UnitIsDeadOrGhost, UnitIsConnected = UnitIsDeadOrGhost, UnitIsConnected; local UnitGetTotalHealAbsorbs = UnitGetTotalHealAbsorbs; local InCombatLockdown, IsResting = InCombatLockdown, IsResting; +local UnitInRange, UnitInPhase = UnitInRange, UnitInPhase; local dispelcolor = addon.Colors.OverlayColorDispel; local charmcolor = addon.Colors.OverlayColorCharm; @@ -22,6 +23,8 @@ local healcolor = addon.Colors.OverlayColorHeal; local ignoredAuras = { [315176] = true, -- Grasping Tendrils + [313759] = true, -- Cursed Blood (Il'gynoth) + [312486] = true, -- Recurring Nightmare (Il'gynoth) }; local powerColors = { @@ -45,7 +48,8 @@ function addon.FrameUpdate(frame) -- range check (doesn't have an event) frames can be marked constantly visible if not frame.constant then local inrange, checked = UnitInRange(unit); - if checked and not inrange then + local inphase = UnitPhaseReason(unit); + if (checked and not inrange) or inphase then frame:SetAlpha(0.55); else frame:SetAlpha(1); @@ -75,10 +79,12 @@ function addon.FrameUpdate(frame) else if UnitIsAFK(unit) then frame.text.status = true; + frame.prev.htext = nil; frame.text:SetText("afk"); if not frame.text:IsShown() then frame.text:Show() end elseif UnitIsDND(unit) then frame.text.status = true; + frame.prev.htext = nil; frame.text:SetText("dnd"); if not frame.text:IsShown() then frame.text:Show() end else @@ -101,29 +107,6 @@ function addon.FrameUpdate(frame) -- health local current, hmax = UnitHealth(unit), UnitHealthMax(unit); if frame.prev.health ~= current or frame.prev.hmax ~= hmax then - if not frame.raid and not frame.text.status and frame.prev.htext ~= current then - frame.prev.htext = current; - if frame.boss then - if hmax < current or hmax <= 1 then - frame.text:SetText("100"); - if not frame.text:IsShown() then frame.text:Show() end - elseif current <= 0 then - if frame.text:IsShown() then frame.text:Hide() end - else - frame.text:SetFormattedText("%.1f", current/hmax*100); - if not frame.text:IsShown() then frame.text:Show() end - end - else - if current > 1000000000 then -- 1.0B - frame.text:SetFormattedText("%.2fB", current / 1000000000); - elseif current > 1000000 then -- 1.0M - frame.text:SetFormattedText("%.2fM", current / 1000000); - elseif current > 1000 then -- 1.0K - frame.text:SetFormattedText("%.1fK", current / 1000); - end - if not frame.text:IsShown() then frame.text:Show() end - end - end frame.prev.health = current; frame.prev.hmax = hmax; if hmax < current or hmax <= 1 then @@ -139,6 +122,32 @@ function addon.FrameUpdate(frame) if not frame.health:IsShown() then frame.health:Show() end end end + -- health text + if not frame.raid and not frame.text.status and frame.prev.htext ~= current then + frame.prev.htext = current; + if frame.boss then + if hmax < current or hmax <= 1 then + frame.text:SetText("100"); + if not frame.text:IsShown() then frame.text:Show() end + elseif current <= 0 then + if frame.text:IsShown() then frame.text:Hide() end + else + frame.text:SetFormattedText("%.1f", current/hmax*100); + if not frame.text:IsShown() then frame.text:Show() end + end + else + if current > 1000000000 then -- 1.0B + frame.text:SetFormattedText("%.2fB", current / 1000000000); + elseif current > 1000000 then -- 1.0M + frame.text:SetFormattedText("%.2fM", current / 1000000); + elseif current > 1000 then -- 1.0K + frame.text:SetFormattedText("%.1fK", current / 1000); + else + frame.text:SetFormattedText("%i", current); + end + if not frame.text:IsShown() then frame.text:Show() end + end + end -- shield local hwidth = frame.health.width; current = UnitGetTotalAbsorbs(unit) or 0; @@ -191,7 +200,10 @@ function addon.FrameUpdate(frame) if frame.prev.mana ~= current or frame.prev.mmax ~= max then frame.prev.mana = current; frame.prev.mmax = max; - if max < current or max <= 1 then + if max < 1 then + if frame.mana:IsShown() then frame.mana:Hide() end + if frame.manatext:IsShown() then frame.manatext:Hide() end + elseif max < current then frame.mana:SetWidth(width); frame.manatext:SetText("100"); if not frame.mana:IsShown() then frame.mana:Show() end @@ -217,6 +229,8 @@ function addon.FrameUpdate(frame) frame.stacks = {}; frame.heal = {}; frame.buff1 = {}; + frame.buff2 = {}; + frame.stagger = {}; addon.SetAuras(frame.unit, frame.guid); frame.rounds = 0; end @@ -233,6 +247,10 @@ function addon.FrameUpdate(frame) local _, amount = next(frame.stacks); frame.stack:SetText(amount); if not frame.stack:IsShown() then frame.stack:Show() end + elseif next(frame.hits) then + local _, amount = next(frame.hits); + frame.stack:SetText(amount); + if not frame.stack:IsShown() then frame.stack:Show() end elseif frame.stack:IsShown() then frame.stack:Hide(); end @@ -254,6 +272,25 @@ function addon.FrameUpdate(frame) elseif frame.glow:IsShown() then frame.glow:Hide(); end + -- DK Death Strike and Monk Stagger tracking + if frame.rolename == "TANK" then + if frame.classname == "DEATHKNIGHT" then + local power = UnitPower(unit); + if power < 45 then + if not frame.bottomwarn:IsShown() then frame.bottomwarn:Show() end + elseif frame.bottomwarn:IsShown() then + frame.bottomwarn:Hide(); + end + elseif frame.classname == "MONK" then + if next(frame.stagger) then -- Heavy Stagger + if not frame.bottomwarn:IsShown() then frame.bottomwarn:Show() end + elseif frame.bottomwarn:IsShown() then + frame.bottomwarn:Hide(); + end + end + elseif frame.bottomwarn:IsShown() then + frame.bottomwarn:Hide(); + end -- overlays if next(frame.alert) then -- major