caster = "player" |
end |
elseif settings.BuffOrDebuff == "CASTCD" then |
local spellName=barSpell, spellRank, spellIconPath |
local spellPower=0 |
if isSpellID or NeedToKnow.is_DK then |
spellName, spellRank, spellIconPath, _, _, spellPower = GetSpellInfo(barSpell) |
local start, cd_len, should_cooldown |
local func = bar.functions[idxName] |
start, cd_len, should_cooldown, buffName, iconPath = func(bar, barSpell) |
|
-- filter out the GCD, we only care about actual spell CDs |
if start and cd_len <= 1.5 and func ~= NeedToKnow.GetAutoShotCooldown then |
if bar.expirationTime then |
start = bar.expirationTime - bar.duration |
cd_len = bar.duration |
else |
start = nil |
end |
end |
if ( settings.bAutoShot and (barSpell == "Auto Shot" or barSpell == NEEDTOKNOW.AUTO_SHOT or barSpell == "75") ) then |
|
if start and cd_len then |
local tNow = GetTime() |
if ( bar.tAutoShotExpires and bar.tAutoShotExpires > tNow ) then |
buffName = NEEDTOKNOW.AUTO_SHOT |
local tEnd = start + cd_len |
if ( tEnd > tNow + 0.1 ) then |
count = 1 |
duration = bar.tAutoShotCD |
expirationTime = bar.tAutoShotExpires |
caster = "player" |
duration = cd_len |
expirationTime = tEnd |
cast = "player" |
end |
else |
local tNow = GetTime() |
local start, cd_len, should_cooldown = GetSpellCooldown(barSpell) |
local is_spell = true |
if not start then |
start, cd_len = GetItemCooldown(barSpell) |
is_spell = false |
end |
|
if is_spell and start and start > 0 then |
if 0 == should_cooldown then |
-- Filter out conditions like Stealth while stealthed |
start = nil |
elseif spellPower == 5 then -- Rune |
-- Filter out rune cooldown artificially extending the cd |
if cd_len <= 10 then |
if bar.expirationTime and tNow < bar.expirationTime then |
-- We've already seen the correct CD for this; keep using it |
start = bar.expirationTime - bar.duration |
cd_len = bar.duration |
elseif NeedToKnow.last_sent and NeedToKnow.last_sent[barSpell] and NeedToKnow.last_sent[barSpell] > (tNow - 1.5) then |
-- We think the spell was just cast, and a CD just started but it's short. |
-- Look at the tooltip to tell what the correct CD should be. If it's supposed |
-- to be short (Ghoul Frenzy, Howling Blast), then start a CD bar |
cd_len = NeedToKnow.DetermineShortCooldownFromTooltip(barSpell) |
if cd_len == 0 or cd_len > 10 then |
start = nil |
end |
else |
start = nil |
end |
end |
end |
end |
|
-- filter out the GCD, we only care about actual spell CDs |
if cd_len <= 1.5 then |
if not bar.expirationTime or bar.expirationTime < tNow then |
start = nil |
else |
start = bar.expirationTime - bar.duration |
cd_len = bar.duration |
end |
end |
|
if start and cd_len then |
local tEnd = start + cd_len |
if ( tEnd > tNow + 0.1 ) then |
if is_spell then |
buffName, _, iconPath = GetSpellInfo(barSpell) |
else |
buffName, _, _, _, _, _, _, _, _, iconPath = GetItemInfo(barSpell) |
end |
if not buffName then buffName = barSpell end |
|
count = 1 |
duration = cd_len |
expirationTime = tEnd |
cast = "player" |
end |
end |
end |
elseif settings.BuffOrDebuff == "USABLE" then |
local _, nDigits = barSpell:find("^%d+") |
local isSpellID = ( nDigits == barSpell:len() ) |
local key = barSpell |
if ( isSpellID ) then key = tonumber(barSpell) end |
local key |
if ( isSpellID ) then key = tonumber(barSpell) else key = barSpell end |
if ( not key ) then key = "" end |
local spellName |
spellName, _, iconPath = GetSpellInfo(key) |