Skip to content

Commit 71b1d76

Browse files
committed
Refactor MySlot.lua to improve talent handling
1 parent c05df3a commit 71b1d76

File tree

3 files changed

+29
-30
lines changed

3 files changed

+29
-30
lines changed

Myslot.lua

+27-28
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@ local GetNumSpellTabs = C_SpellBook and C_SpellBook.GetNumSpellBookSkillLines or
1818
local GetSpellTabInfo = (C_SpellBook and C_SpellBook.GetSpellBookSkillLineInfo) and function(index)
1919
local skillLineInfo = C_SpellBook.GetSpellBookSkillLineInfo(index);
2020
if skillLineInfo then
21-
return skillLineInfo.name,
22-
skillLineInfo.iconID,
23-
skillLineInfo.itemIndexOffset,
24-
skillLineInfo.numSpellBookItems,
25-
skillLineInfo.isGuild,
21+
return skillLineInfo.name,
22+
skillLineInfo.iconID,
23+
skillLineInfo.itemIndexOffset,
24+
skillLineInfo.numSpellBookItems,
25+
skillLineInfo.isGuild,
2626
skillLineInfo.offSpecID,
2727
skillLineInfo.shouldHide,
2828
skillLineInfo.specID;
@@ -261,37 +261,36 @@ end
261261
-- }}}
262262

263263
local function GetTalentTreeString()
264-
if not ClassTalentFrame_LoadUI then
265-
-- maybe classic
266-
if GetTalentTabInfo then
264+
-- maybe classic
265+
if GetTalentTabInfo then
267266

268-
if tonumber(select(3, GetTalentTabInfo(1)), 10) then
269-
return select(3, GetTalentTabInfo(1)) .. "/" .. select(3, GetTalentTabInfo(2)) .. "/" .. select(3, GetTalentTabInfo(3))
270-
end
271-
272-
-- Cataclysm
273-
274-
for i = 1, 3 do
275-
if select(8, GetTalentTabInfo(i)) then
276-
return select(2, GetTalentTabInfo(i))
277-
end
278-
end
267+
-- wlk
268+
if tonumber(select(3, GetTalentTabInfo(1)), 10) then
269+
return select(3, GetTalentTabInfo(1)) .. "/" .. select(3, GetTalentTabInfo(2)) .. "/" .. select(3, GetTalentTabInfo(3))
279270
end
280271

281-
return nil
272+
-- other
273+
if tonumber(select(5, GetTalentTabInfo(1)), 10) then
274+
return select(5, GetTalentTabInfo(1)) .. "/" .. select(5, GetTalentTabInfo(2)) .. "/" .. select(5, GetTalentTabInfo(3))
275+
end
282276
end
283277

284-
ClassTalentFrame_LoadUI()
285-
if (ClassTalentFrame) and (ClassTalentFrame.TalentsTab) and (ClassTalentFrame.TalentsTab.GetLoadoutExportString) then
286-
if ClassTalentFrame.TalentsTab.GetConfigID and ClassTalentFrame.TalentsTab.GetTalentTreeID then
287-
if (not ClassTalentFrame.TalentsTab:GetConfigID()) or (not ClassTalentFrame.TalentsTab:GetTalentTreeID()) then
288-
return nil
289-
end
278+
-- 11.0
279+
if PlayerSpellsFrame_LoadUI then
280+
PlayerSpellsFrame_LoadUI()
281+
282+
-- no talent yet
283+
if not PlayerSpellsFrame.TalentsFrame:GetConfigID() then
284+
return nil
290285
end
291-
ClassTalentFrame.TalentsTab:UpdateTreeInfo()
292286

293-
return ClassTalentFrame.TalentsTab:GetLoadoutExportString()
287+
PlayerSpellsFrame.TalentsFrame:UpdateTreeInfo()
288+
if PlayerSpellsFrame.TalentsFrame:GetLoadoutExportString() then
289+
return PlayerSpellsFrame.TalentsFrame:GetLoadoutExportString()
290+
end
294291
end
292+
293+
return nil
295294
end
296295

297296
function MySlot:Export(opt)

Myslot.toc

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
## Interface: 100207, 110000
1+
## Interface: 110000
22
## Interface-Classic: 11502
33
## Interface-Cata: 40400
44
## Interface-Wrath: 30403

gui.lua

+1-1
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,7 @@ local function DrawMenu(root, menuData)
324324
root:CreateTitle(m.text)
325325
else
326326
local c = root:CreateCheckbox(m.text, m.checked, function ()
327-
327+
328328
end, {
329329
arg1 = m.arg1,
330330
arg2 = m.arg2,

0 commit comments

Comments
 (0)