Skip to content

Commit 56b5246

Browse files
committed
more compatible layer for 11
1 parent c1bf4ee commit 56b5246

File tree

2 files changed

+34
-8
lines changed

2 files changed

+34
-8
lines changed

Myslot.lua

+24-6
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,25 @@ local MYSLOT_AUTHOR = "Boshi Lian <[email protected]>"
1414
local MYSLOT_VER = 42
1515

1616
-- TWW Beta Compat code (fix and cleanup below later)
17-
local GetNumSpellTabs = C_SpellBook and C_SpellBook.GetNumSpellBookSkillLines or GetNumSpellTabs
18-
local GetSpellTabInfo = C_SpellBook and C_SpellBook.GetSpellBookSkillLineInfo or GetSpellTabInfo
19-
local PickupSpell = C_Spell and C_Spell.PickupSpell or PickupSpell
20-
local PickupItem = C_Item and C_Item.PickupItem or PickupItem
21-
local GetSpellInfo = C_Spell and C_Spell.GetSpellName or GetSpellInfo
22-
local GetSpellLink = C_Spell and C_Spell.GetSpellLink or GetSpellLink
17+
local GetNumSpellTabs = C_SpellBook and C_SpellBook.GetNumSpellBookSkillLines or _G.GetNumSpellTabs
18+
local GetSpellTabInfo = (C_SpellBook and C_SpellBook.GetSpellBookSkillLineInfo) and function(index)
19+
local skillLineInfo = C_SpellBook.GetSpellBookSkillLineInfo(index);
20+
if skillLineInfo then
21+
return skillLineInfo.name,
22+
skillLineInfo.iconID,
23+
skillLineInfo.itemIndexOffset,
24+
skillLineInfo.numSpellBookItems,
25+
skillLineInfo.isGuild,
26+
skillLineInfo.offSpecID,
27+
skillLineInfo.shouldHide,
28+
skillLineInfo.specID;
29+
end
30+
end or _G.GetSpellTabInfo
31+
local PickupSpell = C_Spell and C_Spell.PickupSpell or _G.PickupSpell
32+
local PickupItem = C_Item and C_Item.PickupItem or _G.PickupItem
33+
local GetSpellInfo = C_Spell and C_Spell.GetSpellName or _G.GetSpellInfo
34+
local GetSpellLink = C_Spell and C_Spell.GetSpellLink or _G.GetSpellLink
35+
local GetSpellBookItemInfo = C_SpellBook and C_SpellBook.GetSpellBookItemType or _G.GetSpellBookItemInfo
2336
-- TWW Beta Compat End
2437

2538
-- local MYSLOT_IS_DEBUG = true
@@ -516,6 +529,8 @@ function MySlot:RecoverData(msg, opt)
516529
-- {{{ Cache Spells
517530
--cache spells
518531
local spells = {}
532+
533+
if SPELLS_PER_PAGE then
519534
for i = 1, GetNumSpellTabs() do
520535
local tab, tabTex, offset, numSpells, isGuild, offSpecID = GetSpellTabInfo(i);
521536
offSpecID = (offSpecID ~= 0)
@@ -536,7 +551,9 @@ function MySlot:RecoverData(msg, opt)
536551
end
537552
end
538553
end
554+
end
539555

556+
if BOOKTYPE_PROFESSION then
540557
if GetProfessions then
541558
for _, p in pairs({ GetProfessions() }) do
542559
local _, _, _, _, numSpells, spelloffset = GetProfessionInfo(p)
@@ -550,6 +567,7 @@ function MySlot:RecoverData(msg, opt)
550567
end
551568
end
552569
end
570+
end
553571
-- }}}
554572

555573

gui.lua

+10-2
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ do
6565
end
6666

6767
local function CreateSettingMenu(opt)
68-
68+
6969
local tableref = function (name)
7070
if name == "action" then
7171
return opt.ignoreActionBars
@@ -408,6 +408,10 @@ do
408408
}
409409
})
410410

411+
if not EasyMenu then
412+
ba:Hide()
413+
end
414+
411415
ba:SetScript("OnClick", function(self, button)
412416
EasyMenu(settings, menuFrame, "cursor", 0 , 0, "MENU");
413417
end)
@@ -453,6 +457,10 @@ do
453457

454458
tAppendAll(settings, CreateSettingMenu(actionOpt))
455459

460+
if not EasyMenu then
461+
ba:Hide()
462+
end
463+
456464
ba:SetScript("OnClick", function(self, button)
457465
EasyMenu(settings, menuFrame, "cursor", 0 , 0, "MENU");
458466
end)
@@ -755,7 +763,7 @@ SlashCmdList["MYSLOT"] = function(msg, editbox)
755763
return
756764
end
757765

758-
local opt = {}
766+
local opt = {}
759767
CreateSettingMenu(opt)
760768

761769
MySlot:RecoverData(msg, {

0 commit comments

Comments
 (0)