diff --git a/.luacheckrc b/.luacheckrc index b5399a4..55c4796 100644 --- a/.luacheckrc +++ b/.luacheckrc @@ -51,6 +51,7 @@ read_globals = { "AttemptToSaveBindings", "C_LFGList", "C_PetBattles", + "C_Spell", "CanExitVehicle", "ClearOverrideBindings", "CreateFrame", diff --git a/ActionBar.lua b/ActionBar.lua index 5785639..01f22be 100644 --- a/ActionBar.lua +++ b/ActionBar.lua @@ -13,6 +13,11 @@ local WoW10 = select(4, GetBuildInfo()) >= 100000 local tonumber, format, min = tonumber, format, min +local GetSpellBookItemInfo = GetSpellBookItemInfo +if C_SpellBook and C_SpellBook.GetSpellBookItemType then + GetSpellBookItemInfo = function(index, book) assert(book == "spell") return C_SpellBook.GetSpellBookItemType(index, Enum.SpellBookSpellBank.Player) end +end + -- GLOBALS: UIParent, VehicleExit --[[=================================================================================== @@ -177,17 +182,19 @@ function ActionBar:SetupSmartTarget() ]] local i = 1 - local subtype, action = GetSpellBookItemInfo(i, "spell") + local subtype, action, spellId = GetSpellBookItemInfo(i, "spell") while subtype do if subtype == "SPELL" then - local spellId = select(7, GetSpellInfo(i, "spell")) + if not (C_SpellBook and C_SpellBook.GetSpellBookItemType) then + spellId = select(7, GetSpellInfo(i, "spell")) + end if spellId and spellId ~= action then s = s .. "\n" .. ([[ BT_Spell_Overrides[%d] = %d ]]):format(spellId, action) end end i = i + 1 - subtype, action = GetSpellBookItemInfo(i, "spell") + subtype, action, spellId = GetSpellBookItemInfo(i, "spell") end self:Execute(s) diff --git a/Bartender4.lua b/Bartender4.lua index 8eec38e..6fc5fbb 100644 --- a/Bartender4.lua +++ b/Bartender4.lua @@ -374,6 +374,15 @@ function Bartender4.Util:Merge(target, source) return target end +Bartender4.Compat = {} +if C_Spell and C_Spell.GetSpellName then + Bartender4.Compat.GetSpellName = C_Spell.GetSpellName +else + function Bartender4.Compat.GetSpellName(id) + return (GetSpellInfo(id)) + end +end + Bartender4.modulePrototype = {} function Bartender4.modulePrototype:ToggleModule(info, value) if value ~= nil then diff --git a/HideBlizzard.lua b/HideBlizzard.lua index 3b6e87d..1a4f3a9 100644 --- a/HideBlizzard.lua +++ b/HideBlizzard.lua @@ -81,7 +81,7 @@ function Bartender4:HideBlizzard() MainMenuBar:UnregisterEvent("ACTIONBAR_SHOWGRID") MainMenuBar:UnregisterEvent("ACTIONBAR_HIDEGRID") - if IsAddOnLoaded("Blizzard_NewPlayerExperience") then + if C_AddOns.IsAddOnLoaded("Blizzard_NewPlayerExperience") then self:NPE_LoadUI() elseif NPE_LoadUI ~= nil then self:SecureHook("NPE_LoadUI") diff --git a/Options/Bar.lua b/Options/Bar.lua index c4354a2..80cc80e 100644 --- a/Options/Bar.lua +++ b/Options/Bar.lua @@ -8,7 +8,7 @@ local Bar = Bartender4.Bar.prototype local tonumber, tostring, assert, select, floor = tonumber, tostring, assert, select, floor --- GLOBALS: GetNumShapeshiftForms, GetShapeshiftFormInfo, GetSpellInfo +-- GLOBALS: GetNumShapeshiftForms, GetShapeshiftFormInfo --[[=================================================================================== Bar Options @@ -163,7 +163,7 @@ local function getStanceTable() local num = GetNumShapeshiftForms() for i = 1, num do - tbl[i] = GetSpellInfo(select(4, GetShapeshiftFormInfo(i))) + tbl[i] = Bartender4.Compat.GetSpellName(select(4, GetShapeshiftFormInfo(i))) end return tbl end diff --git a/PetButton.lua b/PetButton.lua index 655d871..a723a4d 100644 --- a/PetButton.lua +++ b/PetButton.lua @@ -120,17 +120,22 @@ function PetButtonPrototype:Update() self:SetChecked(false) end - if autoCastAllowed then - self.AutoCastable:Show() + if self.AutoCastOverlay then -- 11.0 + self.AutoCastOverlay:SetShown(autoCastAllowed) + self.AutoCastOverlay:ShowAutoCastEnabled(autoCastEnabled) + else + if autoCastAllowed then + self.AutoCastable:Show() - if autoCastEnabled then - AutoCastShine_AutoCastStart(self.AutoCastShine) + if autoCastEnabled then + AutoCastShine_AutoCastStart(self.AutoCastShine) + else + AutoCastShine_AutoCastStop(self.AutoCastShine) + end else - AutoCastShine_AutoCastStop(self.AutoCastShine) + self.AutoCastable:Hide() + AutoCastShine_AutoCastStop(self.AutoCastShine) end - else - self.AutoCastable:Hide() - AutoCastShine_AutoCastStop(self.AutoCastShine) end if texture then diff --git a/StanceBar.lua b/StanceBar.lua index d1270ae..6db8e0f 100644 --- a/StanceBar.lua +++ b/StanceBar.lua @@ -181,7 +181,7 @@ end local actionTmpl = "Stance Button %d (%s)" function StanceButtonPrototype:GetActionName() local id = self:GetID() - local name = GetSpellInfo(select(4, GetShapeshiftFormInfo(id))) + local name = Bartender4.Compat.GetSpellName(select(4, GetShapeshiftFormInfo(id))) return format(actionTmpl, id, name) end diff --git a/StateBar.lua b/StateBar.lua index cf08eb9..dcc9cb9 100644 --- a/StateBar.lua +++ b/StateBar.lua @@ -9,7 +9,7 @@ local ButtonBar = Bartender4.ButtonBar.prototype local setmetatable, rawset, pairs, type, tostring = setmetatable, rawset, pairs, type, tostring local table_insert, table_concat, fmt = table.insert, table.concat, string.format --- GLOBALS: GetSpellInfo, InCombatLockdown, GetNumShapeshiftForms +-- GLOBALS: InCombatLockdown, GetNumShapeshiftForms -- GLOBALS: MainMenuBarArtFrame, OverrideActionBar, RegisterStateDriver, UnregisterStateDriver local WoWRetail = (WOW_PROJECT_ID == WOW_PROJECT_MAINLINE) @@ -92,27 +92,27 @@ DefaultStanceMap = setmetatable({}, { __index = function(t,k) local newT = nil if k == "DRUID" then newT = { - { id = "bear", name = GetSpellInfo(5487), index = 3 }, - { id = "cat", name = GetSpellInfo(768), index = 1 }, + { id = "bear", name = Bartender4.Compat.GetSpellName(5487), index = 3 }, + { id = "cat", name = Bartender4.Compat.GetSpellName(768), index = 1 }, -- prowl is virtual, no real stance - { id = "prowl", name = ("%s (%s)"):format((GetSpellInfo(768)), (GetSpellInfo(5215))), index = false}, - { id = "moonkin", name = GetSpellInfo(24858), index = 4 }, - (WoWBC or WoWWrath or WoWCata) and { id = "treeoflife", name = GetSpellInfo(33891), index = 2 } or nil, + { id = "prowl", name = ("%s (%s)"):format((Bartender4.Compat.GetSpellName(768)), (Bartender4.Compat.GetSpellName(5215))), index = false}, + { id = "moonkin", name = Bartender4.Compat.GetSpellName(24858), index = 4 }, + (WoWBC or WoWWrath or WoWCata) and { id = "treeoflife", name = Bartender4.Compat.GetSpellName(33891), index = 2 } or nil, } elseif k == "ROGUE" then newT = { - { id = "stealth", name = GetSpellInfo(1784), index = 1 }, - (WoWWrath or WoWCata) and { id = "shadowdance", name = GetSpellInfo(51713), index = 2 } or nil, + { id = "stealth", name = Bartender4.Compat.GetSpellName(1784), index = 1 }, + (WoWWrath or WoWCata) and { id = "shadowdance", name = Bartender4.Compat.GetSpellName(51713), index = 2 } or nil, } elseif k == "WARRIOR" then newT = { - { id = "battle", name = GetSpellInfo(2457), index = 1 }, - { id = "def", name = GetSpellInfo(71), index = 2 }, - { id = "berserker", name = GetSpellInfo(2458), index = 3 }, + { id = "battle", name = Bartender4.Compat.GetSpellName(2457), index = 1 }, + { id = "def", name = Bartender4.Compat.GetSpellName(71), index = 2 }, + { id = "berserker", name = Bartender4.Compat.GetSpellName(2458), index = 3 }, } elseif k == "PRIEST" and (WoWBC or WoWWrath or WoWCata) then newT = { - { id = "shadowform", name = GetSpellInfo(15473), index = 1 }, + { id = "shadowform", name = Bartender4.Compat.GetSpellName(15473), index = 1 }, } end rawset(t, k, newT) @@ -124,19 +124,19 @@ DefaultStanceMap = setmetatable({}, { __index = function(t,k) local newT = nil if k == "DRUID" then newT = { - { id = "bear", name = GetSpellInfo(5487), index = 3 }, - { id = "cat", name = GetSpellInfo(768), index = 1 }, + { id = "bear", name = Bartender4.Compat.GetSpellName(5487), index = 3 }, + { id = "cat", name = Bartender4.Compat.GetSpellName(768), index = 1 }, -- prowl is virtual, no real stance - { id = "prowl", name = ("%s (%s)"):format((GetSpellInfo(768)), (GetSpellInfo(5215))), index = false}, - { id = "moonkin", name = GetSpellInfo(24858), index = 4 }, + { id = "prowl", name = ("%s (%s)"):format((Bartender4.Compat.GetSpellName(768)), (Bartender4.Compat.GetSpellName(5215))), index = false}, + { id = "moonkin", name = Bartender4.Compat.GetSpellName(24858), index = 4 }, } elseif k == "ROGUE" then newT = { - { id = "stealth", name = GetSpellInfo(1784), index = 1 }, + { id = "stealth", name = Bartender4.Compat.GetSpellName(1784), index = 1 }, } elseif k == "EVOKER" then newT = { - { id = "soar", name = GetSpellInfo(369536), index = 1 }, + { id = "soar", name = Bartender4.Compat.GetSpellName(369536), index = 1 }, } end rawset(t, k, newT)