Hi everyone!
I have some issues with FACTION_BAR_COLORS.
Why i dont know
Lua Code:
Message: ...ce\AddOns\AftermathhUI\Modules\Blizzard\AfterRep.lua:60: attempt to index field '?' (a nil value)
Time: 11/21/14 19:31:37
Count: 2
Stack: ...ce\AddOns\AftermathhUI\Modules\Blizzard\AfterRep.lua:60: in function <...ce\AddOns\AftermathhUI\Modules\Blizzard\AfterRep.lua:55>
Locals: FactionColors = <table> {
6 = <table> {
}
2 = <table> {
}
8 = <table> {
}
3 = <table> {
}
1 = <table> {
}
4 = <table> {
}
5 = <table> {
}
7 = <table> {
}
}
Name = nil
ID = 0
Min = 0
Max = 0
Value = 0
(*temporary) = <function> defined =[C]:-1
(*temporary) = <unnamed> {
0 = <userdata>
Shadow = <table> {
}
fadeInfo = <table> {
}
HasBorder = true
Border = <table> {
}
}
(*temporary) = nil
(*temporary) = <userdata>
(*temporary) = <userdata>
(*temporary) = nil
(*temporary) = nil
(*temporary) = nil
(*temporary) = nil
(*temporary) = "attempt to index field '?' (a nil value)"
ReputationBar = <unnamed> {
0 = <userdata>
Shadow = <table> {
}
fadeInfo = <table> {
}
HasBorder = true
Border = <table> {
}
}
ReputationBarFont = <unnamed> {
0 = <userdata>
}
Lua Code:
if AftermathhUI.plugins.repbar == false then return end
local Reputation = CreateFrame("Frame", nil, UIParent)
local ReputationBar = CreateFrame('StatusBar', nil, UIParent)
local InvisFrame = CreateFrame("Frame", nil, ReputationBar)
InvisFrame:SetFrameStrata("HIGH")
InvisFrame:SetFrameLevel(5)
InvisFrame:SetAllPoints()
local ReputationBarFont = InvisFrame:CreateFontString(nil, 'OVERLAY')
ReputationBar:SetPoint('LEFT', oUF_AftermathhPlayer, 223, -178)
ReputationBar:SetStatusBarTexture(AftermathhUI.media.texture)
ReputationBar:SetSize(235, 20)
ReputationBar:SetBackdrop({
bgFile = AftermathhUI.media.blank,
insets = {top = -1, left = -1, bottom = -1, right = -1},
})
ReputationBar:SetBackdropColor(unpack(AftermathhUI.media.backdropcolor))
CreateBorderLight(ReputationBar, AftermathhUI.media.bordersize, AftermathhUI.bordercolor, AftermathhUI.bordercolor, AftermathhUI.bordercolor, 3)
ReputationBar:SetScript("OnEnter", function(self)
if (not GetWatchedFactionInfo()) then
return
end
local Name, ID, Min, Max, Value = GetWatchedFactionInfo()
GameTooltip:SetOwner(self, "ANCHOR_CURSOR")
GameTooltip:AddLine(string.format("%s (%s)", Name, _G["FACTION_STANDING_LABEL" .. ID]))
GameTooltip:AddLine(string.format("%d / %d (%d%%)", Value - Min, Max - Min, (Value - Min) / (Max - Min) * 100), 1, 1, 1, 1, 1, 1)
GameTooltip:Show()
GameTooltip:Show()
end)
ReputationBar:SetScript("OnLeave", function()
if GameTooltip:IsShown() then
GameTooltip:Hide()
end
end)
ReputationBar:SetAlpha(0)
ReputationBar:HookScript("OnEnter", function(self) UIFrameFadeIn(self, 1.2, self:GetAlpha(), 1) end)
ReputationBar:HookScript("OnLeave", function(self) UIFrameFadeIn(self, 0.8, self:GetAlpha(), 0) end)
ReputationBarFont:SetPoint('CENTER', ReputationBar)
ReputationBarFont:SetFont(AftermathhUI.media.font, 12, AftermathhUI.media.fontflag)
if AftermathhUI.media.shadowoffset == true then
ReputationBarFont:SetShadowOffset(1, -1)
ReputationBarFont:SetShadowColor(0,0,0)
end
local function UpdateRep()
local FactionColors = FACTION_BAR_COLORS
local Name, ID, Min, Max, Value = GetWatchedFactionInfo()
ReputationBar:SetMinMaxValues(Min, Max)
ReputationBar:SetValue(Value)
ReputationBar:SetStatusBarColor(FactionColors[ID].r, FactionColors[ID].g, FactionColors[ID].b)
ReputationBarFont:SetText(""..Min.." / "..Max.." - "..Name.."")
end
Reputation:RegisterEvent("UPDATE_FACTION")
Reputation:RegisterEvent("PLAYER_ENTERING_WORLD")
Reputation:SetScript("OnEvent", UpdateRep)