View Single Post
01-25-18, 10:55 PM   #5
Aideenwolf
A Murloc Raider
Join Date: Feb 2007
Posts: 8
Sorry to ress an old thread - but I'm having the same issue in the picture. I figured I could turn it off in the config but I rather like the overall combined healing display when i'm on my druid. Wracked my brain but I really don't quite get the LUA code enough to figure where i'm going wrong.

The worse thing is it's not throwing off a bug error so I can't go HA! That line!

Edit: Figured it out >< I never changed the function name >< -- so if anyone is wondering how to fix the health prediction code:


Core.Lua
Code:
function core.HealthPrediction_Override(self, event, unit)
	if self.unit ~= unit then return end

	local element = self.HealthPrediction
	local parent = self.Health

	local health, maxHealth = UnitHealth(unit), UnitHealthMax(unit)
	if maxHealth == 0 or UnitIsDeadOrGhost(unit) then
		element.healingBar:Hide()
		element.absorbsBar:Hide()
		return
	end

	local missing = maxHealth - health
	local healing = UnitGetIncomingHeals(unit) or 0

	if (healing / maxHealth) >= 0.01 and missing > 0 then
		local bar = element.healingBar
		bar:Show()
		bar:SetMinMaxValues(0, maxHealth)
		if healing > missing then
			bar:SetValue(missing)
			missing = 0
		else
			bar:SetValue(healing)
			missing = missing - healing
		end
		parent = bar
	else
		element.healingBar:Hide()
	end

	local absorbs = UnitGetTotalAbsorbs(unit) or 0
	if (absorbs / maxHealth) >= 0.01 and missing > 0 then
		local bar = element.absorbsBar
		bar:Show()
		bar:SetPoint("TOPLEFT", parent:GetStatusBarTexture(), "TOPRIGHT")
		bar:SetPoint("BOTTOMLEFT", parent:GetStatusBarTexture(), "BOTTOMRIGHT")
		bar:SetMinMaxValues(0, maxHealth)
		if absorbs > missing then
			bar:SetValue(missing)
		else
			bar:SetValue(absorbs)
		end
	else
		element.absorbsBar:Hide()
	end
end
Player/Target/Raid Frame
Code:
-- HealthPrediction 
....

		self.HealthPrediction = {
			healingBar = healing,
			absorbsBar = absorbs,
			Override = core.HealthPrediction_Override
		}
	end

Last edited by Aideenwolf : 01-26-18 at 12:51 AM.
  Reply With Quote