Halo,
As I am new to wow programming, I need some expert advice on how to improve this code snippet below. I am concerned about the performance issue. Is there a better (more efficient way) to achieve the same goal. I am trying to track reputations. So far, it runs fine except for The Klaxxi faction. Only the name ("The Klaxxi") is displayed and nothing else.
Code:
--faciton ids
local repTable = {1341, 1269, 1270, 1337, 1359}
local fEvent = {}
local repFrame = {}
local rName = {}
for k,v in pairs(repTable) do
fEvent[k] = CreateFrame("Frame",nil, UIParent)
fEvent[k]:SetSize(140,15)
fEvent[k]:SetFrameStrata("LOW")
if ( k == 1) then
fEvent[k]:SetPoint("TOP",Minimap,"BOTTOM",0,-25)
else
fEvent[k]:SetPoint("TOP",fEvent[k-1],"BOTTOM",0,-2)
end
--CreateBD creates back drop with with black background and alpha .7
F.CreateBD(fEvent[k],.7)
repFrame[k] = CreateFrame("StatusBar",nil,self)
repFrame[k]:SetFrameStrata("BACKGROUND")
repFrame[k]:SetAllPoints(fEvent[k])
repFrame[k]:SetStatusBarTexture(C.media.texture)
repFrame[k]:SetStatusBarColor(1, 1, 1, 1)
repFrame[k]:SetReverseFill(false)
repFrame[k]:RegisterEvent("UPDATE_FACTION")
rName[k] = F.CreateFS(fEvent[k], 8,"LEFT")
rName[k]:SetPoint("LEFT",fEvent[k],"LEFT",2,0)
repFrame[k]:SetScript("OnEvent", function(self,event,...)
local name, _, standing, barMin, _, barValue, _, _, _, _, _, _, _ = GetFactionInfoByID(v)
local curr
curr = barValue - barMin
if( standing == 8) then
--when exalted, change text color
rName[k]:SetText("|cFFFF9955"..name)
else
rName[k]:SetText("|r"..name)
repFrame[k]:SetMinMaxValues(0,barMin)
repFrame[k]:SetValue(barMin - curr)
end
end)
end
What is the The Klaxxi faction id? I use faction id provided by wowhead.com. But that doesnt seem to work.