Code:
local a = CreateFrame("Frame", nil, UIParent)
local xOffset, yOffset = 0, 0 -- first zero is X offset, second zero is Y offset
local width, height = 0, 0 -- first number is width, second number is height
local r, g, b = 1, 1, 1 -- ranges from 0-1, r g b values for the bar
a:SetPoint("BOTTOMLEFT", xOffset, yOffset)
a:SetSize(width, height)
a.background = a:CreateTexture(nil, "BACKGROUND")
a.background:SetAllPoints()
a.background:SetTexture(r*0.4, g*0.4, b*0.4)
a.bar = a:CreateTexture(nil, "ARTWORK")
a.bar:SetPoint("TOPLEFT")
a.bar:SetPoint("BOTTOMLEFT")
a.bar:SetTexture(r, g, b)
function a:SetValue(cur, max)
if (cur>=max) then
self.bar:Hide()
else
self.bar:Show()
self.bar:SetWidth((1-(cur/max))*width)
end
end
local spellid=((select(4,GetBuildInfo()))>=40200) and 12 or 10
a:SetScript("OnEvent", function(self, event, ...)
if event == "COMBAT_LOG_EVENT_UNFILTERED" then
self.pGUID = self.pGUID or UnitGUID("player")
local arg = {...}
if (arg[2] == "SPELL_PERIODIC_HEAL") and (arg[4] == self.pGUID) and (arg[spellid] == 73651) and ((select(5,GetTalentInfo(3,8)))>=1) then
a.update.timer = 3
a.update:Show()
a:SetValue(3,3)
end
if (arg[2] == "SPELL_AURA_REMOVED") and (arg[4] == self.pGUID) and (arg[spellid] == 73651) then
a.update:Hide()
a:SetValue(3,3)
end
elseif (event == "ACTIVE_TALENT_GROUP_CHANGED") or (event == "SPELLS_CHANGED") then
if ((select(5,GetTalentInfo(3,8)))>=1) then
self.bar:Show()
self.background:Show()
else
self.bar:Hide()
self.background:Hide()
end
if event == "SPELLS_CHANGED" then
self:UnregisterEvent("SPELLS_CHANGED")
end
end
end)
a:RegisterEvent("ACTIVE_TALENT_GROUP_CHANGED")
a:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED")
a.update = CreateFrame("Frame")
a.update:Hide()
a.update:SetScript("OnUpdate", function(self, elapsed)
self.timer = self.timer-elapsed
if self.timer>0 then
a:SetValue(self.timer,3)
else
a:SetValue(3,3)
self:Hide()
end
end)
if GetSpellInfo(1752) then
if ((select(5,GetTalentInfo(3,8)))>=1) then
a.bar:Show()
a.background:Show()
else
a.bar:Hide()
a.background:Hide()
end
else
a:RegisterEvent("SPELLS_CHANGED")
end
a:SetValue(3,3)
Went through and applied all the fixes I posted - I assume those worked as there was no further reply.
If it doesn't work, post back, I'll be happy to continue working on this.