From cfee0c81a2a93031e0a9472f07100f097d9191a0 Mon Sep 17 00:00:00 2001 From: Zidras <10605951+Zidras@users.noreply.github.com> Date: Sun, 28 Aug 2022 15:44:56 +0100 Subject: [PATCH] Heal Prediction: fix lookAhead being ignored on multiple frames Related to #11. https://github.com/Zidras/ElvUI_ProjectZidras/commit/6310e2a56f2187033a03a4e678b4791bef56d76c If there was more than one unitframe with the same GUID, the Heal Prediction bar would always assume no lookAhead on the previous unitframes. After some investigation, I concluded that HealComm4 element from ElvUI was somehow conflicting with PZ, and since it is only being used for ElvUI HP, it is best to disable it completely and solely rely on PZ element. Another alternative that gave satisfying results would be defining self.HealCommTimeframe, although it would be wasting cpu for no reason. --- .../Libraries/oUF_Plugins/HealthPrediction.lua | 5 +++-- .../Modules/UnitFrames/Elements/HealPrediction.lua | 4 ++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/ElvUI_ProjectZidras/Libraries/oUF_Plugins/HealthPrediction.lua b/ElvUI_ProjectZidras/Libraries/oUF_Plugins/HealthPrediction.lua index 8ec3caf..492ddaf 100644 --- a/ElvUI_ProjectZidras/Libraries/oUF_Plugins/HealthPrediction.lua +++ b/ElvUI_ProjectZidras/Libraries/oUF_Plugins/HealthPrediction.lua @@ -112,9 +112,10 @@ local function Update(self, event, unit, absorb) local unitGUID = UnitGUID(unit) local lookAhead = element.lookAhead or 5 + local timeWindow = lookAhead and (GetTime() + lookAhead) or nil - local myIncomingHeal = (HealComm:GetHealAmount(unitGUID, HealComm.ALL_HEALS, GetTime() + lookAhead, UnitGUID("player")) or 0) * (HealComm:GetHealModifier(unitGUID) or 1) or 0 - local allIncomingHeal = (HealComm:GetHealAmount(unitGUID, HealComm.ALL_HEALS, GetTime() + lookAhead) or 0) * (HealComm:GetHealModifier(unitGUID) or 1) or 0 + local myIncomingHeal = ((HealComm:GetHealAmount(unitGUID, HealComm.ALL_HEALS, timeWindow, UnitGUID("player")) or 0) * (HealComm:GetHealModifier(unitGUID) or 1)) or 0 + local allIncomingHeal = ((HealComm:GetHealAmount(unitGUID, HealComm.ALL_HEALS, timeWindow) or 0) * (HealComm:GetHealModifier(unitGUID) or 1)) or 0 absorb = absorb or SA.UnitTotal(UnitGUID(unit)) or 0 local healAbsorb = SA.UnitTotalHealAbsorbs(UnitGUID(unit)) or 0 local health, maxHealth = UnitHealth(unit), UnitHealthMax(unit) diff --git a/ElvUI_ProjectZidras/Modules/UnitFrames/Elements/HealPrediction.lua b/ElvUI_ProjectZidras/Modules/UnitFrames/Elements/HealPrediction.lua index 34a248b..c028686 100644 --- a/ElvUI_ProjectZidras/Modules/UnitFrames/Elements/HealPrediction.lua +++ b/ElvUI_ProjectZidras/Modules/UnitFrames/Elements/HealPrediction.lua @@ -119,6 +119,10 @@ function ZUF:Configure_HealComm(frame) if db.enable ~= E.db.pz.unitframe.units[frame.unitframeType].absorbPrediction.enable then db.enable = true end -- workaround because RaidGroup1Button1 and PartyGroup1Button1 db.enable were being rewritten to false for some reason end + if frame:IsElementEnabled("HealComm4") then + frame:DisableElement("HealComm4") -- disable stock ElvUI element since it was messing with the heal prediction (lookAhead, tags, statusbar). HealthPrediction is provided by PZ and is meant to be a full replacement. + end + if db and db.enable then local pred = frame.HealCommBar