diff --git a/api/api.lua b/api/api.lua index 2ff60792..ea70e418 100644 --- a/api/api.lua +++ b/api/api.lua @@ -35,10 +35,9 @@ function pfUI.api.UnitInRange(unit) RangeCache[unit] = {} RangeCache[unit].time = GetTime() - local noswitch = true if not UnitIsUnit("target", unit) then + pfScanActive = true TargetUnit(unit) - noswitch = false end if IsActionInRange(pfUI.rangecheck.slot) == 1 then @@ -47,8 +46,9 @@ function pfUI.api.UnitInRange(unit) RangeCache[unit].range = nil end - if not noswitch then + if pfScanActive then TargetLastTarget() + pfScanActive = false end end diff --git a/api/unitframes.lua b/api/unitframes.lua index 32ac6d25..e360749a 100644 --- a/api/unitframes.lua +++ b/api/unitframes.lua @@ -204,11 +204,11 @@ function pfUI.uf:CreateUnitFrame(unit, id, config, tick) local powerReal = this.cache.power local powerDiff = abs(powerReal - powerDisplay) - if UnitName(this.label .. this.id) ~= this.lastUnit then + if this.instantRefresh then -- No Animations for new Units - this.lastUnit = UnitName(this.label .. this.id) this.hp.bar:SetValue(hpReal) this.power.bar:SetValue(powerReal) + this.instantRefresh = nil else -- Animation if hpDisplay < hpReal then @@ -476,6 +476,10 @@ function pfUI.uf:RefreshUnit(unit, component) -- break early on misconfigured UF's if not unit.label then return end + if unit.label == "target" or unit.label == "targettarget" then + if pfScanActive == true then return end + end + local default_border = pfUI_config.appearance.border.default if pfUI_config.appearance.border.groupframes ~= "-1" then default_border = pfUI_config.appearance.border.groupframes @@ -483,6 +487,11 @@ function pfUI.uf:RefreshUnit(unit, component) local C = pfUI_config + if UnitName(unit.label .. unit.id) ~= unit.lastUnit then + unit.instantRefresh = true + unit.lastUnit = UnitName(unit.label .. unit.id) + end + if UnitName(unit.label .. unit.id) or (pfUI.gitter and pfUI.gitter:IsShown()) then unit:Show() else unit:Hide() end