/
## Interface: 050300 |
## Interface: 050400 |
## Title: NeedToKnow |
## Author: Kitjan, lieandswell |
## Version: 4.0.16 |
## Version: 4.0.17 |
## Notes: Timer bars for buffs, debuffs, cooldowns, etc. |
## X-Credits: Bilt, Fxfighter EU-Echsenkessel, metalchoir, sp00n, Vlakarados, wowui.cn |
## X-Category: Buffs, Combat |
NeedToKnowOptions = {} |
NeedToKnowRMB = {} |
function NeedToKnow.FindProfileByName(profName) |
local key |
for k,t in pairs(NeedToKnow_Profiles) do |
if t.name == profName then |
return k |
end |
end |
end |
function NeedToKnow.SlashCommand(cmd) |
local args = {} |
for arg in cmd:gmatch("(%S+)") do |
elseif ( cmd == NEEDTOKNOW.CMD_PROFILE ) then |
if args[1] then |
local profileName = table.concat(args, " ") |
local key |
for k,t in pairs(NeedToKnow_Profiles) do |
if t.name == profileName then |
if key then |
print("Warning! Ambiguity between account-wide and per-character profile.") |
end |
key = k |
end |
end |
local key = NeedToKnow.FindProfileByName( profileName ) |
if key then |
NeedToKnow.ChangeProfile(key) |
NeedToKnowOptions.UIPanel_Profile_Update() |
} |
-- NEEDTOKNOW = {} is defined in the localization file, which must be loaded before this file |
NEEDTOKNOW.VERSION = "4.0.16" |
NEEDTOKNOW.VERSION = "4.0.17" |
local c_UPDATE_INTERVAL = 0.05 |
local c_MAXBARS = 20 |
return "G"..n; |
end |
function NeedToKnow.FindUnusedNumericSuffix(prefix, defPrefix) |
local suffix = defPrefix |
if not suffix then suffix = 1 end |
local candidate = prefix .. suffix |
while ( NeedToKnow.FindProfileByName(candidate) ) do |
suffix = suffix + 1 |
candidate = prefix .. suffix |
end |
return candidate; |
end |
function NeedToKnow.CreateProfile(settings, idxSpec, nameProfile) |
if not nameProfile then |
nameProfile = UnitName("player") .. "-"..GetRealmName() .. "." .. idxSpec |
local prefix = UnitName("player") .. "-"..GetRealmName() .. "." |
nameProfile = NeedToKnow.FindUnusedNumericSuffix(prefix, idxSpec) |
end |
settings.name = nameProfile |
end |
local maxKey = 0 |
local aByName = {} |
for iS,vS in pairs(NeedToKnow_Globals.Profiles) do |
if vS.bUncompressed then |
NeedToKnow.CompressProfile(vS) |
local cur = tonumber(iS:sub(2)) |
if ( cur > maxKey ) then maxKey = cur end |
NeedToKnow_Profiles[iS] = vS |
if aByName[ vS.name ] then |
local renamed = NeedToKnow.FindUnusedNumericSuffix(vS.name, 2) |
print("Error! the profile name " .. vS.name .. " has been reused! Renaming one of them to " .. renamed) |
vS.name = renamed; |
end |
aByName[vS.name] = vS |
end |
local aFixups = {} |
if NeedToKnow_CharSettings.Profiles then |
for iS,vS in pairs(NeedToKnow_CharSettings.Profiles) do |
-- Check for collisions by name |
if aByName[ vS.name ] then |
local renamed = NeedToKnow.FindUnusedNumericSuffix(vS.name, 2) |
print("Error! the profile name " .. vS.name .. " has been reused! Renaming one of them to " .. renamed) |
vS.name = renamed; |
end |
aByName[vS.name] = vS |
-- Check for collisions by key |
if ( NeedToKnow_Profiles[iS] ) then |
print("NeedToKnow error encountered, both", vS.name, "and", NeedToKnow_Profiles[iS].name, "collided. Some specs may be mapped to one that should have been mapped to the other."); |
print("NeedToKnow error encountered, both", vS.name, "and", NeedToKnow_Profiles[iS].name, "collided as " .. iS .. ". Some specs may be mapped to one that should have been mapped to the other."); |
local oS = iS; |
iS = NeedToKnow.AllocateProfileKey(); |
aFixups[oS] = iS |
end |
-- Although name should never be compressed, it could have been prior to 4.0.16 |
if not vS.name then vS.name = "Default" end |
local cur = tonumber(iS:sub(2)) |
if ( cur > maxKey ) then maxKey = cur end |
NeedToKnow_Profiles[iS] = vS |
local k = NeedToKnow.FindProfileByName(vS.name); |
end |
end |
-- fixup character profile collisions by key |
for oS,iS in pairs(aFixups) do |
NeedToKnow_CharSettings.Profiles[iS] = NeedToKnow_CharSettings.Profiles[oS]; |
NeedToKnow_CharSettings.Profiles[oS] = nil; |
end |
if ( not NeedToKnow_Globals.NextProfile or maxKey > NeedToKnow_Globals.NextProfile ) then |
print("Warning, NeedToKnow forgot how many profiles it had allocated. New account profiles may hiccup when switching characters.") |
NeedToKnow_Globals.NextProfile = maxKey + 1 |
end |
local spec = g_GetActiveTalentGroup() |
local curKey = NeedToKnow.CharSettings.Specs[spec] |
if ( curKey and not NeedToKnow_Profiles[curKey] ) then |
print("Current profile (" .. curKey .. ") has been deleted!"); |
curKey = NeedToKnow.CreateProfile(CopyTable(NEEDTOKNOW.PROFILE_DEFAULTS), spec) |
local curProf = NeedToKnow_Profiles[curKey] |
NeedToKnow.CharSettings.Specs[spec] = curKey |
end |
-- TODO: check the required members for existence and delete any corrupted profiles |
end |
id, |
_, -- uao.canCast -- The player's class/spec can cast this spell |
_, -- A boss applied this |
_, -- Unknown boolean |
_, -- cast by any player |
v1, |
v2, |
v3, |
bEnd -- Just indicates the end of the variable number of return results |
v3 |
= UnitAura(a,b,c,d) |
if name then |
-- There is a boolean at the end of the list whos purpose is unknown |
-- It can be either true or false, so we must test against nil explicitly |
-- Between the boss boolean and this end boolean will be 0-3 integers |
if nil == bEnd then |
-- some or all tooltip values are missing |
if nil == v3 then |
if nil == v2 then |
v1 = nil |
end |
v2 = nil |
end |
v3 = nil |
end |
return name, icon, count, dur, expiry, caster, id, v1, v2, v3, bEnd |
return name, icon, count, dur, expiry, caster, id, v1, v2, v3 |
end |
end |