WoWInterface SVN TradeTabs

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /
    from Rev 7 to Rev 8
    Reverse comparison

Rev 7 → Rev 8

trunk/TradeTabs.toc
1,8 → 1,8
## Interface: 30000
## Title: TradeTabs
## Notes: Adds spellbook-style tabs to the TradeSkillFrame for easy swapping between production skills
## Author: Tem
## Version 1.6
## Author: tardmrr
## Version 1.7
## X-Category: Tradeskill
## LoadOnDemand: 1
## LoadWith: Blizzard_TradeSkillUI
trunk/TradeTabs.lua
1,18 → 1,24
local TradeTabs = CreateFrame("Frame","TradeTabs")
 
local tradeSpells = {
local tradeSpells = { -- Spell order in this table determines the tab order
28596, -- Alchemy
29844, -- Blacksmithing
33359, -- Cooking
28029, -- Enchanting
30350, -- Engineering
27028, -- First Aid
45357, -- Inscription
28897, -- Jewel Crafting
32549, -- Leatherworking
53428, -- Runeforging
2656, -- Smelting
26790, -- Tailoring
 
33359, -- Cooking
27028, -- First Aid
 
13262, -- Disenchant
51005, -- Milling
31252, -- Prospecting
818, -- Basic Campfire
}
 
function TradeTabs:OnEvent(event,...)
28,38 → 34,42
 
 
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
 
114,6 → 124,7
return button
end
 
TradeTabs:RegisterEvent("TRADE_SKILL_SHOW")
TradeTabs:RegisterEvent("UNIT_SPELLCAST_SUECCEEDED")
TradeTabs:RegisterEvent("TRADE_SKILL_SHOW")
TradeTabs:SetScript("OnEvent",TradeTabs.OnEvent)
 
TradeTabs:Initialize()
\ No newline at end of file