Skip to content

Commit

Permalink
Fixed backwards compatibility issues with cooldown tracking. GH-81
Browse files Browse the repository at this point in the history
  • Loading branch information
Dicebar committed Jul 24, 2024
1 parent 1f5f915 commit 04ba51d
Showing 1 changed file with 33 additions and 7 deletions.
40 changes: 33 additions & 7 deletions Shims.lua
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,10 @@ function SHIM:GetSpellBookItemInfo(index, bookType)

local info = C_SpellBook.GetSpellBookItemInfo(index, bookType)

if info == nil then
return nil
end

local itemType = "UNKNOWN"
if info.itemType == Enum.SpellBookItemType.Spell then
itemType = "SPELL"
Expand All @@ -168,10 +172,7 @@ function SHIM:GetSpellBookItemInfo(index, bookType)
return itemType, info.spellID, info.isPassive
end

local itemType, spellID = GetSpellBookItemInfo(index, bookType)
local isPassive = IsPassiveSpell(index, bookType)

return itemType, spellID, isPassive
return GetSpellBookItemInfo(index, bookType)
end

function SHIM:HasPetSpells()
Expand Down Expand Up @@ -204,9 +205,14 @@ function SHIM:GetSpellCooldown(spellID)
return nil
end

local isEnabled = 1
if not info.isEnabled then
isEnabled = 0
end

return info.startTime,
info.duration,
info.isEnabled,
isEnabled,
info.modRate
end

Expand Down Expand Up @@ -244,15 +250,35 @@ end

function SHIM:GetSpellCharges(index, book)
if _G.C_Spell.GetSpellCharges ~= nil then
return C_Spell.GetSpellCharges(index, book)
local info = C_Spell.GetSpellCharges(index, book)

if info == nil then
return nil
end

return info.currentCharges,
info.maxCharges,
info.cooldownStartTime,
info.cooldownDuration,
info.chargeModRate
end

return GetSpellCharges(index, book)
end

function SHIM:GetSpellChargesByID(spellID)
if _G.C_Spell.GetSpellCharges ~= nil then
return C_Spell.GetSpellCharges(spellID)
local info = C_Spell.GetSpellCharges(spellID)

if info == nil then
return nil
end

return info.currentCharges,
info.maxCharges,
info.cooldownStartTime,
info.cooldownDuration,
info.chargeModRate
end

return GetSpellCharges(spellID)
Expand Down

0 comments on commit 04ba51d

Please sign in to comment.