Skip to content

Commit

Permalink
First pass of compat fixes for WoW 11.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Nevcairiel committed Jun 6, 2024
1 parent fbe2b8f commit 6541f45
Show file tree
Hide file tree
Showing 8 changed files with 55 additions and 33 deletions.
1 change: 1 addition & 0 deletions .luacheckrc
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ read_globals = {
"AttemptToSaveBindings",
"C_LFGList",
"C_PetBattles",
"C_Spell",
"CanExitVehicle",
"ClearOverrideBindings",
"CreateFrame",
Expand Down
13 changes: 10 additions & 3 deletions ActionBar.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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

--[[===================================================================================
Expand Down Expand Up @@ -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)
Expand Down
9 changes: 9 additions & 0 deletions Bartender4.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion HideBlizzard.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
4 changes: 2 additions & 2 deletions Options/Bar.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
21 changes: 13 additions & 8 deletions PetButton.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion StanceBar.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
36 changes: 18 additions & 18 deletions StateBar.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand All @@ -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)
Expand Down

0 comments on commit 6541f45

Please sign in to comment.