|
|
function TradeTabs:Initialize() |
if self.initialized then return end -- Shouldn't need this, but I'm paranoid |
if self.initialized or not IsAddOnLoaded("Blizzard_TradeSkillUI") then return end -- Shouldn't need this, but I'm paranoid |
|
for i=1,#tradeSpells do |
tradeSpells[GetSpellInfo(tradeSpells[i])] = true |
local n = GetSpellInfo(tradeSpells[i]) |
tradeSpells[n] = -1 |
tradeSpells[i] = n |
end |
|
local parent = TradeSkillFrame |
if SkilletFrame then |
parent = SkilletFrame |
self:UnregisterAllEvents() |
end |
|
local spells = {} |
|
for i=1,MAX_SPELLS do |
local n = GetSpellName(i,"spell") |
if tradeSpells[n] then |
spells[n] = i |
tradeSpells[n] = i |
end |
end |
|
local parent = TradeSkillFrame |
if SkilletFrame then |
parent = SkilletFrame |
self:UnregisterAllEvents() |
end |
|
local prev |
for spell,spellid in pairs(spells) do |
local tab = self:CreateTab(spell,spellid,parent) |
local point,relPoint,x,y = "TOPLEFT","BOTTOMLEFT",0,-17 |
if not prev then |
prev,relPoint,x,y = parent,"TOPRIGHT",-32,-64 |
if parent == SkilletFrame then x = 0 end -- Special case. ew |
for i,spell in ipairs(tradeSpells) do |
local spellid = tradeSpells[spell] |
if type(spellid) == "number" and spellid > 0 then |
local tab = self:CreateTab(spell,spellid,parent) |
local point,relPoint,x,y = "TOPLEFT","BOTTOMLEFT",0,-17 |
if not prev then |
prev,relPoint,x,y = parent,"TOPRIGHT",-33,-44 |
if parent == SkilletFrame then x = 0 end -- Special case. ew |
end |
tab:SetPoint(point,prev,relPoint,x,y) |
prev = tab |
end |
tab:SetPoint(point,prev,relPoint,x,y) |
prev = tab |
end |
|
self.initialized = true |
end |
|