/
## Interface: 050100 |
## Interface: 050300 |
## Title: NeedToKnow |
## Author: Kitjan, lieandswell |
## Version: 4.0.12 |
## Version: 4.0.14 |
## Notes: Timer bars for buffs, debuffs, cooldowns, etc. |
## X-Credits: Bilt, Fxfighter EU-Echsenkessel, metalchoir, sp00n, Vlakarados, wowui.cn |
## X-Category: Buffs, Combat |
button2 = CANCEL, |
hasEditBox = 1, |
editBoxWidth = 300, |
--maxLetters = 255, |
maxLetters = 0, |
OnAccept = function(self) |
local text = self.editBox:GetText(); |
local variable = self.variable; |
Opt_CASTCD = |
{ |
{ VariableName = "append_cd", MenuText = "Append \"CD\"" }, -- LOCME |
{ VariableName = "show_charges", MenuText = "Show first and last charge CD" }, -- LOCME |
}, |
Opt_EQUIPSLOT = |
{ |
local mfn_AuraCheck_AllStacks |
local mfn_GetUnresolvedCooldown |
local mfn_GetAutoShotCooldown |
local mfn_GetSpellChargesCooldown |
local mfn_GetSpellCooldown |
local mfn_AddInstanceToStacks |
local mfn_SetStatusBarValue |
} |
-- NEEDTOKNOW = {} is defined in the localization file, which must be loaded before this file |
NEEDTOKNOW.VERSION = "4.0.12" |
NEEDTOKNOW.VERSION = "4.0.14" |
local c_UPDATE_INTERVAL = 0.05 |
local c_MAXBARS = 20 |
show_icon = false, |
show_mypip = false, |
show_all_stacks = false, |
show_charges = true, |
show_ttn1 = false, |
show_ttn2 = false, |
show_ttn3 = false, |
show_icon = "sIc", |
show_mypip = "sPp", |
show_all_stacks = "All", |
show_charges = "Chg", |
show_text_user = "sUr", |
show_ttn1 = "sN1", |
show_ttn2 = "sN2", |
sIc = "show_icon", |
sPp = "show_mypip", |
All = "show_all_stacks", |
Chg = "show_charges", |
sUr = "show_text_user", |
BOn = "blink_enabled", |
BOC = "blink_ooc", |
else |
bar.cd_functions[idx] = mfn_GetSpellCooldown |
end |
if ( bar.cd_functions[idx] == mfn_GetSpellCooldown ) then |
local key = entry.id or entry.name |
if ( bar.settings.show_charges and GetSpellCharges(key) ) then |
bar.cd_functions[idx] = mfn_GetSpellChargesCooldown |
end |
end |
end |
end |
end |
end |
barSettings.bAutoShot = nil |
bar.is_counter = nil |
bar.ticker = NeedToKnow.Bar_OnUpdate |
bar.is_counter = nil |
bar.ticker = NeedToKnow.Bar_OnUpdate |
-- Determine which helper functions to use |
if "BUFFCD" == barSettings.BuffOrDebuff then |
elseif "POWER" == barSettings.BuffOrDebuff then |
bar.fnCheck = mfn_AuraCheck_POWER |
bar.is_counter = true |
bar.ticker = nil |
bar.ticking = false |
bar.ticker = nil |
bar.ticking = false |
elseif "CASTCD" == barSettings.BuffOrDebuff then |
bar.fnCheck = mfn_AuraCheck_CASTCD |
for idx, entry in ipairs(bar.spells) do |
bar.time:Show() |
elseif bar.is_counter then |
bar.max_value = 1 |
local pct = buff_stacks.total_ttn[1] / buff_stacks.total_ttn[2] |
local pct = buff_stacks.total_ttn[1] / buff_stacks.total_ttn[2] |
mfn_SetStatusBarValue(bar,bar.bar1,pct) |
if bar.bar2 then mfn_SetStatusBarValue(bar,bar.bar2,pct) end |
if ( bar.vct ) then |
bar.vct:Hide() |
end |
else |
else |
-- Hide the time text and spark for auras with "infinite" duration |
bar.max_value = 1 |
mfn_GetSpellChargesCooldown = function(bar, entry) |
local barSpell = entry.id or entry.name |
local cur, max, charge_start, recharge = GetSpellCharges(barSpell) |
if ( cur ~= max ) then |
trace(barSpell, cur, max, charge_start, recharge, g_GetTime()-charge_start) |
local start, cd_len, enable, spellName, spellIconPath |
if ( cur == 0 ) then |
start, cd_len, enable, spellName, spellIconPath = mfn_GetSpellCooldown(bar, entry) |
return start, cd_len, enable, spellName, spellIconPath, max, charge_start |
else |
local spellName, _, spellIconPath = GetSpellInfo(barSpell) |
if not spellName then spellName = barSpell end |
return charge_start, recharge, 1, spellName, spellIconPath, max-cur |
end |
end |
end |
-- Wrapper around GetItemCooldown |
-- Expected to return start, cd_len, enable, buffName, iconpath |
function NeedToKnow.GetItemCooldown(bar, entry) |
(not bar.settings.power_sole or pt == cpt) ) |
then |
local bTick = false |
if pt == 3 then |
if pt == 3 then -- SPELL_POWER_ENERGY |
if (pt == cpt) then |
bar.power_regen = GetPowerRegen() |
end |
bar.tPower = now |
bar.last_power = curPower |
bar.last_power_max = maxPower |
end |
end |
print("NTK ERROR setting up index",idxName,"on bar",bar:GetName(),bar.settings.AuraName); |
return; |
end |
local start, cd_len, should_cooldown, buffName, iconPath = func(bar, bar_entry) |
local start, cd_len, should_cooldown, buffName, iconPath, stacks, start_2 = func(bar, bar_entry) |
-- filter out the GCD, we only care about actual spell CDs |
if start and cd_len <= 1.5 and func ~= mfn_GetAutoShotCooldown then |
local tNow = g_GetTime() |
local tEnd = start + cd_len |
if ( tEnd > tNow + 0.1 ) then |
if start_2 then |
mfn_AddInstanceToStacks( all_stacks, bar_entry, |
cd_len, -- duration |
buffName, -- name |
1, -- count |
start_2+cd_len, -- expiration time |
iconPath, -- icon path |
"player" ) -- caster |
stacks = stacks - 1 |
else |
if not stacks then stacks = 1 end |
end |
mfn_AddInstanceToStacks( all_stacks, bar_entry, |
cd_len, -- duration |
buffName, -- name |
1, -- count |
tEnd, -- expiration time |
iconPath, -- icon path |
"player" ) -- caster |
cd_len, -- duration |
buffName, -- name |
stacks, -- count |
tEnd, -- expiration time |
iconPath, -- icon path |
"player" ) -- caster |
end |
end |
end |
EDT["UNIT_POWER"] = fnAuraCheckIfUnitMatches |
EDT["UNIT_DISPLAYPOWER"] = fnAuraCheckIfUnitMatches |
EDT["UNIT_COMBO_POINTS"] = mfn_Bar_AuraCheck |
EDT["UNIT_INVENTORY_CHANGED"] = fnAuraCheckIfUnitPlayer |
EDT["UNIT_INVENTORY_CHANGED"] = function(self, unit) |
if unit == "player" then |
NeedToKnow.UpdateWeaponEnchants() |
mfn_Bar_AuraCheck(self) |
end |
end |
EDT["PLAYER_TARGET_CHANGED"] = function(self, unit) |
if self.unit == "targettarget" then |
NeedToKnow.CheckCombatLogRegistration(self) |
if fn then |
fn(self, unit, ...) |
end |
end |