Quantcast

Quest log states options.

Darthpred [05-15-15 - 12:42]
Quest log states options.
Filename
ElvUI_SLE/core/modules.lua
ElvUI_SLE/defaults/profile.lua
ElvUI_SLE/locales/russian.lua
ElvUI_SLE/modules/load_modules.xml
ElvUI_SLE/modules/quests.lua
ElvUI_SLE/options/load_options.xml
ElvUI_SLE/options/quests_c.lua
diff --git a/ElvUI_SLE/core/modules.lua b/ElvUI_SLE/core/modules.lua
index 5dfbbc2..b19e7ee 100644
--- a/ElvUI_SLE/core/modules.lua
+++ b/ElvUI_SLE/core/modules.lua
@@ -24,6 +24,7 @@ local modules = {
 	['SLE_ScreenSaver'] = { 'AceHook-3.0', 'AceEvent-3.0' },
 	['SLE_Garrison'] = { 'AceEvent-3.0' },
 	['SLE_ErrorFrame'] = { },
+	['SLE_Quests'] = { 'AceEvent-3.0' },
 	['SLE'] = {'AceHook-3.0', 'AceEvent-3.0'},
 }

diff --git a/ElvUI_SLE/defaults/profile.lua b/ElvUI_SLE/defaults/profile.lua
index ceb6ec4..049e5a8 100644
--- a/ElvUI_SLE/defaults/profile.lua
+++ b/ElvUI_SLE/defaults/profile.lua
@@ -428,25 +428,36 @@ P['sle'] = {
 			['called'] = "Hundred",
 		},
 	},
-
+
 	['rumouseover'] = false,

 	['bags'] = {
 		['lootflash'] = true,
 	},
-
+
 	['garrison'] = {
 		['autoOrder'] = false,
 		['autoWar'] = false,
 		['autoTrade'] = false,
 	},
-
+
 	['errorframe'] = {
 		['height'] = 60,
 		['width'] = 512,
 	},
-
+
 	['roleicons'] = "ElvUI",
+
+	['quests'] = {
+		['visibility'] = {
+			['bg'] = "COLLAPSED",
+			['arena'] = "COLLAPSED",
+			['dungeon'] = "FULL",
+			['raid'] = "COLLAPSED",
+			['scenario'] = "FULL",
+			['rested'] = "FULL",
+		},
+	},
 }

 P.chat.editboxhistory = 5
diff --git a/ElvUI_SLE/locales/russian.lua b/ElvUI_SLE/locales/russian.lua
index f8b36be..36ca6b7 100644
--- a/ElvUI_SLE/locales/russian.lua
+++ b/ElvUI_SLE/locales/russian.lua
@@ -480,6 +480,9 @@ L["Error Frame"] = "Фрейм ошибок"
 L["Set the width of Error Frame. Too narrow frame may cause messages to be split in several lines"] = "Устанавливает ширину фрейма ошибок. Если фрейм окажется слишком узким, текст будет разделен на несколько строк."
 L["Set the height of Error Frame. Higher frame can show more lines at once."] = "Устанавливает высоту фрейма ошибок. Чем выше фрейм, тем больше строк может быть показано одновременно."

+--Quests--
+L["Rested"] = "Отдых"
+
 --Credits--
 L["Submodules and Coding:"] = "Субмодули и помощь с кодом:"
 L["Other Support:"] = "Прочая поддержка:"
diff --git a/ElvUI_SLE/modules/load_modules.xml b/ElvUI_SLE/modules/load_modules.xml
index 29184b5..0c71cd8 100644
--- a/ElvUI_SLE/modules/load_modules.xml
+++ b/ElvUI_SLE/modules/load_modules.xml
@@ -27,4 +27,5 @@
 	<Script file='unitframes.lua'/>
 	<Script file='vehicle.lua'/>
 	<Script file='errorframe.lua'/>
+	<Script file='quests.lua'/>
 </Ui>
diff --git a/ElvUI_SLE/modules/quests.lua b/ElvUI_SLE/modules/quests.lua
new file mode 100644
index 0000000..5517ebd
--- /dev/null
+++ b/ElvUI_SLE/modules/quests.lua
@@ -0,0 +1,52 @@
+local E, L, V, P, G = unpack(ElvUI);
+local Q = E:GetModule("SLE_Quests")
+local frame
+
+local statedriver = {
+	['FULL'] = function(frame)
+		ObjectiveTracker_Expand()
+		frame:Show()
+	end,
+	['COLLAPSED'] = function(frame)
+		ObjectiveTracker_Collapse()
+		frame:Show()
+	end,
+	['HIDDEN'] = function(frame)
+		frame:Hide()
+	end,
+}
+
+function Q:ChangeState(event)
+	if InCombatLockdown() then self:RegisterEvent("PLAYER_REGEN_ENABLED", "ChangeState") return end
+	if event == "PLAYER_REGEN_ENABLED" then self:UnregisterEvent("PLAYER_REGEN_ENABLED") end
+
+	if IsResting() then
+		statedriver[Q.db.visibility.rested](frame)
+		-- statedriver["COLLAPSED"](frame)
+	else
+		local instance, instanceType = IsInInstance()
+		if instance then
+			if instanceType == 'pvp' then
+				statedriver[Q.db.visibility.bg](frame)
+			elseif instanceType == 'arena' then
+				statedriver[Q.db.visibility.arena](frame)
+			elseif instanceType == 'party' then
+				statedriver[Q.db.visibility.dungeon](frame)
+			elseif instanceType == 'scenario' then
+				statedriver[Q.db.visibility.scenario](frame)
+			elseif instanceType == 'raid' then
+				statedriver[Q.db.visibility.raid](frame)
+			end
+		else
+			statedriver["FULL"](frame)
+		end
+
+	end
+end
+
+function Q:Initialize()
+	Q.db = E.db.sle.quests
+	frame = ObjectiveTrackerFrame
+	self:RegisterEvent("PLAYER_ENTERING_WORLD", "ChangeState")
+	self:RegisterEvent("PLAYER_UPDATE_RESTING", "ChangeState")
+end
\ No newline at end of file
diff --git a/ElvUI_SLE/options/load_options.xml b/ElvUI_SLE/options/load_options.xml
index e2f6aa3..6f71727 100644
--- a/ElvUI_SLE/options/load_options.xml
+++ b/ElvUI_SLE/options/load_options.xml
@@ -25,4 +25,5 @@
 	<Script file='unitframes_c.lua'/>
 	<Script file='vehicle_c.lua'/>
 	<Script file='errorframe_c.lua'/>
+	<Script file='quests_c.lua'/>
 </Ui>
\ No newline at end of file
diff --git a/ElvUI_SLE/options/quests_c.lua b/ElvUI_SLE/options/quests_c.lua
new file mode 100644
index 0000000..b07c9f6
--- /dev/null
+++ b/ElvUI_SLE/options/quests_c.lua
@@ -0,0 +1,90 @@
+local E, L, V, P, G = unpack(ElvUI);
+
+local function configTable()
+	E.Options.args.sle.args.options.args.general.args.quests = {
+		type = "group",
+		name = OBJECTIVES_TRACKER_LABEL,
+		order = 9,
+		args = {
+			header = {
+				order = 1,
+				type = "header",
+				name = OBJECTIVES_TRACKER_LABEL,
+			},
+			rested = {
+				order = 2,
+				type = "select",
+				name = L["Rested"],
+				get = function(info) return E.db.sle.quests.visibility[ info[#info] ] end,
+				set = function(info, value) E.db.sle.quests.visibility[ info[#info] ] = value; E:GetModule('SLE_Quests'):ChangeState() end,
+				values = {
+					["FULL"] = DEFAULT,
+					["COLLAPSED"] = MINIMIZE,
+					["HIDE"] = HIDE,
+				},
+			},
+			bg = {
+				order = 3,
+				type = "select",
+				name = BATTLEGROUNDS,
+				get = function(info) return E.db.sle.quests.visibility[ info[#info] ] end,
+				set = function(info, value) E.db.sle.quests.visibility[ info[#info] ] = value; E:GetModule('SLE_Quests'):ChangeState() end,
+				values = {
+					["FULL"] = DEFAULT,
+					["COLLAPSED"] = MINIMIZE,
+					["HIDE"] = HIDE,
+				},
+			},
+			arena = {
+				order = 4,
+				type = "select",
+				name = ARENA,
+				get = function(info) return E.db.sle.quests.visibility[ info[#info] ] end,
+				set = function(info, value) E.db.sle.quests.visibility[ info[#info] ] = value; E:GetModule('SLE_Quests'):ChangeState() end,
+				values = {
+					["FULL"] = DEFAULT,
+					["COLLAPSED"] = MINIMIZE,
+					["HIDE"] = HIDE,
+				},
+			},
+			dungeon = {
+				order = 5,
+				type = "select",
+				name = DUNGEONS,
+				get = function(info) return E.db.sle.quests.visibility[ info[#info] ] end,
+				set = function(info, value) E.db.sle.quests.visibility[ info[#info] ] = value; E:GetModule('SLE_Quests'):ChangeState() end,
+				values = {
+					["FULL"] = DEFAULT,
+					["COLLAPSED"] = MINIMIZE,
+					["HIDE"] = HIDE,
+				},
+			},
+			scenario = {
+				order = 6,
+				type = "select",
+				name = SCENARIOS,
+				get = function(info) return E.db.sle.quests.visibility[ info[#info] ] end,
+				set = function(info, value) E.db.sle.quests.visibility[ info[#info] ] = value; E:GetModule('SLE_Quests'):ChangeState() end,
+				values = {
+					["FULL"] = DEFAULT,
+					["COLLAPSED"] = MINIMIZE,
+					["HIDE"] = HIDE,
+				},
+			},
+			raid = {
+				order = 7,
+				type = "select",
+				name = RAIDS,
+				get = function(info) return E.db.sle.quests.visibility[ info[#info] ] end,
+				set = function(info, value) E.db.sle.quests.visibility[ info[#info] ] = value; E:GetModule('SLE_Quests'):ChangeState() end,
+				values = {
+					["FULL"] = DEFAULT,
+					["COLLAPSED"] = MINIMIZE,
+					["HIDE"] = HIDE,
+				},
+			},
+		},
+	}
+end
+
+table.insert(E.SLEConfigs, configTable)
\ No newline at end of file