I am having problem with ComboPoints not properly resetting after fights or when tabbing. This is how I implemented it:
Code:
if unit == "target" then
self.CPoints = SetFontString(self.Health, d3font, 24, "THINOUTLINE")
self.CPoints:SetPoint("LEFT", self.Name, "RIGHT", 5, -1)
self.CPoints:SetTextColor(1, .5, 0)
end
This didn't work, so I tried something dirty.
I added
Code:
local mycombo = GetComboPoints("target")
if mycombo >= 1 then
self.CPoints:SetText(mycombo)
end
to the updatehealth func which finally reseted the Combo Points after a fight was over but tabbing still does not work.
GetComboPoints("player") does not seem to work properly too, it does not reset correctly. When I got out of a fight with 5 points it kept that 5 points.
Maybe its my oUF, haven't updated it for a while (Version 1.1.4).
cpoints.lua
Code:
local parent = debugstack():match[[\AddOns\(.-)\]]
local global = GetAddOnMetadata(parent, 'X-oUF')
assert(global, 'X-oUF needs to be defined in the parent add-on.')
local oUF = _G[global]
local wotlk = select(4, GetBuildInfo()) >= 3e4
local GetComboPoints = GetComboPoints
local MAX_COMBO_POINTS = MAX_COMBO_POINTS
local ename
if(wotlk) then
ename = 'UNIT_COMBO_POINTS'
else
ename = 'PLAYER_COMBO_POINTS'
end
-- TODO: This shouldn't be hardcoded in wotlk.
oUF[ename] = function(self, event, unit)
if(wotlk and unit ~= 'player') then return end
local cp = GetComboPoints('player', 'target')
local cpoints = self.CPoints
if(#cpoints == 0) then
cpoints:SetText((cp > 0) and cp)
else
for i=1, MAX_COMBO_POINTS do
if(i <= cp) then
cpoints[i]:Show()
else
cpoints[i]:Hide()
end
end
end
end
table.insert(oUF.subTypes, function(self, unit)
if(self.CPoints and unit == "target") then
self:RegisterEvent(ename)
end
end)
oUF:RegisterSubTypeMapping(ename)
Oh...maybe I should have used
Code:
local mycombo = GetComboPoints("player","target")
if mycombo >= 1 then
self.CPoints:SetText(mycombo)
end
but that is what cpoints.lua does and its not working.