Skip to content

Commit d4baf0a

Browse files
committed
fix 11.0.2 deprecated/removed api functions
1 parent d78eaee commit d4baf0a

File tree

6 files changed

+21
-6
lines changed

6 files changed

+21
-6
lines changed

.luacheckrc

+2
Original file line numberDiff line numberDiff line change
@@ -84,4 +84,6 @@ read_globals = {
8484
"UnitChannelInfo",
8585
"UnitIsFriend",
8686
"strsplit",
87+
"C_AddOns",
88+
"C_Spell",
8789
}

ClassicCastbars/ClassicCastbars.lua

+7-1
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,13 @@ function ClassicCastbars:BindCurrentCastData(castbar, unitID, isChanneled, chann
140140

141141
-- HACK: UnitChannelInfo is bugged for classic era, tmp fallback method
142142
if channelSpellID and not spellName then
143-
spellName, _, iconTexturePath = GetSpellInfo(channelSpellID)
143+
if C_Spell.GetSpellInfo then
144+
local info = C_Spell.GetSpellInfo(channelSpellID)
145+
spellName = info and info.name
146+
iconTexturePath = info and info.iconID
147+
else
148+
spellName, _, iconTexturePath = GetSpellInfo(channelSpellID)
149+
end
144150
local channelCastTime = spellName and channeledSpells[spellName]
145151
if not channelCastTime then return end
146152

ClassicCastbars/core/ClassicSpellData.lua

+2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ local CLIENT_IS_CLASSIC_ERA = (WOW_PROJECT_ID == WOW_PROJECT_CLASSIC)
55

66
if not CLIENT_IS_TBC and not CLIENT_IS_CLASSIC_ERA then return end
77

8+
local GetSpellInfo = C_Spell and C_Spell.GetSpellName or _G.GetSpellInfo
9+
810
local physicalClasses = {
911
["WARRIOR"] = true,
1012
["ROGUE"] = true,

ClassicCastbars/core/LoadOptionsOnDemand.lua

+4-4
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ SLASH_CLASSICCASTBARS6 = "/classicastbars"
88
local isLoaded = false
99

1010
GameMenuFrame:HookScript("OnShow", function()
11-
if not isLoaded and not IsAddOnLoaded("ClassicCastbars_Options") then
12-
local loaded, reason = LoadAddOn("ClassicCastbars_Options")
11+
if not isLoaded and not C_AddOns.IsAddOnLoaded("ClassicCastbars_Options") then
12+
local loaded, reason = C_AddOns.LoadAddOn("ClassicCastbars_Options")
1313
if not loaded and reason == "DISABLED" then
1414
isLoaded = true -- disabled, dont attempt to load it anymore
1515
return
@@ -20,9 +20,9 @@ GameMenuFrame:HookScript("OnShow", function()
2020
end)
2121

2222
SlashCmdList["CLASSICCASTBARS"] = function()
23-
if not IsAddOnLoaded("ClassicCastbars_Options") then
23+
if not C_AddOns.IsAddOnLoaded("ClassicCastbars_Options") then
2424
if not isLoaded then
25-
local loaded, reason = LoadAddOn("ClassicCastbars_Options")
25+
local loaded, reason = C_AddOns.LoadAddOn("ClassicCastbars_Options")
2626
if not loaded and reason == "DISABLED" then
2727
isLoaded = true -- disabled, dont attempt to load it anymore
2828
return print(string.format(_G.ADDON_LOAD_FAILED, "ClassicCastbars_Options", _G["ADDON_" .. reason] or _G.ADDON_UNKNOWN_ERROR)) -- luacheck: ignore

ClassicCastbars_Options/ClassicCastbars_Options.lua

+2
Original file line numberDiff line numberDiff line change
@@ -622,6 +622,8 @@ local function CreateUnitTabGroup(unitID, localizedUnit, order)
622622
}
623623
end
624624

625+
local GetAddOnMetadata = C_AddOns and C_AddOns.GetAddOnMetadata or _G.GetAddOnMetadata
626+
625627
local function GetOptionsTable()
626628
return { -- only create table on demand
627629
type = "group",

ClassicCastbars_Options/TestMode.lua

+4-1
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,11 @@ local L = LibStub("AceLocale-3.0"):GetLocale("ClassicCastbars")
22
local TestMode = CreateFrame("Frame", "ClassicCastbars_TestMode")
33
TestMode.isTesting = {}
44

5+
local GetSpellName = C_Spell and C_Spell.GetSpellName or _G.GetSpellInfo
6+
local GetSpellTexture = C_Spell and C_Spell.GetSpellTexture or _G.GetSpellTexture
7+
58
local dummySpellData = {
6-
spellName = GetSpellInfo(118),
9+
spellName = GetSpellName(118),
710
icon = GetSpellTexture(118),
811
spellID = 118,
912
maxValue = 10,

0 commit comments

Comments
 (0)