Skip to content

Commit

Permalink
Compat code for WoW 11
Browse files Browse the repository at this point in the history
  • Loading branch information
funkydude committed Jul 10, 2024
1 parent 91fa5ac commit 134461a
Show file tree
Hide file tree
Showing 9 changed files with 58 additions and 25 deletions.
1 change: 1 addition & 0 deletions .luacheckrc
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ globals = {
"BNSendWhisper",
"BasicMessageDialog",
"BossBanner",
"C_AddOns",
"C_BattleNet",
"C_CVar",
"C_ChatInfo",
Expand Down
12 changes: 6 additions & 6 deletions modules/Consumables.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ local L = scope.locale

local format = string.format
local tconcat, sort, wipe = table.concat, table.sort, table.wipe
local GetSpellInfo = GetSpellInfo
local GetSpellName = C_Spell and C_Spell.GetSpellName or GetSpellInfo
local UnitIsUnit, IsInGroup, IsInRaid, IsInInstance = UnitIsUnit, IsInGroup, IsInRaid, IsInInstance
local UnitName, UnitIsConnected, UnitIsVisible = UnitName, UnitIsConnected, UnitIsVisible
local GetTime, UnitIsDeadOrGhost = GetTime, UnitIsDeadOrGhost
Expand All @@ -26,7 +26,7 @@ local NO = ("|cffff2020%s|r"):format(L.no)
local spells = setmetatable({}, {
__index = function(t, k)
if k == nil then return end
local name = GetSpellInfo(k)
local name = GetSpellName(k)
if not name then
print("oRA3: Invalid spell id", k)
name = "" -- only print once
Expand Down Expand Up @@ -175,10 +175,10 @@ local raidBuffs = {
},
}
local raidBuffNames = {
(GetSpellInfo(6673)), -- ITEM_MOD_ATTACK_POWER_SHORT,
(GetSpellInfo(21562)), -- ITEM_MOD_STAMINA_SHORT,
(GetSpellInfo(1459)), -- ITEM_MOD_INTELLECT_SHORT,
(GetSpellInfo(1126)), -- ITEM_MOD_VERSATILITY,
(GetSpellName(6673)), -- ITEM_MOD_ATTACK_POWER_SHORT,
(GetSpellName(21562)), -- ITEM_MOD_STAMINA_SHORT,
(GetSpellName(1459)), -- ITEM_MOD_INTELLECT_SHORT,
(GetSpellName(1126)), -- ITEM_MOD_VERSATILITY,
}
local raidBuffProviders = {
"WARRIOR",
Expand Down
13 changes: 9 additions & 4 deletions modules/Cooldowns/Cooldowns.lua
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ local LibDialog = LibStub("LibDialog-1.0n")
-- Locals
--

local GetSpellName = C_Spell and C_Spell.GetSpellName or GetSpellInfo
local GetSpellTexture = C_Spell and C_Spell.GetSpellTexture or GetSpellTexture

local activeDisplays = {}
local frame = nil -- main options panel
local showPane, hidePane
Expand Down Expand Up @@ -473,7 +476,7 @@ do
end

local function sortBySpellName(a, b)
return GetSpellInfo(a) < GetSpellInfo(b)
return GetSpellName(a) < GetSpellName(b)
end

local function sortByClass(a, b)
Expand All @@ -482,7 +485,7 @@ do
if classA == "RACIAL" then classA = "ARACIAL" end
if classB == "RACIAL" then classB = "ARACIAL" end
if classA == classB then
return GetSpellInfo(a) < GetSpellInfo(b)
return GetSpellName(a) < GetSpellName(b)
else
return classA < classB
end
Expand Down Expand Up @@ -650,7 +653,8 @@ do
else
sort(tmp, sortByClass)
for _, spellId in ipairs(tmp) do
local name, _, icon = GetSpellInfo(spellId)
local name = GetSpellName(spellId)
local icon = GetSpellTexture(spellId)
if name then
local color = oRA.classColors[classLookup[spellId]]
local checkbox = AceGUI:Create("CheckBox")
Expand All @@ -674,7 +678,8 @@ do
end
sort(tmp, sortBySpellName)
for _, spellId in ipairs(tmp) do
local name, _, icon = GetSpellInfo(spellId)
local name = GetSpellName(spellId)
local icon = GetSpellTexture(spellId)
if name then
local checkbox = AceGUI:Create("CheckBox")
checkbox:SetRelativeWidth(0.5)
Expand Down
12 changes: 9 additions & 3 deletions modules/Cooldowns/Displays/Bars.lua
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ local barStyles = oRA3CD:GetBarStyles()

local After = C_Timer.After

local GetSpellName = C_Spell and C_Spell.GetSpellName or GetSpellInfo
local GetSpellTexture = C_Spell and C_Spell.GetSpellTexture or GetSpellTexture

---------------------------------------
-- Display

Expand Down Expand Up @@ -316,7 +319,8 @@ function prototype:TestCooldown(player, class, spellId, remaining)
local bar = self:GetBar(player, spellId) or candy:New(DEFAULT_BAR, self:GetWidth(), self.db.barHeight)
self.bars[bar] = true

local spell, _, icon = GetSpellInfo(spellId)
local spell = GetSpellName(spellId)
local icon = GetSpellTexture(spellId)
bar:Set("ora3cd:guid", player)
bar:Set("ora3cd:player", player)
bar:Set("ora3cd:class", class)
Expand Down Expand Up @@ -344,7 +348,8 @@ function prototype:oRA3CD_StartCooldown(_, guid, player, class, spellId, remaini
self.bars[bar] = true

local duration = oRA3CD:GetCooldown(guid, spellId)
local spell, _, icon = GetSpellInfo(spellId)
local spell = GetSpellName(spellId)
local icon = GetSpellTexture(spellId)
bar:Set("ora3cd:guid", guid)
bar:Set("ora3cd:player", player)
bar:Set("ora3cd:class", class)
Expand Down Expand Up @@ -374,7 +379,8 @@ function prototype:CooldownReady(guid, player, class, spellId)
local bar = self:GetBar(guid, spellId) or candy:New(DEFAULT_BAR, self:GetWidth(), self.db.barHeight)
self.bars[bar] = true

local spell, _, icon = GetSpellInfo(spellId)
local spell = GetSpellName(spellId)
local icon = GetSpellTexture(spellId)
bar:Set("ora3cd:guid", guid)
bar:Set("ora3cd:player", player)
bar:Set("ora3cd:class", class)
Expand Down
9 changes: 7 additions & 2 deletions modules/Cooldowns/Displays/IconGroups.lua
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ local classColors = oRA3.classColors

local Masque = LibStub("Masque", true)

local GetSpellName = C_Spell and C_Spell.GetSpellName or GetSpellInfo
local GetSpellTexture = C_Spell and C_Spell.GetSpellTexture or GetSpellTexture

---------------------------------------
-- Icon factory

Expand Down Expand Up @@ -317,7 +320,8 @@ local function CreateIcon(parent, class, spellId)
local icon = IconProvider:New(parent)
icon.UpdateTooltip = UpdateTooltip

local spell, _, texture = GetSpellInfo(spellId)
local spell = GetSpellName(spellId)
local texture = GetSpellTexture(spellId)
icon:Set("ora3cd:class", class)
icon:Set("ora3cd:icon", texture)
icon:Set("ora3cd:spell", spell)
Expand Down Expand Up @@ -386,7 +390,8 @@ function prototype:TestCooldown(player, class, spellId, remaining)
local frame = self:GetCD(player, spellId) or IconProvider:New(self)
self.icons[frame] = true
local spell, _, icon = GetSpellInfo(spellId)
local spell = GetSpellName(spellId)
local icon = GetSpellTexture(spellId)
frame:Set("ora3cd:guid", player)
frame:Set("ora3cd:player", player)
frame:Set("ora3cd:class", class)
Expand Down
12 changes: 9 additions & 3 deletions modules/Cooldowns/Displays/Icons.lua
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ local classColors = oRA3.classColors
local media = LibStub("LibSharedMedia-3.0")
local Masque = LibStub("Masque", true)

local GetSpellName = C_Spell and C_Spell.GetSpellName or GetSpellInfo
local GetSpellTexture = C_Spell and C_Spell.GetSpellTexture or GetSpellTexture

---------------------------------------
-- Icon factory

Expand Down Expand Up @@ -355,7 +358,8 @@ function prototype:TestCooldown(player, class, spellId, remaining)
local frame = self:GetCD(player, spellId) or IconProvider:New(self)
self.icons[frame] = true

local spell, _, icon = GetSpellInfo(spellId)
local spell = GetSpellName(spellId)
local icon = GetSpellTexture(spellId)
frame:Set("ora3cd:guid", player)
frame:Set("ora3cd:player", player)
frame:Set("ora3cd:class", class)
Expand All @@ -380,7 +384,8 @@ function prototype:oRA3CD_StartCooldown(_, guid, player, class, spellId, remaini
self.icons[frame] = true

local duration = oRA3CD:GetCooldown(guid, spellId)
local spell, _, icon = GetSpellInfo(spellId)
local spell = GetSpellName(spellId)
local icon = GetSpellTexture(spellId)
frame:Set("ora3cd:guid", guid)
frame:Set("ora3cd:player", player)
frame:Set("ora3cd:class", class)
Expand All @@ -407,7 +412,8 @@ function prototype:CooldownReady(guid, player, class, spellId)
local frame = self:GetCD(guid, spellId) or IconProvider:New(self)
self.icons[frame] = true

local spell, _, icon = GetSpellInfo(spellId)
local spell = GetSpellName(spellId)
local icon = GetSpellTexture(spellId)
frame:Set("ora3cd:guid", guid)
frame:Set("ora3cd:player", player)
frame:Set("ora3cd:class", class)
Expand Down
4 changes: 3 additions & 1 deletion modules/Cooldowns/Registry.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ local module = oRA3:GetModule("Cooldowns")
-- Layouts
--

local GetSpellName = C_Spell and C_Spell.GetSpellName or GetSpellInfo

local layoutRegistry = {}
local layoutNames = {}
local layoutDescriptions = {}
Expand Down Expand Up @@ -98,7 +100,7 @@ function module:CreateDisplay(type, name)
end
local spellDB = moduleDB.spells[name]
for spellId in next, spellDB do -- clean up
if not GetSpellInfo(spellId) then
if not GetSpellName(spellId) then
spellDB[spellId] = nil
end
end
Expand Down
19 changes: 13 additions & 6 deletions modules/ReadyCheck.lua
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ local max, ceil, floor = math.max, math.ceil, math.floor
local concat, wipe, tinsert = table.concat, table.wipe, table.insert
local select, next, ipairs, print = select, next, ipairs, print
local UnitIsConnected, UnitIsDeadOrGhost, UnitIsVisible = UnitIsConnected, UnitIsDeadOrGhost, UnitIsVisible
local GetSpellInfo, GetRaidRosterInfo = GetSpellInfo, GetRaidRosterInfo
local GetRaidRosterInfo = GetRaidRosterInfo
local GetSpellName = C_Spell and C_Spell.GetSpellName or GetSpellInfo
local GetSpellTexture = C_Spell and C_Spell.GetSpellTexture or GetSpellTexture
local GetInstanceInfo, GetNumGroupMembers, GetNumSubgroupMembers = GetInstanceInfo, GetNumGroupMembers, GetNumSubgroupMembers
local GetReadyCheckStatus, GetReadyCheckTimeLeft, GetTime = GetReadyCheckStatus, GetReadyCheckTimeLeft, GetTime
local IsInRaid, IsInGroup, UnitGroupRolesAssigned = IsInRaid, IsInGroup, UnitGroupRolesAssigned
Expand Down Expand Up @@ -247,7 +249,8 @@ do
self.tooltip = nil
if id and id < 0 then id = -id end

local name, _, icon = GetSpellInfo(id or 0)
local name = GetSpellName(id or 0)
local icon = GetSpellTexture(id or 0)
if not name then
self.name = nil
self.tooltip = self.defaultTooltip
Expand Down Expand Up @@ -312,25 +315,29 @@ local function addIconAndName(frame)
frame.OutOfRange = oor

-- Battle Shout
local name, _, icon = GetSpellInfo(6673)
local name = GetSpellName(6673)
local icon = GetSpellTexture(6673)
frame.GroupBuff1 = addBuffFrame("GroupBuff1", frame, name, icon, "RIGHT", -6 - (0*BUFF_ICON_SIZE), 0)
frame.GroupBuff1.groupBuff = name -- ITEM_MOD_ATTACK_POWER_SHORT
frame.GroupBuff1.classProvider = "WARRIOR"

-- Power Word: Fortitude
name, _, icon = GetSpellInfo(21562)
name = GetSpellName(21562)
icon = GetSpellTexture(21562)
frame.GroupBuff2 = addBuffFrame("GroupBuff2", frame, name, icon, "RIGHT", -6 - (1*BUFF_ICON_SIZE), 0)
frame.GroupBuff2.groupBuff = name -- ITEM_MOD_STAMINA_SHORT
frame.GroupBuff2.classProvider = "PRIEST"

-- Arcane Intellect
name, _, icon = GetSpellInfo(1459)
name = GetSpellName(1459)
icon = GetSpellTexture(1459)
frame.GroupBuff3 = addBuffFrame("GroupBuff3", frame, name, icon, "RIGHT", -6 - (2*BUFF_ICON_SIZE), 0)
frame.GroupBuff3.groupBuff = name -- ITEM_MOD_INTELLECT_SHORT
frame.GroupBuff3.classProvider = "MAGE"

-- Mark of the Wild
name, _, icon = GetSpellInfo(1126)
name = GetSpellName(1126)
icon = GetSpellTexture(1126)
frame.GroupBuff4 = addBuffFrame("GroupBuff4", frame, name, icon, "RIGHT", -6 - (3*BUFF_ICON_SIZE), 0)
frame.GroupBuff4.groupBuff = name -- ITEM_MOD_VERSATILITY
frame.GroupBuff4.classProvider = "DRUID"
Expand Down
1 change: 1 addition & 0 deletions oRA3.lua
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,7 @@ function addon:OnInitialize()
end
end
RaidFrame:HookScript("OnHide", OnRaidHide)
local IsAddOnLoaded = C_AddOns.IsAddOnLoaded or IsAddOnLoaded
if not IsAddOnLoaded("Blizzard_RaidUI") then
self.rehookAfterRaidUILoad = true
end
Expand Down

0 comments on commit 134461a

Please sign in to comment.