Quantcast

Add Timewalking dungeons to equipment manager.

Michael Tindal [07-22-16 - 00:12]
Add Timewalking dungeons to equipment manager.
Filename
ElvUI_SLE/defaults/private.lua
ElvUI_SLE/locales/english.lua
ElvUI_SLE/modules/equipmanager.lua
ElvUI_SLE/options/equipmanager_c.lua
diff --git a/ElvUI_SLE/defaults/private.lua b/ElvUI_SLE/defaults/private.lua
index fa3e6fe..9ec31e4 100644
--- a/ElvUI_SLE/defaults/private.lua
+++ b/ElvUI_SLE/defaults/private.lua
@@ -10,25 +10,30 @@ V["sle"] = {
 		["spam"] = false,
 		["instanceSet"] = false,
 		["pvpSet"] = false,
+		["timewalkingSet"] = false,
 		["firstSpec"] = {
 			["general"] = "NONE",
 			["pvp"] = "NONE",
 			["instance"] = "NONE",
+			["timewalking"] = "NONE",
 		},
 		["secondSpec"] = {
 			["general"] = "NONE",
 			["pvp"] = "NONE",
 			["instance"] = "NONE",
+			["timewalking"] = "NONE",
 		},
 		["thirdSpec"] = {
 			["general"] = "NONE",
 			["pvp"] = "NONE",
 			["instance"] = "NONE",
+			["timewalking"] = "NONE",
 		},
 		["forthSpec"] = {
 			["general"] = "NONE",
 			["pvp"] = "NONE",
 			["instance"] = "NONE",
+			["timewalking"] = "NONE",
 		},
 		["setoverlay"] = false,
 	},
diff --git a/ElvUI_SLE/locales/english.lua b/ElvUI_SLE/locales/english.lua
index 2cb607b..2e1ce3b 100644
--- a/ElvUI_SLE/locales/english.lua
+++ b/ElvUI_SLE/locales/english.lua
@@ -388,14 +388,20 @@ L["Are you sure you want to remove |cff1784d1%s|r from currency datatexts?"] = t
 L["Equipment Manager"] = true
 L["EM_DESC"] = "This module provides different options to automatically change your equipment sets on spec change or entering certain locations. All options are character based."
 L["Equipment Set Overlay"] = true
+L["Timewalking"] = true
 L["Show the associated equipment sets for the items in your bags (or bank)."] = true
 L["Here you can choose what equipment sets to use in different situations."] = true
 L["Equip this set when switching to specialization %s."] = true
 L["Equip this set for open world/general use."] = true
 L["Equip this set after entering dungeons or raids."] = true
 L["Equip this set after entering battlegrounds or arens."] = true
+L["Equip this set after enetering a timewalking dungeon."] = true
+L["Use Instance Set"] = true
 L["Use a dedicated set for instances and raids."] = true
+L["Use PvP Set"] = true
 L["Use a dedicated set for PvP situations."] = true
+L["Use Timewalking Set"] = true
+L["Use a dedicated set for timewalking instances."] = true
 L["Impossible to switch to appropriate equipment set in combat. Will switch after combat ends."] = true

 --Loot
diff --git a/ElvUI_SLE/modules/equipmanager.lua b/ElvUI_SLE/modules/equipmanager.lua
index a5a99c0..77ccbfe 100644
--- a/ElvUI_SLE/modules/equipmanager.lua
+++ b/ElvUI_SLE/modules/equipmanager.lua
@@ -32,6 +32,15 @@ function EM:IsPvP(inInstance, instanceType)
 	return false
 end

+local TIMEWALKING_DIFFICULTYID = 24;
+
+function EM:IsTimewalkingDungeon(inInstance, instanceType)
+	if inInstance and (instanceType ==  "scenario" or instanceType == "party" or instanceType == "raid") and select(3, GetInstanceInfo()) == TIMEWALKING_DIFFICULTYID then
+		return true
+	end
+	return false
+end
+
 function EM:IsDungeon(inInstance, instanceType)
 	if inInstance and (instanceType ==  "scenario" or instanceType == "party" or instanceType == "raid") then return true end
 	return false
@@ -39,7 +48,13 @@ end

 function EM:WrongSet(equipSet, group, inCombat)
 	local inInstance, instanceType = T.IsInInstance()
-	if inInstance and ((EM.db.instanceSet and EM.db[group].instance ~= "NONE") or (EM.db.pvpSet and EM.db[group].pvp ~= "NONE")) then
+	if inInstance and ((EM.db.timewalkingSet and EM.db[group].timewalking ~= "NONE") or (EM.db.instanceSet and EM.db[group].instance ~= "NONE") or (EM.db.pvpSet and EM.db[group].pvp ~= "NONE")) then
+		if EM:IsTimewalkingDungeon(inInstance, instanceType) and EM.db.timewalkingSet then
+			if equipSet ~= EM.db[group].timewalking and EM.db[group].timewalking ~= "NONE" then
+				if inCombat then SLE:ErrorPrint(L["Impossible to switch to appropriate equipment set in combat. Will switch after combat ends."]); return false end
+				return true, EM.db[group].timewalking
+			end
+		end
 		if EM:IsDungeon(inInstance, instanceType) and EM.db.instanceSet then
 			if equipSet ~= EM.db[group].instance and EM.db[group].instance ~= "NONE" then
 				if inCombat then SLE:ErrorPrint(L["Impossible to switch to appropriate equipment set in combat. Will switch after combat ends."]); return false end
diff --git a/ElvUI_SLE/options/equipmanager_c.lua b/ElvUI_SLE/options/equipmanager_c.lua
index 17c6257..4ee5d8b 100644
--- a/ElvUI_SLE/options/equipmanager_c.lua
+++ b/ElvUI_SLE/options/equipmanager_c.lua
@@ -7,6 +7,7 @@ local SPECIALIZATION_SECONDARY = SPECIALIZATION_SECONDARY
 local PVP = PVP
 local DUNGEONS = DUNGEONS
 local GENERAL = GENERAL
+local TIMEWALKING = L["Timewalking"]

 local sets = {}

@@ -62,9 +63,20 @@ local function configTable()
 						return sets
 					end,
 				},
-				pvp = {
+				timewalking = {
 					order = 4,
 					type = "select",
+					name = TIMEWALKING,
+					disabled = function() return not EM.db.timewalkingSet end,
+					desc = L["Equip this set after enetering a timewalking dungeon."],
+					values = function()
+						FillTable()
+						return sets
+					end,
+				},
+				pvp = {
+					order = 5,
+					type = "select",
 					name = PVP,
 					disabled = function() return not EM.db.pvpSet end,
 					desc = L["Equip this set after entering battlegrounds or arens."],
@@ -117,15 +129,24 @@ local function configTable()
 			instanceSet = {
 				type = "toggle",
 				order = 7,
-				name = L["Use Instanse Set"],
+				name = L["Use Instance Set"],
 				desc = L["Use a dedicated set for instances and raids."],
 				disabled = function() return not EM.db.enable end,
 				get = function(info) return EM.db.instanceSet end,
 				set = function(info, value) EM.db.instanceSet = value; end
 			},
+			timewalkingSet = {
+				type = "toggle",
+				order = 7,
+				name = L["Use Timewalking Set"],
+				desc = L["Use a dedicated set for timewalking instances."],
+				disabled = function() return not EM.db.enable end,
+				get = function(info) return EM.db.timewalkingSet end,
+				set = function(info, value) EM.db.timewalkingSet = value; end
+			},
 			pvpSet = {
 				type = "toggle",
-				order = 8,
+				order = 9,
 				name = L["Use PvP Set"],
 				desc = L["Use a dedicated set for PvP situations."],
 				disabled = function() return not EM.db.enable end,
@@ -135,7 +156,7 @@ local function configTable()
 			equipsets = {
 				type = "group",
 				name = PAPERDOLL_EQUIPMENTMANAGER,
-				order = 9,
+				order = 10,
 				disabled = function() return not EM.db.enable end,
 				guiInline = true,
 				args = {