Skip to content

Commit

Permalink
Refactor MySlot.lua to improve talent handling
Browse files Browse the repository at this point in the history
  • Loading branch information
tg123 committed Jul 31, 2024
1 parent c05df3a commit 71b1d76
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 30 deletions.
55 changes: 27 additions & 28 deletions Myslot.lua
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ local GetNumSpellTabs = C_SpellBook and C_SpellBook.GetNumSpellBookSkillLines or
local GetSpellTabInfo = (C_SpellBook and C_SpellBook.GetSpellBookSkillLineInfo) and function(index)
local skillLineInfo = C_SpellBook.GetSpellBookSkillLineInfo(index);
if skillLineInfo then
return skillLineInfo.name,
skillLineInfo.iconID,
skillLineInfo.itemIndexOffset,
skillLineInfo.numSpellBookItems,
skillLineInfo.isGuild,
return skillLineInfo.name,
skillLineInfo.iconID,
skillLineInfo.itemIndexOffset,
skillLineInfo.numSpellBookItems,
skillLineInfo.isGuild,
skillLineInfo.offSpecID,
skillLineInfo.shouldHide,
skillLineInfo.specID;
Expand Down Expand Up @@ -261,37 +261,36 @@ end
-- }}}

local function GetTalentTreeString()
if not ClassTalentFrame_LoadUI then
-- maybe classic
if GetTalentTabInfo then
-- maybe classic
if GetTalentTabInfo then

if tonumber(select(3, GetTalentTabInfo(1)), 10) then
return select(3, GetTalentTabInfo(1)) .. "/" .. select(3, GetTalentTabInfo(2)) .. "/" .. select(3, GetTalentTabInfo(3))
end

-- Cataclysm

for i = 1, 3 do
if select(8, GetTalentTabInfo(i)) then
return select(2, GetTalentTabInfo(i))
end
end
-- wlk
if tonumber(select(3, GetTalentTabInfo(1)), 10) then
return select(3, GetTalentTabInfo(1)) .. "/" .. select(3, GetTalentTabInfo(2)) .. "/" .. select(3, GetTalentTabInfo(3))
end

return nil
-- other
if tonumber(select(5, GetTalentTabInfo(1)), 10) then
return select(5, GetTalentTabInfo(1)) .. "/" .. select(5, GetTalentTabInfo(2)) .. "/" .. select(5, GetTalentTabInfo(3))
end
end

ClassTalentFrame_LoadUI()
if (ClassTalentFrame) and (ClassTalentFrame.TalentsTab) and (ClassTalentFrame.TalentsTab.GetLoadoutExportString) then
if ClassTalentFrame.TalentsTab.GetConfigID and ClassTalentFrame.TalentsTab.GetTalentTreeID then
if (not ClassTalentFrame.TalentsTab:GetConfigID()) or (not ClassTalentFrame.TalentsTab:GetTalentTreeID()) then
return nil
end
-- 11.0
if PlayerSpellsFrame_LoadUI then
PlayerSpellsFrame_LoadUI()

-- no talent yet
if not PlayerSpellsFrame.TalentsFrame:GetConfigID() then
return nil
end
ClassTalentFrame.TalentsTab:UpdateTreeInfo()

return ClassTalentFrame.TalentsTab:GetLoadoutExportString()
PlayerSpellsFrame.TalentsFrame:UpdateTreeInfo()
if PlayerSpellsFrame.TalentsFrame:GetLoadoutExportString() then
return PlayerSpellsFrame.TalentsFrame:GetLoadoutExportString()
end
end

return nil
end

function MySlot:Export(opt)
Expand Down
2 changes: 1 addition & 1 deletion Myslot.toc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## Interface: 100207, 110000
## Interface: 110000
## Interface-Classic: 11502
## Interface-Cata: 40400
## Interface-Wrath: 30403
Expand Down
2 changes: 1 addition & 1 deletion gui.lua
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ local function DrawMenu(root, menuData)
root:CreateTitle(m.text)
else
local c = root:CreateCheckbox(m.text, m.checked, function ()

end, {
arg1 = m.arg1,
arg2 = m.arg2,
Expand Down

0 comments on commit 71b1d76

Please sign in to comment.