Quantcast

Adding master profile and quest tracker fixes

failcoder [07-28-15 - 20:50]
Adding master profile and quest tracker fixes
Filename
SVUI_!Core/libs/_SVUI_Lib/Registry.lua
SVUI_!Core/setup/installer.lua
SVUI_!Core/system/alerts.lua
SVUI_!Options/SVUI_!Options.lua
SVUI_QuestTracker/components/quests.lua
SVUI_Skins/components/blizzard/system.lua
SVUI_UnitFrames/SVUI_UnitFrames.lua
diff --git a/SVUI_!Core/libs/_SVUI_Lib/Registry.lua b/SVUI_!Core/libs/_SVUI_Lib/Registry.lua
index 2f06980..40c3774 100644
--- a/SVUI_!Core/libs/_SVUI_Lib/Registry.lua
+++ b/SVUI_!Core/libs/_SVUI_Lib/Registry.lua
@@ -685,6 +685,8 @@ local function CorePreInitialize()
     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
+    if(not GLOBAL_SV.SAFEDATA) then GLOBAL_SV.SAFEDATA = {} end
+    if(not GLOBAL_SV.SAFEDATA.MasterProfile) then GLOBAL_SV.SAFEDATA.MasterProfile = false; end
     --GLOBAL KEY STORAGE (ALWAYS EMPTY ON LOGIN)
     GLOBAL_SV.profileKeys = {}
     --SAVED ERRORS
@@ -1361,6 +1363,23 @@ function lib:ToggleDualProfile(enabled)
     UpdateProfileSources()
 end

+function lib:CheckMasterProfile()
+    local mp = GLOBAL_SV.SAFEDATA.MasterProfile
+    if(mp and GLOBAL_SV.profiles[mp]) then
+      return mp
+    else
+      return false
+    end
+end
+
+function lib:SetMasterProfile(key)
+    if((not key) or (not GLOBAL_SV.profiles[key])) then
+      GLOBAL_SV.SAFEDATA.MasterProfile = false;
+    else
+      GLOBAL_SV.SAFEDATA.MasterProfile = key;
+    end
+end
+
 --[[ UNUSED

 local DB_QUEUE;
diff --git a/SVUI_!Core/setup/installer.lua b/SVUI_!Core/setup/installer.lua
index 41aee50..878e9ea 100644
--- a/SVUI_!Core/setup/installer.lua
+++ b/SVUI_!Core/setup/installer.lua
@@ -305,7 +305,7 @@ function SV.Setup:ChatConfigs(mungs)
 				FCF_SetWindowName(chat, LOOT)
 			end
 		end
-
+
 		ChatFrame_RemoveAllMessageGroups(ChatFrame1)
 		ChatFrame_AddMessageGroup(ChatFrame1, "SAY")
 		ChatFrame_AddMessageGroup(ChatFrame1, "EMOTE")
@@ -865,8 +865,19 @@ function SV.Setup:Reset()
 end

 function SV.Setup:Install(autoLoaded)
+	local mp = SVUILib:CheckMasterProfile();
+	if(mp) then
+    SV.SystemAlert["MASTER_PROFILE_PROMPT"].OnAccept = function() SVUILib:CopyDatabase(mp) end
+		SV.SystemAlert["MASTER_PROFILE_PROMPT"].OnCancel = function() SV.Setup:LoadInstaller(autoLoaded) end
+    SV:StaticPopup_Show("MASTER_PROFILE_PROMPT")
+	else
+		SV.Setup:LoadInstaller(autoLoaded)
+	end
+end
+
+function SV.Setup:LoadInstaller(autoLoaded)
 	local old = SVUILib:GetSafeData()
-    preset_mediastyle = old.preset_mediastyle or "default";
+  preset_mediastyle = old.preset_mediastyle or "default";
 	preset_barstyle = old.preset_barstyle or "default";
 	preset_unitstyle = old.preset_unitstyle or "default";
 	preset_groupstyle = old.preset_groupstyle or "default";
diff --git a/SVUI_!Core/system/alerts.lua b/SVUI_!Core/system/alerts.lua
index 0e5404e..ad53f21 100644
--- a/SVUI_!Core/system/alerts.lua
+++ b/SVUI_!Core/system/alerts.lua
@@ -166,6 +166,16 @@ SV.SystemAlert["IMPORT_PROFILE_PROMPT"] = {
 	hideOnEscape = 1,
 	OnAccept = SV.fubar
 };
+SV.SystemAlert["MASTER_PROFILE_PROMPT"] = {
+	text = L["This character need to have a profile installed and I can see that you have a master profile set. Would you like to use that instead of the installer?"],
+	button1 = YES,
+	button2 = NO,
+	timeout = 0,
+	hideOnEscape = 1,
+	noCancelOnEscape = 1,
+	OnAccept = SV.fubar,
+	OnCancel = SV.fubar
+};
 SV.SystemAlert["DELETE_GRAYS"] = {
 	text = L["Are you sure you want to delete all your gray items?"],
 	button1 = YES,
diff --git a/SVUI_!Options/SVUI_!Options.lua b/SVUI_!Options/SVUI_!Options.lua
index ad5a79b..93dccd2 100644
--- a/SVUI_!Options/SVUI_!Options.lua
+++ b/SVUI_!Options/SVUI_!Options.lua
@@ -141,11 +141,46 @@ local function RefreshProfileOptions()
 		type = "toggle",
 		name = "Dual-Spec Switching",
 		get = function() return SVUILib:CheckDualProfile() end,
-		set = function(key, value) SVUILib:ToggleDualProfile(value) end,
-		width = 'full'
+		set = function(key, value) SVUILib:ToggleDualProfile(value) end
 	}
-	optionGroup.importdesc = {
+	optionGroup.mpEnable = {
 		order = 4,
+		type = "toggle",
+		name = "Use Master Profile",
+		desc = L["Toggle the use of a master profile for easy one-click installation on your other characters."],
+		get = function()
+			local mp = SVUILib:CheckMasterProfile()
+			if(type(mp) == 'string') then
+				return true
+			else
+				return false
+			end
+		end,
+		set = function(key, value)
+			if(not value) then
+				SVUILib:SetMasterProfile()
+			else
+				SVUILib:SetMasterProfile(currentProfile)
+			end
+			SV:SavedPopup()
+			RefreshProfileOptions()
+		end,
+	}
+	optionGroup.masterProfile = {
+		order = 4,
+		type = "select",
+		name = "Select Master Profile",
+		desc = L["Flag the current profile as a master for easy one-click installation on your other characters."],
+		get = function() return SVUILib:CheckMasterProfile() end,
+		set = function(key, value) SVUILib:SetMasterProfile(value) SV:SavedPopup() RefreshProfileOptions() end,
+		values = SVUILib:GetProfiles(),
+		disabled = function()
+			local t = SVUILib:CheckMasterProfile()
+			return (not t)
+		end,
+	}
+	optionGroup.importdesc = {
+		order = 5,
 		type = "description",
 		name = function()
 			if(SVUILib:CheckDualProfile()) then
@@ -157,7 +192,7 @@ local function RefreshProfileOptions()
 		width = "full"
 	}
 	optionGroup.spacer3 = {
-		order = 5,
+		order = 6,
 		type = "description",
 		name = "",
 		width = "full",
@@ -166,7 +201,7 @@ local function RefreshProfileOptions()
 		name = L["export"],
 		desc = L["export_sub"],
 		type = "input",
-		order = 6,
+		order = 7,
 		get = false,
 		set = function(key, value) SVUILib:CloneDatabase(value) SV:SavedPopup() RefreshProfileOptions() end,
 		disabled = function()
@@ -178,7 +213,7 @@ local function RefreshProfileOptions()
 		name = L["Copy"],
 		desc = L["Copy from another profile. Further changes from other characters using this profile will not affect this one."],
 		type = "select",
-		order = 7,
+		order = 8,
 		get = function() return currentProfile end,
 		set = function(key, value) SV:CopyProfile(value) SV:SavedPopup() RefreshProfileOptions() end,
 		disabled = function()
@@ -191,7 +226,7 @@ local function RefreshProfileOptions()
 		name = L["Share"],
 		desc = L["Share an already existing profile. Changes made by any characters using this profile will be shared."],
 		type = "select",
-		order = 8,
+		order = 9,
 		get = function() return currentProfile end,
 		set = function(key, value) SV:LinkProfile(value) SV:SavedPopup() RefreshProfileOptions() end,
 		disabled = function()
@@ -202,19 +237,19 @@ local function RefreshProfileOptions()
 		width = 'fill',
 	}
 	optionGroup.spacer4 = {
-		order = 9,
+		order = 10,
 		type = "description",
 		name = "",
 		width = "full",
 	}
 	optionGroup.spacer5 = {
-		order = 10,
+		order = 11,
 		type = "description",
 		name = L["delete_desc"],
 		width = "full",
 	}
 	optionGroup.delete = {
-		order = 11,
+		order = 12,
 		type = "select",
 		width = "full",
 		name = L["delete"],
@@ -227,19 +262,19 @@ local function RefreshProfileOptions()
 		confirmText = L["delete_confirm"],
 	}
 	optionGroup.spacer6 = {
-		order = 12,
+		order = 13,
 		type = "description",
 		name = "",
 		width = "full",
 	}
 	optionGroup.spacer7 = {
-		order = 13,
+		order = 14,
 		type = "description",
 		name = L["reset_desc"],
 		width = "full",
 	}
 	optionGroup.reset = {
-		order = 14,
+		order = 15,
 		type = "execute",
 		name = function() return L["reset"] .. " " .. " |cffFFFF00" .. currentProfile .. "|r" end,
 		desc = L["reset_sub"],
@@ -443,7 +478,7 @@ SV.Options.args.primary = {
 					type = "execute",
 					name = L["Install"],
 					desc = L["Run the installation process."],
-					func = function() SV.Setup:Install() SV:ToggleConfig() end
+					func = function() SV.Setup:LoadInstaller() SV:ToggleConfig() end
 				},
 				Themes = {
 					order = 2,
diff --git a/SVUI_QuestTracker/components/quests.lua b/SVUI_QuestTracker/components/quests.lua
index c739826..0744e9a 100644
--- a/SVUI_QuestTracker/components/quests.lua
+++ b/SVUI_QuestTracker/components/quests.lua
@@ -147,7 +147,7 @@ do
             end
             ACTIVE_ITEMS[itemLink] = self:GetID();
             self.Icon:SetTexture(texture)
-            self.itemID, self.attribute = string.match(itemLink, '|Hitem:(.-):.-|h%[(.+)%]|h')
+            self.itemID, self.itemName = string.match(itemLink, '|Hitem:(.-):.-|h%[(.+)%]|h')
             self.itemLink = itemLink

             if(ItemBlacklist[self.itemID]) then
@@ -157,9 +157,10 @@ do
         end

         if(InCombatLockdown()) then
+						self.attribute = self.itemName
             self:RegisterEvent('PLAYER_REGEN_ENABLED')
         else
-            self:SetAttribute('item', self.attribute)
+            self:SetAttribute('item', self.itemName)
             self:UpdateCooldown()
         end

@@ -171,7 +172,7 @@ do
         if(InCombatLockdown()) then
             self:RegisterEvent('PLAYER_REGEN_ENABLED');
         else
-            self:SetAttribute('item', self.attribute)
+            self:SetAttribute('item', nil)
         end
     end

@@ -909,7 +910,8 @@ local SetQuestRow = function(self, index, watchIndex, title, level, icon, questI
 	objective_block:Reset();

 	for i = 1, subCount do
-		local description, category, objective_completed = GetQuestObjectiveInfo(questID, i, false);
+		local description, category, objective_completed = GetQuestLogLeaderBoard(i, questLogIndex);
+		-- local description, category, objective_completed = GetQuestObjectiveInfo(questID, i, false);
 		if not objective_completed then iscomplete = false end
 		if(description) then
 			fill_height = fill_height + (INNER_HEIGHT + 4);
diff --git a/SVUI_Skins/components/blizzard/system.lua b/SVUI_Skins/components/blizzard/system.lua
index 1624434..2f84cbe 100644
--- a/SVUI_Skins/components/blizzard/system.lua
+++ b/SVUI_Skins/components/blizzard/system.lua
@@ -689,7 +689,7 @@ local function SystemPanelQue()
 	AudioOptionsVoicePanelChatMode1KeyBindingButton:ClearAllPoints()
 	AudioOptionsVoicePanelChatMode1KeyBindingButton:SetPoint("CENTER", AudioOptionsVoicePanelBinding, "CENTER", 0, -10)
 	if(CompactUnitFrameProfilesRaidStylePartyFrames) then CompactUnitFrameProfilesRaidStylePartyFrames:SetStyle("CheckButton") end
-	CompactUnitFrameProfilesGeneralOptionsFrameResetPositionButton:SetStyle("Button")
+	if(CompactUnitFrameProfilesGeneralOptionsFrameResetPositionButton) then CompactUnitFrameProfilesGeneralOptionsFrameResetPositionButton:SetStyle("Button") end

 	for i = 1, #SystemFrameList20 do
 		local this = _G["CompactUnitFrameProfilesGeneralOptionsFrame"..SystemFrameList20[i]]
diff --git a/SVUI_UnitFrames/SVUI_UnitFrames.lua b/SVUI_UnitFrames/SVUI_UnitFrames.lua
index a99a1f3..12c85a6 100644
--- a/SVUI_UnitFrames/SVUI_UnitFrames.lua
+++ b/SVUI_UnitFrames/SVUI_UnitFrames.lua
@@ -1244,7 +1244,7 @@ end

 function MOD:KillBlizzardRaidFrames()
 	if(InCombatLockdown()) then return end
-	if(not _G.CompactRaidFrameManager) then return end
+	if((not _G.CompactRaidFrameManager) or (not _G.CompactRaidFrameContainer) or (not _G.CompactUnitFrameProfiles)) then return end
 	_G.CompactRaidFrameManager:Die()
 	_G.CompactRaidFrameContainer:Die()
 	_G.CompactUnitFrameProfiles:Die()