diff --git a/SVUI_!Core/libs/_SVUI_Lib/Registry.lua b/SVUI_!Core/libs/_SVUI_Lib/Registry.lua
index 3164f0b..66b3001 100644
--- a/SVUI_!Core/libs/_SVUI_Lib/Registry.lua
+++ b/SVUI_!Core/libs/_SVUI_Lib/Registry.lua
@@ -541,6 +541,32 @@ local function CheckForDeprecated(oldKey)
end
end
+local function CheckRealmIntegrity(key)
+ local newKey = key;
+ if(not key:find(" - ")) then
+ newKey = ("%s - %s"):format(playerName, key);
+ end
+ if(not GLOBAL_SV.profileRealms[newKey]) then
+ GLOBAL_SV.profileRealms[newKey] = playerRealm;
+ elseif(GLOBAL_SV.profileRealms[newKey] ~= playerRealm) then
+ newKey = ("%s [%s] - %s"):format(playerName, playerRealm, key);
+ GLOBAL_SV.profileRealms[newKey] = playerRealm;
+ end
+ return newKey
+end
+
+local function CheckSavedRealmIntegrity(oldKey)
+ local safeKey = oldKey;
+ if(not GLOBAL_SV.profileRealms[oldKey]) then
+ GLOBAL_SV.profileRealms[oldKey] = playerRealm;
+ elseif(GLOBAL_SV.profileRealms[oldKey] ~= playerRealm) then
+ safeKey = ("%s [%s] - %s"):format(playerName, playerRealm, "Default");
+ GLOBAL_SV.profileRealms[safeKey] = playerRealm;
+ end
+ PRIVATE_SV.SAFEDATA.CurrentProfile = safeKey
+ return safeKey
+end
+
local function UpdateProfileSources(newKey)
local PREVIOUS_PROFILE_KEY = PROFILE_KEY;
if(PRIVATE_SV.SAFEDATA.DUALSPEC) then
@@ -549,28 +575,26 @@ local function UpdateProfileSources(newKey)
local _, SOURCE_KEY, _, _, _, _ = GetSpecializationInfo(specID);
if(not SOURCE_KEY) then SOURCE_KEY = "Default" end
--PROFILE_KEY = ("%s [%s] - %s"):format(playerName, playerRealm, SOURCE_KEY)
- PROFILE_KEY = ("%s - %s"):format(playerName, SOURCE_KEY)
+ PROFILE_KEY = CheckRealmIntegrity(SOURCE_KEY)
PRIVATE_SV.SAFEDATA.CurrentProfile = PROFILE_KEY
--CheckForDeprecated(("%s - %s"):format(playerName, SOURCE_KEY))
elseif(newKey) then
- PROFILE_KEY = newKey
- PRIVATE_SV.SAFEDATA.CurrentProfile = newKey
+ PROFILE_KEY = CheckRealmIntegrity(newKey)
+ PRIVATE_SV.SAFEDATA.CurrentProfile = PROFILE_KEY
elseif(PRIVATE_SV.SAFEDATA.CurrentProfile) then
- PROFILE_KEY = PRIVATE_SV.SAFEDATA.CurrentProfile
+ PROFILE_KEY = CheckSavedRealmIntegrity(PRIVATE_SV.SAFEDATA.CurrentProfile)
else
- PROFILE_KEY = DEFAULT_PROFILE_KEY
- PRIVATE_SV.SAFEDATA.CurrentProfile = DEFAULT_PROFILE_KEY
+ PROFILE_KEY = CheckSavedRealmIntegrity("Default")
end
lib.EventManager:RegisterEvent("ACTIVE_TALENT_GROUP_CHANGED")
else
if(newKey) then
- PROFILE_KEY = newKey
- PRIVATE_SV.SAFEDATA.CurrentProfile = newKey
+ PROFILE_KEY = CheckRealmIntegrity(newKey)
+ PRIVATE_SV.SAFEDATA.CurrentProfile = PROFILE_KEY
elseif(PRIVATE_SV.SAFEDATA.CurrentProfile) then
- PROFILE_KEY = PRIVATE_SV.SAFEDATA.CurrentProfile
+ PROFILE_KEY = CheckSavedRealmIntegrity(PRIVATE_SV.SAFEDATA.CurrentProfile)
else
- PROFILE_KEY = DEFAULT_PROFILE_KEY
- PRIVATE_SV.SAFEDATA.CurrentProfile = DEFAULT_PROFILE_KEY
+ PROFILE_KEY = CheckSavedRealmIntegrity("Default")
end
lib.EventManager:UnregisterEvent("ACTIVE_TALENT_GROUP_CHANGED")
end
@@ -655,7 +679,8 @@ local function CorePreInitialize()
--GLOBAL PROFILE DATA
if(not GLOBAL_SV.profiles) then GLOBAL_SV.profiles = {} end
if(not GLOBAL_SV.profiles[PROFILE_KEY]) then GLOBAL_SV.profiles[PROFILE_KEY] = {} end
-
+ if(not GLOBAL_SV.profileRealms) then GLOBAL_SV.profileRealms = {} end
+ if(not GLOBAL_SV.profileRealms[PROFILE_KEY]) then GLOBAL_SV.profileRealms[PROFILE_KEY] = playerRealm end
--GLOBAL KEY STORAGE (ALWAYS EMPTY ON LOGIN)
GLOBAL_SV.profileKeys = {}
--SAVED ERRORS
@@ -1166,6 +1191,7 @@ end
--DATABASE PUBLIC METHODS
function lib:Remove(key)
if(GLOBAL_SV.profiles[key]) then GLOBAL_SV.profiles[key] = nil end
+ if(GLOBAL_SV.profileRealms[key]) then GLOBAL_SV.profileRealms[key] = nil end
wipe(GLOBAL_SV.profileKeys)
for k,v in pairs(GLOBAL_SV.profiles) do
GLOBAL_SV.profileKeys[k] = k
diff --git a/SVUI_!Core/system/_reports/time.lua b/SVUI_!Core/system/_reports/time.lua
index 3095ecb..c61c831 100644
--- a/SVUI_!Core/system/_reports/time.lua
+++ b/SVUI_!Core/system/_reports/time.lua
@@ -18,26 +18,6 @@ local math = _G.math;
local format, join = string.format, string.join;
--[[ MATH METHODS ]]--
local floor = math.floor;
-local IsShiftKeyDown = _G.IsShiftKeyDown;
-local GetGameTime = _G.GetGameTime;
-local GameTimeFrame = _G.GameTimeFrame;
-local RequestRaidInfo = _G.RequestRaidInfo;
-local SecondsToTime = _G.SecondsToTime;
-local GetNetStats = _G.GetNetStats;
-local GetNumWorldPVPAreas = _G.GetNumWorldPVPAreas;
-local GetWorldPVPAreaInfo = _G.GetWorldPVPAreaInfo;
-local GetNumSavedInstances = _G.GetNumSavedInstances;
-local GetSavedInstanceInfo = _G.GetSavedInstanceInfo;
-local GetDifficultyInfo = _G.GetDifficultyInfo;
-local GetNumSavedWorldBosses= _G.GetNumSavedWorldBosses;
-local GetSavedWorldBossInfo = _G.GetSavedWorldBossInfo;
-
-local RAID_INFO_WORLD_BOSS = _G.RAID_INFO_WORLD_BOSS;
-local QUEUE_TIME_UNAVAILABLE = _G.QUEUE_TIME_UNAVAILABLE;
-local WINTERGRASP_IN_PROGRESS = _G.WINTERGRASP_IN_PROGRESS;
-local VOICE_CHAT_BATTLEGROUND = _G.VOICE_CHAT_BATTLEGROUND;
-local TIMEMANAGER_TOOLTIP_LOCALTIME = _G.TIMEMANAGER_TOOLTIP_LOCALTIME;
-local TIMEMANAGER_TOOLTIP_REALMTIME = _G.TIMEMANAGER_TOOLTIP_REALMTIME;
--[[
##########################################################
GET ADDON DATA
diff --git a/SVUI_!Core/system/core.lua b/SVUI_!Core/system/core.lua
index 32056c4..9dc9e81 100644
--- a/SVUI_!Core/system/core.lua
+++ b/SVUI_!Core/system/core.lua
@@ -95,6 +95,7 @@ local defaultCenterWidth = min(defaultDockWidth, 900);
local callbacks = {};
local numCallbacks = 0;
local playerName = UnitName("player");
+local playerRealm = GetRealmName();
local playerClass = select(2, UnitClass("player"));
local errorPattern = "|cffff0000Error -- |r|cffff9900Required addon '|r|cffffff00%s|r|cffff9900' is %s.|r";
diff --git a/SVUI_!Options/UnitFrames.lua b/SVUI_!Options/UnitFrames.lua
index 9070002..19771a1 100644
--- a/SVUI_!Options/UnitFrames.lua
+++ b/SVUI_!Options/UnitFrames.lua
@@ -3848,6 +3848,8 @@ SV.Options.args[Schema] = {
type = "toggle",
name = L["Raid 5 Party"],
desc = L["Use party frames when in a 5-man raid group"],
+ get = function(l) return SV.db.UnitFrames['party'][l[#l]] end,
+ set = function(l, m) MOD:ChangeDBVar(m, l[#l], "party"); MOD:SetGroupFrame("party"); MOD:SetGroupFrame("raid"); end,
},
}
},
@@ -4276,7 +4278,7 @@ SV.Options.args[Schema] = {
name = L["Raid 5 Party"],
desc = L["Use party frames when in a 5-man raid group"],
get = function(l) return SV.db.UnitFrames.party[l[#l]] end,
- set = function(l, m) MOD:ChangeDBVar(m, l[#l], "party"); MOD:SetGroupFrame("raid") end,
+ set = function(l, m) MOD:ChangeDBVar(m, l[#l], "party"); MOD:SetGroupFrame("party"); MOD:SetGroupFrame("raid"); end,
},
}
},
diff --git a/SVUI_UnitFrames/groups.lua b/SVUI_UnitFrames/groups.lua
index 9d1c1a0..304215d 100644
--- a/SVUI_UnitFrames/groups.lua
+++ b/SVUI_UnitFrames/groups.lua
@@ -202,15 +202,29 @@ local UpdateTemplates = {};
COMMON
##########################################################
]]--
-local Update5ManVisibility = function()
- local parytDB = SV.db.UnitFrames.party
- local raidDB = SV.db.UnitFrames.raid
- if(parytDB.useFor5man) then
- SV.db.UnitFrames.party.visibility = "[group:party,nogroup:raid][@raid6,noexists,group:raid] show;hide"
- SV.db.UnitFrames.raid.visibility = "[@raid6,exists,group:raid] show;hide"
+local PARTY_VIS1 = "[group:party,nogroup:raid] show;hide";
+local PARTY_VIS2 = "[group:party,nogroup:raid][@raid6,noexists,group:raid] show;hide";
+local RAID_VIS1 = "[group:raid] show;hide";
+local RAID_VIS2 = "[@raid6,exists,group:raid] show;hide";
+local VISIBILITY_OPTIONS = { party = PARTY_VIS1, raid = RAID_VIS1 };
+
+local Update5ManVisibility = function(token)
+ local partyVis = "[group:party,nogroup:raid] show;hide";
+ local raidVis = "[group:raid] show;hide";
+
+ if(SV.db.UnitFrames.party.useFor5man) then
+ VISIBILITY_OPTIONS.party = PARTY_VIS2;
+ VISIBILITY_OPTIONS.raid = RAID_VIS2;
else
- SV.db.UnitFrames.party.visibility = "[group:party,nogroup:raid] show;hide"
- SV.db.UnitFrames.raid.visibility = "[group:raid] show;hide"
+ VISIBILITY_OPTIONS.party = PARTY_VIS1;
+ VISIBILITY_OPTIONS.raid = RAID_VIS1;
+ end
+
+ SV.db.UnitFrames.party.visibility = VISIBILITY_OPTIONS.party
+ SV.db.UnitFrames.raid.visibility = VISIBILITY_OPTIONS.raid
+
+ if(token) then
+ return VISIBILITY_OPTIONS[token] or "";
end
end
@@ -314,14 +328,14 @@ end
UpdateTemplates["party"] = function(self)
if(SV.NeedsFrameAudit) then return end
- Update5ManVisibility()
+ local visibility = Update5ManVisibility("party")
local db = SV.db.UnitFrames.party
local groupFrame = self:GetParent()
+ RegisterStateDriver(groupFrame, "visibility", visibility)
if not groupFrame.positioned then
groupFrame:ClearAllPoints()
groupFrame:SetPoint("BOTTOMLEFT", SV.Dock.BottomLeft, "TOPLEFT", 0, 80)
- RegisterStateDriver(groupFrame, "visibility", db.visibility)
SV:NewAnchor(groupFrame, L['Party Frames']);
SV:SetAnchorResizing(groupFrame, groupLayoutPostSizeFunc, 10, 500)
groupFrame.positioned = true;
@@ -421,14 +435,14 @@ end
UpdateTemplates["raid"] = function(self)
if(SV.NeedsFrameAudit) then return end
- Update5ManVisibility()
+ local visibility = Update5ManVisibility("raid")
local db = SV.db.UnitFrames.raid
-
local groupFrame = self:GetParent()
+ RegisterStateDriver(groupFrame, "visibility", visibility)
+
if not groupFrame.positioned then
groupFrame:ClearAllPoints()
groupFrame:SetPoint("BOTTOMLEFT", SV.Dock.BottomLeft, "TOPLEFT", 0, 80)
- RegisterStateDriver(groupFrame, "visibility", db.visibility)
SV:NewAnchor(groupFrame, "Raid Frames")
SV:SetAnchorResizing(groupFrame, groupLayoutPostSizeFunc, 10, 500)
groupFrame.positioned = true
@@ -1137,6 +1151,7 @@ end
function MOD:SetGroupFrame(token, forceUpdate)
if(InCombatLockdown()) then self:RegisterEvent("PLAYER_REGEN_ENABLED"); return end
+ Update5ManVisibility()
local settings = SV.db.UnitFrames[token]
local realName = token:gsub("(.)", upper, 1)
local layout = "SVUI_"..realName