Skip to content

Commit

Permalink
System - Fixed GetSpellCharges usage (table return)
Browse files Browse the repository at this point in the history
  • Loading branch information
CuteOne committed Aug 6, 2024
1 parent 90e7e7c commit 74a0200
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions System/Functions/Spell.lua
Original file line number Diff line number Diff line change
Expand Up @@ -162,11 +162,14 @@ end

-- if br.getCharges(115399) > 0 then
function br.getCharges(spellID)
return select(1, br._G.C_Spell.GetSpellCharges(spellID))
local chargeInfo = br._G.C_Spell.GetSpellCharges(spellID)
return chargeInfo.currentCharges
end

function br.getChargesFrac(spellID, chargeMax)
local charges, maxCharges, start, duration = br._G.C_Spell.GetSpellCharges(spellID)
local chargeInfo = br._G.C_Spell.GetSpellCharges(spellID)
local charges, maxCharges, start, duration = chargeInfo.currentCharges, chargeInfo.maxCharges,
chargeInfo.cooldownStartTime, chargeInfo.cooldownDuration
if chargeMax == nil then chargeMax = false end
if maxCharges ~= nil then
if chargeMax then
Expand All @@ -185,7 +188,9 @@ function br.getChargesFrac(spellID, chargeMax)
end

function br.getRecharge(spellID, chargeMax)
local charges, maxCharges, chargeStart, chargeDuration = br._G.C_Spell.GetSpellCharges(spellID)
local chargeInfo = br._G.C_Spell.GetSpellCharges(spellID)
local charges, maxCharges, chargeStart, chargeDuration = chargeInfo.currentCharges, chargeInfo.maxCharges,
chargeInfo.cooldownStartTime, chargeInfo.cooldownDuration
if chargeMax then return chargeDuration end
if charges then
if charges < maxCharges then
Expand All @@ -198,7 +203,9 @@ end

-- Full RechargeTime of a Spell/dump getFullRechargeTime(214579)
function br.getFullRechargeTime(spellID)
local charges, maxCharges, chargeStart, chargeDuration = br._G.C_Spell.GetSpellCharges(spellID)
local chargeInfo = br._G.C_Spell.GetSpellCharges(spellID)
local charges, maxCharges, chargeStart, chargeDuration = chargeInfo.currentCharges, chargeInfo.maxCharges,
chargeInfo.cooldownStartTime, chargeInfo.cooldownDuration
if charges then
local currentChargeTime = (charges or 0) < (maxCharges or 0) and
chargeDuration - (br._G.GetTime() - (chargeStart or 0)) or 0
Expand Down

0 comments on commit 74a0200

Please sign in to comment.