- super temp hax to make the custom cd bar work with "Holy Word: Aspire". none of the spell api functions work when that spell is passed by name but they do work with the spell id, so i built a table of names => ids that gets checked before calling any api's

This commit is contained in:
Parnic
2010-10-21 01:09:14 +00:00
parent 9abae08235
commit 1a3b4cbda9

View File

@ -12,7 +12,9 @@ IceCustomCDBar.prototype.cooldownDuration = 0
IceCustomCDBar.prototype.cooldownEndTime = 0
IceCustomCDBar.prototype.coolingDown = false
-- super temp...remove this when blizzard fixes these spells to work by name with GetSpellCooldown()
local brokenSpellsNameToId = {}
table.insert(brokenSpellsNameToId, {"Holy Word: Aspire",88682})
-- Constructor --
function IceCustomCDBar.prototype:init()
@ -385,6 +387,8 @@ end
-- 'Protected' methods --------------------------------------------------------
function IceCustomCDBar.prototype:GetCooldownDuration(buffName)
buffName = self:GetSpellNameOrId(buffName)
local now = GetTime()
local localDuration = nil
local localStart, localRemaining, hasCooldown = GetSpellCooldown(buffName)
@ -551,10 +555,11 @@ end
function IceCustomCDBar.prototype:IsReady()
local is_ready = nil
local checkSpell = self:GetSpellNameOrId(self.moduleSettings.cooldownToTrack)
if (IsUsableSpell(self.moduleSettings.cooldownToTrack) == 1) then
if SpellHasRange(self.moduleSettings.cooldownToTrack) then
if (UnitExists("target") and IsSpellInRange(self.moduleSettings.cooldownToTrack, "target") == 1) then
if (IsUsableSpell(checkSpell) == 1) then
if SpellHasRange(checkSpell) then
if (UnitExists("target") and IsSpellInRange(checkSpell, "target") == 1) then
is_ready = 1
end
else
@ -565,6 +570,18 @@ function IceCustomCDBar.prototype:IsReady()
return is_ready
end
function IceCustomCDBar.prototype:GetSpellNameOrId(spellName)
-- super temp hax. certain spells (the new 'morphing' spells) do not work by name with GetSpellCooldown(), only id.
for i=1,#brokenSpellsNameToId do
if spellName == brokenSpellsNameToId[i][1] then
spellName = brokenSpellsNameToId[i][2]
break
end
end
return spellName
end
function IceCustomCDBar.prototype:Show(bShouldShow, bForceHide)
if self.moduleSettings.enabled and not bForceHide then
if (self.moduleSettings.displayMode == "Always") then