Skip to content

Commit

Permalink
more compatible layer for 11
Browse files Browse the repository at this point in the history
  • Loading branch information
tg123 committed Jul 2, 2024
1 parent c1bf4ee commit 56b5246
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 8 deletions.
30 changes: 24 additions & 6 deletions Myslot.lua
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,25 @@ local MYSLOT_AUTHOR = "Boshi Lian <[email protected]>"
local MYSLOT_VER = 42

-- TWW Beta Compat code (fix and cleanup below later)
local GetNumSpellTabs = C_SpellBook and C_SpellBook.GetNumSpellBookSkillLines or GetNumSpellTabs
local GetSpellTabInfo = C_SpellBook and C_SpellBook.GetSpellBookSkillLineInfo or GetSpellTabInfo
local PickupSpell = C_Spell and C_Spell.PickupSpell or PickupSpell
local PickupItem = C_Item and C_Item.PickupItem or PickupItem
local GetSpellInfo = C_Spell and C_Spell.GetSpellName or GetSpellInfo
local GetSpellLink = C_Spell and C_Spell.GetSpellLink or GetSpellLink
local GetNumSpellTabs = C_SpellBook and C_SpellBook.GetNumSpellBookSkillLines or _G.GetNumSpellTabs
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,
skillLineInfo.offSpecID,
skillLineInfo.shouldHide,
skillLineInfo.specID;
end
end or _G.GetSpellTabInfo
local PickupSpell = C_Spell and C_Spell.PickupSpell or _G.PickupSpell
local PickupItem = C_Item and C_Item.PickupItem or _G.PickupItem
local GetSpellInfo = C_Spell and C_Spell.GetSpellName or _G.GetSpellInfo
local GetSpellLink = C_Spell and C_Spell.GetSpellLink or _G.GetSpellLink
local GetSpellBookItemInfo = C_SpellBook and C_SpellBook.GetSpellBookItemType or _G.GetSpellBookItemInfo
-- TWW Beta Compat End

-- local MYSLOT_IS_DEBUG = true
Expand Down Expand Up @@ -516,6 +529,8 @@ function MySlot:RecoverData(msg, opt)
-- {{{ Cache Spells
--cache spells
local spells = {}

if SPELLS_PER_PAGE then
for i = 1, GetNumSpellTabs() do
local tab, tabTex, offset, numSpells, isGuild, offSpecID = GetSpellTabInfo(i);
offSpecID = (offSpecID ~= 0)
Expand All @@ -536,7 +551,9 @@ function MySlot:RecoverData(msg, opt)
end
end
end
end

if BOOKTYPE_PROFESSION then
if GetProfessions then
for _, p in pairs({ GetProfessions() }) do
local _, _, _, _, numSpells, spelloffset = GetProfessionInfo(p)
Expand All @@ -550,6 +567,7 @@ function MySlot:RecoverData(msg, opt)
end
end
end
end
-- }}}


Expand Down
12 changes: 10 additions & 2 deletions gui.lua
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ do
end

local function CreateSettingMenu(opt)

local tableref = function (name)
if name == "action" then
return opt.ignoreActionBars
Expand Down Expand Up @@ -408,6 +408,10 @@ do
}
})

if not EasyMenu then
ba:Hide()
end

ba:SetScript("OnClick", function(self, button)
EasyMenu(settings, menuFrame, "cursor", 0 , 0, "MENU");
end)
Expand Down Expand Up @@ -453,6 +457,10 @@ do

tAppendAll(settings, CreateSettingMenu(actionOpt))

if not EasyMenu then
ba:Hide()
end

ba:SetScript("OnClick", function(self, button)
EasyMenu(settings, menuFrame, "cursor", 0 , 0, "MENU");
end)
Expand Down Expand Up @@ -755,7 +763,7 @@ SlashCmdList["MYSLOT"] = function(msg, editbox)
return
end

local opt = {}
local opt = {}
CreateSettingMenu(opt)

MySlot:RecoverData(msg, {
Expand Down

0 comments on commit 56b5246

Please sign in to comment.