/trunk
## Interface: 30300 |
## Title: NeedToKnow - Updated! |
## Author: Kitjan |
## Version: 2.8.2 |
## Version: 2.8.3 |
## Notes: Buff/debuff timer bars, original code by Nephthys of Hyjal-US Added support for multiple buffs per bar. |
## OptionalDeps: LibStub,LibSharedMedia-3.0 |
## DefaultState: Enabled |
NeedToKnow = {}; |
-- NEEDTOKNOW = {} is defined in the localization file, which must be loaded before this file |
NEEDTOKNOW.VERSION = "2.8.2"; |
NEEDTOKNOW.VERSION = "2.8.3"; |
NEEDTOKNOW.MAXGROUPS = 4; |
NEEDTOKNOW.MAXBARS = 6; |
NEEDTOKNOW.UPDATE_INTERVAL = 0.05; |
NeedToKnow_Settings["Spec"][2]["Groups"][1]["Enabled"] = true; |
else |
NeedToKnow.SafeUpgrade(); |
NeedToKnow.Update(); |
NeedToKnow.UIPanel_Update(); |
end |
if ( not NeedToKnow_Visible ) then |
function NeedToKnow.SafeUpgrade() |
if ( NeedToKnow_Settings["Version"] < "2.0" ) then -- total settings clear if v1.x |
-- If there had been an error during the previous upgrade, NeedToKnow_Settings |
-- may be in an inconsistent, halfway state. |
local bCorruptUpgrade = false; |
if ( NeedToKnow_Settings["Spec"] ) then |
for idxSpec = 1,2 do |
local specSettings = NeedToKnow_Settings.Spec[idxSpec]; |
if ( not specSettings or not specSettings.Groups ) then |
bCorruptUpgrade = true; |
else |
for idxGroup = 1,NEEDTOKNOW.MAXGROUPS do |
local groupSettings = specSettings.Groups[idxGroup]; |
if not groupSettings then |
bCorruptUpgrade = true; |
end |
end |
end |
end |
if ( not bCorruptUpgrade and NeedToKnow_Settings["Version"] < "2.4" ) then |
NeedToKnow_Settings.OldVersion = NeedToKnow_Settings["Version"]; |
NeedToKnow_Settings["Version"] = NEEDTOKNOW.VERSION; |
end |
end |
if ( bCorruptUpgrade or NeedToKnow_Settings["Version"] < "2.0" ) then -- total settings clear if v1.x |
print("Old NeedToKnow settings not compatible with current version... starting from scratch"); |
NeedToKnow_Settings = CopyTable(NEEDTOKNOW.DEFAULTS); |
NeedToKnow_Settings["Spec"][1]["Groups"][1]["Enabled"] = true; |
NeedToKnow_Settings["Spec"][2]["Groups"][1]["Enabled"] = true; |
NeedToKnow_Settings["Spec"][2]["Groups"][1]["Enabled"] = true; |
-- if before dual spec support, copy old settings to both specs |
elseif (NeedToKnow_Settings["Version"] < "2.4") then |
NeedToKnow_Settings["Spec"][1]["Groups"][i] = tempSettings["Groups"][i]; |
NeedToKnow_Settings["Spec"][2]["Groups"][i] = tempSettings["Groups"][i]; |
end |
NeedToKnow.Update(); |
NeedToKnow.UIPanel_Update(); |
end |
NeedToKnow_Settings.OldVersion = NeedToKnow_Settings["Version"]; |
NeedToKnow_Settings["Version"] = NEEDTOKNOW.VERSION; |
resizeButton:Show(); |
end |
group:ClearAllPoints(); |
local point, relativePoint, xOfs, yOfs = unpack(groupSettings.Position); |
group:SetPoint(point, UIParent, relativePoint, xOfs, yOfs); |
group:SetScale(groupSettings.Scale); |
-- Early enough in the loading process (before PLAYER_LOGIN), we might not |
-- know the position yet |
if groupSettings.Position then |
group:ClearAllPoints(); |
local point, relativePoint, xOfs, yOfs = unpack(groupSettings.Position); |
group:SetPoint(point, UIParent, relativePoint, xOfs, yOfs); |
group:SetScale(groupSettings.Scale); |
end |
if ( NeedToKnow_Visible and groupSettings.Enabled ) then |
group:Show(); |
else |