Yeah, thanks for pointing that out. I've corrected the code. But the problem is still there.
In fact, I created those tags hoping to solve the same problem i was having with ouf_reputation's default tags. I was getting the same nil and zero results from it's tags so i tried creating my own but with no luck.
I even tried disabling every single addon, leaving just ouf, ouf_drk and ouf_reputation but the problem persists.
Here's the code for the plugin:
lua Code:
-- oUF_Reputation
local addRepBar
do
local PostUpdateRep = function(Reputation, unit, min, max)
if GetWatchedFactionInfo() then
local FACTION_BAR_COLORS = {
[0] = {r = 1, g = 0.3, b = 0.22},
[1] = {r = 0.8, g = 0.3, b = 0.22}, -- hated, dark red
[2] = {r = 1, g = 0, b = 0}, -- hostile, bright red
[3] = {r = 1, g = 0.5, b = 0}, -- unfriendly, orange
[4] = {r = 0.9, g = 0.7, b = 0}, -- neutral, yellow
[5] = {r = 0, g = 0.6, b = 0.1}, -- friendly, dark green
[6] = {r = 0, g = 1, b = 0}, -- honored, bright green
[7] = {r = 0.25, g = 0.4, b = 0.9}, -- reverted, blue
[8] = {r = 0.6, g = 0.2, b = 0.8}, -- exalted, purple
}
local _, id = GetWatchedFactionInfo()
local r, g, b
local multiplier = 0.3
r = FACTION_BAR_COLORS[id].r;
g = FACTION_BAR_COLORS[id].g;
b = FACTION_BAR_COLORS[id].b;
Reputation:SetStatusBarColor(r, g, b)
Reputation.bg:SetVertexColor(r * multiplier, g * multiplier, b * multiplier)
end
end
lib.addRepBar = function(self)
if IsAddOnLoaded("oUF_Reputation") then
-- Rep bar
local rep = CreateFrame("StatusBar", nil, self)
rep:SetStatusBarTexture(cfg.statusBarTexture)
rep:SetHeight(4)
rep:SetWidth(250)
rep:SetFrameLevel(1)
rep:SetPoint("BOTTOMLEFT", self,"TOPLEFT", 0, 8)
local repBG = rep:CreateTexture(nil, "BACKGROUND")
repBG:SetTexture(cfg.statusBarTexture)
repBG:SetAllPoints(rep)
rep.bg = repBG
-- Text display
local repName= setFont(rep, cfg.smallfont, 13, "OUTLINE", 0)
repName:SetPoint("LEFT", 0, 5)
repName:SetPoint("RIGHT", rep, "RIGHT", 0, 5)
repName:SetJustifyH("CENTER")
self:Tag(repName, "[drk:currep]/[drk:maxrep] [drk:repstanding] - [reputation]")
createBGFrame(rep, 0)
self.Reputation = rep
self.Reputation.PostUpdate = PostUpdateRep
end
end
end
The bar itself always shows the right ammount of rep and the right color, the problem is just the tags, no matter if i use the plugin's default tags or mine.